LunarVim / LunarVim

🌙 LunarVim is an IDE layer for Neovim. Completely free and community driven.
https://www.lunarvim.org
GNU General Public License v3.0
18.04k stars 1.5k forks source link

It is not possible to configure nvim-tree, the configuration is either ignored or overridden #2515

Closed danielo515 closed 2 years ago

danielo515 commented 2 years ago

Problem description

Hello. I'm trying to configure lvim-tree to my likings, and it is being very very hard. What I want to setup is permanent indent makers. Currently by default they only show when the window has focus, and that makes me hard to navigate it visually when it is not.

Below is the specific configuration that is shown on nvim-tree docs. None of them works with current stable version of nvim. I don't know if latest fixes in nvim-tree file have fixed the problem for at least for scenario 2 below, but it should work for 1 and 2.

None of this works, and at least one should:

-- Option 1 raw on config.lua
    lvim.builtin.nvimtree.setup.renderer = {
        indent_markers = {
            enable = true,
            icons = {
                corner = "‚îî ",
                edge = "│ ",
                none = "  ",
            },
        },
    }
-- Option 2 inside the callback function, using setup
lvim.builtin.nvimtree.on_config_done = function()
    require("nvim-tree").setup({
        renderer = {
            indent_markers = {
                enable = true,
                icons = {
                    corner = "‚îî ",
                    edge = "│ ",
                    none = "  ",
                },
            },
        },
    })
   -- Option 3 inside callback function, overriding setup table sections
    lvim.builtin.nvimtree.setup.renderer = {
        indent_markers = {
            enable = true,
            icons = {
                corner = "‚îî ",
                edge = "│ ",
                none = "  ",
            },
        },
    }
end

However, if after lvim has boot up I run :lua lvim.builtin.nvimtree.on_config_done() then the configuration is applied correctly and persist for the entire session. So this is a boot order problem or some other thing

LunarVim version

f41edc6

Neovim version (>= 0.6.1)

NVIM v0.7.0

Operating system/version

macOS 12.1

Relevant log output

hop: require("hop.health").check()
========================================================================
  - ERROR: Failed to run healthcheck for "hop" plugin. Exception:
    function health#check, line 20
    Vim(eval):E5108: Error executing lua ...arvim/site/pack/packer/start/hop.nvim/lua/hop/health.lua:13: attempt to index field 'opts' (a nil value)
    stack traceback:
    ...arvim/site/pack/packer/start/hop.nvim/lua/hop/health.lua:13: in function 'check'
    [string "luaeval()"]:1: in main chunk

null-ls: require("null-ls.health").check()
========================================================================
  - ERROR: eslint: the command "eslint" is not executable.
  - OK: stylua: the command "stylua" is executable.
  - ERROR: eslint: the command "eslint" is not executable.

nvim: health#nvim#check
========================================================================
## Configuration
  - OK: no issues found

## Performance
  - OK: Build type: Release

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=^H
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $TERM_PROGRAM='tmux'
  - INFO: $COLORTERM='truecolor'

## tmux
  - OK: escape-time: 0
  - INFO: Checking stuff
  - OK: focus-events: on
  - INFO: $TERM: xterm-256color
  - INFO: default-terminal: tmux-256color
  - ERROR: $TERM differs from the tmux `default-terminal` setting. Colors might look wrong.
    - ADVICE:
      - $TERM may have been set by some rc (.bashrc, .zshrc, ...).

nvim-lsp-installer: require("nvim-lsp-installer.health").check()
========================================================================
## nvim-lsp-installer report
  - OK: neovim version >= 0.6.0
  - WARNING: **Composer**: not available
  - WARNING: **PHP**: not available
  - WARNING: **julia**: not available
  - OK: **bash**: `GNU bash, version 3.2.57(1)-release (arm64-apple-darwin21)`
  - OK: **tar**: `bsdtar 3.5.1 - libarchive 3.5.1 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8 `
  - OK: **gzip**: `Apple gzip 353.100.22`
  - OK: **curl**: `curl 7.79.1 (x86_64-apple-darwin21.0) libcurl/7.79.1 (SecureTransport) LibreSSL/3.3.5 zlib/1.2.11 nghttp2/1.45.1`
  - OK: **python3**: `Python 3.9.12`
  - OK: **node**: `v18.0.0`
  - OK: **Ruby**: `ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]`
  - OK: **Go**: `go version go1.17.8 darwin/arm64`
  - OK: **sh**: `Ok`
  - WARNING: **java**: not available
  - WARNING: **javac**: not available
  - OK: **wget**: `GNU Wget 1.21.3 built on darwin21.3.0.`
  - OK: **RubyGem**: `3.0.3.1`
  - OK: **pip3**: `pip 22.0.4 from /opt/homebrew/lib/python3.9/site-packages/pip (python 3.9)`
  - OK: **npm**: `8.6.0`

