- random colorscheme (common-settings)

- заменить Enter на Tab в cmp-path
- Теперь nvim tree стал более userfriendly: Enter открывает директорию как корневую, чтобы посмотреть просто ее содержимое Tab, так же Enter заменяет s(открытие файлов типа docx,pdf и тд. во внешнем приложении) так же удалены некоторые лишние на мой взгляд плагины: wichkey vimtex(возможно в будущем верну)
This commit is contained in:
2025-03-09 07:44:48 +03:00
parent 3ffda93c33
commit 6f9fcff8fa
8 changed files with 205 additions and 110 deletions

View File

@ -4,7 +4,7 @@ require("nvim-tree").setup({
sorter = "case_sensitive",
},
view = {
width = 30,
width = 50,
},
renderer = {
group_empty = true,
@ -17,6 +17,43 @@ require("nvim-tree").setup({
quit_on_open = true, -- закрывать дерево при открытии файла
},
},
on_attach = function(bufnr)
local api = require("nvim-tree.api")
-- Apply default mappings
api.config.mappings.default_on_attach(bufnr)
-- Remove default C-] mapping
vim.keymap.del("n", "<C-]>", { buffer = bufnr })
-- Define file extensions to handle with system open
local special_extensions = {
".pdf", ".png", ".jpeg", ".jpg", ".doc", ".docx"
}
-- Helper function to check file extension
local function has_special_extension(node)
for _, ext in ipairs(special_extensions) do
if node.name:match("%.?[^.]+$") == ext then
return true
end
end
return false
end
-- Create combined CR mapping
vim.keymap.set("n", "<CR>", function()
local node = api.tree.get_node_under_cursor()
if node and has_special_extension(node) then
api.node.run.system() -- Open file in system
else
api.node.open.edit() -- Default open file behavior
api.tree.change_root_to_node() -- Change root to node
end
end, { buffer = bufnr })
end,
})
-- Глобальные бинды для nvim-tree
vim.keymap.set("n", "<Leader>e", ":NvimTreeToggle<CR>", { noremap = true, silent = true })
vim.keymap.set("n", "<Leader>q", ":NvimTreeFindFile<CR>", { noremap = true, silent = true })