vim-dispatch icon indicating copy to clipboard operation
vim-dispatch copied to clipboard

unable to change pwd

Open justrajdeep opened this issue 10 years ago • 4 comments

Hi

i just started using dispatch so it might be a config issue also. this is what my makeprg is set to

:set makeprg?
 makeprg=`depth`/bin/nvmk -c . $*

I have autochdir set

when i launch :make! it runs make in the directory.

when i launch :Make! in headless mode it runs in the current directory.

but when i launch :Make! from a gvim opened from a tmux session it runs the make in some other location.

i was thinking if i can modify my makeprg to something like

makeprg=cd '%:p:h'  && `depth`/bin/nvmk -c . $*

please advice.

justrajdeep avatar Dec 11 '14 05:12 justrajdeep

Can you be more specific about the right/wrong directories? 'autochdir' is a nightmare to deal with but I wouldn't expect it to cause a problem here.

Putting cd in 'makeprg' can adversely affect Vim's error parsing because it doesn't know the directory the command is running in. I wouldn't recommend it. If it really proves necessary, a more robust hack is to chdir in quickfix autocommands.

tpope avatar Dec 11 '14 17:12 tpope

hi Tpope the tmux session was launched in the root of the project. and i am working inside a subdir. when i create a new window in tmux it is created in the project root and not the subdir. when i run :Make from the gvim, which is launched from tmux, it starts a new tmux window and before i can switch to it it gets closed. so i am not able to see what exactly the error message is. or what is happening.

But in headless mode since it does not have a tmux attached it somehow manages to launch the make in the gvim working dir, and that is exactly what my intention is.

Thanks.

justrajdeep avatar Dec 11 '14 19:12 justrajdeep

Hi Tpope,

I think i found the problem.

Starting from tmux 1.9 the directory create new-window has been changed

http://unix.stackexchange.com/questions/12032/create-new-window-with-current-directory-in-tmux

That might be why this behavior is observed.

justrajdeep avatar Dec 21 '14 05:12 justrajdeep

That's a pretty big feature to yank out from under people. But I'm not sure that's the root cause, as the script we generate begins with a cd. You should be able to confirm this by rummaging through tmp. Look at the files in the parent directory of :echo tempname().

tpope avatar Dec 21 '14 07:12 tpope