nvim-treesitter: require("nvim-treesitter.health").check()
========================================================================
## Installation
  - OK: `tree-sitter` found 0.20.6 (ccd6bf554d922596ce905730d98a77af368bba5c) (parser generator, only needed for :TSInstallFromGrammar)
  - OK: `node` found v18.0.0 (only needed for :TSInstallFromGrammar)
  - OK: `git` executable found.
  - OK: `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
    Version: Apple clang version 13.1.6 (clang-1316.0.21.2)
  - OK: Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.

## Parser/Features H L F I J
  - json           ‚úì ‚úì ‚úì ‚úì . 
  - vim            ‚úì ‚úì . . ‚úì 
  - lua            ‚úì ‚úì ‚úì ‚úì ‚úì 
  - css            ‚úì . ‚úì ‚úì ‚úì 
  - java           ‚úì ‚úì . ‚úì ‚úì 
  - bash           ‚úì ‚úì ‚úì . ‚úì 
  - python         ‚úì ‚úì ‚úì ‚úì ‚úì 
  - yaml           ‚úì ‚úì ‚úì ‚úì ‚úì 
  - rust           ‚úì ‚úì ‚úì ‚úì ‚úì 
  - c              ‚úì ‚úì ‚úì ‚úì ‚úì 
  - javascript     ‚úì ‚úì ‚úì ‚úì ‚úì 
  - tsx            ‚úì ‚úì ‚úì ‚úì ‚úì 
  - typescript     ‚úì ‚úì ‚úì ‚úì ‚úì 

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang}

provider: health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: pbcopy

## Python 3 provider (optional)
  - INFO: `g:python3_host_prog` is not set.  Searching for python3 in the environment.
  - INFO: Multiple python3 executables found.  Set `g:python3_host_prog` to avoid surprises.
  - INFO: Executable: /opt/homebrew/bin/python3
  - INFO: Other python executable: /usr/bin/python3
  - INFO: Python version: 3.9.12
  - INFO: pynvim version: 0.4.3
  - OK: Latest pynvim is installed.

## Python virtualenv
  - OK: no $VIRTUAL_ENV

## Ruby provider (optional)
  - INFO: Ruby: ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]
  - WARNING: `neovim-ruby-host` not found.
    - ADVICE:
      - Run `gem install neovim` to ensure the neovim RubyGem is installed.
      - Run `gem environment` to ensure the gem bin directory is in $PATH.
      - If you are using rvm/rbenv/chruby, try "rehashing".
      - See :help |g:ruby_host_prog| for non-standard gem installations.
      - You may disable this provider (and warning) by adding `let g:loaded_ruby_provider = 0` to your init.vim

## Node.js provider (optional)
  - INFO: Node.js: v18.0.0
  - INFO: Nvim node.js host: /Users/danielo/.config/yarn/global//node_modules/neovim/bin/cli.js
  - OK: Latest "neovim" npm/yarn package is installed: 4.10.1

## Perl provider (optional)
  - WARNING: "Neovim::Ext" cpan module is not installed
    - ADVICE:
      - See :help |provider-perl| for more information.
      - You may disable this provider (and warning) by adding `let g:loaded_perl_provider = 0` to your init.vim

targets: health#targets#check
========================================================================
  - OK: No conflicting mappings found

telescope: require("telescope.health").check()
========================================================================
## Checking for required plugins
  - OK: plenary installed.
  - OK: nvim-treesitter installed.

## Checking external dependencies
  - OK: rg: found ripgrep 13.0.0
  - WARNING: fd: not found. Install [sharkdp/fd](https://github.com/sharkdp/fd) for extended capabilities

## ===== Installed extensions =====

## Telescope Extension: `command_palette`
  - INFO: No healthcheck provided

## Telescope Extension: `file_browser`
  - INFO: No healthcheck provided

## Telescope Extension: `frecency`
  - INFO: No healthcheck provided

## Telescope Extension: `fzf`
  - INFO: No healthcheck provided

## Telescope Extension: `harpoon`
  - INFO: No healthcheck provided

## Telescope Extension: `lazygit`
  - INFO: No healthcheck provided

## Telescope Extension: `luasnip`
  - INFO: No healthcheck provided

## Telescope Extension: `notify`
  - INFO: No healthcheck provided

## Telescope Extension: `packer`
  - INFO: No healthcheck provided

## Telescope Extension: `projects`
  - INFO: No healthcheck provided

vim.lsp: require("vim.lsp.health").check()
========================================================================
  - INFO: LSP log level : WARN
  - INFO: Log path: /Users/danielo/.cache/nvim/lsp.log
  - INFO: Log size: 134 KB

vim.treesitter: require("vim.treesitter.health").check()
========================================================================
  - INFO: Runtime ABI version : 14
  - OK: Loaded parser for bash: ABI version 13
  - OK: Loaded parser for c: ABI version 13
  - OK: Loaded parser for css: ABI version 13
  - OK: Loaded parser for java: ABI version 13
  - OK: Loaded parser for javascript: ABI version 13
  - OK: Loaded parser for json: ABI version 13
  - OK: Loaded parser for lua: ABI version 13
  - OK: Loaded parser for python: ABI version 13
  - OK: Loaded parser for rust: ABI version 13
  - OK: Loaded parser for tsx: ABI version 13
  - OK: Loaded parser for typescript: ABI version 13
  - OK: Loaded parser for vim: ABI version 13
  - OK: Loaded parser for yaml: ABI version 13

which_key: health#which_key#check
========================================================================
## WhichKey: checking conflicting keymaps
  - WARNING: conflicting keymap exists for mode **"n"**, lhs: **"<C-\\>"**
  - INFO: rhs: `:lua require'nvim-tmux-navigation'.NvimTmuxNavigateLastActive()<CR>`
  - WARNING: conflicting keymap exists for mode **"n"**, lhs: **"c"**
  - INFO: rhs: `<Cmd>lua require("packer.load")({'vim-surround'}, { keys = "c", prefix = "" }, _G.packer_plugins)<CR>`
  - WARNING: conflicting keymap exists for mode **"n"**, lhs: **"y"**
  - INFO: rhs: `<Cmd>lua require("packer.load")({'vim-surround'}, { keys = "y", prefix = "" }, _G.packer_plugins)<CR>`
  - WARNING: conflicting keymap exists for mode **"n"**, lhs: **"ys"**
  - INFO: rhs: `<Plug>Ysurround`
  - WARNING: conflicting keymap exists for mode **"n"**, lhs: **"yS"**
  - INFO: rhs: `<Plug>YSurround`
  - WARNING: conflicting keymap exists for mode **"n"**, lhs: **"gc"**
  - INFO: rhs: `<Cmd>lua require("Comment.api").call("toggle_linewise_op")<CR>g@`
  - WARNING: conflicting keymap exists for mode **"n"**, lhs: **"gb"**
  - INFO: rhs: `<Cmd>lua require("Comment.api").call("toggle_blockwise_op")<CR>g@`
  - WARNING: conflicting keymap exists for mode **"n"**, lhs: **"d"**
  - INFO: rhs: `<Cmd>lua require("packer.load")({'vim-surround'}, { keys = "d", prefix = "" }, _G.packer_plugins)<CR>`
  - WARNING: conflicting keymap exists for mode **"n"**, lhs: **" f"**
  - INFO: rhs: `<Cmd>lua require("which-key").execute(1)<CR>`
  - WARNING: conflicting keymap exists for mode **"v"**, lhs: **"a"**
  - INFO: rhs: `targets#e('o', 'a', 'a')`
  - WARNING: conflicting keymap exists for mode **"v"**, lhs: **"i"**
  - INFO: rhs: `targets#e('o', 'i', 'i')`
  - WARNING: buffer-local keymap overriding global for mode **"n"**, buf: 0, lhs: **"<leader>sC"**
  - INFO: old rhs: `<cmd>Telescope commands<cr>`
  - INFO: new rhs: `<cmd>Telescope command_history<cr>`
  - WARNING: buffer-local keymap overriding global for mode **"n"**, buf: 0, lhs: **"<leader>sc"**
  - INFO: old rhs: `<cmd>Telescope colorscheme<cr>`
  - INFO: new rhs: `<cmd>Telescope commands<cr>`
  - WARNING: buffer-local keymap overriding global for mode **"n"**, buf: 0, lhs: **"<leader>gs"**
  - INFO: old rhs: `<cmd>lua require 'gitsigns'.stage_hunk()<cr>`
  - INFO: new rhs: `<cmd>lua require 'gitsigns'.stage_buffer()<cr>`
  - WARNING: buffer-local keymap overriding global for mode **"n"**, buf: 0, lhs: **"<leader>gg"**
  - INFO: old rhs: `<cmd>lua require('lvim.core.terminal')._exec_toggle({ cmd = 'lazygit', count = 101, direction = 'float'})<CR>`
  - INFO: new rhs: `<cmd>lua require 'lazygit'.lazygit()<cr>`
  - WARNING: buffer-local keymap overriding global for mode **"n"**, buf: 0, lhs: **"<leader>gd"**
  - INFO: old rhs: `<cmd>Gitsigns diffthis HEAD<cr>`
  - INFO: new rhs: `<cmd>DiffviewOpen<cr>`


