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

6 views
Skip to first unread message

Yegappan Lakshmanan

unread,
May 14, 2019, 12:17:11 PM5/14/19
to vim_dev, vim...@googlegroups.com
Hi,

On Sat, May 11, 2019 at 10:12 AM Manuel Ortega <manny...@gmail.com> 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.

Regards,
Yegappan



>
> 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
>
Reply all
Reply to author
Forward
0 new messages