Vim: Copy the currently edited file full path to the system Clipboard

Source: Internet
Author: User

Under Win, code debugging or VS is the most convenient, when using vs open exe, vs need to quickly locate the file, in source Insght, write a macro, with a shortcut key implementation. But how do you do it in vim? Looked for again, did not find out-of-the-box (perhaps their level is too shallow, not found), then use the script to write one yourself.

Add the following content to the _VIMRC.

function Getcurfilepath () let    cur_dir=getcwd () Let    cur_file_name=getreg (' percent ') let    dir_filename=cur_dir. "\". Cur_file_name    Echo dir_filename. "         Done "Call    setreg (' + ', dir_filename) endfunction

Finally define a shortcut key

Nnoremap <silent> <F9>: Call Getcurfilepath () <cr>

Now can F9 walk up, very convenient.


Vim: Copy the currently edited file full path to the system Clipboard

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.