Created
March 25, 2011 23:45
-
-
Save MattWoelk/887861 to your computer and use it in GitHub Desktop.
workman keyboard layout for vim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"A blatant workman ripoff of bmx 007's beautiful colemak version called 'colqer' http://www.vim.org/scripts/script.php?script_id=2865 It makes vim so that you can insert and Ex mode in the workman keyboard layout, but can do the rest in qwerty. | |
"usage: put it in ~/.vim/plugin/ as workman.vim | |
"press \; in normal mode to activate/deactivate it. | |
"Keyboard is qwerty | |
" we want workman in insert mode | |
function IMapColemak() | |
if s:imap_colemak == 0 | |
noremap! q q | |
noremap! w d | |
noremap! e r | |
noremap! r w | |
noremap! t b | |
noremap! y j | |
noremap! u f | |
noremap! i u | |
noremap! o p | |
noremap! p ; | |
noremap! a a | |
noremap! s s | |
noremap! d h | |
noremap! f t | |
noremap! g g | |
noremap! h y | |
noremap! j n | |
noremap! k e | |
noremap! l o | |
noremap! ; i | |
noremap! z z | |
noremap! x x | |
noremap! c m | |
noremap! v c | |
noremap! b v | |
noremap! n k | |
noremap! m l | |
noremap! Q Q | |
noremap! W D | |
noremap! E R | |
noremap! R W | |
noremap! T B | |
noremap! Y J | |
noremap! U F | |
noremap! I U | |
noremap! O P | |
noremap! P : | |
noremap! A A | |
noremap! S S | |
noremap! D H | |
noremap! F T | |
noremap! G G | |
noremap! H Y | |
noremap! J N | |
noremap! K E | |
noremap! L O | |
noremap! : I | |
noremap! Z Z | |
noremap! X X | |
noremap! C M | |
noremap! V C | |
noremap! B V | |
noremap! N K | |
noremap! M L | |
let s:imap_colemak = 1 | |
endif | |
endfunction | |
function IUnmapColemak() | |
if s:imap_colemak == 1 | |
unmap! q | |
unmap! w | |
unmap! e | |
unmap! r | |
unmap! t | |
unmap! y | |
unmap! u | |
unmap! i | |
unmap! o | |
unmap! p | |
unmap! a | |
unmap! s | |
unmap! d | |
unmap! f | |
unmap! g | |
unmap! h | |
unmap! j | |
unmap! k | |
unmap! l | |
unmap! ; | |
unmap! z | |
unmap! x | |
unmap! c | |
unmap! v | |
unmap! b | |
unmap! n | |
unmap! m | |
unmap! Q | |
unmap! W | |
unmap! E | |
unmap! R | |
unmap! T | |
unmap! Y | |
unmap! U | |
unmap! I | |
unmap! O | |
unmap! P | |
unmap! A | |
unmap! S | |
unmap! D | |
unmap! F | |
unmap! G | |
unmap! H | |
unmap! J | |
unmap! K | |
unmap! L | |
unmap! : | |
unmap! Z | |
unmap! X | |
unmap! C | |
unmap! V | |
unmap! B | |
unmap! N | |
unmap! M | |
let s:imap_colemak = 0 | |
endif | |
endfunction | |
"Keyboard is workman | |
"we want to keep the qwerty for command mode | |
function CMapQwerty() | |
if s:cmap_qwerty == 0 | |
noremap q q | |
noremap <c-q> <c-q> | |
noremap d w | |
noremap <c-d> <c-w> | |
noremap r e | |
noremap <c-r> <c-e> | |
noremap w r | |
noremap <c-w> <c-r> | |
noremap b t | |
noremap <c-b> <c-t> | |
noremap j y | |
noremap <c-j> <c-y> | |
noremap f u | |
noremap <c-f> <c-u> | |
noremap u i | |
noremap <c-u> <c-i> | |
noremap p o | |
noremap <c-p> <c-o> | |
noremap ; p | |
noremap <c-;> <c-p> | |
noremap a a | |
noremap <c-a> <c-a> | |
noremap s s | |
noremap <c-s> <c-s> | |
noremap h d | |
noremap <c-h> <c-d> | |
noremap t f | |
noremap <c-t> <c-f> | |
noremap g g | |
noremap <c-g> <c-g> | |
noremap y h | |
noremap <c-y> <c-h> | |
noremap n j | |
noremap <c-n> <c-j> | |
noremap e k | |
noremap <c-e> <c-k> | |
noremap o l | |
noremap <c-o> <c-l> | |
noremap i ; | |
noremap <c-i> <c-;> | |
noremap z z | |
noremap <c-z> <c-z> | |
noremap x x | |
noremap <c-x> <c-x> | |
noremap m c | |
noremap <c-m> <c-c> | |
noremap c v | |
noremap <c-c> <c-v> | |
noremap v b | |
noremap <c-v> <c-b> | |
noremap k n | |
noremap <c-k> <c-n> | |
noremap l m | |
noremap <c-l> <c-m> | |
noremap Q Q | |
noremap D W | |
noremap R E | |
noremap W R | |
noremap B T | |
noremap J Y | |
noremap F U | |
noremap U I | |
noremap P O | |
noremap : P | |
noremap A A | |
noremap S S | |
noremap H D | |
noremap T F | |
noremap G G | |
noremap Y H | |
noremap N J | |
noremap E K | |
noremap O L | |
noremap I : | |
noremap Z Z | |
noremap X X | |
noremap M C | |
noremap C V | |
noremap V B | |
noremap K N | |
noremap L M | |
let s:cmap_qwerty = 1 | |
endif | |
endfunction | |
function CUnmapQwerty() | |
if s:cmap_qwerty == 1 | |
unmap f | |
echo "UNMAPING unmap <c-f>" | |
unmap <c-f> | |
unmap p | |
echo "UNMAPING unmap <c-p>" | |
unmap <c-p> | |
unmap g | |
echo "UNMAPING unmap <c-g>" | |
unmap <c-g> | |
unmap j | |
echo "UNMAPING unmap <c-j>" | |
unmap <c-j> | |
unmap l | |
echo "UNMAPING unmap <c-l>" | |
unmap <c-l> | |
unmap u | |
echo "UNMAPING unmap <c-u>" | |
unmap <c-u> | |
unmap y | |
echo "UNMAPING unmap <c-y>" | |
unmap <c-y> | |
unmap ; | |
echo "UNMAPING unmap <c-;>" | |
unmap r | |
echo "UNMAPING unmap <c-r>" | |
unmap <c-r> | |
unmap s | |
echo "UNMAPING unmap <c-s>" | |
unmap <c-s> | |
unmap t | |
echo "UNMAPING unmap <c-t>" | |
unmap <c-t> | |
unmap d | |
echo "UNMAPING unmap <c-d>" | |
unmap <c-d> | |
unmap n | |
echo "UNMAPING unmap <c-n>" | |
unmap <c-n> | |
unmap e | |
echo "UNMAPING unmap <c-e>" | |
unmap <c-e> | |
unmap i | |
echo "UNMAPING unmap <c-i>" | |
unmap <c-i> | |
unmap o | |
echo "UNMAPING unmap <c-o>" | |
unmap <c-o> | |
unmap k | |
echo "UNMAPING unmap <c-k>" | |
unmap <c-k> | |
unmap F | |
echo "UNMAPING unmap <c-F>" | |
unmap P | |
echo "UNMAPING unmap <c-P>" | |
unmap G | |
echo "UNMAPING unmap <c-G>" | |
unmap J | |
echo "UNMAPING unmap <c-J>" | |
unmap L | |
echo "UNMAPING unmap <c-L>" | |
unmap U | |
echo "UNMAPING unmap <c-U>" | |
unmap Y | |
echo "UNMAPING unmap <c-Y>" | |
unmap : | |
echo "UNMAPING unmap <c-:>" | |
unmap R | |
echo "UNMAPING unmap <c-R>" | |
unmap S | |
echo "UNMAPING unmap <c-S>" | |
unmap T | |
echo "UNMAPING unmap <c-T>" | |
unmap D | |
echo "UNMAPING unmap <c-D>" | |
unmap N | |
echo "UNMAPING unmap <c-N>" | |
unmap E | |
echo "UNMAPING unmap <c-E>" | |
unmap I | |
echo "UNMAPING unmap <c-I>" | |
unmap O | |
echo "UNMAPING unmap <c-O>" | |
unmap K | |
echo "UNMAPING unmap <c-K>" | |
let s:cmap_qwerty = 0 | |
endif | |
endfunction | |
map <Plug>IMapColemakUnmapColemak :call IMapColemak()<CR> | |
map <Plug>IUnmapColemakUnmapColemak :call IUnmapColemak()<CR> | |
map <Plug>CmapQwertyUnmapColemak :call CmapQwerty()<CR> | |
map <Plug>CunmapQwertyUnmapColemak :call CunmapQwerty()<CR> | |
let s:imap_colemak = 0 | |
function IMapColemakSwitch() | |
call CUnmapQwerty() | |
if s:imap_colemak == 1 | |
call IUnmapColemak() | |
echo "Normal" | |
else | |
call IMapColemak() | |
echo "WORKMAN" | |
end | |
endfunction | |
let s:cmap_qwerty = 0 | |
function CMapQwertySwitch() | |
call IUnmapColemak() | |
if s:cmap_qwerty == 1 | |
call CUnmapQwerty() | |
echo "Normal" | |
else | |
call CMapQwerty() | |
echo "QWERTY" | |
end | |
endfunction | |
nnoremap <Leader>; :call IMapColemakSwitch()<cr> | |
nnoremap <Leader>o :call CMapQwertySwitch()<cr> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment