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.
p puts text after the cursor, P puts text before the cursor.
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.
<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.
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).
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With