Home / Notes / VIM Notes ======================== 1. CVS commit the current file: :!cvs commit -m '[commit message]' % 2. Execute a command and read its input into the current buffer: :r![command] 3. Hard wrap text to 80 columns: a. Set the text width to 80 columns: :set textwidth=80 or :set tw=80 b. To format the entire file, go to the start of the file (:gg), and then: :gqG To format the current line only use :gq$ To format the current paragraph only use :gq} c. Alternatively, use :%!fold -w [col] Sources: http://mark.stosberg.com/Tech/text_editor_review.html#vim https://stackoverflow.com/questions/3033423/ https://vim.works/2019/03/16/wrapping-text-in-vim/ 4. Split a window and edit two files a. :sp or <CTRL>ws (horizontal split, new window on the top :vs or <CTRL>vw (vertical split, new window is on the left) b. <CTRL>ww (move to new window) c. :edit [file] To resize a split: <CTRL>w+ (increase size) <CTRL>w- (decrease size) To close a split: :only or :q or <CTRL>wo Sources: https://vim.works/2019/03/03/split-windows-in-vim/ https://vi.stackexchange.com/questions/64/ 5. Spell checking the current file: :!aspell -c % 6. Enable a custom dictionary for additional words for spelling mode: $ mkdir -p ~/.vim/spell && touch ~/.vim/spell/en.utf-8.add From: https://codeyarns.com/tech/2015-09-30-how-to-make-spellfile-in-vim.html