Added nvim-tree
This commit is contained in:
@@ -1,4 +1,2 @@
|
||||
require("settings")
|
||||
|
||||
require("lazy-nvim")
|
||||
|
||||
|
||||
@@ -27,4 +27,3 @@ require("lazy").setup({
|
||||
-- Automatically check for plugin updates
|
||||
checker = { enabled = true },
|
||||
})
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
return {
|
||||
'nvim-tree/nvim-tree.lua',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
lazy = false,
|
||||
keys = {
|
||||
{ '<leader>e', '<cmd>NvimTreeToggle<CR>', desc = 'Toggle file explorer' },
|
||||
},
|
||||
init = function()
|
||||
-- disable netrw
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
end,
|
||||
config = function()
|
||||
require('nvim-tree').setup({
|
||||
view = { width = 32 },
|
||||
sync_root_with_cwd = true,
|
||||
update_focused_file = { enable = true },
|
||||
|
||||
actions = {
|
||||
open_file = {
|
||||
window_picker = { enable = true },
|
||||
},
|
||||
},
|
||||
|
||||
on_attach = function(bufnr)
|
||||
local api = require('nvim-tree.api')
|
||||
|
||||
-- Keep all default keymaps
|
||||
api.config.mappings.default_on_attach(bufnr)
|
||||
|
||||
local function opts(desc)
|
||||
return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
||||
end
|
||||
|
||||
-- Swap 'd'/'D'
|
||||
vim.keymap.set({ 'n', 'x' }, 'd', api.fs.trash, opts('Trash'))
|
||||
vim.keymap.set({ 'n', 'x' }, 'D', api.fs.remove, opts('Delete'))
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
@@ -27,6 +27,11 @@ return {
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
group = ts_autoinstall_group,
|
||||
callback = function(args)
|
||||
-- Skip UI/special buffers (file explorers, help, terminals, quickfix, ecc.)
|
||||
if vim.bo[args.buf].buftype ~= '' then
|
||||
return
|
||||
end
|
||||
|
||||
local lang = vim.treesitter.language.get_lang(args.match) or args.match
|
||||
|
||||
-- Try starting right away: if it works, the parser was already installed
|
||||
@@ -54,4 +59,3 @@ return {
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ vim.opt.cursorline = true -- Highlight the current line
|
||||
vim.opt.colorcolumn = "80,120" -- Show vertical ruler
|
||||
vim.opt.scrolloff = 8 -- Keep at least 8 lines between the cursor and the borders
|
||||
vim.opt.wrap = false -- Don't wrap long lines
|
||||
vim.opt.laststatus = 3 -- Single global status bar
|
||||
|
||||
-- Show whitespace characters (tabs, trailing spaces, etc.)
|
||||
vim.opt.list = true
|
||||
@@ -25,7 +26,6 @@ vim.api.nvim_create_autocmd('BufWritePre', {
|
||||
local save_view = vim.fn.winsaveview()
|
||||
vim.cmd([[%s/\s\+$//e]]) -- Remove trailing whitespace on every line
|
||||
vim.cmd([[%s/\n\+\%$//e]]) -- Remove all trailing blank lines
|
||||
vim.fn.append(vim.fn.line('$'), '') -- Always append exactly one blank line at the end
|
||||
vim.fn.winrestview(save_view) -- Restore the window to where it was before the edits
|
||||
end,
|
||||
})
|
||||
@@ -61,4 +61,3 @@ vim.opt.smartindent = true -- Auto-indent new lines based on syntax (e.g. after
|
||||
-- Search
|
||||
vim.opt.ignorecase = true -- Case-insensitive search...
|
||||
vim.opt.smartcase = true -- ...unless you type an explicit uppercase letter
|
||||
|
||||
|
||||
@@ -19,4 +19,7 @@
|
||||
- gcc
|
||||
- curl
|
||||
- tar
|
||||
|
||||
# nvim-tree
|
||||
- trash-cli
|
||||
when: chezmoi.osRelease.id == "arch"
|
||||
|
||||
Reference in New Issue
Block a user