Created
February 8, 2016 15:54
-
-
Save mrbalihai/66833535d78be19b659d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Strip the newline from the end of a string | |
function! Chomp(str) | |
return substitute(a:str, '\n$', '', '') | |
endfunction | |
" Find a file and pass it to cmd | |
function! DmenuOpen(cmd) | |
let fname = Chomp(system("git ls-files | rofi -dmenu -i -l 20 -p " . a:cmd)) | |
if empty(fname) | |
return | |
endif | |
execute a:cmd . " " . fname | |
endfunction | |
map <c-f><c-f> :call DmenuOpen("e")<cr> | |
map <c-f><c-v> :call DmenuOpen("vsplit")<cr> | |
map <c-f><c-h> :call DmenuOpen("split")<cr> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works great!
in my case i remapped the keys like this: