Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does "%:p:h" mean in VIM

Tags:

I know ':cd %:p:h ' will change the working directory to the dir for current editing file. But what's the magic in %:p:h ?

Thanks.

like image 960
Rocky Avatar asked Oct 12 '11 03:10

Rocky


People also ask

What is P Vim?

p puts text after the cursor, P puts text before the cursor.

How do I change the current directory in Vim?

Vim has an option for this. Here's the documentation: 'autochdir' 'acd' boolean (default off) global When on, Vim will change the current working directory whenever you open a file, switch buffers, delete a buffer or open/close a window. It will change to the directory containing the file which was opened or selected.

What is Vim silent?

<silent> tells vim to show no message when this key sequence is used. <leader> means the key sequence starts with the character assigned to variable mapleader -- a backslash, if no let mapleader = statement has executed yet at the point nmap executes.

How do I browse files in Vim?

The command :Explore opens the file explorer window. Select a file or directory name and press Enter to open that file or directory. (For example :e /home/user displays the contents of that directory.) To return to the explorer window, press Ctrl-^ (usually Ctrl-6).


1 Answers

oh, I get this link: http://vimdoc.sourceforge.net/htmldoc/cmdline.html#filename-modifiers

:p Make file name a full path.

:h Head of the file name (the last component and any separators removed)

like image 95
Rocky Avatar answered Oct 02 '22 18:10

Rocky