Thursday, August 11, 2011

Re: "Edit with vim": Set working directory as folder containing editted file

On 11/08/11 23:19, Paul wrote:
> I have gvim 7.3 installed on Windows 7 Enterprise (32-bit). When I
> select a bunch of files, right-click, and choose "Edit with single
> Vim", the working directory for vim becomes "Symantec Endpoint
> Protection" rather than the folder that contains the selected files.
> Is there a simple tweak that I can make to ensure that the working
> directory is the same as the folder containing the editted files?
>

Possibility 1: (in Vimrc)

au VimEnter * silent! cd %:h

Note: This will always cd to the directory containing the last edited
file (if any), even if _not_ using Edit with Vim

Possibility 2: (at the keyboard) type

:cd %:h

Note: this is not automatic, you have to do it every time

Possibility 3: construct a keyboard shortcut and/or a .bat file which
would execute

gvim -c 'silent! cd %:h'

followed by all your file names

Note: This is not a complete solution, the detail is left to the student
as an exercise.


I tested none of them, and I am not on Windows (i.e., no "Edit with Vim
menu here).


Best regards,
Tony.
--
Justice, n.:
A decision in your favor.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: