" Vimball Archiver by Charles E. Campbell, Jr., Ph.D. UseVimball finish doc/tinykeymap.txt [[[1 219 *tinykeymap.txt* Tiny, temporary keymaps Author: Tom Link, micathom at gmail com This plugin is a 90% clone of Andy Wokula's tinymode (vimscript #2223). It takes a different approach that hopefully avoids certain problems without creating new ones. tinymode actually creates maps to do its job, tinykeymap only creates maps for the entry sequence and uses the |getchar()| function to handle further input. This plugin lets users define "temporary keymaps", a.k.a. tinykeymaps, with the |tinykeymap#EnterMap()| function. Users can define a map to activate a tinykeymap. Users can then use single key shortcuts to trigger commands defined with |tinykeymap#Map()|. Pressing an undefined key or , deactivates the tinykeymap. Example usage: Define a tinykeymap to make it easier to ... - operate on windows - operate on tabs - operate on text Example definition for a "tabs" tinykeymap (heavily based on Andy Wokula's tabs mode for tinymode): > call tinykeymap#EnterMap('tabs', 'gt', {'name': 'Tabs mode'}) call tinykeymap#Map('tabs', 'n', 'tabnew') call tinykeymap#Map('tabs', 't', 'norm! gt') call tinykeymap#Map('tabs', 'T', 'norm! gT') call tinykeymap#Map("tabs", "^", "tabfirst") call tinykeymap#Map("tabs", "$", "tablast") call tinykeymap#Map("tabs", "c", "tabclose") Example use of the above tinykeymap: E.g. pressing gt3n^c2t will: gt ... Enter tabs mode 3n ... create 3 new tabs, ^ ... select the first one, c ... close it, and 2t ... move to the second tab on the right. A tinykeymap is exited (1) by pressing or (2) by timeout (see |g:tinykeymap#timeout|). tinykeymap comes with the following pre-defined tinykeymaps: tabs gt :: Operate on tabs windows :: Operate on windows buffers b :: Operate on buffers undo u :: Operate on the |undo| tree Differences to tinymode: - tinykeymaps and maps may have options (optional) - tinykeymaps can be buffer-local - dealing with [count] is easier (if a map contains "", this placeholder is replaced with the current [count], i.e. a previously entered number; otherwise the expression is evaluated [count] times) - avoid a certain misleading error message ----------------------------------------------------------------------- Install~ In order to install the vba, open the vba file in VIM and type: > :so % See :help vimball for details. By default, tinykeymap will load all tinykeymaps in your 'runtimepath'. If this is not what you want, set |g:tinykeymaps_default| in your |vimrc| file. Also available via git: http://github.com/tomtom/tinykeymap_vim/ ======================================================================== Contents~ g:tinykeymaps_default ............. |g:tinykeymaps_default| g:tinykeymap#conflict ............. |g:tinykeymap#conflict| g:tinykeymap#timeout .............. |g:tinykeymap#timeout| g:tinykeymap#resolution ........... |g:tinykeymap#resolution| tinykeymap#Load ................... |tinykeymap#Load()| tinykeymap#EnterMap ............... |tinykeymap#EnterMap()| tinykeymap#Map .................... |tinykeymap#Map()| tinykeymap#PressEnter ............. |tinykeymap#PressEnter()| g:tinykeymap#buffers#map .......... |g:tinykeymap#buffers#map| g:tinykeymap#windows#map .......... |g:tinykeymap#windows#map| g:tinykeymap#undo#map ............. |g:tinykeymap#undo#map| g:tinykeymap#tabs#map ............. |g:tinykeymap#tabs#map| ======================================================================== plugin/tinykeymap.vim~ *g:tinykeymaps_default* g:tinykeymaps_default (default: ["*"]) A list tinykeymaps that should be loaded on startup. The list may also include |wildcards|. A value of "*" make tinykeymap load all available tinykeymaps. See also |tinykeymap#Load()|. ======================================================================== autoload/tinykeymap.vim~ *g:tinykeymap#conflict* g:tinykeymap#conflict (default: 0) Conflict resolution if a map is already defined (see |tinykeymap#EnterMap|): 0 ... Don't create a lead map 1 ... Don't create a lead map and display a message 2 ... Create a new lead map and display a message 3 ... Create a new lead map 4 ... Throw an error *g:tinykeymap#timeout* g:tinykeymap#timeout (default: 5000) *g:tinykeymap#resolution* g:tinykeymap#resolution (default: "200m") *tinykeymap#Load()* tinykeymap#Load(maps) Load pre-defined tinykeymaps. [maps] is either a single name or a list of names. Run > :echo globpath(&rtp, 'autoload/tinykeymap/*.vim') < for a list of available tinykeymaps. *tinykeymap#EnterMap()* tinykeymap#EnterMap(name, map, ?options={}) If you press [map], the tinykeymap [name] becomes effective. Pressing or an undefined key, causes the tinykeymap to stop. If an undefined keymap is pressed right after [map], [map][key] is queued for processing via |feedkeys()|. Options may contain the following keys: mode ... A map mode (see |maparg()|) buffer ... Make the tinykeymap buffer-local message ... An expression that returns a message string (the string will be shortened if necessary start ... An expression |:execute|d before entering the map stop ... An expression |:execute|d after leaving the map after ... An execute |:execute|d after processing a character CAUTION: Currently only normal mode maps (mode == "n") are supported. It is possible to define other type of maps but the behaviour is untested/undefined. *tinykeymap#Map()* tinykeymap#Map(name, key, expr, ?options={}) When the tinykeymap [name] is in effect, pressing [key] causes [expr] to be |:execute|d. [key] must not be , or . If [key] is a numeric value, such a map could cause conflicts when using a [count]. The following keys are handled by tinykeymaps and can/should not be used in maps since they may cause conflicts. Numeric value ... Add to [count] ... Exit a tinykeymap ... Remove the last digit from [count] ... Display some help Any occurence of "" in [expr] is replaced with the current [count]. Occurences of "" are replaced with "<". "" works similar but a value of 1 is inserted anyway. Options may contain the following keys: name ... The key's name (to be displayed in the help) exit ... If true, exit the current tinykeymap after evaluating [expr] *tinykeymap#PressEnter()* tinykeymap#PressEnter() ======================================================================== autoload/tinykeymap/buffers.vim~ *g:tinykeymap#buffers#map* g:tinykeymap#buffers#map (default: g:mapleader ."b") Map leader for the "buffers" tinykeymap. ======================================================================== autoload/tinykeymap/windows.vim~ *g:tinykeymap#windows#map* g:tinykeymap#windows#map (default: "") Map leader for the "windows" tinykeymap. ======================================================================== autoload/tinykeymap/undo.vim~ *g:tinykeymap#undo#map* g:tinykeymap#undo#map (default: g:mapleader ."u") Map leader for the "undo" tinykeymap. If the undotree plugin is available, |:UndotreeToggle| will be called when entering the undo tinykeymap. ======================================================================== autoload/tinykeymap/tabs.vim~ *g:tinykeymap#tabs#map* g:tinykeymap#tabs#map (default: "gt") Map leader for the "tabs" tinykeymap. vim:tw=78:fo=tcq2:isk=!-~,^*,^|,^":ts=8:ft=help:norl: plugin/tinykeymap.vim [[[1 40 " @Author: Tom Link (micathom AT gmail com?subject=[vim]) " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @GIT: http://github.com/tomtom/ " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2012-08-28. " @Last Change: 2012-08-30. " @Revision: 18 " GetLatestVimScripts: 0 0 :AutoInstall: tinykeymap.vim if &cp || exists("loaded_tinykeymap") finish endif let loaded_tinykeymap = 1 let s:save_cpo = &cpo set cpo&vim if !exists('g:tinykeymaps_default') " A list tinykeymaps that should be loaded on startup. " The list may also include |wildcards|. A value of "*" make " tinykeymap load all available tinykeymaps. " See also |tinykeymap#Load()|. let g:tinykeymaps_default = ["*"] "{{{2 endif augroup TinyKeyMap autocmd! if !empty(g:tinykeymaps_default) if has('vim_starting') autocmd VimEnter * call tinykeymap#Load(g:tinykeymaps_default) else call tinykeymap#Load(g:tinykeymaps_default) endif endif augroup END let &cpo = s:save_cpo unlet s:save_cpo autoload/tinykeymap.vim [[[1 399 " tinykeymap.vim " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2012-08-27. " @Last Change: 2012-08-31. " @Revision: 338 if !exists('g:tinykeymap#conflict') " Conflict resolution if a map is already defined (see " |tinykeymap#EnterMap|): " 0 ... Don't create a lead map " 1 ... Don't create a lead map and display a message " 2 ... Create a new lead map and display a message " 3 ... Create a new lead map " 4 ... Throw an error let g:tinykeymap#conflict = 0 "{{{2 endif if !exists('g:tinykeymap#timeout') let g:tinykeymap#timeout = 5000 "{{{2 endif if !exists('g:tinykeymap#resolution') let g:tinykeymap#resolution = "200m" "{{{2 endif let s:tinykeymaps = {} let s:oid = "\options" " Load pre-defined tinykeymaps. " [maps] is either a single name or a list of names. " " Run > " :echo globpath(&rtp, 'autoload/tinykeymap/*.vim') " for a list of available tinykeymaps. function! tinykeymap#Load(maps) "{{{3 if type(a:maps) == 3 let maps = a:maps else let maps = [a:maps] endif for map in maps " TLogVAR map for file in split(globpath(&rtp, 'autoload/tinykeymap/'. map .'.vim'), '\n') " TLogVAR file exec 'source' file endfor endfor endf " :display: tinykeymap#EnterMap(name, map, ?options={}) " If you press [map], the tinykeymap [name] becomes effective. " " Pressing or an undefined key, causes the tinykeymap to stop. If " an undefined keymap is pressed right after [map], [map][key] is queued " for processing via |feedkeys()|. " " Options may contain the following keys: " mode ... A map mode (see |maparg()|) " buffer ... Make the tinykeymap buffer-local " message ... An expression that returns a message string (the string " will be shortened if necessary " start ... An expression |:execute|d before entering the map " stop ... An expression |:execute|d after leaving the map " after ... An execute |:execute|d after processing a character " " CAUTION: Currently only normal mode maps (mode == "n") are supported. " It is possible to define other type of maps but the behaviour is " untested/undefined. function! tinykeymap#EnterMap(name, map, ...) "{{{3 let options = a:0 >= 1 ? a:1 : {} let mode = get(options, 'mode', 'n') if !empty(maparg(a:map, mode)) let warning_msg = "tinykeymap: Map already defined: ". a:name ." ". a:map if g:tinykeymap#conflict == 1 || g:tinykeymap#conflict == 2 echohl WarningMsg echom warningmsg echohl NONE endif if g:tinykeymap#conflict <= 1 return elseif g:tinykeymap#conflict == 4 throw warning_msg endif endif let buffer_local = get(options, 'buffer', 0) ? '' : '' let cmd = mode . "map" let rhs = s:RHS(mode, ':call EnterMap('. string(a:name) .')') exec cmd buffer_local a:map rhs if empty(buffer_local) let dict = s:tinykeymaps else if !exists('b:tinykeymaps') let b:tinykeymaps = {} endif let dict = b:tinykeymaps endif let options.map = a:map if !has_key(options, 'name') let options.name = a:name endif let dict[a:name] = {s:oid : copy(options)} endf " :display: tinykeymap#Map(name, key, expr, ?options={}) " When the tinykeymap [name] is in effect, pressing [key] causes [expr] " to be |:execute|d. " " [key] must not be , or . If [key] is a numeric value, " such a map could cause conflicts when using a [count]. " " The following keys are handled by tinykeymaps and can/should not be " used in maps since they may cause conflicts. " " Numeric value ... Add to [count] " ... Exit a tinykeymap " ... Remove the last digit from [count] " ... Display some help " " Any occurence of "" in [expr] is replaced with the current " [count]. Occurences of "" are replaced with "<". " "" works similar but a value of 1 is inserted anyway. " " Options may contain the following keys: " name ... The key's name (to be displayed in the help) " exit ... If true, exit the current tinykeymap after evaluating " [expr] function! tinykeymap#Map(name, key, expr, ...) "{{{3 let dict = s:GetDict(a:name) let def = {'expr': a:expr, 'options': a:0 >= 1 ? a:1 : {}} if !has_key(def.options, 'name') let def.options.name = a:key endif let keycode = s:Keycode(a:key) let dict[keycode] = def endf function! s:Keycode(key) "{{{3 let keycode = escape(a:key, '\') let keycode = substitute(keycode, '<', '\\<', 'g') let keycode = eval('"'. keycode .'"') return keycode endf function! s:GetDict(name) "{{{3 if exists('b:tinykeymaps') && has_key(b:tinykeymaps, a:name) return b:tinykeymaps[a:name] elseif has_key(s:tinykeymaps, a:name) return s:tinykeymaps[a:name] else throw "tinykeymaps: Unknown map: ". a:name endif endf function! s:RHS(mode, map) "{{{3 if a:mode ==# 'n' let pre = '' let post = '' elseif a:mode ==# 'i' let pre = '' let post = '' elseif a:mode ==# 'v' || a:mode ==# 'x' let pre = '' let post = '' elseif a:mode ==# 'c' let pre = '' let post = '' elseif a:mode ==# 'o' let pre = '' let post = '' endif return pre . a:map . post endf function! s:EnterMap(name) "{{{3 let rv = '' let dict = s:GetDict(a:name) let msg = get(dict[s:oid], 'name', a:name) let maxlen = float2nr(&columns * 0.8) " let maxlen = float2nr((&columns * &cmdheight) * 0.8) " let keys = keys(dict) " let keys = filter(keys, 'v:val[0:0] != "\"') " let keys = map(keys, 'get(dict[v:val].options, "name", v:val)') " let keys = sort(keys) " call add(keys, '') " call add(keys, '') " let message = printf("tinykeymap: %s (keys: %s)", msg, join(keys, '/')) " if strlen(message) > float2nr(&columns * 0.8) let message0 = "-- tinykeymap ". msg ." (help )%s --" " endif let messenger = get(dict[s:oid], 'message', '') if empty(messenger) let laststatus = -1 let statusline = "" else let laststatus = &laststatus set laststatus=2 let statusline = &statusline endif let pos = getpos('.') let first_run = 1 let time = 0 let s:count = '' let ruler = &ruler let showcmd = &showcmd echo let before = get(dict[s:oid], 'before', '') let after = get(dict[s:oid], 'after', '') let start = get(dict[s:oid], 'start', '') if !empty(start) exec start endif try while time < g:tinykeymap#timeout let key = getchar(0) " TLogVAR key if type(key) == 0 && key == 0 if empty(s:count) let message = printf(message0, '') else let message = printf(message0, ' '. s:count) endif if !empty(messenger) let mapmsg = eval(messenger) " if !empty(mapmsg) " let message .= ' '. mapmsg " endif if strlen(mapmsg) >= &columns let mapmsg = mapmsg[0 : &columns - 4] . '...' endif let &statusline = mapmsg endif if strlen(message) > maxlen let message = message[0 : maxlen - 4] . '...' endif redraw echohl ModeMsg echo message echohl NONE exec 'sleep' g:tinykeymap#resolution let time += g:tinykeymap#resolution elseif type(key) == 0 && key == 27 break elseif type(key) == 1 && key == "\" call s:Help(dict) elseif type(key) == 1 && key == "\" if !empty(s:count) let s:count = s:count[0 : -2] endif else let status = s:ProcessKey(a:name, key, before) " TLogVAR status if status > 0 let time = 0 let first_run = 0 if !empty(after) exec after endif elseif status < 0 let char = s:KeyChar(key) if first_run if time > &timeoutlen let fkeys = char let mode = 'm' else let map = dict[s:oid].map let keycode = s:Keycode(map) let fkeys = keycode . char let mode = 'n' endif else let fkeys = char let mode = 'm' endif " TLogVAR time, first_run, fkeys, mode call feedkeys(fkeys, mode) break else break endif endif endwh " echo "tinykeymaps: Leave ". msg echo "" redraw finally let stop = get(dict[s:oid], 'stop', '') if !empty(stop) exec stop endif let &ruler = ruler let &showcmd = showcmd if laststatus >= 0 let &laststatus = laststatus let &statusline = statusline endif endtry return rv endf function! s:Help(dict) "{{{3 " TLogVAR a:dict echo "tinykeymap: Help for ". a:dict[s:oid].name for [key, def] in sort(items(a:dict)) if key !~ "^\" let key = get(def.options, 'name', key) let msg = get(def.options, 'desc', def.expr) if has_key(def.options, 'exit') let msg .= ' -> EXIT' endif echo printf(' %s: %s', key, msg) endif endfor call tinykeymap#PressEnter() redraw endf function! tinykeymap#PressEnter() "{{{3 echohl MoreMsg try call input("--- Press ENTER to continue ---") finally echohl NONE endtry endf function! s:ProcessKey(name, key, before) "{{{3 " TLogVAR a:name, a:key let cont = 1 let key = s:KeyChar(a:key) " TLogVAR a:key, key let dict = s:GetDict(a:name) " TLogVAR dict " TLogVAR key if has_key(dict, key) let def = get(dict, key, '') if get(def.options, 'exit', 0) let cont = 0 endif let expr = def.expr " TLogVAR def, expr let iterations = 1 " echom "DBG ProcessKey 2: s:count" s:count if expr =~ '\V' let expr = substitute(expr, '\V', s:count, 'g') elseif expr =~ '\V' let count1 = s:count == 0 ? 1 : s:count let expr = substitute(expr, '\V', count1, 'g') elseif !empty(s:count) let iterations = str2nr(s:count) endif if iterations == 0 let iterations = 1 endif let s:count = '' let expr = substitute(expr, '\V', '<', 'g') " TLogVAR iterations, expr if !empty(expr) if !empty(a:before) exec a:before endif for i in range(iterations) exec expr endfor endif elseif type(a:key) == 0 && a:key >= 48 && a:key < 58 if a:key > 48 || !empty(s:count) let s:count .= key endif " echom "DBG ProcessKey 1: s:count" s:count else let cont = -1 endif return cont endf function! s:KeyChar(key) "{{{3 if type(a:key) == 1 return a:key else return nr2char(a:key) endif endf autoload/tinykeymap/buffers.vim [[[1 102 " buffers.vim " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2012-08-28. " @Last Change: 2012-08-31. " @Revision: 102 if !exists('g:tinykeymap#buffers#map') " Map leader for the "buffers" tinykeymap. let g:tinykeymap#buffers#map = g:mapleader ."b" "{{{2 endif call tinykeymap#EnterMap("buffers", g:tinykeymap#buffers#map, { \ 'message': 'tinykeymap#buffers#List(g:tinykeymap#buffers#idx)', \ 'start': 'let g:tinykeymap#buffers#idx = 1 | let g:tinykeymap#buffers#filter = ""', \ }) call tinykeymap#Map('buffers', '', 'call tinykeymap#buffers#Buffer()', {'exit': 1}) call tinykeymap#Map('buffers', 'd', 'drop ', {'exit': 1}) call tinykeymap#Map('buffers', 'b', 'buffer ') call tinykeymap#Map('buffers', 's', 'sbuffer ') call tinykeymap#Map('buffers', 'v', 'vert sbuffer ') call tinykeymap#Map('buffers', 'n', 'bnext ') call tinykeymap#Map('buffers', 'p', 'bprevious ') call tinykeymap#Map('buffers', '', 'bnext ') call tinykeymap#Map('buffers', '', 'bprevious ') call tinykeymap#Map('buffers', '', 'bfirst') call tinykeymap#Map('buffers', '', 'blast') call tinykeymap#Map('buffers', '', 'ls! | call tinykeymap#PressEnter()') call tinykeymap#Map('buffers', 'D', 'bdelete ') call tinykeymap#Map('buffers', '', 'call tinykeymap#buffers#Shift(-)', \ {'desc': 'Rotate list to the right'}) call tinykeymap#Map('buffers', '', 'call tinykeymap#buffers#Shift()', \ {'desc': 'Rotate list to the left'}) call tinykeymap#Map('buffers', '/', 'let g:tinykeymap#buffers#filter = input("Filter regexp: ")', \ {'desc': 'Prioritize buffers matching a regexp'}) " :nodoc: function! tinykeymap#buffers#Buffer(...) "{{{3 if a:0 >= 1 let nr = a:1 else let buflist = s:List(g:tinykeymap#buffers#idx, 1, g:tinykeymap#buffers#filter) let nr = matchstr(get(buflist, 0, ''), '^\d\+') endif if !empty(nr) exec 'buffer' nr endif endf " :nodoc: function! tinykeymap#buffers#Shift(n) "{{{3 let buflist = s:List(1, 0, "") let max = len(buflist) " TLogVAR g:tinykeymap#buffers#idx, a:n, max, buflist let g:tinykeymap#buffers#idx = (g:tinykeymap#buffers#idx + a:n) % max if g:tinykeymap#buffers#idx <= 0 let g:tinykeymap#buffers#idx = max + g:tinykeymap#buffers#idx endif " TLogVAR g:tinykeymap#buffers#idx endf function! s:List(start_idx, rotate, filter) "{{{3 let buffers = [] let cur_idx = -1 for i in range(1, bufnr('$')) if buflisted(i) && bufloaded(i) " let bufname = fnamemodify(bufname(i), ':t') let bufname = bufname(i) let desc = printf('%s %s', i, pathshorten(bufname)) if i == bufnr('%') let cur_idx = len(buffers) endif call add(buffers, desc) endif endfor if len(buffers) > 1 if cur_idx > 0 let buffers = buffers[cur_idx : -1] + buffers[0 : cur_idx - 1] endif if !empty(a:filter) let buffers = filter(copy(buffers), 'v:val =~ a:filter') + \ filter(copy(buffers), 'v:val !~ a:filter') endif if a:start_idx > 1 let start_idx = a:start_idx - 1 let buffers = buffers[start_idx : -1] + buffers[0 : start_idx - 1] endif endif " TLogVAR a:start_idx, buffers return buffers endf " :nodoc: function! tinykeymap#buffers#List(start_idx) "{{{3 return "buffers: ". join(s:List(a:start_idx, 1, g:tinykeymap#buffers#filter), ', ') endf autoload/tinykeymap/tabs.vim [[[1 26 " tabs.vim " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2012-08-28. " @Last Change: 2012-08-31. " @Revision: 9 if !exists('g:tinykeymap#tabs#map') " Map leader for the "tabs" tinykeymap. let g:tinykeymap#tabs#map = "gt" "{{{2 endif " Based on Andy Wokulas's tabs mode for tinymode. call tinykeymap#EnterMap('tabs', g:tinykeymap#tabs#map, {'name': 'tabs mode'}) call tinykeymap#Map('tabs', 'n', 'tabnew') call tinykeymap#Map('tabs', 't', 'norm! gt') call tinykeymap#Map('tabs', 'T', 'norm! gT') call tinykeymap#Map('tabs', "", 'norm! gt') call tinykeymap#Map('tabs', "", 'norm! gT') call tinykeymap#Map("tabs", "^", "tabfirst") call tinykeymap#Map("tabs", "$", "tablast") call tinykeymap#Map("tabs", "", "tabfirst") call tinykeymap#Map("tabs", "", "tablast") call tinykeymap#Map("tabs", "c", "tabclose") autoload/tinykeymap/undo.vim [[[1 54 " undo.vim " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) " @Website: <+WWW+> " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2012-08-30. " @Last Change: 2012-08-31. " @Revision: 38 if !exists('g:tinykeymap#undo#map') " Map leader for the "undo" tinykeymap. " If the undotree plugin is available, |:UndotreeToggle| will be " called when entering the undo tinykeymap. let g:tinykeymap#undo#map = g:mapleader ."u" "{{{2 endif if !exists('tinykeymap#undo#options') let tinykeymap#undo#options = { \ 'name': 'undo mode', \ 'message': 'printf("cur: %s, time: %s", undotree().seq_cur, strftime("%c", undotree().time_cur))' \ } if exists(':UndotreeToggle') let tinykeymap#undo#options.start = 'if bufwinnr("undotree_") == -1 | UndotreeToggle | endif' let tinykeymap#undo#options.stop = 'if bufwinnr("undotree_") != -1 | UndotreeToggle | endif' let tinykeymap#undo#options.after = 'doautocmd CursorMoved' endif endif call tinykeymap#EnterMap("undo", g:tinykeymap#undo#map, tinykeymap#undo#options) call tinykeymap#Map('undo', 'u', 'undo') call tinykeymap#Map('undo', '', 'undo') call tinykeymap#Map('undo', 'U', 'norm! U') call tinykeymap#Map('undo', 'r', 'redo') call tinykeymap#Map('undo', '', 'redo') call tinykeymap#Map('undo', '', 'undolist | call tinykeymap#PressEnter()') call tinykeymap#Map('undo', '+', 'norm! g+') call tinykeymap#Map('undo', '', 'norm! g+') call tinykeymap#Map('undo', '-', 'norm! g-') call tinykeymap#Map('undo', '', 'norm! g-') call tinykeymap#Map('undo', 'e', 'earlier ') call tinykeymap#Map('undo', 's', 'earlier s') call tinykeymap#Map('undo', 'm', 'earlier m') call tinykeymap#Map('undo', 'h', 'earlier h') call tinykeymap#Map('undo', 'd', 'earlier d') call tinykeymap#Map('undo', 'f', 'earlier f') call tinykeymap#Map('undo', 'l', 'later ') call tinykeymap#Map('undo', 'S', 'later s') call tinykeymap#Map('undo', 'M', 'later m') call tinykeymap#Map('undo', 'H', 'later h') call tinykeymap#Map('undo', 'D', 'later d') call tinykeymap#Map('undo', 'F', 'later f') autoload/tinykeymap/windows.vim [[[1 50 " windows.vim " @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2012-08-28. " @Last Change: 2012-08-31. " @Revision: 40 if !exists('g:tinykeymap#windows#map') " Map leader for the "windows" tinykeymap. let g:tinykeymap#windows#map = "" "{{{2 endif " Based on Andy Wokulas's windows mode for tinymode. call tinykeymap#EnterMap("windows", g:tinykeymap#windows#map, { \ 'name': 'windows mode', \ 'message': 'winnr() .": ". bufname("%")' \ }) call tinykeymap#Map('windows', '>', 'wincmd >', {'desc': 'Increase width'}) call tinykeymap#Map('windows', '<', 'wincmd <', {'desc': 'Decrease width'}) call tinykeymap#Map('windows', '|', 'vertical resize ', {'desc': 'Set width'}) call tinykeymap#Map('windows', '+', 'resize +', {'desc': 'Increase height'}) call tinykeymap#Map('windows', '-', 'resize -', {'desc': 'Decrease height'}) call tinykeymap#Map('windows', '_', 'resize ', {'desc': 'Set height'}) call tinykeymap#Map('windows', '=', 'wincmd =', {'desc': 'Make equally high and wide'}) call tinykeymap#Map('windows', 'r', 'wincmd r', {'desc': 'Rotate window downwards/rightwards'}) call tinykeymap#Map('windows', 'R', 'wincmd R', {'desc': 'Rotate window upwards/leftwards'}) call tinykeymap#Map('windows', 'x', 'wincmd x', {'desc': 'Exchange windows'}) call tinykeymap#Map('windows', 'K', 'wincmd K', {'desc': 'Move current window to the top'}) call tinykeymap#Map('windows', 'J', 'wincmd J', {'desc': 'Move current window to the bottom'}) call tinykeymap#Map('windows', 'H', 'wincmd H', {'desc': 'Move current window to the left'}) call tinykeymap#Map('windows', 'L', 'wincmd L', {'desc': 'Move current window to the right'}) call tinykeymap#Map('windows', 'T', 'wincmd T', {'desc': 'Move current window to a new tab page'}) call tinykeymap#Map('windows', 'w', 'wincmd w', {'desc': 'Below-right window'}) call tinykeymap#Map('windows', 'W', 'wincmd W', {'desc': 'Above-left window'}) call tinykeymap#Map('windows', 'h', 'wincmd h', {'desc': 'Window above'}) call tinykeymap#Map('windows', 'j', 'wincmd j', {'desc': 'Window below'}) call tinykeymap#Map('windows', 'k', 'wincmd k', {'desc': 'Left window'}) call tinykeymap#Map('windows', 'l', 'wincmd l', {'desc': 'Right window'}) call tinykeymap#Map('windows', 't', 'wincmd t', {'desc': 'Top-left window'}) call tinykeymap#Map('windows', 'b', 'wincmd b', {'desc': 'Bottom-right window'}) call tinykeymap#Map('windows', 'p', 'wincmd p', {'desc': 'Previous window'}) call tinykeymap#Map('windows', 'P', 'wincmd P', {'desc': 'Preview window'}) call tinykeymap#Map('windows', 'c', 'wincmd c', {'desc': 'Close window'}) " call tinykeymap#Map('windows', 'o', 'wincmd o', {'desc': 'Make the only window'}) call tinykeymap#Map('windows', 's', 'split') call tinykeymap#Map('windows', 'v', 'vert split') call tinykeymap#Map('windows', "", 'wincmd W', {'exit': 1}) call tinykeymap#Map('windows', "", 'wincmd w', {'exit': 1})