Compare commits

..

2 Commits

Author SHA1 Message Date
fanyx 948e49df35 nvim-tree updates 2023-10-12 12:30:05 +02:00
fanyx fb37ba1ad7 Add editorconfig 2023-10-12 12:30:05 +02:00
2 changed files with 60 additions and 0 deletions

View File

@ -1,19 +1,69 @@
local function on_attach(bufnr)
local api = require("nvim-tree.api")
local function opts(desc)
return { desc = "Tree: " .. desc, buffer = bufnr, noremap = true,
silent = true, nowait = true }
end
vim.keymap.set("n", "<CR>", api.node.open.edit, opts("Open"))
end
local tree = {
'nvim-tree/nvim-tree.lua',
lazy = false,
dependencies = { 'nvim-tree/nvim-web-devicons' },
opts = {
on_attach = on_attach,
disable_netrw = true,
sort_by = "case_sensitive",
view = {
adaptive_size = true,
centralize_selection = true,
number = true,
relativenumber = true,
},
renderer = {
group_empty = true,
highlight_git = true,
},
filters = {
dotfiles = true,
},
update_focused_file = {
enable = true,
},
actions = {
change_dir = {
enable = false,
},
},
},
}
local function is_modified_buffer_open(buffers)
for _, v in pairs(buffers) do
if v.name:match("NvimTree_") == nil then
return true
end
end
return false
end
-- [[
vim.api.nvim_create_autocmd("BufEnter", {
nested = true,
callback = function()
if
#vim.api.nvim_list_wins() == 1
and vim.api.nvim_buf_get_name(0):match("NvimTree_") ~= nil
and is_modified_buffer_open(vim.fn.getbufinfo({ bufmodified = 1 })) == false
then
vim.cmd("quit")
end
end,
})
-- ]]
return { tree }

10
.editorconfig Normal file
View File

@ -0,0 +1,10 @@
root = true
[*]
# charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true