Permalink
Browse files

selecta in vim limits to 10k files, breadth-first

  • Loading branch information...
garybernhardt committed Jan 21, 2014
1 parent 61575fd commit 1f3e06b2c9b267c524de060ea5d263d68066eb08
Showing with 9 additions and 2 deletions.
  1. +2 −2 .vimrc
  2. +7 −0 bin/breadth-first-find
View
4 .vimrc
@@ -498,13 +498,13 @@ endfunction
" Find all files in all non-dot directories starting in the working directory.
" Fuzzy select one of those. Open the selected file with :e.
-nnoremap <leader>f :call SelectaCommand("find * -type f", "", ":e")<cr>
+nnoremap <leader>f :call SelectaCommand("breadth-first-find * -type f \| head -10000", "", ":e")<cr>
function! SelectaIdentifier()
" Yank the word under the cursor into the z register
normal "zyiw
" Fuzzy match files in the current directory, starting with the word under
" the cursor
- call SelectaCommand("find * -type f", "-s " . @z, ":e")
+ call SelectaCommand("breadth-first-find * -type f \| head -10000", "-s " . @z, ":e")
endfunction
nnoremap <c-g> :call SelectaIdentifier()<cr>
View
@@ -0,0 +1,7 @@
+#!/bin/bash
+depth=0
+
+while find $* -mindepth $depth -maxdepth $depth | grep '.'
+do
+ depth=$((depth + 1))
+done

0 comments on commit 1f3e06b

Please sign in to comment.