Skip to content

Working directory is wrong when launching Neovim by specifying a directory. #945

Closed
@guilhermerodz

Description

@guilhermerodz

OS
Ubuntu 20.04.3 LTS (Focal Fossa)

Neovim version
0.7.0-dev

Nvim-tree version
ea92e7b

Describe the bug
Since 8a6c7ba, the working directory is no longer synced EVEN if I specify a directory when launching Neovim.

(dropped a few guesses of mine at the end of this issue)

To Reproduce

On Terminal:

$ cd ~/a # navigate into folder A
$ nvim ~/b # attempt to launch nvim on folder B

Inside Neovim:

:pwd
/home/guilhermerodz/a << Should be "b" not "a".

NOTE: This behaviour wasn't happening before this commit: 8a6c7ba.

Expected behavior

  • When launching Neovim, nvim-tree should automatically set the current working directory if specified in the command line.

  • MAIN GUESS: I know there are very recent refactors. I think this issue is related to nvim-tree/explorer/init.lua. The Explorer.new(cwd) method is called. A new Explorer instance is created, then the cwd variable is set. But this logic causes Explorer's cwd to be unsynced with Neovim's current working directory, which remains unchanged.
  • A NOTE: I took some time to compare our updated version to an older version. In the current version, at nvim-tree/actions/change-dir, the M.fn method stopped being called at startup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions