Saturday, August 2, 2014

Re: external command not using current directory

On 03/08/14 05:11, Wis Macomson wrote:
> What I want is for external commands (":!") to run in the current
> directory. With "autochdir", that should be the directory where my file
> is, right?
>
> If I ":cwd", I get the expected current directory. If I "!!ls", I do
> not get the expected contents of the current directory, rather, the
> directory two levels up.
>
> This is a new machine, and I'm sure my _vimrc is the same as on previous
> machines. This on a Windoze 7 Pro machine and I'm running Cygwin. Are
> there some DOS environment variables, or some other behind the scenes
> setup that I need to configure?
>
>
> Thanks,
>
> -wis

'autochdir' does not always the way you expect, in particular with the
netrw plugin, which works better when that option is not set when it
opens new windows.

What I recommend is to :lcd to the directory you want current for the
current editfile and all its children, and leave it there. For instance,
when editing Vim source, something like:

:tabnew ~/.build/vim/vim74/vim/
:lcd %
:sv src
:pwd
/home/wis/.build/vim/vim74/vim
:!ls src " or :!ls %:h
:e feature.h

etc.



Best regards,
Tony.
--
"As in 1925, creationists are not battling for religion. They have been
disowned by leading church men of all persuasions, for they debase
religion
even more than they misconstrue science. They are a motley collection to
be sure, but their core of practical support lies with the evangelical
right, and creationism is a mere stalking horse or subsidiary issue in a
political program...The enemy is not fundamentalism; it is intolerance.
In this case, the intolerance is perverse since it masquerades under the
'liberal' rhetoric of 'equal time'."
[Stephen J Gould]

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment