4 ms·
For VIM n00bs, care to explain what these do/why you use them?
by cweiss 13y ago
For VIM n00bs, care to explain what these do/why you use them?
- johncoltrane 13y agoI'm not the parent but… Hit jj instead of <Esc> which many people find too far. inoremap jj <ESC> Exchange ; and : because : is used a lot and you need to press Shift (on an american keyboard) while ; is less used and available without a modifier key: nnoremap ; : vnoremap ; : \v means "use verymagic mode for the rest of the pattern", normally, you'd have to use a lot of backslashes to escape parentheses and other "spacial" characters but "verymagic" allows you o type less and obtain more readable patterns. Example: /f\(oo\)ba\[zr\] /\vf(oo)ba[zr] With these mappings, search-based navigation is a lot less expensive because it use s "verymagic" by default: " Fix vim's terrible default regexp scheme nnoremap / /\v vnoremap / /\v vnoremap ? ?\v nnoremap ? ?\v :cnext, :cprevious and friends are quickfix commands: thay allow you to navigate through the errors displayed in the quickfix window without using the window itself. Even in their shortened form (:cn, :cp, :cfir, :cla) they represent a lot of typing and a good occasion to create much more useful mappings: nmap <silent>]c :cnext<CR> nmap <silent>[c :cprevious<CR> nmap <silent>[C :cfirst<CR> nmap <silent>]C :clast<CR> nmap means "normal mode mapping". nnoremap means "non-recursive normal mode mapping", see learnvimscriptthehardway.stevelosh.com/chapters/05.html#nonrecursive-mapping vnoremap means "non-recursive visual and select mode mapping", it should be xnoremap (visual mode only). <silent> means "don't print the executed command".
- lcedp 13y agoThank you, didn't see the question to reply in time.