diff options
author | kylo252 <[email protected]> | 2021-06-26 19:37:24 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2021-06-26 13:37:24 -0400 |
commit | dc6196ee295fa92b1a20a436be5d539f44475e29 (patch) | |
tree | 8022a8a1fa01f79b9f71a68adb4d5d451ebbf530 /lua/lv-nvimtree/init.lua | |
parent | 918a26ebc070ba21e5073b85a0addac867057617 (diff) |
Fix barbar integration with nvim-tree (#523)
- Add an offset to display NvimTree buffer in barbar.
It won't work correctly if you enable "vim.g.nvim_tree_quit_on_open".
- Add which-key support to barbar to enable missing mappings.
Co-authored-by: Christian Chiarulli <[email protected]>
Diffstat (limited to 'lua/lv-nvimtree/init.lua')
-rw-r--r-- | lua/lv-nvimtree/init.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lua/lv-nvimtree/init.lua b/lua/lv-nvimtree/init.lua index 934a321b..4b8c3973 100644 --- a/lua/lv-nvimtree/init.lua +++ b/lua/lv-nvimtree/init.lua @@ -20,6 +20,7 @@ vim.g.nvim_tree_indent_markers = 1 -- "0 by default, this option shows indent ma vim.g.nvim_tree_follow = 1 -- "0 by default, this option allows the cursor to be updated when entering a buffer vim.g.nvim_tree_auto_close = O.auto_close_tree -- 0 by default, closes the tree when it's the last window vim.g.nvim_tree_auto_ignore_ft = 'startify' --empty by default, don't auto open tree on specific filetypes. +vim.g.nvim_tree_quit_on_open = 0 -- this doesn't play well with barbar local tree_cb = require'nvim-tree.config'.nvim_tree_callback vim.g.nvim_tree_bindings = { -- ["<CR>"] = ":YourVimFunction()<cr>", @@ -63,3 +64,19 @@ vim.g.nvim_tree_icons = { git = {unstaged = "", staged = "✓", unmerged = "", renamed = "➜", untracked = ""}, folder = {default = "", open = "", empty = "", empty_open = "", symlink = ""} } + +local view = require'nvim-tree.view' + +local _M = {} +_M.toggle_tree = function() + if view.win_open() then + require'nvim-tree'.close() + require'bufferline.state'.set_offset(0) + else + require'bufferline.state'.set_offset(31, 'File Explorer') + require'nvim-tree'.find_file(true) + end + +end + +return _M |