Skip to content

NvimTree aligns itself on the right the first time I open a file, but closing and opening the file again fixes it. #1553

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

Closed
YoNoSoyVictor opened this issue Aug 25, 2022 · 12 comments · Fixed by #1594
Labels
bug Something isn't working

Comments

@YoNoSoyVictor
Copy link

Description

Pretty much the title. I have configured NvimTree to start when opening a directory. When started this way, the first time I open a file NvimTree will align itself on the right side of the screen for some reason. Closing the file and opening it again will correctly re-align NvimTree on the left side.

Neovim version

NVIM v0.7.2
Build type: Release
LuaJIT 2.1.0-beta3

Operating system and version

5.19.2-arch1-1

nvim-tree version

e3353c4

Minimal config

-- PLUGINS
local Plug = vim.fn['plug#']
vim.call('plug#begin', '~/.config/nvim/plugged')

Plug 'kyazdani42/nvim-tree.lua'

vim.call('plug#end')



-- NVIM TREE CONFIG
require("nvim-tree").setup({
  sort_by = "name",
  open_on_setup = true,
  hijack_cursor = true,
  view = {
    side = "left",
    width = 20, 
    mappings = {
      list = {
        { key = "-", action = "dir_up" },
	{key = "+", action = "cd"}
      },
    },
  },
  renderer = {
    group_empty = true,
  },
  filters = {
    dotfiles = true,
  },
})

Steps to reproduce

  1. Open Nvim with a directory as a target.
  2. NvimTree will open in fullscreen mode as normal
  3. Choose a file and open it by pressing enter
  4. NvimTree will be positioned on the right side of the screen while the file will be opened on the left side
  5. Close the file with :q
  6. Now open it back again in the same way
  7. Now the file is on the right side while NvimTree is on the left, as it should

Expected behavior

NvimTree should be aligned to the left side the first time it is opened.

Actual behavior

No response

@YoNoSoyVictor YoNoSoyVictor added the bug Something isn't working label Aug 25, 2022
@alex-courtis
Copy link
Member

Confirmed

@SaBenBurra
Copy link

same issue

@sweger92
Copy link

Same on macOS 12.5.1

@pmoieni
Copy link

pmoieni commented Sep 2, 2022

confirmed on Neovim 0.7.2

@jjeejj
Copy link

jjeejj commented Sep 4, 2022

Same on macOS 12.0.1 (macOS Monterey)
NVIM v0.7.2

@megaconfidence
Copy link

Same issue on Linux using Neovim

@qwerty2501
Copy link

Same issue on Linux(Ubuntu 22.04)
NVIM v0.7.2

@toffee-makes-things
Copy link

Same issue on neovim on MacOS Ventura 13.0

@alex-courtis
Copy link
Member

fix branch: 1553-wrong-align-on-open-dir
PR: #1594

I would be very grateful if this fix were tested:

cd /path/to/nvim-tree.lua
git pull
git checkout 1553-wrong-align-on-open-dir

Checkout master when you are finished testing.;q

@megaconfidence
Copy link

This fixes the bug @alex-courtis. Thanks!

Kooha-2022-09-21-00-14-52.webm

@pleshevskiy
Copy link

@alex-courtis It works! Thank you!

@Souhail-JAMHOUR
Copy link

Souhail-JAMHOUR commented Sep 21, 2022

@alex-courtis thank you !! waiting for the master branch , #1594 fixed this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.