chore: cleanup of nvim
This commit is contained in:
parent
511dabde0f
commit
6984aa64e8
6 changed files with 36 additions and 14 deletions
|
|
@ -19,11 +19,9 @@ nvim_tree.setup { -- BEGIN_DEFAULT_OPTS
|
|||
hijack_cursor = false,
|
||||
hijack_netrw = true,
|
||||
hijack_unnamed_buffer_when_opening = false,
|
||||
ignore_buffer_on_setup = false,
|
||||
open_on_setup = false,
|
||||
open_on_setup_file = false,
|
||||
open_on_tab = false,
|
||||
ignore_buf_on_tab_change = {},
|
||||
sort_by = "name",
|
||||
root_dirs = {},
|
||||
prefer_startup_root = false,
|
||||
|
|
@ -241,3 +239,27 @@ vim.api.nvim_create_autocmd("BufEnter", {
|
|||
end
|
||||
end
|
||||
})
|
||||
|
||||
local function open_nvim_tree(data)
|
||||
|
||||
-- buffer is a [No Name]
|
||||
local no_name = data.file == "" and vim.bo[data.buf].buftype == ""
|
||||
|
||||
-- buffer is a directory
|
||||
local directory = vim.fn.isdirectory(data.file) == 1
|
||||
|
||||
if not no_name and not directory then
|
||||
return
|
||||
end
|
||||
|
||||
-- change to the directory
|
||||
if directory then
|
||||
vim.cmd.cd(data.file)
|
||||
end
|
||||
|
||||
-- open the tree
|
||||
require("nvim-tree.api").tree.open()
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue