Wednesday, September 28, 2011

VIM tips

* spelling
:setlocal spell spelllang=en_us / :set nospell
]s move to next misspelled word, [s move to prev. misspelled word
z= suggests correctly spelled words under cursor,
1z= takes the first word from the suggestion list
^Xs does the same in insert mode.
:spellr repeats replacements done with z= for all matches

For more info about spellchecking in vim ->:h spell

* save all open buffers (and quit)
:wa " write (save) any changed files and keep working
:xa " write any changed files and exit

* double click open into vim in a terminal
/usr/bin/gnome-terminal -x /usr/bin/vim

* default tabstop in vim (in vimrc file)
set tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab

* install plugin (in vimrc file)
filetype plugin on
source /usr/share/vim/addons/plugin/(plugin).vim
...
my file:
source /usr/share/vim/addons/plugin/cscope_macros.vim
source /usr/share/vim/addons/plugin/taglist.vim
source /usr/share/vim/addons/plugin/NERD_tree.vim
source /usr/share/vim/addons/plugin/exec_menuitem.vim
source /usr/share/vim/addons/plugin/fs_menu.vim
...

* global copy paste: "+y --> "+p (in vim) / ctrl-v (across any application)

* view filename: ctrl-g

No comments:

Post a Comment