Vim How to - VIM as Python IDE - Vim as a Modern IDE - Learning the vi Editor - Python.org Vim
# soft breaks
:set wrap linebreak nolist
#Remove all hard Breaks
:g/^\s*\n.*\S/+norm vipJ 1
#Vim modeline for word processing
vim:tw=77 fo=a wrap
:set tw=78
gg
gqG
:set tw=9999999999
gg
gqG
map <f2> gqap
map <F7> :setlocal spell spelllang=en_us<Cr>
map <F5> a<C-R>=strftime("%b %d, %Y - %H:%M ")<CR><Esc>
" soft breaks
:set wrap linebreak nolist
" Remove all hard Breaks
:g/^\s*\n.*\S/+norm vipJ 1
There's several things that all need to be in place. Just to summarize them all in one location:
Set the following option:
:filetype indent on
:set filetype=html # abbrev - :set ft=html
:set smartindent # abbrev - :set si
Then either move the cursor to the top of the file and indent to the end: gg =G
Or select the desired text to indent and hit = to indent it.
:!tidy -mi -xml -wrap 0 %
:!tidy -mi -wrap 0 %
Show Spaces as dots:
set lcs+=space:·
# soft breaks
'':set wrap linebreak nolist''
# Remove all hard Breaks
'':g/^\s*\n.*\S/+norm vipJ 1''
#Vim modelines for word processing
''vim:tw=80 fo=ant noai wrap nonu''
''vim:tw=80 fo=ant wm=0''
Turn off auto Wrap:
setlocal noautoindent
setlocal nocindent
setlocal nosmartindent
setlocal indentexpr=
Wrap to 78 and rewrap entire document
:set tw=78
gg
gqG
Remove All Hard Wraps
:set tw=9999999999
gg
gqG
These are the settings I typically recommend you set up when working with text documents:
setlocal formatoptions=ant
setlocal textwidth=80
setlocal wrapmargin=0
''vim:tw=80 fo=ant wm=0''
map <f2> gqap
map <F7> :setlocal spell spelllang=en_us<Cr>
map <S-F7> :set nospell<Cr>
map <F5> a<C-R>=strftime("%b %d, %Y - %H:%M ")<CR><Esc>
" soft breaks
:set wrap linebreak nolist
" Remove all hard Breaks
:g/^\s*\n.*\S/+norm vipJ 1
Making lazygit a function instead of an alias allows you to pass it an argument. I have added the following to my .bashrc (or .bash_profile if Mac):
bash
function lazygit() {
git add .
git commit -a -m "$1"
git push
}
This allows you to provide a commit message, such as
lazygit "My commit msg"
Activate: \ww
Use \r instead of \n.
Substituting by \n inserts a null character into the text. To get a newline, use \r. When searching for a newline, you’d still use \n, however. This asymmetry is due to the fact that \n and \r do slightly different things:
\n matches an end of line (newline), whereas \r matches a carriage return. On the other hand, in substitutions \n inserts a null character whereas \r inserts a newline (more precisely, it’s treated as the input CR). Here’s a small, non-interactive example to illustrate this, using the Vim command line feature (in other words, you can copy and paste the following into a terminal to run it). xxd shows a hexdump of the resulting file.
https://www.maketecheasier.com/turn-vim-word-processor/
func! WordProcessor()
" movement changes
map j gj
map k gk
" formatting text
setlocal formatoptions=1
setlocal noexpandtab
setlocal wrap
setlocal linebreak
" spelling and thesaurus
setlocal spell spelllang=en_us
set thesaurus+=/home/test/.vim/thesaurus/mthesaur.txt
" complete+=s makes autocompletion search the thesaurus
set complete+=s
endfu
com! WP call WordProcessor()