Explorar el Código

add dvorak and colemak keymaps

Fun!
weiyi hace 12 años
padre
commit
8d59334403
Se han modificado 2 ficheros con 65 adiciones y 1 borrados
  1. 43 0
      vim/keymap/colemak.vim
  2. 22 1
      vim/vimrc

+ 43 - 0
vim/keymap/colemak.vim

@@ -0,0 +1,43 @@
+" Maintainer:   Weiyi Lou <cinaeco@gmail.com>
+" Last Changed: 2013 Jul 04
+"
+" All characters are ASCII, conversion to another encoding (e.g., UTF-8)
+" should work.
+
+let b:keymap_name = "en-cm"
+
+loadkeymap
+e	f
+r	p
+t	g
+y	j
+u	l
+i	u
+o	y
+p	;
+s	r
+d	s
+f	t
+g	d
+j	n
+k	e
+l	i
+;	o
+n	k
+E	F
+R	P
+T	G
+Y	J
+U	L
+I	U
+O	Y
+P	:
+S	R
+D	S
+F	T
+G	D
+J	N
+K	E
+L	I
+:	O
+N	K

+ 22 - 1
vim/vimrc

@@ -161,6 +161,7 @@ set incsearch   " vim will search as you type!
 set ignorecase  " ignore case for searches
 set smartcase   " well, unless a user puts in uppercase search characters
 set magic       " enables wildcard searching
+
 " use ack for grepping if available
 if executable('ack-grep')
   set grepprg=ack-grep\ --with-filename\ --nocolor\ --nogroup
@@ -216,6 +217,9 @@ nmap <silent> <leader>p    :set paste! paste?<CR>
 " Toggle visible whitespace characters
 nmap <silent> <leader>l    :set list!<CR>
 
+" Toggle keyboard layout
+nmap <silent> <leader>k    :call CycleKeymap()<CR>
+
 " Toggle scrollbind for moving multiple splits in sync together
 nmap <silent> <leader>s    :set scrollbind! scrollbind?<CR>
 
@@ -392,7 +396,24 @@ function! ClearSearch()
   if (@/ != "")
     let @/=""
     redraw
-  end
+  endif
+endfunction
+
+function! CycleKeymap()
+  if has('keymap')
+    if (&keymap == '')
+      set keymap=colemak
+      echo "Colemak keymap selected"
+    elseif (&keymap == 'colemak')
+      set keymap=dvorak
+      echo "Dvorak keymap selected"
+    else
+      set keymap=
+      echo "Qwerty keymap selected"
+    endif
+  else
+    echo "Keymaps not supported"
+  endif
 endfunction
 
 function! MapQfPrevNext()