Created
September 4, 2013 17:20
-
-
Save zerowidth/6439993 to your computer and use it in GitHub Desktop.
filenames + clipboard + vim
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
""" copy filename of current file to clipboard | |
map <Leader>cf :silent exe '!echo -n % \| pbcopy'<CR>:echo bufname('%')<CR> | |
""" edit filename from clipboard | |
map <silent> <Leader>ef :call EditFromClipboard()<CR> | |
function EditFromClipboard() | |
let filename = expand(fnameescape(system('pbpaste'))) | |
if filereadable(filename) | |
exe 'edit ' . filename | |
else | |
echo 'not a file: ' . filename | |
endif | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment