" Redesigned mapping for the Colemak layout for Vim 7.0 " 2008-04-21 Shai Coleman, http://colemak.com/ . Public domain. " " * Use ":source colemak.vim" (without quotes) to load this file. Adjust path to colemak.vim if needed. " * Add the line: "source colemak.vim" (without quotes) in your .vimrc file to automatically load this file. " It is recommended to load colemak.vim after all other Vim scripts. " recommended commands for running under Linux console " $ export TERM=xterm # make Backspace and Ctrl-H work correctly " $ stty -ixon -ixoff # make Ctrl+S and Ctrl+Q work correctly " " Colemak layout: | QWERTY layout: " `12345 67890-= Move Around: | (instead of) `12345 67890-= " qwfpg jlUy;[]\ u | k qwert yuiop[]\ " arstd hNEIo' n i | h l asdfg HJKL;' " zxcvb km,./ e | j zxcvb nm,./ " " (nv ) n =Left , i =Right , u =Up , e =Down " (nv ) N =Left*5 , I =Right*5 , U =Up*5 , E =Down*5 " ( ic) =Left , =Right , =Up , =Down " ( ic) =Left*5 , =Right*5 , =Up*5 , =Down*5 " (nv ) l =Left 1 word , y =Right 1 word " (nv ) =Left 1 WORD , =Right 1 WORD " (nv ) L =Home , Y =End " (nv ) j =PageUp , h =PageDown " (nv ) =File start , =File end " (nv ) - =First line , _ =Last line, -=Goto line # " (nvi ) =Escape (also stops search highlight in normal mode) " ( c) =Escape " (nvi ) =Tab " (nvic) =Space " ( v ) =Undo space " Legend: " S - Shift, C - Ctrl " (c - command line, i - insert mode, n - normal mode, v - visual+select mode) " if v:version < 700 | echohl WarningMsg | echo "colemak.vim: You need Vim version 7.0 or later" | echohl None | finish | endif " incompatible scripts: matchit.vim (fix available) " recommended settings, enabled by default set nocompatible " make Vim behave in a more useful way set nostartofline " keep cursor in the same column if possible set whichwrap=b,s,[,],<,>,h,l " allow cursor to wrap between lines set virtualedit=block " allow virtual editing in Visual block mode set lazyredraw " don't redraw screen while executing macros/mappings set scrolloff=1 " minimal number of screen lines to keep above and below the cursor set incsearch " enable incremental search set backspace=indent,eol,start " allow backspacing over everything in insert mode set winaltkeys=no " allow mapping of alt (meta) key shortcuts set ruler " show the cursor position all the time set showcmd " display incomplete commands syntax on " enable syntax highlighting " recommended settings, but not enabled by default "if has("gui_running") | source $VIMRUNTIME/mswin.vim | endif " other optional settings "set hlsearch " highlight search patterns "set ignorecase " ignore case "set smartcase " ignore case when the pattern contains lowercase letters only "set showtabline=2 " always show tab page labels "set number " display line numbers " Make Alt pop up the menu for all keys, mappings in use will be overridden subsequentially noremap :simalt a|noremap :simalt b|noremap :simalt c| noremap :simalt d|noremap :simalt e|noremap :simalt f| noremap :simalt g|noremap :simalt h|noremap :simalt i| noremap :simalt j|noremap :simalt k|noremap :simalt l| noremap :simalt m|noremap :simalt n|noremap :simalt o| noremap :simalt p|noremap :simalt q|noremap :simalt r| noremap :simalt s|noremap :simalt t|noremap :simalt u| noremap :simalt v|noremap :simalt w|noremap :simalt x| noremap :simalt y|noremap :simalt z| " Turbo navigation mode " Modified to work with counts, see :help complex-repeat nnoremap N @='5n'|xnoremap N @='5n'|onoremap N 5h| nnoremap U @='5u'|xnoremap U @='5u'|onoremap U 5k| nnoremap E @='5e'|xnoremap E @='5e'|onoremap E 5j| nnoremap I @='5i'|xnoremap I @='5i'|onoremap I 5l| inoremap 5h|cnoremap | inoremap 5k|cnoremap | inoremap 5j|cnoremap | inoremap 5l|cnoremap | " Up/down/left/right nnoremap n h|xnoremap n h|onoremap n h| nnoremap u k|xnoremap u k|onoremap u k| nnoremap e j|xnoremap e j|onoremap e j| nnoremap i l|xnoremap i l|onoremap i l| inoremap |cnoremap | inoremap |cnoremap | inoremap |cnoremap | inoremap |cnoremap | " Home/end of line " 0 unchanged nnoremap L ^|xnoremap L ^|onoremap L ^| nnoremap Y $|xnoremap Y $|onoremap Y $| inoremap |cnoremap | inoremap |cnoremap | " PageUp/PageDown nnoremap j (winheight(0)-1) . "\" nnoremap h (winheight(0)-1) . "\" xnoremap j (winheight(0)-1) . "\" xnoremap h (winheight(0)-1) . "\" inoremap "\" . (winheight(0)-1) . "\" inoremap "\" . (winheight(0)-1) . "\" nnoremap (winheight(0)-1) . "\" nnoremap (winheight(0)-1) . "\" vnoremap (winheight(0)-1) . "\" vnoremap (winheight(0)-1) . "\" vnoremap (winheight(0)-1) . "\" vnoremap (winheight(0)-1) . "\" cnoremap | cnoremap | " Half page up/down nnoremap (winheight(0)/2) . "\" nnoremap (winheight(0)/2) . "\" vnoremap (winheight(0)/2) . "\" vnoremap (winheight(0)/2) . "\" " Jump to line nnoremap - gg|xnoremap - gg|onoremap - gg| nnoremap _ G|xnoremap _ G|onoremap _ G| " Words forwards/backwards nnoremap l b|xnoremap l b|onoremap l b| nnoremap y w|xnoremap y w|onoremap y w| inoremap |cnoremap | inoremap |cnoremap | " WORD left/right nnoremap B|vnoremap B|onoremap B| nnoremap W|vnoremap W|onoremap W| " inneR text objects " e.g. dip (delete inner paragraph) is now drp onoremap r i " End of word forwards/backwards "nnoremap ; e|xnoremap ; e|onoremap ; e| "nnoremap g; ge|xnoremap g; ge|onoremap g; ge| " Folds, etc. "nnoremap ; z|xnoremap ; z| " Map ; to : nnoremap ; :|xnoremap ; :| " for virtualedit=onemore "set virtualedit=block,onemore "nnoremap | "snoremap | "xnoremap | " Cut/copy/paste nnoremap x x|xnoremap x d| nnoremap c y|xnoremap c y| nnoremap v gP|xnoremap v gP| nnoremap X dd|xnoremap X d| nnoremap C yy|xnoremap C y| nnoremap V p|xnoremap V p| nnoremap "+Y| " with no selection copies current line to clipboard nnoremap "+dd| " with no selection cuts current line to clipboard " (GUI) Make / work also in command mode, but must be selected using the mouse cnoremap | cnoremap | cnoremap +| cnoremap +| " Undo/redo nnoremap z u|xnoremap z :undo| nnoremap gz U|xnoremap gz Uundo| nnoremap Z |xnoremap Z :redo| inoremap u| " Break undo chain (Tip #1054) " Cursor position jumplist nnoremap ( | nnoremap ) | " Navigate help file " Use < and > to navigate in the help file instead au FileType help nnoremap < | au FileType help nnoremap > | au FileType help nnoremap | au FileType help nnoremap | au FileType help nnoremap (winheight(0)-1) . "\0"| au FileType help nnoremap (winheight(0)-1) . "\0"| nnoremap :tab help " opens commands in a new tab cnoreabbr h (getcmdtype() . getcmdline() != ':h' ? 'h' : 'tab help') cnoreabbr he (getcmdtype() . getcmdline() != ':he' ? 'he' : 'tab help') cnoreabbr hel (getcmdtype() . getcmdline() != ':hel' ? 'hel' : 'tab help') cnoreabbr help (getcmdtype() . getcmdline() != ':help' ? 'help' : 'tab help') cnoreabbr e (getcmdtype() . getcmdline() != ':e' ? 'e' : 'tabedit' ) cnoreabbr ed (getcmdtype() . getcmdline() != ':ed' ? 'ed' : 'tabedit' ) cnoreabbr edi (getcmdtype() . getcmdline() != ':edi' ? 'edi' : 'tabedit' ) cnoreabbr edit (getcmdtype() . getcmdline() != ':edit' ? 'edit' : 'tabedit' ) " (GUI) Start/end of document nnoremap gg|vnoremap gg|inoremap gg| nnoremap gg0|xnoremap gg0|snoremap |inoremap gg0| nnoremap gg0|xnoremap gg0|snoremap | nnoremap G$|xnoremap G$|snoremap |inoremap G$| nnoremap G$|xnoremap G$|snoremap | " (GUI) Move cursor to top/bottom of screen nnoremap H|vnoremap H|inoremap H| nnoremap L|vnoremap L|inoremap L| " (GUI) Scroll in place nnoremap |inoremap | nnoremap |inoremap | " (GUI) Live line reordering (very useful) nnoremap :move .-2| nnoremap :move .+1| vnoremap :move '<-2gv| vnoremap :move '>+1gv| inoremap :move .-2| inoremap :move .+1| " inSert/Replace/append (T) nnoremap s i| nnoremap S I| nnoremap t a| nnoremap T A| " Make insert/add work also in visual line mode like in visual block mode xnoremap s (mode() =~# "[V]" ? "\0o$I" : "I") xnoremap S (mode() =~# "[V]" ? "\0o$I" : "I") xnoremap t (mode() =~# "[V]" ? "\0o$A" : "A") xnoremap T (mode() =~# "[V]" ? "\0o$A" : "A") " Change nnoremap w c|xnoremap w c| nnoremap W C|xnoremap W C| nnoremap ww cc| " Visual mode nnoremap a v|xnoremap a v| nnoremap A V|xnoremap A V| nnoremap ggVG$|xnoremap ggVG$|vnoremap ggVG$| nnoremap | " Allow switching from visual line to visual block mode vnoremap (mode() =~# "[vV]" ? "\0o$" : "") " (GUI) Visual mode with mouse noremap | noremap V| noremap | " Insert literal inoremap |cnoremap | " Search " f unchanged " F unchanged nnoremap p t|xnoremap p t|onoremap p t| nnoremap P T|xnoremap P T|onoremap P T| nnoremap b ;|xnoremap b ;|onoremap b ;| nnoremap B ,|xnoremap B ,|onoremap B ,| nnoremap k n|xnoremap k n|onoremap k n| nnoremap K N|xnoremap K N|onoremap K N| " (GUI) search nnoremap :promptrepl|vnoremap :promptrepl|inoremap :promptrepl nnoremap n|vnoremap n|inoremap n| nnoremap N|vnoremap N|inoremap N| nnoremap *|vnoremap *|inoremap *| nnoremap #|vnoremap #|inoremap #| "http://xona.com/2005/08/02.html " Redraw screen "nnoremap |vnoremap | " New/close/save noremap :call CloseWindow()|inoremap :call CloseWindow()|cnoremap :call CloseWindow()| noremap :tabnew| "noremap :tabnew| function! CloseWindow() if winheight(2) < 0 | confirm quit | else | confirm close | endif endfunction "nnoremap :update|inoremap :update| " (GUI) open nnoremap :browse tabnew|vnoremap :browse tabnew| " (GUI) Tabs noremap :tabprev| noremap :tabnext| " Restore mappings " Free mappings: ,/+/H/~ " Macros (replay the macro recorded by qq) nnoremap Q @q| " Duplicate line "nnoremap Q :copy .+0| " "@ " , is reserved for your custom remapping " " Misc overridden keys must be prefixed with g nnoremap gs s|xnoremap gs s| nnoremap gX X|xnoremap gX X| nnoremap gU U|xnoremap gU U| nnoremap gQ Q|xnoremap gQ Q| nnoremap gK K|xnoremap gK K| " extra alias nnoremap gh K|xnoremap gh K| " Window handling: is now nnoremap |xnoremap | " opens a new window nnoremap n|xnoremap n| nnoremap n h|xnoremap n h| nnoremap u k|xnoremap u k| nnoremap e j|xnoremap e j| nnoremap i l|xnoremap i l| nnoremap i| xnoremap :let b:tmp_var=&sw\|set sw=1\|normal! gv>:let &sw=b:tmp_var\|normal! gv xnoremap :let b:tmp_var=&sw\|set sw=1\|normal! gv<:let &sw=b:tmp_var\|normal! gv " The Tab key is mapped to Escape. Press Shift-Tab to insert a Tab. " To minimize Tab use, you can use '<', '>' and ':set autoindent' nnoremap :nohlsearchpclose| vnoremap | " added to fix select mode problem inoremap | nnoremap i vnoremap >gv| inoremap | " Enter, open line nnoremap i| inoremap | nnoremap O| nnoremap o|inoremap o| " Delete/Backspace nnoremap "_dw|vnoremap "_d|inoremap |cnoremap | nnoremap "_x|vnoremap "_d| nnoremap a|vnoremap "_d| nnoremap a|inoremap |cnoremap | nnoremap "_dw|inoremap "_dw|cnoremap | nnoremap "_d^|inoremap |cnoremap | nnoremap "_d$|inoremap |cnoremap | " Local autocomplete inoremap | inoremap | " Omni completion inoremap | inoremap (&omnifunc == '' pumvisible() ? "\" : "\\") inoremap pumvisible() ? "\" : "\u\" "Tip #1386, Make Vim completion popup menu work just like in an IDE "set completeopt=longest,menuone "inoremap pumvisible() ? "\C-n>" : "\C-n>\C-r>=pumvisible() ? \"\\Down>\" : \"\"\CR>" "inoremap pumvisible() ? "\C-n>" : "\C-x>\C-o>\C-n>\C-p>\C-r>=pumvisible() ? \"\\Down>\" : \"\"\CR>"