Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

search for file changed

  • Loading branch information...
commit 50ad56e5dad70686a1054d5d9a45f06e3efce3f3 1 parent 0224eff
@troydm authored
Showing with 21 additions and 7 deletions.
  1. +3 −2 doc/easytree.txt
  2. +18 −5 plugin/easytree.vim
View
5 doc/easytree.txt
@@ -100,9 +100,10 @@ g:easytree_width_auto_fit (Default: 0)
To refresh current expanded directory listing press |r| while having your line over that directory
Pressing |R| will refresh whole easytree buffer
File search:
- Press |f| to search for a file/directory and specify a pattern filename pattern you want to search for
+ Press |f| while having your cursor over some directory to search in and
+ specify a filename pattern you want to search for in that directory
Press |n| and |N| to move your cursor over search results
- Pressing |F| instead of |f| will have repeat last search
+ Pressing |F| instead of |f| will have last search pattern pretyped
File management:
To create a new file/directory press |m| while having your cursor over/in directory were you want to
create a new file/directory. If name specified will have / as it's suffix, a directory will be created,
View
23 plugin/easytree.vim
@@ -532,14 +532,27 @@ function! s:GetDirLine(linen)
return 1
endfunction
-function! s:Find(find)
- let find = s:AskInputComplete('find ',a:find,'file')
+function! s:Find(linen, find)
+ let linen = a:linen
+ if linen == 2
+ let linen = 1
+ endif
+ let fpath = s:GetFullPathDir(linen)
+ let find = s:AskInputComplete('search in '.fpath.' for ',a:find,'file')
if !empty(find)
- let fpath = getline(1)
let b:find = find
echo 'searching for '.find
exe "let b:findresult = pyeval(\"EasyTreeFind(vim.eval('find'),vim.eval('fpath'),".b:showhidden.")\")"
redraw
+ if fpath != getline(1)
+ let fpath = fpath[len(getline(1)):]
+ if len(fpath) > 0 && fpath[0] == '/'
+ let fpath = fpath[1:]
+ endif
+ if len(fpath) > 0
+ let b:findresult = map(b:findresult,"fpath.'/'.v:val")
+ endif
+ endif
if !empty(b:findresult)
echo ''
let b:findindex = -1
@@ -990,8 +1003,8 @@ function! s:OpenTree(win, dir)
nnoremap <silent> <buffer> O :call <SID>ExpandAll(line('.'))<CR>
nnoremap <silent> <buffer> x :call <SID>Unexpand(line('.'))<CR>
nnoremap <silent> <buffer> X :call <SID>UnexpandAll(line('.'))<CR>
- nnoremap <silent> <buffer> f :call <SID>Find('')<CR>
- nnoremap <silent> <buffer> F :call <SID>Find(b:find)<CR>
+ nnoremap <silent> <buffer> f :call <SID>Find(line('.'),'')<CR>
+ nnoremap <silent> <buffer> F :call <SID>Find(line('.'),b:find)<CR>
nnoremap <silent> <buffer> n :call <SID>FindNext()<CR>
nnoremap <silent> <buffer> N :call <SID>FindBackward()<CR>
nnoremap <silent> <buffer> u :call <SID>GoUpTree()<CR>
Please sign in to comment.
Something went wrong with that request. Please try again.