Skip to content

Instantly share code, notes, and snippets.

@rhowardiv
Last active December 26, 2015 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rhowardiv/7142092 to your computer and use it in GitHub Desktop.
Save rhowardiv/7142092 to your computer and use it in GitHub Desktop.
Add length sorting to selecta inputs
$ git diff HEAD^
diff --git a/vimrc b/vimrc
index cada33f..18f0b56 100644
--- a/vimrc
+++ b/vimrc
@@ -275,15 +275,15 @@ 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 \| lsort", "", ":e")<cr>
+nnoremap <leader>f :call SelectaCommand("find * -type f", "", ":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 \| lsort", "-s " . @z, ":e")
+ call SelectaCommand("find * -type f", "-s " . @z, ":e")
endfunction
nnoremap <leader>g :call SelectaIdentifier()<cr>
-nnoremap <leader>t :call SelectaCommand("cut -f1 tags \| uniq \| lsort", "", ":tj ")<cr>
+nnoremap <leader>t :call SelectaCommand("cut -f1 tags \| uniq", "", ":tj ")<cr>
$ cat $(which lsort)
#!/bin/bash
cat | awk '{ print length($0),$0 }' | sort -n | sed 's/^[0-9]\+ //'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment