switch from nvimtree to neotree
parent
615e8a4aae
commit
690372bd88
@ -1,42 +0,0 @@
|
||||
local function open_nvim_tree(data)
|
||||
-- buffer is a real file on the disk
|
||||
local real_file = vim.fn.filereadable(data.file) == 1
|
||||
|
||||
-- buffer is a [No Name]
|
||||
local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
|
||||
|
||||
if not real_file and not no_name then
|
||||
return
|
||||
end
|
||||
|
||||
-- open the tree, find the file but don't focus it
|
||||
require("nvim-tree.api").tree.toggle({ focus = false, find_file = true, })
|
||||
end
|
||||
|
||||
-- Auto open
|
||||
-- vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
|
||||
|
||||
-- Auto close
|
||||
vim.api.nvim_create_autocmd({ "QuitPre" }, {
|
||||
callback = function() vim.cmd("NvimTreeClose") end,
|
||||
})
|
||||
|
||||
-- Go to last used hidden buffer when deleting a buffer
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
nested = true,
|
||||
callback = function()
|
||||
-- Only 1 window with nvim-tree left: we probably closed a file buffer
|
||||
if #vim.api.nvim_list_wins() == 1 and require("nvim-tree.utils").is_nvim_tree_buf() then
|
||||
local api = require('nvim-tree.api')
|
||||
-- Required to let the close event complete. An error is thrown without this.
|
||||
vim.defer_fn(function()
|
||||
-- close nvim-tree: will go to the last hidden buffer used before closing
|
||||
api.tree.toggle({ find_file = true, focus = true })
|
||||
-- re-open nivm-tree
|
||||
api.tree.toggle({ find_file = true, focus = true })
|
||||
-- nvim-tree is still the active window. Go to the previous window.
|
||||
vim.cmd("wincmd p")
|
||||
end, 0)
|
||||
end
|
||||
end
|
||||
})
|
@ -0,0 +1,31 @@
|
||||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
config = function()
|
||||
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
||||
local ntree = require 'neo-tree'
|
||||
ntree.setup({
|
||||
close_if_last_window = true,
|
||||
window = {
|
||||
width = 30,
|
||||
mappings = {
|
||||
["o"] = "open",
|
||||
["F"] = "clear_filter",
|
||||
['e'] = function() vim.api.nvim_command('Neotree focus filesystem left') end,
|
||||
['b'] = function() vim.api.nvim_command('Neotree focus buffers left') end,
|
||||
['g'] = function() vim.api.nvim_command('Neotree focus git_status left') end,
|
||||
}
|
||||
},
|
||||
filesystem = {
|
||||
follow_current_file = true
|
||||
},
|
||||
source_selector = {
|
||||
winbar = true
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
@ -1,6 +1,10 @@
|
||||
return {
|
||||
'ray-x/lsp_signature.nvim',
|
||||
config = function()
|
||||
require('lsp_signature').setup {}
|
||||
config = function()
|
||||
local cfg = {
|
||||
floating_window_above_cur_line = true,
|
||||
doc_lines = 0,
|
||||
}
|
||||
require('lsp_signature').setup(cfg)
|
||||
end
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +0,0 @@
|
||||
return {
|
||||
{
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
version = "*",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
config = function()
|
||||
require("nvim-tree").setup {
|
||||
filters = { custom = { "^.git$" } },
|
||||
}
|
||||
end,
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
return {
|
||||
}
|
Loading…
Reference in New Issue