Re: Window-local and Tab-local previous directories?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Re: Window-local and Tab-local previous directories?

Yegappan Lakshmanan

On Sat, May 11, 2019 at 10:12 AM Manuel Ortega <[hidden email]> wrote:

> On Friday, May 10, 2019 at 5:20:08 PM UTC-4, Bram Moolenaar wrote:
> > I think that's the best way we provide this functionality.  But I like
> > to hear from others.
> I think this is adding complexity, a maintenance burden, and yet another
> corner for corner-cases to hide in, all   for the sake of a *very* niche
> use-case.  (Has anybody complained about this yet in all the years of :lcd
> existing?)

When the ":cd -" or ":tcd -" or ":lcd -" commands are used, a user will
expect to go back to the previous directory. When a tab-local directory
is used, a user will expect that the previous current directory will be
the one before the last :tcd command used for the current tabpage. With
the current implementation, the previous directory will be the current
directory before invoking the last ":cd" or ":tcd" or ":lcd" command.
This may not be the expected directory.

For example, let us say you are using a separate tabpage for each
project.  You use the ":tcd" command to switch to the project specific
root directory in each tabpage. Now you change the directory in one of
the tabpages to look at some files inside the corresponding project. Now
the previous directory of all the other tabpages will also be changed.
If you go to some other tabpage and use the ":tcd -" command, the
current directory will be changed to that of the other project and not
the current project.  This may not be expected behavior.


> This seems to be exactly the sort of thing for which a user should just make
> some custom ":Lcd" or ":Tcd" that  e.g. uses the DirChanged autcommand event
> to store the value of getcwd() in some w:variable (or t:variable) for
> possible later use.
> -Manny

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

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 [hidden email].
To view this discussion on the web visit
For more options, visit