Skip to content

Instantly share code, notes, and snippets.

@zerowidth
Created September 4, 2013 17:20
Show Gist options
  • Save zerowidth/6439993 to your computer and use it in GitHub Desktop.
Save zerowidth/6439993 to your computer and use it in GitHub Desktop.
filenames + clipboard + vim
""" 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