nvim-tree.lua icon indicating copy to clipboard operation
nvim-tree.lua copied to clipboard

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

Open YoNoSoyVictor opened this issue 1 year ago • 8 comments

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 avatar Aug 25 '22 14:08 YoNoSoyVictor

Confirmed

alex-courtis avatar Aug 27 '22 02:08 alex-courtis

same issue

SaBenBurra avatar Aug 29 '22 18:08 SaBenBurra

Same on macOS 12.5.1

sweger92 avatar Aug 30 '22 23:08 sweger92

confirmed on Neovim 0.7.2

pmoieni avatar Sep 02 '22 11:09 pmoieni

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

jjeejj avatar Sep 04 '22 10:09 jjeejj

Same issue on Linux using Neovim

megaconfidence avatar Sep 08 '22 01:09 megaconfidence

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

qwerty2501 avatar Sep 08 '22 03:09 qwerty2501

Same issue on neovim on MacOS Ventura 13.0

lambda-makes-things avatar Sep 14 '22 02:09 lambda-makes-things

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

alex-courtis avatar Sep 20 '22 00:09 alex-courtis

This fixes the bug @alex-courtis. Thanks!

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

megaconfidence avatar Sep 20 '22 23:09 megaconfidence

@alex-courtis It works! Thank you!

pleshevskiy avatar Sep 21 '22 05:09 pleshevskiy

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

Souhail-JAMHOUR avatar Sep 21 '22 12:09 Souhail-JAMHOUR