### Screenshots

_No response_
abzcoding commented 2 years ago

i just added the first option and it worked 🤔

Screen Shot 2022-04-25 at 2 33 23 PM
danielo515 commented 2 years ago

i just added the first option and it worked 🤔

On the screenshot you have the nvimtree window focused. Have you tried to move the cursor to some other window? By the way, seems some weird unicode is going on on my pasted text.

Here is a gif that explains the problem better than words. At first you can see how only renders the marks when I'm focusing the nvimtree window, later on the gif, I execute the on_config_done function and from there it works as it should: ![Uploading Kapture 2022-04-25 at 17.07.53.gif…]()

Maybe you're on the rolling one? I'm using the stable lvim version.

abzcoding commented 2 years ago

i am indeed on the rolling branch, also it doesn't matter which window i'm focused on, it works everytime

Screen Shot 2022-04-25 at 9 09 11 PM

on another note, it seems like your gif has not been uploaded 😅

Screen Shot 2022-04-25 at 9 09 45 PM
danielo515 commented 2 years ago

on another note, it seems like your gif has not been uploaded 😅

Dam it, let's see if it works this time

Kapture 2022-04-25 at 17 07 53

abzcoding commented 2 years ago

why does that look like indent-blankline plugin 😅

abzcoding commented 2 years ago

