# HG changeset patch # User Steve Losh # Date 1281127174 14400 # Node ID 87bb4c33955ce9ba20cc6199d3c931739a2df823 # Parent dcd05a92e988e19110a896b1bdef15255bc141e7 vim: bunches diff -r dcd05a92e988 -r 87bb4c33955c vim/.vimrc --- a/vim/.vimrc Thu Aug 05 12:41:27 2010 -0400 +++ b/vim/.vimrc Fri Aug 06 16:39:34 2010 -0400 @@ -16,7 +16,6 @@ set encoding=utf-8 set scrolloff=3 set autoindent -set smartindent set showmode set showcmd set hidden @@ -92,8 +91,6 @@ " Folding set foldlevelstart=1 -nnoremap za -vnoremap za nnoremap za vnoremap za au BufNewFile,BufRead *.html map ft Vatzf @@ -116,7 +113,9 @@ endfunction " Fuck you, help key. -imap +inoremap :set invfullscreena +nnoremap :set invfullscreen +vnoremap :set invfullscreen " Various syntax stuff au BufNewFile,BufRead *.less set filetype=less @@ -184,14 +183,9 @@ " HTML tag closing inoremap :call InsertCloseTag()a -" Arpeggio -call arpeggio#load() -Arpeggio inoremap jk -Arpeggio inoremap fh -Arpeggio inoremap hj -Arpeggio inoremap fj -Arpeggio inoremap asdf +" Faster Esc inoremap +inoremap jj " Scratch nmap :Sscratchx:resize 15 @@ -204,3 +198,7 @@ " Edit .vimrc nmap V :e $MYVIMRC + +" Sudo to write +cmap w!! w !sudo tee % >/dev/null + diff -r dcd05a92e988 -r 87bb4c33955c vim/bundle/arpeggio/.mduem/cache/Makefile.variables --- a/vim/bundle/arpeggio/.mduem/cache/Makefile.variables Thu Aug 05 12:41:27 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -all_files_in_repos := Makefile after/syntax/vim/arpeggio.vim autoload/arpeggio.vim doc/arpeggio.txt plugin/arpeggio.vim test/ui.expected test/ui.input -current_branch := master -origin_name := origin -origin_uri := ../. -repos_name := vim-arpeggio -version := 0.0.6 diff -r dcd05a92e988 -r 87bb4c33955c vim/bundle/arpeggio/Makefile --- a/vim/bundle/arpeggio/Makefile Thu Aug 05 12:41:27 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -# Makefile for usual Vim plugin - -REPOS_TYPE := vim-script -INSTALLATION_DIR := $(HOME)/.vim -TARGETS_STATIC = $(filter %.vim %.txt,$(all_files_in_repos)) -TARGETS_ARCHIVED = $(all_files_in_repos) mduem/Makefile - - - - -include mduem/Makefile - -# __END__ diff -r dcd05a92e988 -r 87bb4c33955c vim/bundle/arpeggio/after/syntax/vim/arpeggio.vim --- a/vim/bundle/arpeggio/after/syntax/vim/arpeggio.vim Thu Aug 05 12:41:27 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -" Vim additional syntax: vim/arpeggio - highlight :Arpeggio commands -" Version: 0.0.6 -" Copyright (C) 2008-2010 kana -" License: So-called MIT/X license {{{ -" Permission is hereby granted, free of charge, to any person obtaining -" a copy of this software and associated documentation files (the -" "Software"), to deal in the Software without restriction, including -" without limitation the rights to use, copy, modify, merge, publish, -" distribute, sublicense, and/or sell copies of the Software, and to -" permit persons to whom the Software is furnished to do so, subject to -" the following conditions: -" -" The above copyright notice and this permission notice shall be included -" in all copies or substantial portions of the Software. -" -" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -" }}} - -syntax keyword vimArpeggioCommand -\ Arpeggio -\ skipwhite nextgroup=vimMap - -syntax match vimArpeggioCommand -\ /\/ -\ skipwhite nextgroup=vimMapBang,vimMapMod,vimMapLhs - -syntax match vimArpeggioCommand -\ /\!\?/ -\ skipwhite nextgroup=vimMapMod,vimMapLhs - - - - -highlight default link vimArpeggioCommand vimCommand - -" __END__ -" vim: foldmethod=marker diff -r dcd05a92e988 -r 87bb4c33955c vim/bundle/arpeggio/autoload/arpeggio.vim --- a/vim/bundle/arpeggio/autoload/arpeggio.vim Thu Aug 05 12:41:27 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,439 +0,0 @@ -" arpeggio - Mappings for simultaneously pressed keys -" Version: 0.0.6 -" Copyright (C) 2008-2010 kana -" License: So-called MIT/X license {{{ -" Permission is hereby granted, free of charge, to any person obtaining -" a copy of this software and associated documentation files (the -" "Software"), to deal in the Software without restriction, including -" without limitation the rights to use, copy, modify, merge, publish, -" distribute, sublicense, and/or sell copies of the Software, and to -" permit persons to whom the Software is furnished to do so, subject to -" the following conditions: -" -" The above copyright notice and this permission notice shall be included -" in all copies or substantial portions of the Software. -" -" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -" }}} -" Notes "{{{1 -" -" CONVENTIONS FOR INTERNAL MAPPINGS -" -" work:... -" Use to set 'timeoutlen', to restore 'timeoutlen', and to -" determine whether keys are simultaneously pressed or not. -" -" success:... -" Use to restore 'timeoutlen' and to do user-defined action for -" the simultaneously pressed keys "...". -" -" -" MAPPING FLOWCHART -" -" {X} (user types a key {X}) -" | -" v -" work:{X} -" | (are {Y}... simultaneously typed with {X}?) -" [yes] | [no] -" .---------------*-------------------. -" | | -" v v -" work:{X}{Y}... (arpeggio-default:{X}) -" | -" v -" success:{X}{Y}... -" | -" v -" {rhs} - - - - - - - - -" Variables "{{{1 - -" See s:set_up_options() and s:restore_options(). -let s:original_showcmd = &showcmd -let s:original_timeout = &timeout -let s:original_timeoutlen = &timeoutlen -let s:original_ttimeoutlen = &ttimeoutlen - - - - - - - - -" Public "{{{1 -function! arpeggio#list(modes, options, ...) "{{{2 - let lhs = 1 <= a:0 ? a:1 : 0 - let opt_buffer = a:options =~# 'b' ? '' : '' - - for mode in s:each_char(a:modes) - execute printf('%smap %s success:%s', - \ mode, opt_buffer, lhs is 0 ? '' : lhs) - endfor - return -endfunction - - - - -function! arpeggio#load() "{{{2 - runtime! plugin/arpeggio.vim -endfunction - - - - -function! arpeggio#map(modes, options, remap_p, lhs, rhs) "{{{2 - for mode in s:each_char(a:modes) - call s:do_map(mode, a:options, a:remap_p, s:split_to_keys(a:lhs), a:rhs) - endfor - return -endfunction - - - - -function! arpeggio#unmap(modes, options, lhs) "{{{2 - let v:errmsg = '' - - for mode in s:each_char(a:modes) - call s:do_unmap(mode, a:options, s:split_to_keys(a:lhs)) - endfor - - if v:errmsg != '' - echoerr v:errmsg - endif - return v:errmsg == '' -endfunction - - - - - - - - -" Core "{{{1 -function! arpeggio#_do(script) "{{{2 - let _ = split(substitute(a:script, '^\s\+', '', ''), '^\S\+\zs') - execute 'Arpeggio'._[0] join(_[1:], '') - return -endfunction - - - - -function! arpeggio#_map_or_list(modes, remap_p, q_args) "{{{2 - let [options, lhs, rhs] = s:parse_args(a:q_args) - if rhs isnot 0 - return arpeggio#map(a:modes, options, a:remap_p, lhs, rhs) - else - return arpeggio#list(a:modes, options, lhs) - endif -endfunction - - - - -function! arpeggio#_unmap(modes, q_args) "{{{2 - let [options, lhs, rhs] = s:parse_args(a:q_args) - return arpeggio#unmap(a:modes, options, lhs) -endfunction - - - - -function! s:chord_cancel(key) "{{{2 - call s:restore_options() - return "\(arpeggio-default:" . a:key . ')' -endfunction - - - - -function! s:chord_key(key) "{{{2 - call s:set_up_options(a:key) - return s:SID . 'work:' . a:key " work:... -endfunction - - - - -function! s:chord_success(keys) "{{{2 - call s:restore_options() - return s:SID . 'success:' . a:keys " success:... -endfunction - - - - -function! s:do_map(mode, options, remap_p, keys, rhs) "{{{2 - " Assumption: Values in a:keys are <>-escaped, e.g., "" not "\". - let opt_buffer = a:options =~# 'b' ? '' : '' - - let already_mapped_p = 0 - for key in a:keys - let rhs = maparg(key, a:mode) - if rhs != '' && rhs !=# ('' . matchstr(s:SID, '\d\+') . '_' - \ . 'chord_key(' . string(key) . ')') - echohl WarningMsg - echomsg 'Key' string(key) 'is already mapped in mode' string(a:mode) - echohl None - let already_mapped_p = !0 - endif - endfor - if a:options =~# 'u' && already_mapped_p - echoerr 'Abort to map because of the above reason' - return - endif - - for key in a:keys - execute printf('%smap %s %s chord_key(%s)', - \ a:mode, opt_buffer, key, string(s:unescape_lhs(key))) - endfor - - let combos = [] - for i in range(1, len(a:keys) - 1) - call extend(combos, s:permutations(a:keys, i)) - endfor - for combo in combos - execute printf('%smap work:%s chord_cancel(%s)', - \ a:mode, combo, string(s:unescape_lhs(combo))) - execute printf('silent! %snoremap (arpeggio-default:%s) %s', - \ a:mode, combo, combo) - endfor - - for combo in s:permutations(a:keys, len(a:keys)) - execute printf('%smap work:%s chord_success(%s)', - \ a:mode, combo, string(s:unescape_lhs(combo))) - execute printf('%s%smap %s success:%s %s', - \ a:mode, - \ a:remap_p ? '' : 'nore', - \ s:to_map_arguments(a:options), - \ combo, - \ a:rhs) - endfor - return -endfunction - - - - -function! s:do_unmap(mode, options, keys) "{{{2 - " FIXME: Mediate key mappings "work:" should be removed. - " But they may be used by other arpeggio key mappings and it's hard - " to determine whether a given mediate key mappng is still used or - " not in fast and exact way. So that they aren't removed currently. - let opt_buffer = a:options =~# 'b' ? '' : '' - - for key in a:keys - silent! execute printf('%sunmap %s %s', - \ a:mode, opt_buffer, key) - endfor - - for combo in s:permutations(a:keys, len(a:keys)) - silent! execute printf('%sunmap %s success:%s', - \ a:mode, - \ s:to_map_arguments(a:options), - \ combo) - endfor - - return -endfunction - - - - - - - - -" Misc. "{{{1 -function! s:SID() "{{{2 - return matchstr(expand(''), '\zs\d\+\ze_') -endfunction -let s:SID = "\" . s:SID() . '_' - - - - -function! s:each_char(s) "{{{2 - return split(a:s, '.\zs') -endfunction - - - - -function! s:parse_args(q_args) "{{{2 - " Parse for :map commands into {options}, {lhs} and {rhs}. - " Omitted arguments are expressed as 0. - let ss = s:split_to_keys(a:q_args) - - let options = '' - let ss = s:skip_spaces(ss) - while 0 < len(ss) - if ss[0] =~? '' - let options .= 'b' - elseif ss[0] =~? '' - let options .= 'e' - elseif ss[0] =~? '' - let options .= 's' - elseif ss[0] =~? '' - let options .= 'u' - else - break - endif - let ss = s:skip_spaces(ss[1:]) - endwhile - - let i = 0 - while i < len(ss) - if ss[i] =~ '\s' - break - endif - let i += 1 - endwhile - let lhs = 1 <= i ? join(ss[:i-1], '') : 0 - let ss = s:skip_spaces(ss[(i):]) - - let rhs = 0 < len(ss) ? join(ss, '') : 0 - - return [options, lhs, rhs] -endfunction - - - - -function! s:permutations(ss, r) "{{{2 - " This function is translated one of itertools.permutations() of Python 2.6: - " http://www.python.org/doc/2.6/library/itertools.html#itertools.permutations - let result = [] - let n = len(a:ss) - let r = a:r - let indices = range(n) - let cycles = range(n, n-r+1, -1) - let rest = n - for _ in range(n-1, n-r+1, -1) - let rest = rest * _ - endfor - - call add(result, join(map(indices[:r-1], 'a:ss[v:val]'), '')) - for _ in range(rest - 1) - for i in range(r-1, 0, -1) - let cycles[i] -= 1 - if cycles[i] == 0 - let indices[(i):] = indices[(i+1):] + indices[(i):(i)] - let cycles[i] = n - i - else - let j = cycles[i] - let [indices[i], indices[-j]] = [indices[-j], indices[i]] - call add(result, join(map(indices[:r-1], 'a:ss[v:val]'), '')) - break - endif - endfor - endfor - return result -endfunction - - - - -function! s:restore_options() "{{{2 - let &showcmd = s:original_showcmd - let &timeout = s:original_timeout - let &timeoutlen = s:original_timeoutlen - let &ttimeoutlen = s:original_ttimeoutlen - return -endfunction - - - - -function! s:set_up_options(key) "{{{2 - let s:original_showcmd = &showcmd - let s:original_timeout = &timeout - let s:original_timeoutlen = &timeoutlen - let s:original_ttimeoutlen = &ttimeoutlen - - set noshowcmd " To avoid flickering in the bottom line. - set timeout " To ensure time out on :mappings - let &timeoutlen = get(g:arpeggio_timeoutlens, a:key, g:arpeggio_timeoutlen) - let &ttimeoutlen = (0 <= s:original_ttimeoutlen - \ ? s:original_ttimeoutlen - \ : s:original_timeoutlen) - return -endfunction - - - - -function! s:skip_spaces(ss) "{{{2 - let i = 0 - for i in range(len(a:ss)) - if a:ss[i] !~# '\s' - break - endif - endfor - return a:ss[(i):] -endfunction - - - - -function! s:split_to_keys(lhs) "{{{2 - " Assumption: Special keys such as are escaped with < and >, i.e., - " a:lhs doesn't directly contain any escape sequences. - return split(a:lhs, '\(<[^<>]\+>\|.\)\zs') -endfunction - - - - -function! s:to_map_arguments(options) "{{{2 - let _ = {'b': '', 'e': '', 's': '', 'u': ''} - return join(map(s:each_char(a:options), '_[v:val]')) -endfunction - - - - -function! s:unescape_lhs(escaped_lhs) "{{{2 - let keys = s:split_to_keys(a:escaped_lhs) - call map(keys, 'v:val =~ "^<.*>$" ? eval(''"\'' . v:val . ''"'') : v:val') - return join(keys, '') -endfunction - - - - -function! s:without(list, i) "{{{2 - if 0 < a:i - return a:list[0 : (a:i-1)] + a:list[(a:i+1) : -1] - else - return a:list[1:] - endif -endfunction - - - - - - - - -" __END__ "{{{1 -" vim: foldmethod=marker diff -r dcd05a92e988 -r 87bb4c33955c vim/bundle/arpeggio/doc/arpeggio.txt --- a/vim/bundle/arpeggio/doc/arpeggio.txt Thu Aug 05 12:41:27 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,332 +0,0 @@ -*arpeggio.txt* Key mappings for simultaneously pressed keys - -Version 0.0.6 -Script ID: 2425 -Copyright (C) 2008-2010 kana -License: So-called MIT/X license {{{ - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -}}} - -CONTENTS *arpeggio-contents* - -Introduction |arpeggio-introduction| -Interface |arpeggio-interface| - Commands |arpeggio-commands| - Functions |arpeggio-functions| - Mappings |arpeggio-mappings| - Variables |arpeggio-variables| -Bugs |arpeggio-bugs| -Changelog |arpeggio-changelog| - - - - -============================================================================== -INTRODUCTION *arpeggio-introduction* - -*arpeggio* is a Vim plugin to define another type of |key-mapping| called -*arpeggio-key-mapping* -- it consists of 2 or more keys ({lhs}) and it will be -expanded to another key sequence ({rhs}) whenever all keys in {lhs} are -simultaneously pressed. For example: -> - Arpeggio inoremap jk - " OR - call arpeggio#map('i', '', 0, 'jk', '') -< -With the above definition, you can input in Insert mode by pressing "j" -and "k" simultaneously, while you can move the cursor by pressing "j" or "k" -solely. - -The concept of this plugin is derived from Emacs' key-chord.el (*1), but there -are the following differences: - -- Number of keys to be simultaneously pressed is unlimited. - -- Custom delay for each key is supported (see |g:arpeggio_timeoutlens|). - This is a generalization of space-chord.el (*2). - -(*1) http://www.emacswiki.org/emacs/key-chord.el -(*2) http://www.emacswiki.org/emacs/space-chord.el - - -Requirements: -- Vim 7.2 or later - -Latest version: -http://github.com/kana/vim-arpeggio - -Document in HTML format: -http://kana.github.com/config/vim/arpeggio.html - - - - -============================================================================== -INTERFACE *arpeggio-interface* - ------------------------------------------------------------------------------- -COMMANDS *arpeggio-commands* - -:Arpeggio {command} ... *:Arpeggio* - Equivalent to ":Arpeggio{command} ...". This command - is just for readability. - -:Arpeggiomap {lhs} {rhs} *:Arpeggiomap* -:Arpeggiomap! {lhs} {rhs} *:Arpeggiomap!* -:Arpeggiocmap {lhs} {rhs} *:Arpeggiocmap* -:Arpeggioimap {lhs} {rhs} *:Arpeggioimap* -:Arpeggiolmap {lhs} {rhs} *:Arpeggiolmap* -:Arpeggionmap {lhs} {rhs} *:Arpeggionmap* -:Arpeggioomap {lhs} {rhs} *:Arpeggioomap* -:Arpeggiosmap {lhs} {rhs} *:Arpeggiosmap* -:Arpeggiovmap {lhs} {rhs} *:Arpeggiovmap* -:Arpeggioxmap {lhs} {rhs} *:Arpeggioxmap* - Like |:map| and others, but map to {rhs} if and only - if all keys in {lhs} are simultaneously pressed. - - Available |:map-arguments| are , , - and/or . See also |arpeggio#map()| - for other notes and limitations. - -:Arpeggionoremap {lhs} {rhs} *:Arpeggionoremap* -:Arpeggionoremap! {lhs} {rhs} *:Arpeggionoremap!* -:Arpeggiocnoremap {lhs} {rhs} *:Arpeggiocnoremap* -:Arpeggioinoremap {lhs} {rhs} *:Arpeggioinoremap* -:Arpeggiolnoremap {lhs} {rhs} *:Arpeggiolnoremap* -:Arpeggionnoremap {lhs} {rhs} *:Arpeggionnoremap* -:Arpeggioonoremap {lhs} {rhs} *:Arpeggioonoremap* -:Arpeggiosnoremap {lhs} {rhs} *:Arpeggiosnoremap* -:Arpeggiovnoremap {lhs} {rhs} *:Arpeggiovnoremap* -:Arpeggioxnoremap {lhs} {rhs} *:Arpeggioxnoremap* - Variants of |:Arpeggiomap| without remapping, like - |:noremap|. - -:Arpeggiounmap {lhs} {rhs} *:Arpeggiounmap* -:Arpeggiounmap! {lhs} {rhs} *:Arpeggiounmap!* -:Arpeggiocunmap {lhs} {rhs} *:Arpeggiocunmap* -:Arpeggioiunmap {lhs} {rhs} *:Arpeggioiunmap* -:Arpeggiolunmap {lhs} {rhs} *:Arpeggiolunmap* -:Arpeggionunmap {lhs} {rhs} *:Arpeggionunmap* -:Arpeggioounmap {lhs} {rhs} *:Arpeggioounmap* -:Arpeggiosunmap {lhs} {rhs} *:Arpeggiosunmap* -:Arpeggiovunmap {lhs} {rhs} *:Arpeggiovunmap* -:Arpeggioxunmap {lhs} {rhs} *:Arpeggioxunmap* - Like |:unmap| and others, but remove key mappings - defined by |:Arpeggiomap| and/or others. - -:Arpeggiomap [{lhs}] *:Arpeggiomap_l* -:Arpeggiomap! [{lhs}] *:Arpeggiomap_l!* -:Arpeggiocmap [{lhs}] *:Arpeggiocmap_l* -:Arpeggioimap [{lhs}] *:Arpeggioimap_l* -:Arpeggiolmap [{lhs}] *:Arpeggiolmap_l* -:Arpeggionmap [{lhs}] *:Arpeggionmap_l* -:Arpeggioomap [{lhs}] *:Arpeggioomap_l* -:Arpeggiosmap [{lhs}] *:Arpeggiosmap_l* -:Arpeggiovmap [{lhs}] *:Arpeggiovmap_l* -:Arpeggioxmap [{lhs}] *:Arpeggioxmap_l* - List key mappings which are defined by |:Arpeggiomap| - or others and which contain all keys in {lhs}. - If {lhs} is omitted, list all key mappings defined by - |:Arpeggiomap| or others. - - ------------------------------------------------------------------------------- -FUNCTIONS *arpeggio-functions* - -arpeggio#list({modes}, {options}, [{lhs}]) *arpeggio#list()* - Function version of |:Arpeggiomap_l| and others. - See |arpeggio#map()| for the details of arguments. - - For this function, {lhs} can be omitted or can be 0. - If so, all arpeggio mappings defined in {modes} will - be listed. - -arpeggio#load() *arpeggio#load()* - Load this plugin if it is not loaded yet. Otherwise, - does nothing. Call this function to ensure that - |arpeggio-commands| are defined before you use one of - them, especially, in your |vimrc|. - - *arpeggio#map()* -arpeggio#map({modes}, {options}, {remap-p}, {lhs}, {rhs}) - Function version of |:Arpeggiomap| and others. - - {modes} - String. Each character means one or more - modes to define the given key mapping. "n" - means Normal mode, "v" means Visual mode and - Select mode (the same as what |:vmap| does), - and so forth. - - {options} - String. Each character means one of - |:map-arguments|. The meanings of characters - are as follows: - - Char Meaning ~ - b - e - s - u - - Other |:map-arguments| are not supported for - arpeggio key mappings. - - Note that the meaning of is a bit - differed as follows: - - - If a key in {lhs} is already mapped to - something other than a part of - |arpeggio-key-mapping|, an error will be - raised and defining of this mapping will be - aborted. - - - If {lhs} is already mapped to another - |arpeggio-key-mapping|, an error will be - raised and defining of this mapping will be - aborted. - - {remap-p} - Number as a boolean. True means that {rhs} - will be remapped, and false means that {rhs} - will not be remapped. - - {lhs} - String. This value must contain two or more - keys. Special keys such as must be - escaped with < and >, i.e., use '' not - "\". - - {rhs} - String. - -arpeggio#unmap({modes}, {options}, {lhs}) *arpeggio#unmap()* - Function version of |:Arpeggiounmap| and others. - See |arpeggio#map()| for the details of arguments. - - ------------------------------------------------------------------------------- -MAPPINGS *arpeggio-mappings* - -In the following description, {X} means a character in {lhs} which are used -for |:Arpeggiomap| and others. - -{X} - Mapped to internal stuffs. Don't map {X} to anything. - To customize the action for solely typed {X}, use - |(arpeggio-default:{X})| instead. - -(arpeggio-default:{X}) *(arpeggio-default:{X})* - Pseudo key sequence to customize the action whenever - {X} is typed solely. By default, this key sequence is - mapped to {X} with no remapping. - - ------------------------------------------------------------------------------- -VARIABLES *arpeggio-variables* - -g:arpeggio_timeoutlen number (default 40) *g:arpeggio_timeoutlen* - The time in milliseconds to determine whether typed - keys are simultaneously pressed or not. - -g:arpeggio_timeoutlens Dictionary (default {}) *g:arpeggio_timeoutlens* - Each key (in this dictionary) is a string of a key (on - a keyboard), and each value is a number which means - the same as |g:arpeggio_timeoutlen| but it is used - only for the corresponding key. - - - - -============================================================================== -BUGS *arpeggio-bugs* - -- Not all keyboards have N-key rollover (*). Though this plugin supports - unlimited number of simultaneously pressed keys, 3 or more keys may not be - inputted simultaneously. - - For keyboards which don't have N-key rollover, it's possible to emulate to - simultaneously press 3 or more keys by pressing each key after another key - in short time, i.e., arpeggio. - - (*) http://en.wikipedia.org/wiki/Rollover_(key) - -- |arpeggio-key-mapping| may not be worked or may be conflicted with |@| - and/or |key-mapping|. Because recorded key sequence doesn't have any - information about typing delay for each key. So some keys may be treated as - an arpeggio key mapping unexpectedly. - - - - -============================================================================== -CHANGELOG *arpeggio-changelog* - -0.0.6 2010-04-20T12:24:42+09:00 *arpeggio-changelog-0.0.6* - - Fix |arpeggio-commands| to behave the same as |:map| commands. In - other words, " and keys after " in {rhs} for |arpeggio-commands| are - treated as a part of {rhs}. Old versions don't behave so. - - Fix minor bugs. - - Revise the document a bit. - - Revise additional syntax highlighting a bit. - -0.0.5 2008-11-19T23:11:31+09:00 *arpeggio-changelog-0.0.5* - - Remove the assumption on 'timeout' and 'ttimeout'. Old version - assumes that "set timeout notimeout", but now their values can be - arbitrary. - - Fix the bug that 'ttimeoutlen' can be interpreted as an unexpected - value because of the adjustment of 'timeout' and 'timeoutlen' for - arpeggio key mappings. - -0.0.4 2008-11-10T02:38:07+09:00 *arpeggio-changelog-0.0.4* - - Add syntax highlighting for |arpeggio-commands|. - - Fix bugs of "noremap" version of |arpeggio-commands| such as - |:Arpeggionoremap| that {rhs} are remapped despite the meaning of - the commands. (Thanks for id:ampmmn) - -0.0.3 2008-11-09T10:37:46+09:00 *arpeggio-changelog-0.0.3* - - Add |:Arpeggio|. - - Support |:map-| for |arpeggio#map()| and other commands. - - In |arpeggio#map()| and other commands, warn if a key in {lhs} is - already mapped to something other than a part of another - |arpeggio-key-mapping|. - - Add custom 'timeoutlen' per key. See |g:arpeggio_timeoutlens|. - - Add a bit of completion for |arpeggio-commands|. - -0.0.2 2008-11-07T22:16:51+09:00 *arpeggio-changelog-0.0.2* - - Fix |:Arpeggionoremap| that allowed remapping but it should not do - so. (Thanks for id:ampmmn) - - Define |arpeggio-commands| and |arpeggio-variables| automatically - for interactive or other use. (But you still have to call - |arpeggio#load()| to use them in vimrc.) - -0.0.1 2008-11-06T09:34:19+09:00 *arpeggio-changelog-0.0.1* - - Implement |arpeggio-commands|. - - Add missing |arpeggio#list()|. - - Revise minor stuffs. - -0.0.0 2008-11-04T15:53:03+09:00 *arpeggio-changelog-0.0.0* - - Initial version. - - - - -============================================================================== -vim:tw=78:ts=8:ft=help:norl:fen:fdl=0:fdm=marker: diff -r dcd05a92e988 -r 87bb4c33955c vim/bundle/arpeggio/mduem/Makefile --- a/vim/bundle/arpeggio/mduem/Makefile Thu Aug 05 12:41:27 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,431 +0,0 @@ -# mduem - Little utility for little software development -# -# This is a library Makefile to maintain software development, especially for -# Vim script. Note that this Makefile requires GNU make to use. -# Coding Rules #{{{1 -# -# - Use non-empty string as true and empty string as false. -# -# -# Naming Rules: -# -# - Use UPPER_CASE variables to be configured by user. -# -# - Use lower_case variables for internal use of mduem. -# -# - Use suffix "_p" to indicate that a boolean value is resulted from -# a variable. -# Example: SHOULD_INSTALL_ASIS_P -# -# - Use noun for ordinary variables. -# Example: repos_name, TARGETS_GENERATED -# -# - Use verb for variables as functions. -# Example: resolve_dep_uri, RENAME_TARGET -# -# - Use prefix "generate_rule_" for variables to generate make rules. -# Example: generate_rule_to_install_a_target -# -# - Use abbreviations for words which names are too long to code. -# Example: dependency => dep, directory => dir, repository => repos -# -# - Use lower-case names for phony targets. -# -# - Use verb for phony targets. -# Example: clean, install, pack, ... -# -# - Use hyphens to join words in names of phony targets. -# Example: clean-junks, fetch-deps -# -# - Use prefix "," for names of files which are automatically generated by -# mduem and they are temporary ones. -# Example: test/,good-case.output -# -# - Use directory ".mduem" to contain stuffs for internal use. -# Example: .mduem/cache/ -# -# - All rules may be violated if there is a strong custom from old times. -# Example: all (phony target) - - - - - - - - -# Common #{{{1 - -all: # Ensure that this is the default target. - -SHELL := /bin/bash -this_makefile := $(lastword $(MAKEFILE_LIST)) -cache_makefile := .mduem/cache/Makefile.variables -user_makefiles := $(filter-out \ - $(this_makefile) $(cache_makefile), \ - $(MAKEFILE_LIST)) - -not = $(if $(1),,t) -toplevel_dir := $(shell git rev-parse --show-toplevel 2>/dev/null) -inner_dir := $(shell git rev-parse --show-prefix 2>/dev/null) -git_controlled_p := $(toplevel_dir) -toplevel_dir_p := $(and $(git_controlled_p),$(call not,$(inner_dir))) - -ifneq '$(git_controlled_p)' '' -$(cache_makefile): \ - $(toplevel_dir)/.git/config \ - $(toplevel_dir)/.git/index \ - $(this_makefile) - @echo 'GENERATE $@' - @mkdir -p '$(dir $@)' - @{ \ - current_branch="$$(git symbolic-ref -q HEAD \ - | sed -e 's|^refs/heads/||')"; \ - _origin_name="$$(git config "branch.$$current_branch.remote")"; \ - origin_name="$${_origin_name:-origin}"; \ - _origin_uri="$$(git config "remote.$$origin_name.url")"; \ - origin_uri="$${_origin_uri:-../.}"; \ - \ - echo "all_files_in_repos := \ - $(filter-out .gitmodules \ - $(shell cd $(toplevel_dir) && \ - git submodule foreach 'echo "$$path"'),\ - $(shell git ls-files))"; \ - echo "current_branch := $${current_branch}"; \ - echo "origin_name := $${origin_name}"; \ - echo "origin_uri := $${origin_uri}"; \ - echo 'repos_name := $(notdir $(shell pwd))'; \ - echo 'version := $(shell git describe --tags --always --dirty)'; \ - } >'$@' -endif -include $(cache_makefile) - - # The type of a repository. It must be one of the following values: - # - # generic For any software. - # vim-script For Vim plugins, etc. -REPOS_TYPE ?= $(if $(filter vim-%,$(repos_name)),vim-script,generic) -vim_script_repos_p := $(filter vim-script,$(REPOS_TYPE)) - - - - - - - - -# all #{{{1 - -.PHONY: all -all: build - - - - - - - - -# build #{{{1 - -TARGETS_ARCHIVED ?= $(all_files_in_repos) -TARGETS_GENERATED ?=# Empty -TARGETS_STATIC ?=# Empty - -targets_all_installed := $(TARGETS_GENERATED) $(TARGETS_STATIC) -targets_all_archived := $(sort \ - $(TARGETS_ARCHIVED) \ - $(targets_all_installed) \ - $(cache_makefile) \ - ) - - - - -.PHONY: build -build: $(targets_all_installed) - - - - - - - - -# clean #{{{1 - -.PHONY: clean -clean: clean-generated clean-junks - -.PHONY: clean-generated -clean-generated: - @echo 'CLEAN-GENERATED' - @rm -rf $(TARGETS_GENERATED) - @find -name '.mduem' | xargs rm -rf - -.PHONY: clean-junks -clean-junks: - @echo 'CLEAN-JUNKS' - @find -name '*~' -or -name ',*' | xargs rm -rf - - - - - - - - -# fetch-deps #{{{1 - -DEPS ?=# Empty -vim_script_deps := $(if $(vim_script_repos_p),vim-vspec vimup,) -all_deps := $(vim_script_deps) $(DEPS) - -DEP_vim_vspec_URI ?= ../vim-vspec -DEP_vim_vspec_VERSION ?= 0.0.3 - -DEP_vimup_URI ?= ../vimup -DEP_vimup_VERSION ?= 0.0.0a3 - - - # BUGS: This resolves "../" just once, but it's enough for usual cases. -resolve_dep_uri = $(strip $(if $(filter ../%,$(1)), \ - $(dir $(origin_uri))$(1:../%=%), \ - $(1))) -normalize_dep_name = $(subst -,_,$(1)) -get_dep_raw_uri = $(DEP_$(call normalize_dep_name,$(1))_URI) -get_dep_dir_name = $(patsubst %.git,%,$(notdir $(call get_dep_uri,$(1)))) - -get_dep_uri = $(call resolve_dep_uri,$(call get_dep_raw_uri,$(1))) -get_dep_version = $(DEP_$(call normalize_dep_name,$(1))_VERSION) -get_dep_dir = .mduem/deps/$(call get_dep_dir_name,$(1)) - - - - -.PHONY: fetch-deps -fetch-deps: $(all_deps:%=.mduem/deps/,%) - -# FIXME: Update for changes on only DEPS and other values. -.mduem/deps/,%: $(user_makefiles) - @echo 'FETCH-DEP $*' - @mkdir -p '$(dir $@)' - @ ( \ - if [ -d '$(call get_dep_dir,$*)' ] \ - ; then \ - cd './$(call get_dep_dir,$*)' \ - && git fetch \ - && git checkout -f mduem-master \ - ; else \ - git clone '$(call get_dep_uri,$*)' '$(call get_dep_dir,$*)'\ - && cd './$(call get_dep_dir,$*)' \ - && git checkout -b mduem-master \ - ; fi \ - && git reset --hard '$(call get_dep_version,$*)' \ - ; ) &>'$@.log' \ - || { cat '$@.log'; false; } - @touch '$@' - - - - - - - - -# install #{{{1 -# Core #{{{2 - -INSTALLATION_DIR ?= $(error Please set INSTALLATION_DIR) - -RENAME_TARGET ?= $(patsubst %,$(INSTALLATION_DIR)/%,$(1)) -SHOULD_INSTALL_ASIS_P ?=# All files are version-filtered by default. - - - - -.PHONY: install -install: build - - -define generate_rule_to_install_a_target # (build_target, install_target) -install: $(2) -$(2): $(1) - @echo 'INSTALL $(1)' - @mkdir -p '$(dir $(2))' -ifneq '$(call SHOULD_INSTALL_ASIS_P,$(1))' '' - @cp '$(1)' '$(2)' -else - @sed -e 's/0.0.6/$(version)/' '$(1)' >'$(2)' -endif - -endef -$(eval \ - $(foreach t, \ - $(targets_all_installed), \ - $(call generate_rule_to_install_a_target,$(t),$(call RENAME_TARGET,$(t))))) - - -# This should be placed at the last to ensure that post-install is executed -# after any other rules to install. -install: post-install - - - - -# post-install #{{{2 - -TARGETS_POST_INSTALL ?=# Empty -targets_post_install_builtin :=# Empty - - -ifneq '$(vim_script_repos_p)' '' -target_vim_helptags := $(call RENAME_TARGET,doc/tags) -$(target_vim_helptags): $(filter doc/%.txt,$(targets_all_installed)) - @echo 'POST-INSTALL vim helptags' - @vim -n -N -u NONE -U NONE -e -c 'helptags $(dir $@) | qall!' - -targets_post_install_builtin += $(target_vim_helptags) -endif - - -.PHONY: post-install -post-install: $(targets_post_install_builtin) $(TARGETS_POST_INSTALL) - - - - - - - - -# pack #{{{1 - -archive_basename = $(repos_name)-$(version) -archive_name = $(archive_basename).zip - - -.PHONY: pack -pack: $(archive_name) - -$(archive_name): $(cache_makefile) - rm -rf '$(archive_basename)' '$(archive_name)' - $(MAKE) \ - 'INSTALLATION_DIR=$(archive_basename)' \ - 'targets_all_installed=$(targets_all_archived)' \ - install - zip -r $(archive_name) $(archive_basename)/ - rm -rf '$(archive_basename)' - - - - - - - - -# release #{{{1 - -.PHONY: release -release: $(if $(vim_script_repos_p),release-vim-script,release-default) - - -.PHONY: release-default -release-default: - @echo 'Rules to release are not defined.' - - -.PHONY: release-vim-script -release-vim-script: fetch-deps $(repos_name).vimup pack - ./.mduem/deps/vimup/vimup update-script $(repos_name) - rm $(repos_name).vimup - -.PHONY: release-new-vim-script -release-new-vim-script: fetch-deps $(repos_name).vimup pack - ./.mduem/deps/vimup/vimup new-script $(repos_name) - rm $(repos_name).vimup - -$(repos_name).vimup: $(firstword $(sort $(filter doc/%.txt, \ - $(all_files_in_repos)))) - ./.mduem/deps/vimup/vimup-info-generator \ - <$< \ - >$(repos_name).vimup - - - - - - - - -# test #{{{1 - -test_cases := $(patsubst test/%.expected,%, \ - $(filter test/%.expected,$(all_files_in_repos))) - - -default_test_rule_deps := $(MAKEFILE_LIST) -define default_test_rule - source './$<' &>'$@' || { cat '$@'; false; } -endef - -ifneq '$(vim_script_repos_p)' '' -all_vim_scripts := $(filter %.vim,$(all_files_in_repos)) -vim_script_test_rule_deps := .mduem/deps/vim-vspec/bin/vspec $(all_vim_scripts) -define vim_script_test_rule - ./$(call get_dep_dir,vim-vspec)/bin/vspec \ - $< \ - "$$PWD" \ - $(foreach d,$(all_deps),$(call get_dep_dir,$(d))) \ - &>$@ -endef -endif - -TEST_RULE ?= $(if $(vim_script_repos_p), \ - $(vim_script_test_rule), \ - $(default_test_rule)) -TEST_RULE_DEPS ?=# Empty - -builtin_test_rule_deps := $(if $(vim_script_repos_p), \ - $(vim_script_test_rule_deps), \ - $(default_test_rule_deps)) -all_test_rule_deps := $(builtin_test_rule_deps) $(TEST_RULE_DEPS) - - - - -.PHONY: test -test: fetch-deps test/,ok - -test/,ok: $(test_cases:%=test/,%.ok) - @echo 'ALL TESTS ARE PASSED.' - @touch $@ - -test/,%.ok: test/%.input $(all_test_rule_deps) - @echo -n 'TEST $* ... ' - @$(MAKE) --silent '$(@:.ok=.diff)' - @if ! [ -s $(@:.ok=.diff) ]; then \ - echo 'OK'; \ - else \ - echo 'FAILED'; \ - cat $(@:.ok=.diff); \ - echo 'END'; \ - false; \ - fi - @touch $@ - -test/,%.diff: test/%.expected test/,%.output - @diff -u $^ >$@; true - -test/,%.output: test/%.input $(all_test_rule_deps) - @$(TEST_RULE) - - - - - - - - -# __END__ #{{{1 -# vim: foldmethod=marker diff -r dcd05a92e988 -r 87bb4c33955c vim/bundle/arpeggio/plugin/arpeggio.vim --- a/vim/bundle/arpeggio/plugin/arpeggio.vim Thu Aug 05 12:41:27 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -" arpeggio - Mappings for simultaneously pressed keys -" Version: 0.0.6 -" Copyright (C) 2008-2010 kana -" License: So-called MIT/X license {{{ -" Permission is hereby granted, free of charge, to any person obtaining -" a copy of this software and associated documentation files (the -" "Software"), to deal in the Software without restriction, including -" without limitation the rights to use, copy, modify, merge, publish, -" distribute, sublicense, and/or sell copies of the Software, and to -" permit persons to whom the Software is furnished to do so, subject to -" the following conditions: -" -" The above copyright notice and this permission notice shall be included -" in all copies or substantial portions of the Software. -" -" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -" }}} - -if exists('g:loaded_arpeggio') - finish -endif - - - - -if !exists('g:arpeggio_timeoutlen') - let g:arpeggio_timeoutlen = 40 -endif -if !exists('g:arpeggio_timeoutlens') - let g:arpeggio_timeoutlens = {} -endif - - - - -command! -complete=command -nargs=+ Arpeggio call arpeggio#_do() - - -function! s:_(...) - execute call('printf', - \ ['command! %s -complete=mapping -nargs=* Arpeggio%s' - \ . ' call arpeggio#_map_or_list(%s, %s, )'] - \ + a:000) -endfunction - -call s:_('-bang', 'map', "(0 ? 'ic' : 'nvo')", 1) -call s:_('', 'cmap', '"c"', 1) -call s:_('', 'imap', '"i"', 1) -call s:_('', 'lmap', '"l"', 1) -call s:_('', 'nmap', '"n"', 1) -call s:_('', 'omap', '"o"', 1) -call s:_('', 'smap', '"s"', 1) -call s:_('', 'vmap', '"v"', 1) -call s:_('', 'xmap', '"x"', 1) - -call s:_('-bang', 'noremap', "(0 ? 'ic' : 'nvo')", 0) -call s:_('', 'cnoremap', '"c"', 0) -call s:_('', 'inoremap', '"i"', 0) -call s:_('', 'lnoremap', '"l"', 0) -call s:_('', 'nnoremap', '"n"', 0) -call s:_('', 'onoremap', '"o"', 0) -call s:_('', 'snoremap', '"s"', 0) -call s:_('', 'vnoremap', '"v"', 0) -call s:_('', 'xnoremap', '"x"', 0) - - -function! s:_(...) - execute call('printf', - \ ['command! %s -complete=mapping -nargs=* Arpeggio%s' - \ . ' call arpeggio#_unmap(%s, )'] - \ + a:000) -endfunction - -call s:_('-bang', 'unmap', "(0 ? 'ic' : 'nvo')") -call s:_('', 'cunmap', '"c"') -call s:_('', 'iunmap', '"i"') -call s:_('', 'lunmap', '"l"') -call s:_('', 'nunmap', '"n"') -call s:_('', 'ounmap', '"o"') -call s:_('', 'sunmap', '"s"') -call s:_('', 'vunmap', '"v"') -call s:_('', 'xunmap', '"x"') - - - - -let g:loaded_arpeggio = 1 - -" __END__ -" vim: foldmethod=marker diff -r dcd05a92e988 -r 87bb4c33955c vim/bundle/arpeggio/test/ui.expected --- a/vim/bundle/arpeggio/test/ui.expected Thu Aug 05 12:41:27 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -==== Arpeggio ----- It should define key mappings properly. -........... - - - -**** Result **** - - -11 examples, 0 failures diff -r dcd05a92e988 -r 87bb4c33955c vim/bundle/arpeggio/test/ui.input --- a/vim/bundle/arpeggio/test/ui.input Thu Aug 05 12:41:27 2010 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -runtime! plugin/arpeggio.vim - -function! CheckMapModes(lhs) - let _ = ['n', 'x', 's', 'o', 'i', 'c', 'l'] - call map(_, 'maparg(' . string(a:lhs) . ', v:val)') - call map(_, 'v:val != ""') - return _ -endfunction - -function s:describe__Arpeggio() "{{{1 - " Set up. - - tabnew - - It should define key mappings properly. - - silent! execute 'Arpeggio inoremap lhs1 rhs1"rhs2' - silent! execute 'Arpeggio inoremap lhs2 rhs1rhs2' - silent! execute 'Arpeggio inoremap lhs3 rhs1|rhs2' - Should CheckMapModes('o') ==# [0, 0, 0, 0, 0, 0, 0] - Should CheckMapModes('l') ==# [0, 0, 0, 0, 1, 0, 0] - Should CheckMapModes('h') ==# [0, 0, 0, 0, 1, 0, 0] - Should CheckMapModes('s') ==# [0, 0, 0, 0, 1, 0, 0] - Should CheckMapModes('1') ==# [0, 0, 0, 0, 1, 0, 0] - Should CheckMapModes('2') ==# [0, 0, 0, 0, 1, 0, 0] - Should CheckMapModes('3') ==# [0, 0, 0, 0, 1, 0, 0] - - normal olhs0 - Should getline('.') ==# 'lhs0' - normal olhs1 - Should getline('.') ==# 'rhs1"rhs2' - normal olhs2 - Should getline('.') ==# 'rhs1|rhs2' - normal olhs3 - Should getline('.') ==# 'rhs1' - - " Tear down. - - tabclose! -endfunction - - - - -" __END__ "{{{1 -" vim: filetype=vim foldmethod=marker