17 January, 2012

keymappings for mac vim

thought i'd share... i hate the goddamn keymapping of command+W closing mac vim. i can't seem to get my fingers to actually use control + W + [h,j,k,l] when i want to move to a different pane in vim on the mac, so i have a tendency to hit command + W, which has horrible consequences in mac vim. ugh! anyway, after digging around i found info on how to remap some keys. i now have remapped all my vim pane navigations in mac vim by adding the following to my .gvim file:


if has("gui_macvim")
        macmenu &File.Close\ Window key=
        macmenu &File.Close key=
        nnoremap <D-w>h <C-W>h        
        inoremap <D-w>h <C-W>h       
        nnoremap <D-w>l <C-W>l        
        inoremap <D-w>l <C-W>l       
        nnoremap <D-w>j <C-W>j        
        inoremap <D-w>j <C-W>j       
        nnoremap <D-w>k <C-W>k        
        inoremap <D-w>k <C-W>k       

endif

so, i guess you want this in a .gvim file because .vim file options are loaded first and macvim then puts all of its mappings on top of that. if you add these to .gvim they are preserved.


my understanding of how i needed to put this in the .gvim file as opposed to the .vim file came from this posting on superuser.com.

No comments: