From 17e319a4455f3135ed3cc759dee8ba5034fde75b Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Thu, 15 Aug 2024 20:28:13 +0200 Subject: update vim config --- .config/nvim/lua/pm/plugins/nvim-tree/load.lua | 11 +++++ .config/nvim/lua/pm/plugins/nvim-tree/setup.lua | 66 +++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 .config/nvim/lua/pm/plugins/nvim-tree/load.lua create mode 100644 .config/nvim/lua/pm/plugins/nvim-tree/setup.lua (limited to '.config/nvim/lua/pm/plugins/nvim-tree') diff --git a/.config/nvim/lua/pm/plugins/nvim-tree/load.lua b/.config/nvim/lua/pm/plugins/nvim-tree/load.lua new file mode 100644 index 0000000..adffb8a --- /dev/null +++ b/.config/nvim/lua/pm/plugins/nvim-tree/load.lua @@ -0,0 +1,11 @@ +return { + "nvim-tree/nvim-tree.lua", + version = "*", + lazy = false, + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + config = function() + require("nvim-tree").setup {} + end, +} diff --git a/.config/nvim/lua/pm/plugins/nvim-tree/setup.lua b/.config/nvim/lua/pm/plugins/nvim-tree/setup.lua new file mode 100644 index 0000000..d7d6ade --- /dev/null +++ b/.config/nvim/lua/pm/plugins/nvim-tree/setup.lua @@ -0,0 +1,66 @@ +require("nvim-tree").setup({ + sort = { + sorter = "case_sensitive", + }, + view = { + float = { + enable = true, + quit_on_focus_loss = true, + open_win_config = function() + local screen_w = vim.opt.columns:get() + local screen_h = vim.opt.lines:get() - vim.opt.cmdheight:get() + local window_w = screen_w * 0.5 + local window_h = screen_h * 0.3 + local window_w_int = math.floor(window_w) + local window_h_int = math.floor(window_h) + local center_x = (screen_w - window_w) / 2 + local center_y = ((vim.opt.lines:get() - window_h) / 2) - vim.opt.cmdheight:get() + return { + border = "rounded", + relative = "editor", + row = center_y, + col = center_x, + width = window_w_int, + height = window_h_int, + } + end, + } + }, + renderer = { + group_empty = true, + icons = { + glyphs = { + git = { + unstaged = "", + staged = "", + unmerged = "UM", + renamed = "", + deleted = "󰆴", + untracked = "", + ignored = "", + } + } + } + }, + filters = { + dotfiles = true, + }, +}) + +vim.api.nvim_create_autocmd({ 'WinEnter', 'BufWinEnter' }, { + pattern = 'NvimTree*', + callback = function() + local def = vim.api.nvim_get_hl(0, { name = 'Cursor' }) + vim.api.nvim_set_hl(0, 'Cursor', vim.tbl_extend('force', def, { blend = 100 })) + vim.opt.guicursor:append('a:Cursor/lCursor') + end, +}) + +vim.api.nvim_create_autocmd({ 'BufLeave', 'WinClosed' }, { + pattern = 'NvimTree*', + callback = function() + local def = vim.api.nvim_get_hl(0, { name = 'Cursor' }) + vim.api.nvim_set_hl(0, 'Cursor', vim.tbl_extend('force', def, { blend = 0 })) + vim.opt.guicursor = 'n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20' + end, +}) -- cgit v1.2.3-70-g09d2