map <F1> !}fmt<CR>in your .vimrc to use F1 to reformat a paragraph. You can specify command line arguments to fmt by:
map <F1> !}fmt --option1 --option2<CR>Instead, if you want to reformat the entire document (good if you want to reformat mail from Windows users) try:
map <F1> 1G!Gfmt --option1 --option2<CR>1G moves you to the top of the file !G says pipe from here to the end of the doc through the following command.
For non-interactive spell checkers (like writing a script that greps /usr/dict/words), put this in your .vimrc:
set keywordprg=/usr/local/interactivespellcheckerafter that, by pressing K, vim will hand the word under the cursor to the spell checker.
using vim's highlighting to check a whole file
Download engspchk.vim (http://www.ee.cua.edu/~cec/engspchk.vim.gz) if you don't already have it. Then in your .vimrc file, put:
map <F3> :so /usr/share/vim/syntax/engspchk.vim<CR>make sure syntax highlighting is on by placing
syntax onin your .vimrc file. Unrecognized words are highlighted in red. It's clear how to add words to this file if you ever need to. If you have Vim 5.4 or higher, you can also use \en and \ep for the next and preceeding error. Using an interactive spell checker (from the vim faq)
Put this in your .vimrc:
noremap ;ispell :%! ispell-filter<CR><C-L>where ispell-filter is:
#!/bin/sh # This script runs ispell on stdin, returning the result through stdout. # It can be used from VI like this (or map it to a key sequence): # :%! ~/bin/ispell-filter # cat > /tmp/tmp.$$ ispell $* /tmp/tmp.$$ < /dev/tty > /dev/tty cat /tmp/tmp.$$ rm -f /tmp/tmp.$$Using an interactive spellchecker like ispell:
Put the following in your .vimrc
map #fi :w<CR>:!ispell %<CR<:e %<CR>Actually, I like this one the best because I can see exactly what it's doing.
This will work for stock old, musty vi.
map #fi maps the string #fi in command mode (not : or text insert mode) :w<CR> writes the file. !ispell %<CR> runs ispell on your file. in ex, % expands to the file you're currently editing :e %<CR> ispell writes to your file, but you still have the old copy with spellign erors. So you want to reload the file.
control-n will complete the current string using text from lines below the current position (next). control-p will complete the current string using text from above (previous).
deand you'd like to put the country names after their 2 letter codes.
fi
uk
Germany
Finland
England
deGermany
fiFinland
ukEngland
de Germany
fi Finland
uk England
v/./.,/./-1join
" _Y: Yank the highlighted block of text (or a single line) to a tmp file.Now you just highlight the area you want to copy with V commands and yank it with _Y. Then you can paste it in another vim with _P.
" _P: Put the text yanked with \_Y (possibly in another invocation of Vim).
nmap _Y :.w! ~/.vi_tmp<CR>
vmap _Y :w! ~/.vi_tmp<CR>
nmap _P :r ~/.vi_tmp<CR>
map #fi :w<CR>:!ispell %<:CR>:e %<CR> "map #fi :w^M:!ispell %^M:e %^M "set autoindent " lines following an indented line will have the same " indentation. ^d in text mode backs over the indentation set beautify set nomesg " don't bug me (set mesg) set modeline "set number " puts line numbers on the LHS of the screen (set nonumber) set shiftwidth=3 " similar to tabstop, but tabstop takes precedence set showmode " shows what mode we're in set tabstop=3 " sets the number of spaces to a tab set textwidth=76 " textwidth wins over wrapmargin set warn " warns if you modified a file but haven't saved it yet. " doesn't seem to work set wrapmargin=6 set nobackup set noerrorbells map! <F1> \begin{equation} map! <F2> \end{equation} map! <F3> \langle map! <F4> \rangle au BufNewFile,BufRead *.html map! <F1> <TT> au BufNewFile,BufRead *.html map! <F2> </TT> au BufNewFile,BufRead *.html map! <F3> <BLOCKQUOTE> au BufNewFile,BufRead *.html map! <F4> </BLOCKQUOTE> au BufNewFile,BufRead *.f90,*.for,*.c,,*.html,*.pl,*.tex set tw=0 wm=0 "syntax on map <F3> :so /usr/share/vim/syntax/engspchk.vim<CR>
To mark a text location:
To go back to the mark you just made:
`a,`Bs/emacs/vim/g | Between text markers a and B, change all occurances of emacs to vim. |
`a,`cd | Delete all text between text markers a and c. |
'j,'kyy | Yank text between the beginning of the line marked by j and the beginning of the line marked by k. |
"cy`b | Place the text between the current cursor position and marker b into the named buffer c. |
au BufNewFile,BufRead *.c *.html *.h *.cc set tw=0 wm=0