jooize / vim-colemak

Colemak key mappings for Vim. Consider using Coleremak instead.
203 stars 50 forks source link

Keymap collision with surround.vim #2

Closed jacklenox closed 9 years ago

jacklenox commented 9 years ago

I've noticed that surround.vim presents the same issue as fugitive.vim in terms of keymap collisions with y.

surround.vim makes use of things like y s s. Any ideas on a fix for this?

jacklenox commented 9 years ago

For anyone who might come upon this issue, I have a fix for this thanks to @tpope pointing me in the right direction.

I've added this to my .vimrc:

" Surround custom mapping for Colemak
let g:surround_no_mappings = 1
nmap ds  <Plug>Dsurround
nmap cs  <Plug>Csurround
nmap cS  <Plug>CSurround
nmap ws  <Plug>Ysurround
nmap wS  <Plug>YSurround
nmap wss <Plug>Yssurround
nmap wSs <Plug>YSsurround
nmap wSS <Plug>YSsurround
xmap S   <Plug>VSurround
xmap gS  <Plug>VgSurround
if !exists("g:surround_no_insert_mappings") || ! g:surround_no_insert_mappings
    if !hasmapto("<Plug>Isurround","i") && "" == mapcheck("<C-S>","i")
        imap    <C-S> <Plug>Isurround
    endif
    imap      <C-G>s <Plug>Isurround
    imap      <C-G>S <Plug>ISurround
endif

This remaps the y commands from surround.vim to w which works rather well with vim-colemak (I think). For example, ysiw to place something around a word becomes wsrw (which Colemakkers will appreciate is a pretty neat movement!)

I don't think this causes any other clashes.