The coolest features of Vim7
- omni/intellisense completion: use CTRL-X CTRL-O in insert mode to start it [:he compl-omni]
- internal grep: vimgrep foo bar [:he vimgrep]
- tab pages: vim -p file1 file2 – then use the :tab command [:he tabpage]
gt -> next tab
gT -> previous tab - undo branches: :undolist / :earlier 2h / :later 2h
instead of using u (undo) and CTRL-R (redo), you might experiment with g- and g+ to move through the text state [:he undolist] - browse (and of course edit) remote directories via scp using netrw plugin: :edit scp://host//path/to/ [:he netrw.vim]
- start editing the filename under the cursor and jump to the line number following the file name: press gF [:he gF]
- press ‘CTRL-W F’ to start editing the filename under the cursor in a new window and jump to the line number following the file name. [:he CTRL-W_F]
- spelling correction [:he spell]:
]s -> Move to next misspelled word after the cursor
zg -> Add word under the cursor as a good word to the first name in ‘spellfile’
zw -> Like “zg” but mark the word as a wrong (bad) word
z= -> For the word under/after the cursor suggest correctly spelled words - highlight active cursor line using ‘set cursorline’ [:he cursorline]
- delete inner quotes inside HTML-code using cit [:he tag-blocks]
Configuration template for your ~/.vimrc:
if version >= 700 " Thanks for some ideas to Christian 'strcat' Schneider and Julius Plenz " turn spelling on by default: " set spell " toggle spelling with F12 key: map <F12> :set spell!<CR><Bar>:echo "Spell Check: " . strpart("OffOn", 3 * &spell, 3)<CR> set spellfile=~/.vim/spellfile.add " change language - get spell files from http://ftp.vim.org/pub/vim/runtime/spell/ " cd ~/.vim/spell && wget http://ftp.vim.org/pub/vim/runtime/spell/de.latin1.spl " change to german: " set spelllang=de " highlight matching parens: " set matchpairs=(:),[:],{:},< :> " let loaded_matchparen = 1 " highlight MatchParen term=reverse ctermbg=7 guibg=cornsilk " highlight the cursor line and column: " set cursorline " highlight CursorLine term=reverse ctermbg=7 guibg=#333333 " highlight CursorColumn guibg=#333333 " delete Inner-Quotes - very useful within HTML-code! imap <F10> <C-O>cit " set maximum number of suggestions listed to top 10 items set sps=best,10 endif
Note: all of the above is brought to grml-users via /etc/skel/.vimrc of current grml-etc package and will be shipped with the next grml-release of course.
May 28th, 2006 at 18:26
I also found the ‘pumheight’ option pretty handy when using vim7 over a SSH connection. If you set this option to 7, the completion menu will just dispay 7 items at a time, thus avoiding too much unnecessary terminal redraws. YMMV.
I Omni-Completion for CSS des work fine in HTML and PHP file, in external *.css files it doesn’t, though. Does it work for you?
Oh, and by the way: I’d call "cit" rather "cut [out] inner tag" (which is what it really does).
May 28th, 2006 at 19:39
@julius:
pumheight – nice, thanks :)
same problem with external css-files here, even though ft=css is set, seems to be a bug
oh and thanks for the "cit"-description as well :-)
regards,
-mika-
June 5th, 2006 at 15:27
Hi,
great stuff! Ok, I don’t want to be picky, but I am. The c actually stands for change, so that makes it change inner tag. Also new in the same category: ci" which will remove the text between quotes and leave you in insert mode; also works for ‘ and `. If you want to change the contents of a tag like <h1> to <h2>, you can now type: ci<h2<ESC>, which will remove everything between < and > and replace it with h2.
–Peter
June 5th, 2006 at 16:30
@Peter: thanks for your comment, I updated the configuration file for vim on grml corresponding. :)
mfg,
-mika-