-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow autochdir #19
Comments
P.S. I do agree, of course, to be the guinea pig if one is needed ^^ |
---deleted--- Sorry, had set autochdir in my vimrc, preventing Dirvish from working. Guesss these would be a nice feature, haha. Side note, would be great if some more docs on using Dirvish were included. |
@bobmonteverde more docs in addition to https://github.com/justinmk/vim-dirvish/blob/master/doc/dirvish.txt ? I do plan to add support for 'autochdir', though it's not high priority. |
Related to justinmk#19 Allow the :cd on autocmd emulation of autochdir to work with dirvish. Describe this workaround for autochdir-like behavior in the help. This change might be a first step towards autochdir, but it's not enough yet. The autocmd breaks dirvish when we try to force an alternate file because we're :cd-ing while dirvish is trying to do stuff and we end up with an empty buffername. This change tracks when we're in set_altbuf so the autocmd can be disabled during that region (using noau didn't work and replacing set_altbuf with keepalt everywhere didn't work either). Ideally, we detect if autochdir is enabled and re-enable it when we're clear of set_altbuf, but it doesn't work yet.
@soli: I tried that, but it's not so simple. I think because there are multiple places where dirvish "does it's thing?" I messed around with this for a bit and made idbrii/vim-dirvish/autochdir-workaround (see above). It's probably not pull-request worthy, but might be a starting point. |
@idbrii Thanks for looking at that. If |
Thanks @idbrii I'll have a look! |
s:set_altbuf is the main issue for my workaround, but there seem to be more problems with autochdir. I only tested it enough to see that it was still broken. |
Related to justinmk#19 Allow the :cd on autocmd emulation of autochdir to work with dirvish. Describe this workaround for autochdir-like behavior in the help. This change might be a first step towards autochdir, but it's not enough yet. The autocmd breaks dirvish when we try to force an alternate file because we're :cd-ing while dirvish is trying to do stuff and we end up with an empty buffername. This change tracks when we're in set_altbuf so the autocmd can be disabled during that region (using noau didn't work and replacing set_altbuf with keepalt everywhere didn't work either). Ideally, we detect if autochdir is enabled and re-enable it when we're clear of set_altbuf, but it doesn't work yet.
Related to justinmk#19 Allow the :cd on autocmd emulation of autochdir to work with dirvish. Describe this workaround for autochdir-like behavior in the help. This change might be a first step towards autochdir, but it's not enough yet. The autocmd breaks dirvish when we try to force an alternate file because we're :cd-ing while dirvish is trying to do stuff and we end up with an empty buffername. This change tracks when we're in set_altbuf so the autocmd can be disabled during that region (using noau didn't work and replacing set_altbuf with keepalt everywhere didn't work either). Ideally, we detect if autochdir is enabled and re-enable it when we're clear of set_altbuf, but it doesn't work yet.
+1 |
1 similar comment
+1 |
Related to justinmk#19 Allow the :cd on autocmd emulation of autochdir to work with dirvish. Describe this workaround for autochdir-like behavior in the help. This change might be a first step towards autochdir, but it's not enough yet. The autocmd breaks dirvish when we try to force an alternate file because we're :cd-ing while dirvish is trying to do stuff and we end up with an empty buffername. This change tracks when we're in set_altbuf so the autocmd can be disabled during that region (using noau didn't work and replacing set_altbuf with keepalt everywhere didn't work either). Ideally, we detect if autochdir is enabled and re-enable it when we're clear of set_altbuf, but it doesn't work yet.
You can use set noautochdir
augroup auto_ch_dir
autocmd!
autocmd BufEnter * silent! lcd %:p:h
augroup END |
Related to justinmk#19 Allow the :cd on autocmd emulation of autochdir to work with dirvish. Describe this workaround for autochdir-like behavior in the help. This change might be a first step towards autochdir, but it's not enough yet. The autocmd breaks dirvish when we try to force an alternate file because we're :cd-ing while dirvish is trying to do stuff and we end up with an empty buffername. This change tracks when we're in set_altbuf so the autocmd can be disabled during that region (using noau didn't work and replacing set_altbuf with keepalt everywhere didn't work either). Ideally, we detect if autochdir is enabled and re-enable it when we're clear of set_altbuf, but it doesn't work yet.
This conflicts when using Shdo since its changes the directory. |
A fix for function! dirvish#shdo(paths, cmd) abort
…
endfor
call insert(lines, 'cd '.shellescape(dir)) " ++
execute 'silent split' tmpfile '|' (2==exists(':lcd')?('lcd '.dir):'')
… |
That reminds me to send PR #200! It a different fix for shdo: write the |
Would it be possible to save
&autochdir
, unset it while Dirvish does its thing and restore it afterwards, with the rest of the "state" ?The text was updated successfully, but these errors were encountered: