Permalink
Browse files

Version 0.8

- Require tlib 0.28
  • Loading branch information...
1 parent 744b5b2 commit 6e22eb969a2c873d9d583d7b15ac748b573c90f2 @tomtom tomtom committed with Dec 2, 2008
Showing with 35 additions and 14 deletions.
  1. +18 −7 autoload/tselectfiles.vim
  2. +5 −0 doc/tselectfiles.txt
  3. +12 −7 plugin/tselectfiles.vim
View
@@ -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-10-15.
-" @Last Change: 2008-10-16.
-" @Revision: 0.0.197
+" @Last Change: 2008-11-30.
+" @Revision: 0.0.216
if &cp || exists("loaded_tselectfiles_autoload")
finish
@@ -213,7 +213,7 @@ function! tselectfiles#ViewFile(world, selected) "{{{3
call a:world.RestoreOrigin()
return a:world
else
- call a:world.SetOrigin()
+ " call a:world.SetOrigin()
return tlib#agent#ViewFile(a:world, a:selected)
endif
endf
@@ -336,7 +336,7 @@ function! tselectfiles#FormatFirstLine(filename) "{{{3
let lines = readfile(a:filename)
for l in lines
if !empty(l)
- return printf('%-20s %s', fnamemodify(a:filename, ':t'), l)
+ return printf('%-20s %s', fnamemodify(a:filename, ':t') .'::', l)
endif
endfor
endif
@@ -345,6 +345,7 @@ endf
function! tselectfiles#FormatVikiMetaDataOrFirstLine(filename) "{{{3
+ " TLogVAR a:filename
if filereadable(a:filename)
let lines = readfile(a:filename)
let acc = []
@@ -363,12 +364,19 @@ function! tselectfiles#FormatVikiMetaDataOrFirstLine(filename) "{{{3
break
endif
endfor
- return printf('%-20s %s', fnamemodify(a:filename, ':t'), join(acc, ' | '))
+ return printf('%-20s %s', fnamemodify(a:filename, ':t') .'::', join(acc, ' | '))
endif
return a:filename
endf
+function! tselectfiles#Highlight(world) "{{{3
+ if a:world.display_as_filenames
+ call a:world.Highlight_filename()
+ endif
+endf
+
+
function! tselectfiles#FormatEntry(world, filename) "{{{3
" \ {'tlib_UseInputListScratch': 'call world.Highlight_filename()'},
let display_format = 'a:world.FormatFilename(%s)'
@@ -392,7 +400,8 @@ endf
function! tselectfiles#FormatFilter(world, filename) "{{{3
- let mode = tlib#var#Get('tselectfiles_filter_basename', 'bg', 0)
+ let mode = a:world.tselectfiles_filter_basename
+ " TLogVAR mode
if mode
return fnamemodify(a:filename, ':t')
else
@@ -420,6 +429,8 @@ function! tselectfiles#SelectFiles(mode, dir)
let world.state_handlers = [
\ {'state': '\<reset\>', 'exec': 'call tselectfiles#GetFileList(world, '. string(a:mode) .', 1)'},
\ ]
+ let world.tselectfiles_filter_basename = tlib#var#Get('tselectfiles_filter_basename', 'bg', 0)
+ " TLogVAR world.tselectfiles_filter_basename
if a:mode =~ '^n'
let s:select_files_pattern = {'mode': 'n', 'pattern': ['*']}
call s:InstallDirHandler(world)
@@ -443,7 +454,7 @@ function! tselectfiles#SelectFiles(mode, dir)
call world.SetInitialFilter(filter)
endif
let world.display_as_filenames = 1
- let world.tlib_UseInputListScratch = 'if world.display_as_filenames | call world.Highlight_filename() | endif'
+ let world.tlib_UseInputListScratch = 'call tselectfiles#Highlight(world)'
let fs = tlib#input#ListW(world)
call s:ClosePreview()
endf
View
@@ -75,6 +75,7 @@ Contents~
g:tselectfiles_part_subst_ruby ...... |g:tselectfiles_part_subst_ruby|
g:tselectfiles_limit ................ |g:tselectfiles_limit|
g:tselectfiles_filedescription_rx ... |g:tselectfiles_filedescription_rx|
+ g:tselectfiles_filter_basename ...... |g:tselectfiles_filter_basename|
g:tselectfiles_world ................ |g:tselectfiles_world|
g:tselectfiles_suffixes ............. |g:tselectfiles_suffixes|
g:tselectfiles_hidden_rx ............ |g:tselectfiles_hidden_rx|
@@ -118,6 +119,10 @@ g:tselectfiles_filedescription_rx (default: {})
A dictionary of REGEXP => FUNCREF(filename) -> String describing the
file (DEFAULT: the filename).
+ *g:tselectfiles_filter_basename*
+g:tselectfiles_filter_basename (default: 0)
+ Apply filters to basename only.
+
*g:tselectfiles_world*
g:tselectfiles_world (default: {)
View
@@ -3,18 +3,18 @@
" @Website: http://www.vim.org/account/profile.php?user_id=4037
" @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
" @Created: 2007-04-16.
-" @Last Change: 2008-10-16.
-" @Revision: 544
+" @Last Change: 2008-11-25.
+" @Revision: 551
" GetLatestVimScripts: 1865 1 tselectfiles.vim
if &cp || exists("loaded_tselectfile")
finish
endif
-if !exists('loaded_tlib') || loaded_tlib < 18
- echoerr "tlib >= 0.18 is required"
+if !exists('loaded_tlib') || loaded_tlib < 28
+ echoerr "tlib >= 0.28 is required"
finish
endif
-let loaded_tselectfile = 7
+let loaded_tselectfile = 8
" Whether to cache directory listings (in memory). (per buffer, global)
" If 0, disable the use of cached file listings all together.
@@ -40,13 +40,16 @@ TLet g:tselectfiles_limit = 0
" file (DEFAULT: the filename).
TLet g:tselectfiles_filedescription_rx = {}
+" Apply filters to basename only.
+TLet g:tselectfiles_filter_basename = 0
+
" Use these dirs (a comma separated list, see |globpath()|). (per window, per buffer, global)
" TLet g:tselectfiles_dir = ''
TLet g:tselectfiles_world = {
\ 'type': 'm',
\ 'query': 'Select files',
- \ 'scratch': '__ttoc__',
+ \ 'scratch': '__tselectfiles__',
\ 'return_agent': 'tselectfiles#ViewFile',
\ 'display_format': 'tselectfiles#FormatEntry(world, %s)',
\ 'filter_format': 'tselectfiles#FormatFilter(world, %s)',
@@ -71,7 +74,6 @@ TLet g:tselectfiles_world = {
\ ],
\ }
" \ 'scratch_vertical': (&lines > &co),
- \ ]
TLet g:tselectfiles_suffixes = printf('\(%s\)\$', join(map(split(&suffixes, ','), 'v:val'), '\|'))
@@ -190,3 +192,6 @@ rx in the current buffer's filename.
- NEW: g:tselectfiles_part_subst* variables.
- NEW: [bg]:tselectfiles_filter_basename variable
+0.8
+- Require tlib 0.28
+

0 comments on commit 6e22eb9

Please sign in to comment.