mirror of
				https://github.com/amix/vimrc
				synced 2025-10-31 06:33:35 +08:00 
			
		
		
		
	Updated plugins. Added vim-golang as a mode
This commit is contained in:
		| @ -3,8 +3,8 @@ | ||||
| " @Website:     http://www.vim.org/account/profile.php?user_id=4037 | ||||
| " @License:     GPL (see http://www.gnu.org/licenses/gpl.txt) | ||||
| " @Created:     2008-11-25. | ||||
| " @Last Change: 2013-09-25. | ||||
| " @Revision:    0.0.92 | ||||
| " @Last Change: 2014-01-23. | ||||
| " @Revision:    0.0.108 | ||||
|  | ||||
| let s:prototype = tlib#Object#New({'_class': ['Filter_cnf'], 'name': 'cnf'}) "{{{2 | ||||
| let s:prototype.highlight = g:tlib#input#higroup | ||||
| @ -147,7 +147,16 @@ endf | ||||
|  | ||||
| " :nodoc: | ||||
| function! s:prototype.ReduceFrontFilter(world) dict "{{{3 | ||||
|     let a:world.filter[0][0] = a:world.filter[0][0][0:-2] | ||||
|     let filter = a:world.filter[0][0] | ||||
|     " TLogVAR filter | ||||
|     let str = matchstr(filter, '\(\\\(\.\\{-}\|[.?*+$^]\)\|\)$') | ||||
|     if empty(str) | ||||
|         let filter = filter[0 : -2] | ||||
|     else | ||||
|         let filter = strpart(filter, 0, len(filter) - len(str)) | ||||
|     endif | ||||
|     " TLogVAR str, filter | ||||
|     let a:world.filter[0][0] = filter | ||||
| endf | ||||
|  | ||||
|  | ||||
|  | ||||
| @ -3,8 +3,8 @@ | ||||
| " @Website:     http://www.vim.org/account/profile.php?user_id=4037 | ||||
| " @License:     GPL (see http://www.gnu.org/licenses/gpl.txt) | ||||
| " @Created:     2008-11-25. | ||||
| " @Last Change: 2013-09-25. | ||||
| " @Revision:    0.0.51 | ||||
| " @Last Change: 2014-01-23. | ||||
| " @Revision:    0.0.57 | ||||
|  | ||||
| let s:prototype = tlib#Filter_cnf#New({'_class': ['Filter_cnfd'], 'name': 'cnfd'}) "{{{2 | ||||
| let s:prototype.highlight = g:tlib#input#higroup | ||||
| @ -29,11 +29,7 @@ let s:Help = s:prototype.Help | ||||
| " :nodoc: | ||||
| function! s:prototype.Help(world) dict "{{{3 | ||||
|     call call(s:Help, [a:world], self) | ||||
|     if self.name == 'cnfx' | ||||
|         call a:world.PushHelp(g:tlib#Filter_cnfx#expander, 'Any characters') | ||||
|     else | ||||
|         call a:world.PushHelp('.', 'Any characters') | ||||
|     endif | ||||
|     call a:world.PushHelp('.', 'Any characters') | ||||
| endf | ||||
|  | ||||
|  | ||||
| @ -50,16 +46,6 @@ function! s:prototype.PushFrontFilter(world, char) dict "{{{3 | ||||
| endf | ||||
|  | ||||
|  | ||||
| " :nodoc: | ||||
| function! s:prototype.ReduceFrontFilter(world) dict "{{{3 | ||||
|     let flt = a:world.filter[0][0] | ||||
|     if flt =~ '\\\.\\{-}$' | ||||
|         let a:world.filter[0][0] = flt[0:-7] | ||||
|     else | ||||
|         let a:world.filter[0][0] = flt[0:-2] | ||||
|     endif | ||||
| endf | ||||
|  | ||||
| " :nodoc: | ||||
| function! s:prototype.CleanFilter(filter) dict "{{{3 | ||||
|     return substitute(a:filter, '\\.\\{-}', '.', 'g') | ||||
|  | ||||
| @ -1,42 +0,0 @@ | ||||
| " @Author:      Tom Link (mailto:micathom AT gmail com?subject=[vim]) | ||||
| " @Website:     http://www.vim.org/account/profile.php?user_id=4037 | ||||
| " @License:     GPL (see http://www.gnu.org/licenses/gpl.txt) | ||||
| " @Created:     2008-11-25. | ||||
| " @Last Change: 2013-09-25. | ||||
| " @Revision:    0.0.62 | ||||
|  | ||||
| let s:prototype = tlib#Filter_cnfd#New({'_class': ['Filter_cnfx'], 'name': 'cnfx'}) "{{{2 | ||||
| let s:prototype.highlight = g:tlib#input#higroup | ||||
|  | ||||
|  | ||||
| " A character that should be expanded to '\.\{-}'. | ||||
| TLet g:tlib#Filter_cnfx#expander = '+' | ||||
|  | ||||
|  | ||||
| " The same as |tlib#Filter_cnfd#New()| but a a customizable character  | ||||
| " |see tlib#Filter_cnfx#expander| is expanded to '\.\{-}'.  | ||||
| " The pattern is a '/\V' very no-'/magic' regexp pattern. | ||||
| function! tlib#Filter_cnfx#New(...) "{{{3 | ||||
|     let object = s:prototype.New(a:0 >= 1 ? a:1 : {}) | ||||
|     return object | ||||
| endf | ||||
|  | ||||
|  | ||||
| " :nodoc: | ||||
| function! s:prototype.SetFrontFilter(world, pattern) dict "{{{3 | ||||
|     let pattern = substitute(a:pattern, tlib#rx#Escape(g:tlib#Filter_cnfx#expander, 'V'), '\\.\\{-}', 'g') | ||||
|     let a:world.filter[0] = reverse(split(pattern, '\s*|\s*')) + a:world.filter[0][1 : -1] | ||||
| endf | ||||
|  | ||||
|  | ||||
| " :nodoc: | ||||
| function! s:prototype.PushFrontFilter(world, char) dict "{{{3 | ||||
|     let a:world.filter[0][0] .= a:char == char2nr(g:tlib#Filter_cnfx#expander) ? '\.\{-}' : nr2char(a:char) | ||||
| endf | ||||
|  | ||||
|  | ||||
| " :nodoc: | ||||
| function! s:prototype.CleanFilter(filter) dict "{{{3 | ||||
|     return substitute(a:filter, '\\.\\{-}', g:tlib#Filter_cnfx#expander, 'g') | ||||
| endf | ||||
|  | ||||
							
								
								
									
										68
									
								
								sources_non_forked/tlib/autoload/tlib/Filter_glob.vim
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								sources_non_forked/tlib/autoload/tlib/Filter_glob.vim
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,68 @@ | ||||
| " @Author:      Tom Link (mailto:micathom AT gmail com?subject=[vim]) | ||||
| " @Website:     http://www.vim.org/account/profile.php?user_id=4037 | ||||
| " @License:     GPL (see http://www.gnu.org/licenses/gpl.txt) | ||||
| " @Created:     2008-11-25. | ||||
| " @Last Change: 2014-01-23. | ||||
| " @Revision:    0.0.80 | ||||
|  | ||||
| let s:prototype = tlib#Filter_cnf#New({'_class': ['Filter_glob'], 'name': 'glob'}) "{{{2 | ||||
| let s:prototype.highlight = g:tlib#input#higroup | ||||
|  | ||||
|  | ||||
| " A character that should be expanded to '\.\{-}'. | ||||
| TLet g:tlib#Filter_glob#seq = '*' | ||||
|  | ||||
|  | ||||
| " A character that should be expanded to '\.\?'. | ||||
| TLet g:tlib#Filter_glob#char = '?' | ||||
|  | ||||
|  | ||||
| " The same as |tlib#Filter_cnf#New()| but a a customizable character  | ||||
| " |see tlib#Filter_glob#seq| is expanded to '\.\{-}' and  | ||||
| " |g:tlib#Filter_glob#char| is expanded to '\.'. | ||||
| " The pattern is a '/\V' very no-'/magic' regexp pattern. | ||||
| function! tlib#Filter_glob#New(...) "{{{3 | ||||
|     let object = s:prototype.New(a:0 >= 1 ? a:1 : {}) | ||||
|     return object | ||||
| endf | ||||
|  | ||||
|  | ||||
| let s:Help = s:prototype.Help | ||||
|  | ||||
| " :nodoc: | ||||
| function! s:prototype.Help(world) dict "{{{3 | ||||
|     call call(s:Help, [a:world], self) | ||||
|     call a:world.PushHelp(g:tlib#Filter_glob#seq, 'Any characters') | ||||
|     call a:world.PushHelp(g:tlib#Filter_glob#char, 'Single characters') | ||||
| endf | ||||
|  | ||||
|  | ||||
| " :nodoc: | ||||
| function! s:prototype.SetFrontFilter(world, pattern) dict "{{{3 | ||||
|     let pattern = substitute(a:pattern, tlib#rx#Escape(g:tlib#Filter_glob#seq, 'V'), '\\.\\{-}', 'g') | ||||
|     let pattern = substitute(a:pattern, tlib#rx#Escape(g:tlib#Filter_glob#char, 'V'), '\\.', 'g') | ||||
|     let a:world.filter[0] = reverse(split(pattern, '\s*|\s*')) + a:world.filter[0][1 : -1] | ||||
| endf | ||||
|  | ||||
|  | ||||
| " :nodoc: | ||||
| function! s:prototype.PushFrontFilter(world, char) dict "{{{3 | ||||
|     " TLogVAR a:char, nr2char(a:char) | ||||
|     if a:char == char2nr(g:tlib#Filter_glob#seq) | ||||
|         let char = '\.\{-}' | ||||
|     elseif a:char == char2nr(g:tlib#Filter_glob#char) | ||||
|         let char = '\.' | ||||
|     else | ||||
|         let char = nr2char(a:char) | ||||
|     endif | ||||
|     let a:world.filter[0][0] .= char | ||||
| endf | ||||
|  | ||||
|  | ||||
| " :nodoc: | ||||
| function! s:prototype.CleanFilter(filter) dict "{{{3 | ||||
|     let filter = substitute(a:filter, '\\.\\{-}', g:tlib#Filter_glob#seq, 'g') | ||||
|     let filter = substitute(filter, '\\.', g:tlib#Filter_glob#char, 'g') | ||||
|     return filter | ||||
| endf | ||||
|  | ||||
| @ -1,10 +1,7 @@ | ||||
| " World.vim -- The World prototype for tlib#input#List() | ||||
| " @Author:      Tom Link (micathom AT gmail com?subject=[vim]) | ||||
| " @Website:     http://www.vim.org/account/profile.php?user_id=4037 | ||||
| " @License:     GPL (see http://www.gnu.org/licenses/gpl.txt) | ||||
| " @Created:     2007-05-01. | ||||
| " @Last Change: 2013-12-03. | ||||
| " @Revision:    0.1.1310 | ||||
| " @Revision:    1389 | ||||
|  | ||||
| " :filedoc: | ||||
| " A prototype used by |tlib#input#List|. | ||||
| @ -75,6 +72,7 @@ let s:prototype = tlib#Object#New({ | ||||
|             \ 'resize_vertical': 0, | ||||
|             \ 'restore_from_cache': [], | ||||
|             \ 'filtered_items': [], | ||||
|             \ 'resume_state': '',  | ||||
|             \ 'retrieve_eval': '', | ||||
|             \ 'return_agent': '', | ||||
|             \ 'rv': '', | ||||
| @ -92,6 +90,7 @@ let s:prototype = tlib#Object#New({ | ||||
|             \ 'temp_prompt': [], | ||||
|             \ 'timeout': 0, | ||||
|             \ 'timeout_resolution': 2, | ||||
|             \ 'tabpagenr': -1, | ||||
|             \ 'type': '',  | ||||
|             \ 'win_wnr': -1, | ||||
|             \ 'win_height': -1, | ||||
| @ -119,6 +118,22 @@ function! s:prototype.Set_display_format(value) dict "{{{3 | ||||
| endf | ||||
|  | ||||
|  | ||||
| " :nodoc: | ||||
| function! s:prototype.DisplayFormat(list) dict "{{{3 | ||||
|     let display_format = self.display_format | ||||
|     if !empty(display_format) | ||||
|         if has_key(self, 'InitFormatName') | ||||
|             call self.InitFormatName() | ||||
|         endif | ||||
|         let cache = self.fmt_display | ||||
|         " TLogVAR display_format, fmt_entries | ||||
|         return map(copy(a:list), 'self.FormatName(cache, display_format, v:val)') | ||||
|     else | ||||
|         return a:list | ||||
|     endif | ||||
| endf | ||||
|  | ||||
|  | ||||
| " :nodoc: | ||||
| function! s:prototype.Set_highlight_filename() dict "{{{3 | ||||
|     let self.tlib_UseInputListScratch = 'call world.Highlight_filename()' | ||||
| @ -180,6 +195,32 @@ else | ||||
|     endf | ||||
|  | ||||
|  | ||||
|     " :nodoc: | ||||
|     function! s:prototype.UseFilenameIndicators() dict "{{{3 | ||||
|         return g:tlib_inputlist_filename_indicators || has_key(self, 'filename_indicators') | ||||
|     endf | ||||
|  | ||||
|  | ||||
|     " :nodoc: | ||||
|     function! s:prototype.InitFormatName() dict "{{{3  | ||||
|         if self.UseFilenameIndicators() | ||||
|             let self._buffers = {} | ||||
|             for bufnr in range(1, bufnr('$')) | ||||
|                 let filename = fnamemodify(bufname(bufnr), ':p') | ||||
|                 " TLogVAR filename | ||||
|                 let bufdef = { | ||||
|                             \ 'bufnr': bufnr, | ||||
|                             \ } | ||||
|                 " '&buflisted' | ||||
|                 for opt in ['&modified', '&bufhidden'] | ||||
|                     let bufdef[opt] = getbufvar(bufnr, opt) | ||||
|                 endfor | ||||
|                 let self._buffers[filename] = bufdef | ||||
|             endfor | ||||
|         endif | ||||
|     endf | ||||
|  | ||||
|  | ||||
|     " :nodoc: | ||||
|     function! s:prototype.FormatFilename(file) dict "{{{3 | ||||
|         " TLogVAR a:file | ||||
| @ -196,34 +237,30 @@ else | ||||
|         if strwidth(fname) > width | ||||
|             let fname = strpart(fname, 0, width - 3) .'...' | ||||
|         endif | ||||
|         let dnmax = &co - max([width, strwidth(fname)]) - 10 - self.index_width - &fdc | ||||
|         if g:tlib_inputlist_filename_indicators | ||||
|             let dnmax -= 2 | ||||
|         endif | ||||
|         if strwidth(dname) > dnmax | ||||
|             let dname = '...'. strpart(dname, len(dname) - dnmax) | ||||
|         endif | ||||
|         let marker = [] | ||||
|         let use_indicators = g:tlib_inputlist_filename_indicators || has_key(self, 'filename_indicators') | ||||
|         let dnmax = &co - max([width, strwidth(fname)]) - 8 - self.index_width - &fdc | ||||
|         let use_indicators = self.UseFilenameIndicators() | ||||
|         " TLogVAR use_indicators | ||||
|         let marker = [] | ||||
|         if use_indicators | ||||
|             call insert(marker, '[') | ||||
|             if g:tlib_inputlist_filename_indicators | ||||
|                 let bnr = bufnr(a:file) | ||||
|                 TLogVAR a:file, bnr, self.bufnr | ||||
|                 let bufdef = get(self._buffers, a:file, {}) | ||||
|                 " let bnr = bufnr(a:file) | ||||
|                 let bnr = get(bufdef, 'bufnr', -1) | ||||
|                 " TLogVAR a:file, bnr, self.bufnr | ||||
|                 if bnr != -1 | ||||
|                     if bnr == self.bufnr | ||||
|                         call add(marker, '%') | ||||
|                     else | ||||
|                         call add(marker, bnr) | ||||
|                     endif | ||||
|                     if getbufvar(bnr, '&modified') | ||||
|                     if get(bufdef, '&modified', 0) | ||||
|                         call add(marker, '+') | ||||
|                     endif | ||||
|                     if getbufvar(bnr, '&bufhidden') == 'hide' | ||||
|                     if get(bufdef, '&bufhidden', '') == 'hide' | ||||
|                         call add(marker, 'h') | ||||
|                     endif | ||||
|                     " if !buflisted(bnr) | ||||
|                     " if !get(bufdef, '&buflisted', 1) | ||||
|                     "     call add(marker, 'u') | ||||
|                     " endif | ||||
|                     " echom "DBG" a:file string(get(self,'filename_indicators')) | ||||
| @ -242,9 +279,16 @@ else | ||||
|         else | ||||
|             call add(marker, '|') | ||||
|         endif | ||||
|         let markers = join(marker, '') | ||||
|         if !empty(markers) | ||||
|             let dnmax -= len(markers) | ||||
|         endif | ||||
|         if strwidth(dname) > dnmax | ||||
|             let dname = '...'. strpart(dname, len(dname) - dnmax) | ||||
|         endif | ||||
|         return printf("%-*s %s %s", | ||||
|                     \ self.width_filename + len(fname) - strwidth(fname), | ||||
|                     \ fname, join(marker, ''), dname) | ||||
|                     \ fname, markers, dname) | ||||
|     endf | ||||
|  | ||||
| endif | ||||
| @ -764,6 +808,7 @@ function! s:prototype.UseInputListScratch() dict "{{{3 | ||||
|     if !exists('b:tlib_list_init') | ||||
|         call tlib#autocmdgroup#Init() | ||||
|         autocmd TLib VimResized <buffer> call feedkeys("\<c-j>", 't') | ||||
|         " autocmd TLib WinLeave <buffer> let b:tlib_world_event = 'WinLeave' | call feedkeys("\<c-j>", 't') | ||||
|         let b:tlib_list_init = 1 | ||||
|     endif | ||||
|     if !exists('w:tlib_list_init') | ||||
| @ -923,16 +968,17 @@ function! s:prototype.DisplayHelp() dict "{{{3 | ||||
|     let self.temp_lines = self.InitHelp() | ||||
|     call self.PushHelp('<Esc>', self.key_mode == 'default' ? 'Abort' : 'Reset keymap') | ||||
|     call self.PushHelp('Enter, <cr>', 'Pick the current item') | ||||
|     call self.PushHelp('<M-Number>',  'Pick an item') | ||||
|     call self.PushHelp('Mouse', 'L: Pick item, R: Show menu') | ||||
|     call self.PushHelp('<M-Number>',  'Select an item') | ||||
|     call self.PushHelp('<BS>, <C-BS>', 'Reduce filter') | ||||
|     call self.PushHelp('<S-Esc>, <F10>', 'Enter command') | ||||
|  | ||||
|     if self.key_mode == 'default' | ||||
|         call self.PushHelp('<C|M-r>',     'Reset the display') | ||||
|         call self.PushHelp('<C|M-r>',      'Reset the display') | ||||
|         call self.PushHelp('Up/Down',      'Next/previous item') | ||||
|         call self.PushHelp('<C|M-q>',     'Edit top filter string') | ||||
|         call self.PushHelp('<C|M-q>',      'Edit top filter string') | ||||
|         call self.PushHelp('Page Up/Down', 'Scroll') | ||||
|         call self.PushHelp('<S-Space>',    'Enter * Wildcard') | ||||
|         if self.allow_suspend | ||||
|             call self.PushHelp('<C|M-z>', 'Suspend/Resume') | ||||
|             call self.PushHelp('<C-o>', 'Switch to origin') | ||||
| @ -1164,7 +1210,7 @@ function! s:prototype.Query() dict "{{{3 | ||||
|     if g:tlib_inputlist_shortmessage | ||||
|         let query = 'Filter: '. self.DisplayFilter() | ||||
|     else | ||||
|         let query = self.query .' (filter: '. self.DisplayFilter() .'; press "?" for help)' | ||||
|         let query = self.query .' (filter: '. self.DisplayFilter() .'; press <F1> for help)' | ||||
|     endif | ||||
|     return query | ||||
| endf | ||||
| @ -1236,6 +1282,9 @@ endf | ||||
| " :nodoc: | ||||
| function! s:prototype.SwitchWindow(where) dict "{{{3 | ||||
|     " TLogDBG string(tlib#win#List()) | ||||
|     if self.tabpagenr != tabpagenr() | ||||
|         call tlib#tab#Set(self.tabpagenr) | ||||
|     endif | ||||
|     let wnr = get(self, a:where.'_wnr') | ||||
|     " TLogVAR self, wnr | ||||
|     return tlib#win#Set(wnr) | ||||
| @ -1312,3 +1361,8 @@ function! s:prototype.RestoreOrigin(...) dict "{{{3 | ||||
|     " TLogDBG "RestoreOrigin1 ". string(tlib#win#List()) | ||||
| endf | ||||
|  | ||||
|  | ||||
| function! s:prototype.Suspend() dict "{{{3 | ||||
|     call tlib#agent#Suspend(self, self.rv) | ||||
| endf | ||||
|  | ||||
|  | ||||
| @ -3,8 +3,8 @@ | ||||
| " @Website:     http://www.vim.org/account/profile.php?user_id=4037 | ||||
| " @License:     GPL (see http://www.gnu.org/licenses/gpl.txt) | ||||
| " @Created:     2007-06-24. | ||||
| " @Last Change: 2013-11-05. | ||||
| " @Revision:    0.1.242 | ||||
| " @Last Change: 2014-02-06. | ||||
| " @Revision:    0.1.251 | ||||
|  | ||||
|  | ||||
| " :filedoc: | ||||
| @ -55,6 +55,20 @@ function! tlib#agent#PageDown(world, selected) "{{{3 | ||||
| endf | ||||
|  | ||||
|  | ||||
| function! tlib#agent#Home(world, selected) "{{{3 | ||||
|     let a:world.prefidx = 1 | ||||
|     let a:world.state = 'redisplay' | ||||
|     return a:world | ||||
| endf | ||||
|  | ||||
|  | ||||
| function! tlib#agent#End(world, selected) "{{{3 | ||||
|     let a:world.prefidx = len(a:world.list) | ||||
|     let a:world.state = 'redisplay' | ||||
|     return a:world | ||||
| endf | ||||
|  | ||||
|  | ||||
| function! tlib#agent#Up(world, selected, ...) "{{{3 | ||||
|     TVarArg ['lines', 1] | ||||
|     let a:world.idx = '' | ||||
| @ -463,7 +477,7 @@ function! tlib#agent#ShowInfo(world, selected) | ||||
|     for f in a:selected | ||||
|         if filereadable(f) | ||||
|             let desc = [getfperm(f), strftime('%c', getftime(f)),  getfsize(f) .' bytes', getftype(f)] | ||||
|             call add(lines, fnamemodify(f, ':t') .':') | ||||
|             call add(lines, fnamemodify(f, ':p')) | ||||
|             call add(lines, '  '. join(desc, '; ')) | ||||
|         endif | ||||
|     endfor | ||||
| @ -561,7 +575,7 @@ endf | ||||
|  | ||||
| function! tlib#agent#ExecAgentByName(world, selected) "{{{3 | ||||
|     let s:agent_names_world = a:world | ||||
|     let agent_names = {} | ||||
|     let agent_names = {'Help': 'tlib#agent#Help'} | ||||
|     for def in values(a:world.key_map[a:world.key_mode]) | ||||
|         if has_key(def, 'help') && !empty(def.help) && has_key(def, 'agent') && !empty(def.agent) | ||||
|             let agent_names[def.help] = def.agent | ||||
|  | ||||
| @ -4,7 +4,7 @@ | ||||
| " @License:     GPL (see http://www.gnu.org/licenses/gpl.txt) | ||||
| " @Created:     2007-06-30. | ||||
| " @Last Change: 2013-09-25. | ||||
| " @Revision:    0.1.220 | ||||
| " @Revision:    0.1.230 | ||||
|  | ||||
|  | ||||
| " The cache directory. If empty, use |tlib#dir#MyRuntime|.'/cache'. | ||||
| @ -109,13 +109,20 @@ endf | ||||
|  | ||||
|  | ||||
| function! tlib#cache#Save(cfile, dictionary) "{{{3 | ||||
|     " TLogVAR a:cfile, a:dictionary | ||||
|     call tlib#persistent#Save(a:cfile, a:dictionary) | ||||
| endf | ||||
|  | ||||
|  | ||||
| function! tlib#cache#Get(cfile) "{{{3 | ||||
| function! tlib#cache#Get(cfile, ...) "{{{3 | ||||
|     call tlib#cache#MaybePurge() | ||||
|     return tlib#persistent#Get(a:cfile) | ||||
|     if !empty(a:cfile) && filereadable(a:cfile) | ||||
|         let val = readfile(a:cfile, 'b') | ||||
|         return eval(join(val, "\n")) | ||||
|     else | ||||
|         let default = a:0 >= 1 ? a:1 : {} | ||||
|         return default | ||||
|     endif | ||||
| endf | ||||
|  | ||||
|  | ||||
| @ -123,10 +130,18 @@ endf | ||||
| " or does not exist, create it calling a generator function. | ||||
| function! tlib#cache#Value(cfile, generator, ftime, ...) "{{{3 | ||||
|     if !filereadable(a:cfile) || (a:ftime != 0 && getftime(a:cfile) < a:ftime) | ||||
|         let args = a:0 >= 1 ? a:1 : [] | ||||
|         let val = call(a:generator, args) | ||||
|         " TLogVAR a:generator, args, val | ||||
|         call tlib#cache#Save(a:cfile, {'val': val}) | ||||
|         if empty(a:generator) && a:0 >= 1 | ||||
|             " TLogVAR a:1 | ||||
|             let val = a:1 | ||||
|         else | ||||
|             let args = a:0 >= 1 ? a:1 : [] | ||||
|             " TLogVAR a:generator, args | ||||
|             let val = call(a:generator, args) | ||||
|         endif | ||||
|         " TLogVAR val | ||||
|         let cval = {'val': val} | ||||
|         " TLogVAR cval | ||||
|         call tlib#cache#Save(a:cfile, cval) | ||||
|         return val | ||||
|     else | ||||
|         let val = tlib#cache#Get(a:cfile) | ||||
|  | ||||
| @ -3,8 +3,8 @@ | ||||
| " @Website:     http://www.vim.org/account/profile.php?user_id=4037 | ||||
| " @License:     GPL (see http://www.gnu.org/licenses/gpl.txt) | ||||
| " @Created:     2007-06-30. | ||||
| " @Last Change: 2009-02-15. | ||||
| " @Revision:    0.0.30 | ||||
| " @Last Change: 2014-01-20. | ||||
| " @Revision:    0.0.37 | ||||
|  | ||||
| if &cp || exists("loaded_tlib_char_autoload") | ||||
|     finish | ||||
| @ -19,13 +19,22 @@ let loaded_tlib_char_autoload = 1 | ||||
| "   echo tlib#char#Get() | ||||
| "   echo tlib#char#Get(5) | ||||
| function! tlib#char#Get(...) "{{{3 | ||||
|     TVarArg ['timeout', 0], ['resolution', 0] | ||||
|     TVarArg ['timeout', 0], ['resolution', 0], ['getmod', 0] | ||||
|     let char = -1 | ||||
|     let mode = 0 | ||||
|     if timeout == 0 || !has('reltime') | ||||
|         return getchar() | ||||
|         let char = getchar() | ||||
|     else | ||||
|         return tlib#char#GetWithTimeout(timeout, resolution) | ||||
|         let char = tlib#char#GetWithTimeout(timeout, resolution) | ||||
|     endif | ||||
|     if getmod | ||||
|         if char != -1 | ||||
|             let mode = getcharmod() | ||||
|         endif | ||||
|         return [char, mode] | ||||
|     else | ||||
|         return char | ||||
|     endif | ||||
|     return -1 | ||||
| endf | ||||
|  | ||||
|  | ||||
|  | ||||
| @ -3,8 +3,8 @@ | ||||
| " @Website:     http://www.vim.org/account/profile.php?user_id=4037 | ||||
| " @License:     GPL (see http://www.gnu.org/licenses/gpl.txt) | ||||
| " @Created:     2007-08-23. | ||||
| " @Last Change: 2013-05-14. | ||||
| " @Revision:    0.0.46 | ||||
| " @Last Change: 2014-02-05. | ||||
| " @Revision:    0.0.53 | ||||
|  | ||||
| if &cp || exists("loaded_tlib_cmd_autoload") | ||||
|     finish | ||||
| @ -58,10 +58,12 @@ endf | ||||
| "   call tlib#cmd#BrowseOutputWithCallback('tlib#cmd#ParseScriptname', 'scriptnames') | ||||
| function! tlib#cmd#BrowseOutputWithCallback(callback, command) "{{{3 | ||||
|     let list = tlib#cmd#OutputAsList(a:command) | ||||
|     let cmd = tlib#input#List('s', 'Output of: '. a:command, list) | ||||
|     if !empty(cmd) | ||||
|         let Callback = function(a:callback) | ||||
|         call call(Callback, [cmd]) | ||||
|     let cmds = tlib#input#List('m', 'Output of: '. a:command, list) | ||||
|     if !empty(cmds) | ||||
|         for cmd in cmds | ||||
|             let Callback = function(a:callback) | ||||
|             call call(Callback, [cmd]) | ||||
|         endfor | ||||
|     endif | ||||
| endf | ||||
|  | ||||
| @ -70,8 +72,9 @@ function! tlib#cmd#DefaultBrowseOutput(cmd) "{{{3 | ||||
| endf | ||||
|  | ||||
| function! tlib#cmd#ParseScriptname(line) "{{{3 | ||||
|     let parsedValue = substitute(a:line, '^.\{-}\/', '/', '') | ||||
|     exe ':e '. parsedValue | ||||
|     " let parsedValue = substitute(a:line, '^.\{-}\/', '/', '') | ||||
|     let parsedValue = matchstr(a:line, '^\s*\d\+:\s*\zs.*$') | ||||
|     exe 'drop '. fnameescape(parsedValue) | ||||
| endf | ||||
|  | ||||
| " :def: function! tlib#cmd#UseVertical(?rx='') | ||||
|  | ||||
| @ -1,10 +1,7 @@ | ||||
| " input.vim | ||||
| " @Author:      Tom Link (micathom AT gmail com?subject=[vim]) | ||||
| " @Website:     http://www.vim.org/account/profile.php?user_id=4037 | ||||
| " @License:     GPL (see http://www.gnu.org/licenses/gpl.txt) | ||||
| " @Created:     2007-06-30. | ||||
| " @Last Change: 2013-09-30. | ||||
| " @Revision:    0.0.1262 | ||||
| " @Revision:    1315 | ||||
|  | ||||
|  | ||||
| " :filedoc: | ||||
| @ -23,16 +20,15 @@ TLet g:tlib#input#livesearch_threshold = 1000 | ||||
|  | ||||
|  | ||||
| " Determine how |tlib#input#List()| and related functions work. | ||||
| " Can be "cnf", "cnfd", "cnfx", "seq", or "fuzzy". See: | ||||
| "   cnfx ... Like cnfd but |g:tlib#Filter_cnfx#expander| is interpreted  | ||||
| "            as a wildcard (this is the default method) | ||||
| "     - A plus character ("+") acts as a wildcard as if ".\{-}" (see  | ||||
| "       |/\{-|) were entered. | ||||
| " Can be "glob", "cnf", "cnfd", "seq", or "fuzzy". See: | ||||
| "   glob ... Like cnf but "*" and "?" (see |g:tlib#Filter_glob#seq|,  | ||||
| "       |g:tlib#Filter_glob#char|) are interpreted as glob-like  | ||||
| "       |wildcards| (this is the default method) | ||||
| "     - Examples: | ||||
| "         - "f+o" matches "fo", "fxo", and "fxxxoo", but doesn't match  | ||||
| "         - "f*o" matches "fo", "fxo", and "fxxxoo", but doesn't match  | ||||
| "           "far". | ||||
| "     - Otherwise it is a derivate of the cnf method (see below). | ||||
| "     - See also |tlib#Filter_cnfx#New()|. | ||||
| "     - See also |tlib#Filter_glob#New()|. | ||||
| "   cnfd ... Like cnf but "." is interpreted as a wildcard, i.e. it is  | ||||
| "            expanded to "\.\{-}" | ||||
| "     - A period character (".") acts as a wildcard as if ".\{-}" (see  | ||||
| @ -60,7 +56,7 @@ TLet g:tlib#input#livesearch_threshold = 1000 | ||||
| "     - |tlib#Filter_seq#New()| | ||||
| "   fuzzy .. Match fuzzy character sequences | ||||
| "     - |tlib#Filter_fuzzy#New()| | ||||
| TLet g:tlib#input#filter_mode = 'cnfx' | ||||
| TLet g:tlib#input#filter_mode = 'glob' | ||||
|  | ||||
|  | ||||
| " The highlight group to use for showing matches in the input list  | ||||
| @ -126,6 +122,8 @@ TLet g:tlib#input#numeric_chars = { | ||||
| TLet g:tlib#input#keyagents_InputList_s = { | ||||
|             \ "\<PageUp>":   'tlib#agent#PageUp', | ||||
|             \ "\<PageDown>": 'tlib#agent#PageDown', | ||||
|             \ "\<Home>":     'tlib#agent#Home', | ||||
|             \ "\<End>":      'tlib#agent#End', | ||||
|             \ "\<Up>":       'tlib#agent#Up', | ||||
|             \ "\<Down>":     'tlib#agent#Down', | ||||
|             \ "\<c-Up>":     'tlib#agent#UpN', | ||||
| @ -140,7 +138,6 @@ TLet g:tlib#input#keyagents_InputList_s = { | ||||
|             \ 26:            'tlib#agent#Suspend', | ||||
|             \ 250:           'tlib#agent#Suspend', | ||||
|             \ 15:            'tlib#agent#SuspendToParentWindow',   | ||||
|             \ 63:            'tlib#agent#Help', | ||||
|             \ "\<F1>":       'tlib#agent#Help', | ||||
|             \ "\<F10>":      'tlib#agent#ExecAgentByName', | ||||
|             \ "\<S-Esc>":    'tlib#agent#ExecAgentByName', | ||||
| @ -155,6 +152,7 @@ TLet g:tlib#input#keyagents_InputList_s = { | ||||
|             \ char2nr(g:tlib#input#or):  'tlib#agent#OR', | ||||
|             \ char2nr(g:tlib#input#and): 'tlib#agent#AND', | ||||
|             \ } | ||||
|             " \ 63:            'tlib#agent#Help', | ||||
|  | ||||
|  | ||||
| " :nodefault: | ||||
| @ -345,6 +343,16 @@ function! tlib#input#ListW(world, ...) "{{{3 | ||||
|             try | ||||
|                 call s:RunStateHandlers(world) | ||||
|  | ||||
|                 " if exists('b:tlib_world_event') | ||||
|                 "     let event = b:tlib_world_event | ||||
|                 "     unlet! b:tlib_world_event | ||||
|                 "     if event == 'WinLeave' | ||||
|                 "         " let world.resume_state = world.state | ||||
|                 "         let world = tlib#agent#Suspend(world, world.rv) | ||||
|                 "         break | ||||
|                 "     endif | ||||
|                 " endif | ||||
|  | ||||
|                 " let time02 = str2float(reltimestr(reltime()))  " DBG | ||||
|                 " TLogVAR time02, time02 - time0 | ||||
|                 if world.state =~ '\<reset\>' | ||||
| @ -443,14 +451,7 @@ function! tlib#input#ListW(world, ...) "{{{3 | ||||
|                             " TLogDBG 5 | ||||
|                             " TLogDBG len(world.list) | ||||
|                             " TLogVAR world.list | ||||
|                             let dlist = copy(world.list) | ||||
|                             " TLogVAR world.display_format | ||||
|                             if !empty(world.display_format) | ||||
|                                 let display_format = world.display_format | ||||
|                                 let cache = world.fmt_display | ||||
|                                 " TLogVAR display_format, fmt_entries | ||||
|                                 call map(dlist, 'world.FormatName(cache, display_format, v:val)') | ||||
|                             endif | ||||
|                             let dlist = world.DisplayFormat(world.list) | ||||
|                             " TLogVAR world.prefidx | ||||
|                             " TLogDBG 6 | ||||
|                             " let time6 = str2float(reltimestr(reltime()))  " DBG | ||||
| @ -545,20 +546,15 @@ function! tlib#input#ListW(world, ...) "{{{3 | ||||
|                             exec exec_cmd | ||||
|                         endif | ||||
|                     elseif has('gui_gtk') || has('gui_gtk2') | ||||
|                         let c = getchar() | ||||
|                         let cmod = getcharmod() | ||||
|                         " TLogVAR c, cmod | ||||
|                         if c !~ '\D' && c > 0 && cmod != 0 | ||||
|                             let c = printf("<%s-%s>", cmod, c) | ||||
|                         endif | ||||
|                         let c = s:GetModdedChar(world) | ||||
|                         " TLogVAR c | ||||
|                     endif | ||||
|                 else | ||||
|                     " TLogVAR world.timeout | ||||
|                     let c = tlib#char#Get(world.timeout, world.timeout_resolution) | ||||
|                     let c = s:GetModdedChar(world) | ||||
|                     " TLogVAR c, has_key(world.key_map[world.key_mode],c) | ||||
|                     let cmod = getcharmod() | ||||
|                 endif | ||||
|                 " TLogVAR c, cmod | ||||
|                 " TLogVAR c | ||||
|                 " TLogDBG string(sort(keys(world.key_map[world.key_mode]))) | ||||
|  | ||||
|                 " TLogVAR world.next_agent, world.next_eval | ||||
| @ -602,7 +598,7 @@ function! tlib#input#ListW(world, ...) "{{{3 | ||||
|                         " let world.offset  = world.prefidx | ||||
|                         if empty(world.prefidx) | ||||
|                             " call feedkeys(c, 't') | ||||
|                             let c = tlib#char#Get(world.timeout) | ||||
|                             let c = s:GetModdedChar(world) | ||||
|                             let world.state = 'help' | ||||
|                             continue | ||||
|                         endif | ||||
| @ -829,6 +825,16 @@ function! tlib#input#ListW(world, ...) "{{{3 | ||||
| endf | ||||
|  | ||||
|  | ||||
| function! s:GetModdedChar(world) "{{{3 | ||||
|     let [char, mode] = tlib#char#Get(a:world.timeout, a:world.timeout_resolution, 1) | ||||
|     if char !~ '\D' && char > 0 && mode != 0 | ||||
|         return printf("<%s-%s>", mode, char) | ||||
|     else | ||||
|         return char | ||||
|     endif | ||||
| endf | ||||
|  | ||||
|  | ||||
| function! s:Init(world, cmd) "{{{3 | ||||
|     " TLogVAR a:cmd | ||||
|     let a:world.initial_display = 1 | ||||
| @ -844,6 +850,9 @@ function! s:Init(world, cmd) "{{{3 | ||||
|         else | ||||
|             call a:world.Retrieve(1) | ||||
|         endif | ||||
|         " if !empty(a:world.resume_state) | ||||
|         "     let a:world.state = a:world.resume_state | ||||
|         " endif | ||||
|     elseif !a:world.initialized | ||||
|         " TLogVAR a:world.initialized, a:world.win_wnr, a:world.bufnr | ||||
|         let a:world.filetype = &filetype | ||||
|  | ||||
| @ -3,7 +3,7 @@ | ||||
| " @License:     GPL (see http://www.gnu.org/licenses/gpl.txt) | ||||
| " @Created:     2012-05-11. | ||||
| " @Last Change: 2012-05-11. | ||||
| " @Revision:    7 | ||||
| " @Revision:    9 | ||||
|  | ||||
| " The directory for persistent data files. If empty, use  | ||||
| " |tlib#dir#MyRuntime|.'/share'. | ||||
| @ -29,13 +29,8 @@ function! tlib#persistent#Filename(type, ...) "{{{3 | ||||
|     return tlib#cache#Filename(a:type, file, mkdir, tlib#persistent#Dir()) | ||||
| endf | ||||
|  | ||||
| function! tlib#persistent#Get(cfile) "{{{3 | ||||
|     if !empty(a:cfile) && filereadable(a:cfile) | ||||
|         let val = readfile(a:cfile, 'b') | ||||
|         return eval(join(val, "\n")) | ||||
|     else | ||||
|         return {} | ||||
|     endif | ||||
| function! tlib#persistent#Get(...) "{{{3 | ||||
|     return call('tlib#cache#Get', a:000) | ||||
| endf | ||||
|  | ||||
| function! tlib#persistent#Value(...) "{{{3 | ||||
|  | ||||
| @ -4,7 +4,7 @@ | ||||
| " @License:     GPL (see http://www.gnu.org/licenses/gpl.txt) | ||||
| " @Created:     2007-09-30. | ||||
| " @Last Change: 2010-01-07. | ||||
| " @Revision:    0.0.66 | ||||
| " @Revision:    0.0.69 | ||||
|  | ||||
| if &cp || exists("loaded_tlib_progressbar_autoload") | ||||
|     finish | ||||
| @ -57,6 +57,7 @@ function! tlib#progressbar#Display(value, ...) "{{{3 | ||||
|         let pbr = repeat('.', s:width[0] - val) | ||||
|         let txt = printf(s:format[0], '['.pbl.pbr.']') . extra | ||||
|         let &l:statusline = txt | ||||
|         " TLogDBG txt | ||||
|         redrawstatus | ||||
|         " redraw | ||||
|         " call tlib#notify#Echo(txt) | ||||
|  | ||||
| @ -3,8 +3,8 @@ | ||||
| " @Website:     http://www.vim.org/account/profile.php?user_id=4037 | ||||
| " @License:     GPL (see http://www.gnu.org/licenses/gpl.txt) | ||||
| " @Created:     2007-07-18. | ||||
| " @Last Change: 2013-11-11. | ||||
| " @Revision:    0.0.251 | ||||
| " @Last Change: 2014-02-06. | ||||
| " @Revision:    0.0.252 | ||||
|  | ||||
| if &cp || exists("loaded_tlib_scratch_autoload") | ||||
|     finish | ||||
| @ -100,6 +100,8 @@ function! tlib#scratch#UseScratch(...) "{{{3 | ||||
|         endif | ||||
|     endif | ||||
|     let keyargs.scratch = bufnr('%') | ||||
|     let keyargs.scratch_tabpagenr = tabpagenr() | ||||
|     let keyargs.scratch_winnr = winnr() | ||||
|     " TLogVAR 2, winnr(), bufnr('%'), bufname("%"), keyargs.scratch | ||||
|     return keyargs.scratch | ||||
| endf | ||||
|  | ||||
| @ -3,8 +3,8 @@ | ||||
| " @Website:     http://www.vim.org/account/profile.php?user_id=4037 | ||||
| " @License:     GPL (see http://www.gnu.org/licenses/gpl.txt) | ||||
| " @Created:     2007-08-27. | ||||
| " @Last Change: 2009-02-15. | ||||
| " @Revision:    0.0.29 | ||||
| " @Last Change: 2014-02-06. | ||||
| " @Revision:    0.0.30 | ||||
|  | ||||
| if &cp || exists("loaded_tlib_tab_autoload") | ||||
|     finish | ||||
| @ -50,6 +50,8 @@ endf | ||||
|  | ||||
|  | ||||
| function! tlib#tab#Set(tabnr) "{{{3 | ||||
|     exec a:tabnr .'tabnext' | ||||
|     if a:tabnr > 0 | ||||
|         exec a:tabnr .'tabnext' | ||||
|     endif | ||||
| endf | ||||
|  | ||||
|  | ||||
| @ -4,7 +4,7 @@ | ||||
| " @License:     GPL (see http://www.gnu.org/licenses/gpl.txt) | ||||
| " @Created:     2010-07-19. | ||||
| " @Last Change: 2012-06-08. | ||||
| " @Revision:    35 | ||||
| " @Revision:    37 | ||||
|  | ||||
|  | ||||
| let s:restoreframecmd = '' | ||||
| @ -120,3 +120,33 @@ function! s:RestoreFrameParams() "{{{3 | ||||
|     endif | ||||
| endf | ||||
|  | ||||
|  | ||||
| " :display: tlib#vim##CopyFunction(old, new, overwrite=0) | ||||
| function! tlib#vim#CopyFunction(old, new, ...) "{{{3 | ||||
|     let overwrite = a:0 >= 1 ? a:1 : 0 | ||||
|     redir => oldfn | ||||
|     exec 'silent function' a:old | ||||
|     redir END | ||||
|     if exists('*'. a:new) | ||||
|         if overwrite > 0 | ||||
|             exec 'delfunction' a:new | ||||
|         elseif overwrite < 0 | ||||
|             throw 'tlib#vim##CopyFunction: Function already exists: '. a:old .' -> '. a:new | ||||
|         else | ||||
|             return | ||||
|         endif | ||||
|     endif | ||||
|     let fn = split(oldfn, '\n') | ||||
|     let fn = map(fn, 'substitute(v:val, ''^\d\+'', "", "")') | ||||
|     let fn[0] = substitute(fn[0], '\V\^\s\*fu\%[nction]!\?\s\+\zs'. a:old, a:new, '') | ||||
|     let t = @t | ||||
|     try | ||||
|         let @t = join(fn, "\n") | ||||
|         redir => out | ||||
|         @t | ||||
|         redir END | ||||
|     finally | ||||
|         let @t = t | ||||
|     endtry | ||||
| endf | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 amix
					amix