Last Updated: June 24, 2016·
Tab completion when opening files in Vim
:edit %<Tab> to expand the file path relative to current window.
To expand the path, without the filename, use
:edit %:h<Tab> instead.
For full, absolute path expansion use:
Sometimes it can be useful to copy the absolute path of the file to open / operate on it somewhere else. I use most when I’m opening another Vim window in a separate display. As the path is copied into system buffer, opening the file is as simple as typing
noremap <silent> <F4> :let @+=expand("%:p")<CR>
Written by Wojtek Ryrych
Basic Vim commands - For getting started
Format JSON in vim
Have a fresh tip? Share with Coderwall community!
Post a tip
Best #Vim Authors
Sponsored by #native_company# — Learn More