can you run this?

git -C ~/.local/share/lunarvim/site/pack/packer/start/nvim-tree.lua rev-parse HEAD
danielo515 commented 2 years ago

why does that look like indent-blankline plugin 😅

Because I have it installed. That was my first guess, that it only appears because the indent-blankline plugin was adding it. Do you think that it may be also overriding it when it loses focus? Dam, if that is the case then it is super embarrassing

abzcoding commented 2 years ago

Because I have it installed. That was my first guess, that it only appears because the indent-blankline plugin was adding it. Do you think that it may be also overriding it when it loses focus? Dam, if that is the case then it is super embarrassing

i mean you can ignore it in indent-blankline setup using filetype_exclude and see if it helps or not

my config for ref https://github.com/abzcoding/lvim/blob/090d8a3587dff316b16d409ef41259be80824317/lua/user/indent_blankline.lua#L31

danielo515 commented 2 years ago

Just setup like this (because I was not sure where should I put the filetype)

{
        "lukas-reineke/indent-blankline.nvim",
        event = "BufRead",
        setup = function()
            vim.g.indentLine_enabled = 1
            vim.g.indent_blankline_char = "|" -- actual character here, not this
            vim.g.indent_blankline_filetype_exclude = { "help", "terminal", "dashboard", "NvimTree" }
            vim.g.indent_blankline_buftype_exclude = { "terminal", "NvimTree" }
            vim.g.indent_blankline_show_trailing_blankline_indent = false
            vim.g.indent_blankline_show_first_indent_level = false
        end,
    }

Now indeed it does not show any indent guides. I had to reload lvim config 3 times, run packer sync and close and ope 3 times lvim. Why is it that hard to get some settings to apply?

EDIT: the good part is that now I have a nice indent-blankline config 😄

abzcoding commented 2 years ago

it should be better in the rolling branch, since we've merged this -> https://github.com/LunarVim/LunarVim/commit/0481ec8dddf4bd8ed81c10ae98807fec97f6f872

danielo515 commented 2 years ago

it should be better in the rolling branch, since we've merged this -> 0481ec8

I checked the diff and I don't see anything that could make this situation better. To what were you referring to?

abzcoding commented 2 years ago

I checked the diff and I don't see anything that could make this situation better. To what were you referring to?

i meant this part 😅 sorry for the confusion

I had to reload lvim config 3 times, run packer sync and close and ope 3 times lvim. Why is it that hard to get some settings to apply?

so the issue still persists?

can you run this then?

git -C ~/.local/share/lunarvim/site/pack/packer/start/nvim-tree.lua rev-parse HEAD
danielo515 commented 2 years ago

so the issue still persists?

Yes, but just because I'm still on the stable branch. I don't have the time to test the rolling one and get errors on it and not be able to work. However, after updating my indent-blankline.nvim config now I can't get the old method (manually calling the on_config_done function) to work either.

abzcoding commented 2 years ago

yes that was indent-blankline showing up, it had nothing to do with calling the on_config_done that is why i'm asking to you to run

git -C ~/.local/share/lunarvim/site/pack/packer/start/nvim-tree.lua rev-parse HEAD

because i suspect the version of nvim-tree that you are using doesn't support indent_markers or sth

danielo515 commented 2 years ago

Oh, sorry I was not understanding you properly. This is the output of the command:

20797a8d74e68bce50b98455c76c5de250c6f0e5

On Tue, Apr 26, 2022 at 8:51 PM Abouzar Parvan @.***> wrote:

yes that was indent-blankline showing up, it had nothing to do with calling the on_config_done that is why i'm asking to you to run

git -C ~/.local/share/lunarvim/site/pack/packer/start/nvim-tree.lua rev-parse HEAD

because i suspect the version of nvim-tree that you are using doesn't support indent_markers or sth

— Reply to this email directly, view it on GitHub https://github.com/LunarVim/LunarVim/issues/2515#issuecomment-1110138114, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARKJWMVURCBR2ON7MWTNR3VHA3J5ANCNFSM5UHYEITA . You are receiving this because you authored the thread.Message ID: @.***>

--

https://danielorodriguez.com

abzcoding commented 2 years ago

Oh, sorry I was not understanding you properly.

yep packer has fucked up i think, that commit is from 40 days ago

latest version in rolling branch is https://github.com/LunarVim/LunarVim/blob/3de829e76ed3d90b25250b1ab76f6425146af9d2/snapshots/default.json#L68-L70

and the latest on master is https://github.com/LunarVim/LunarVim/blob/ad5eeaf6ad12cf05e4b936690bf78bc53827b12c/snapshots/default.json#L68-L70


if :LvimCoreSync didn't fix the issue, you might need to cd into that dir and manullay update the repo

danielo515 commented 2 years ago

thank you, will try that. What does LvimCoreSync do exactly?

abzcoding commented 2 years ago

it will make sure that the version of your plugins is synced with the one specified in the snapshot https://github.com/LunarVim/LunarVim/blob/dd65e285656a5c46c52144f4e082c8e2d1d95757/lua/lvim/plugin-loader.lua#L129-L139

and snapshots are here https://github.com/LunarVim/LunarVim/blob/dd65e285656a5c46c52144f4e082c8e2d1d95757/snapshots/default.json#L1-L10

danielo515 commented 2 years ago

Is that a new feature? I get that LvimCoreSync is not an editor command. I guess I'll have to make a pull manually. By the way, will you backport the fix for the packer commit snapshot? It is broken on stable

On Thu, Apr 28, 2022 at 3:21 PM Abouzar Parvan @.***> wrote:

it will make sure that the version of your plugins is synced with the one specified in the snapshot

https://github.com/LunarVim/LunarVim/blob/dd65e285656a5c46c52144f4e082c8e2d1d95757/lua/lvim/plugin-loader.lua#L129-L139

and snapshots are here

https://github.com/LunarVim/LunarVim/blob/dd65e285656a5c46c52144f4e082c8e2d1d95757/snapshots/default.json#L1-L10

— Reply to this email directly, view it on GitHub https://github.com/LunarVim/LunarVim/issues/2515#issuecomment-1112196995, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARKJWNGTIZCP2RPHNULXYTVHKGG5ANCNFSM5UHYEITA . You are receiving this because you authored the thread.Message ID: @.***>

--

https://danielorodriguez.com

abzcoding commented 2 years ago

Is that a new feature? I get that LvimCoreSync is not an editor command. I guess I'll have to make a pull manually. By the way, will you backport the fix for the packer commit snapshot? It is broken on stable

hopefully, we'll do a stable release soon ( and backport those bug fixes - maybe after #2537) cc: @kylo252

danielo515 commented 2 years ago

Just got into the packer folder, did a manual checkout to master, pull and indeed the configuration works. Dam packer... Sorry for the inconvenience