Skip to content
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

nvim-tree does not hijack and changes tab settings #562

Closed
FOSSilizedDaemon opened this issue Aug 13, 2021 · 4 comments
Closed

nvim-tree does not hijack and changes tab settings #562

FOSSilizedDaemon opened this issue Aug 13, 2021 · 4 comments

Comments

@FOSSilizedDaemon
Copy link

I have found two issues with nvim-tree that I am unsure how to resolve.

The first issue is that nvim-tree does not hijack netrw. I have tried using both a configuration and the defaults, but neither seem to work. I have been told this is still under development, but was unsure if it was something that should be working at the moment.

The second issue is that nvim-tree keeps changing my tab filchar and tab spacing settings. I have debugged this issue all the way down to being an issue caused by nvim-tree. As with the first issue I have tried using both the defaults and a configuration and neither work.

When I do test with a configuration I use the following:

-----------------
--- Nvim Tree ---
-----------------
-- Show nvim-tree on the left side.
plugin.nvim_tree_side = 'left'

-- Set width.
plugin.nvim_tree_width = 30

-- Set files that should be ignored.
plugin.nvim_tree_ignore = { '.git', '.gitignore', '.gitmodules', '.github', '.env', '.envrc', '.editorconfig',
                            '.busted', '.luacheckrc' }

-- Ignore files in '.gitignore'.
plugin.nvim_tree_gitignore = 1

-- Do not open nvim-tree when trying 'vim $DIR' or 'vim'.
plugin.nvim_tree_auto_open = 0

-- Do not close nvim-tree when it is the last window open.
plugin.nvim_tree_auto_close = 0

-- Set file types that should not cause nvim-tree to automatically open.
plugin.nvim_tree_auto_ignore_ft = { 'startify', 'dashboard' }

-- Close nvim-tree when a file is opened.
plugin.nvim_tree_quit_on_open = 1

-- Update the cursor when entering a buffer.
plugin.nvim_tree_follow = 1

-- Do not show ident markers when folders are open.
plugin.nvim_tree_indent_markers = 0

-- Show hidden files and directories.
plugin.nvim_tree_hide_dotfiles = 0

-- Enable file highlighting for git attributes.
plugin.nvim_tree_git_hl = 1

-- Enable folder and file icon highlighting for opened files and directories.
plugin.nvim_tree_highlight_opened_files = 1

-- Set the root folder modifier.
plugin.nvim_tree_root_folder_modifier = ':~'

-- Do not open nvim-tree when entering a new tab.
plugin.nvim_tree_tab_open = 1

-- Resize nvim-tree when opening a file.
plugin.nvim_tree_auto_resize = 1

-- Disable netrw.
plugin.nvim_tree_disable_netrw = 1

-- Use nvim-tree instead of netrw when opening a directory.
plugin.nvim_tree_hijack_netrw = 1

-- Append a trailing '/' for folder names.
plugin.nvim_tree_add_trailing = 1

-- Compact folders that only contain a single folder into one node in the file tree.
plugin.nvim_tree_group_empty = 1

-- Show LSP diagnostics in signcolumn.
plugin.nvim_tree_lsp_diagnostics = 1

-- Enable window picker.
plugin.nvim_tree_disable_window_picker = 0

-- when moving the cursor in the tree position the cursor at the start of the file on the current line.
plugin.nvim_tree_hijack_cursor = 1

-- Add one space between icons and file names.
plugin.nvim_tree_icon_padding = ' '

-- Separator to use between symbolic links source and target.
plugin.nvim_tree_symlink_arrow = ' ➛ '

-- Update nvim-tree's current working directory when changing nvim's directory.
plugin.nvim_tree_update_cwd = 1

-- Change nvim-tree's current working direcgtory to that of the new buffer's.
plugin.nvim_tree_respect_buf_cwd = 1

-- List of filenames that gets highlighted with NvimTreeSpecialFile
-- plugin.nvim_tree_special_files = { 'README.md': 1, 'Makefile': 1, 'MAKEFILE': 1, 'setup.py': 1, }

-- Icon types to show.
-- plugin.nvim_tree_show_icons = { 'git': 1, 'folders': 1, 'files': 1, 'folder_arrows': 1, }

Note: plugin = vim.g*

@kyazdani42
Copy link
Member

hello,

  1. i think you might be running the setup too late (if you lazy load for instance) which can lead to undesirable behavior. The setup of the plugin is being worked on indeed but it might take some time.
  2. i'm not sure how nvim-tree could affect the fillchar because i only use setlocal on the nvim-tree's window which should not affect anything else. Although i override the VertSplit colo group with NvimTreeVertSplit which you might be able to customize to your liking.

@nguyenvukhang
Copy link
Contributor

@FOSSilizedDaemon, when you say that nvim-tree doesn't hijack netrw, do you mean when you run :NvimTreeToggle or when you launch neovim with nvim or nvim dir where dir is a directory?

Because if it's the second case, then this:

-- Do not open nvim-tree when trying 'vim $DIR' or 'vim'.
plugin.nvim_tree_auto_open = 0

is the conflicting setting. set it to 1 to have nvim-tree open when you launch nvim alone or in a directory.

@FOSSilizedDaemon
Copy link
Author

hello,

  1. i think you might be running the setup too late (if you lazy load for instance) which can lead to undesirable behavior. The setup of the plugin is being worked on indeed but it might take some time.
  2. i'm not sure how nvim-tree could affect the fillchar because i only use setlocal on the nvim-tree's window which should not affect anything else. Although i override the VertSplit colo group with NvimTreeVertSplit which you might be able to customize to your liking.

My apologies for the late reply, university has started again so I am running on over drive. It seems the issue with fillchar was due to a configuration bug I introduced myself with something else. Thank you for your response.

@FOSSilizedDaemon
Copy link
Author

@FOSSilizedDaemon, when you say that nvim-tree doesn't hijack netrw, do you mean when you run :NvimTreeToggle or when you launch neovim with nvim or nvim dir where dir is a directory?

Because if it's the second case, then this:

-- Do not open nvim-tree when trying 'vim $DIR' or 'vim'.
plugin.nvim_tree_auto_open = 0

is the conflicting setting. set it to 1 to have nvim-tree open when you launch nvim alone or in a directory.

I can't believe I overlooked that! Thank you so much all is working as expected now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants