Fandom

Vim Tips Wiki

Copy current file to another location from within vim

Redirected from VimTip230

1,624pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Tip 230 Printable Monobook Previous Next

created April 2, 2002 · complexity basic · author Tabrez Syed · version 5.7


I work on jsp pages in my source tree but I have to copy the jsp files over to the tomcat directory in order to view my changes.The following mapping will copy the file being edited to another location.

command Cpage silent !cp '%:p' "c:/Progra~1/Tomcat/webapps/console/pages/%"

Explanation:

% refers to the current buffer
%:p refers to the path to the file
silent suppresses the command prompt window.

Usage:

:Cpage

CommentsEdit

Why not

:w %:t c:/Progra~1/Tomcat/webapps/console/pages/

on a windows environment eg. to tmp dir:

:silent !copy %:p "c:\tmp\"

Also on Fandom

Random Wiki