Tip 315 Printable Monobook Previous Next
created August 14, 2002 · complexity advanced · author Alex A. Naanou · version 5.7
Put the following in your vimrc. When you press the Home key, the cursor will move to the first nonblank character on the line, or, if already at that position, the cursor will move to the first character.
function! SmartHome() let s:col = col(".") normal! ^ if s:col == col(".") normal! 0 endif endfunction nnoremap <silent> <Home> :call SmartHome()<CR> inoremap <silent> <Home> <C-O>:call SmartHome()<CR>
Comments
Here is another way to do the same thing: http://hermitte.free.fr/vim/ressources/vimfiles/plugin/homeLikeVC++.vim