From a07f1286284bd878bd33c3c8f22ed51c9678ab2b Mon Sep 17 00:00:00 2001 From: laentropia Date: Wed, 20 May 2026 09:39:20 -0600 Subject: [PATCH] current good --- init.lua | 317 +++++++++++++++-------------- lua/custom/plugins/buffertabs.lua | 122 +++++++++++ lua/custom/plugins/lualine.lua | 104 ++++++++++ lua/custom/plugins/toggleterm.lua | 65 ++++++ lua/custom/plugins/trouble.lua | 67 ++++++ lua/kickstart/plugins/neo-tree.lua | 73 ++++++- 6 files changed, 584 insertions(+), 164 deletions(-) create mode 100644 lua/custom/plugins/buffertabs.lua create mode 100644 lua/custom/plugins/lualine.lua create mode 100644 lua/custom/plugins/toggleterm.lua create mode 100644 lua/custom/plugins/trouble.lua diff --git a/init.lua b/init.lua index 5d29c72..b435b20 100644 --- a/init.lua +++ b/init.lua @@ -1,89 +1,3 @@ ---[[ - -===================================================================== -==================== READ THIS BEFORE CONTINUING ==================== -===================================================================== -======== .-----. ======== -======== .----------------------. | === | ======== -======== |.-""""""""""""""""""-.| |-----| ======== -======== || || | === | ======== -======== || KICKSTART.NVIM || |-----| ======== -======== || || | === | ======== -======== || || |-----| ======== -======== ||:Tutor || |:::::| ======== -======== |'-..................-'| |____o| ======== -======== `"")----------------(""` ___________ ======== -======== /::::::::::| |::::::::::\ \ no mouse \ ======== -======== /:::========| |==hjkl==:::\ \ required \ ======== -======== '""""""""""""' '""""""""""""' '""""""""""' ======== -======== ======== -===================================================================== -===================================================================== - -What is Kickstart? - - Kickstart.nvim is *not* a distribution. - - Kickstart.nvim is a starting point for your own configuration. - The goal is that you can read every line of code, top-to-bottom, understand - what your configuration is doing, and modify it to suit your needs. - - Once you've done that, you can start exploring, configuring and tinkering to - make Neovim your own! That might mean leaving Kickstart just the way it is for a while - or immediately breaking it into modular pieces. It's up to you! - - If you don't know anything about Lua, I recommend taking some time to read through - a guide. One possible example which will only take 10-15 minutes: - - https://learnxinyminutes.com/docs/lua/ - - After understanding a bit more about Lua, you can use `:help lua-guide` as a - reference for how Neovim integrates Lua. - - :help lua-guide - - (or HTML version): https://neovim.io/doc/user/lua-guide.html - -Kickstart Guide: - - TODO: The very first thing you should do is to run the command `:Tutor` in Neovim. - - If you don't know what this means, type the following: - - - - : - - Tutor - - - - (If you already know the Neovim basics, you can skip this step.) - - Once you've completed that, you can continue working through **AND READING** the rest - of the kickstart init.lua. - - Next, run AND READ `:help`. - This will open up a help window with some basic information - about reading, navigating and searching the builtin help documentation. - - This should be the first place you go to look when you're stuck or confused - with something. It's one of my favorite Neovim features. - - MOST IMPORTANTLY, we provide a keymap "sh" to [s]earch the [h]elp documentation, - which is very useful when you're not exactly sure of what you're looking for. - - I have left several `:help X` comments throughout the init.lua - These are hints about where to find more information about the relevant settings, - plugins or Neovim features used in Kickstart. - - NOTE: Look for lines like this - - Throughout the file. These are for you, the reader, to help you understand what is happening. - Feel free to delete them once you know what you're doing, but they should serve as a guide - for when you are first encountering a few different constructs in your Neovim config. - -If you experience any errors while trying to install kickstart, run `:checkhealth` for more info. - -I hope you enjoy your Neovim journey, -- TJ - -P.S. You can delete this when you're done too. It's your config now! :) ---]] - -- ============================================================ -- SECTION 1: FOUNDATION -- Core Neovim settings, leaders, options, basic keymaps, basic autocmds @@ -91,7 +5,6 @@ P.S. You can delete this when you're done too. It's your config now! :) do -- Enable faster startup by caching compiled Lua modules vim.loader.enable() - -- Set as the leader key -- See `:help mapleader` -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) @@ -99,19 +12,43 @@ do vim.g.maplocalleader = ' ' -- Set to true if you have a Nerd Font installed and selected in the terminal - vim.g.have_nerd_font = false + vim.g.have_nerd_font = true -- [[ Setting options ]] -- See `:help vim.o` -- NOTE: You can change these options as you wish! -- For more options, you can see `:help option-list` - -- Make line numbers default vim.o.number = true -- You can also add relative line numbers, to help with jumping. -- Experiment for yourself to see if you like it! -- vim.o.relativenumber = true + vim.o.allowrevins = true + + vim.o.autocompletedelay = 10 + vim.o.autoindent = true + vim.o.autoread = true + vim.o.background = 'dark' + vim.o.backspace = 'indent,eol,start' + vim.o.wrap = true + vim.o.linebreak = true + vim.o.breakat = ' I!@*-+;:,./?' + vim.o.tabstop = 4 + vim.o.shiftwidth = 4 + vim.o.expandtab = true + vim.o.smartindent = true + vim.o.hlsearch = true + vim.o.incsearch = true + vim.o.signcolumn = 'yes' + vim.o.relativenumber = true + vim.opt.completeopt = { 'menu', 'menuone', 'noselect' } + vim.o.wildmode = 'longest:full,full' + vim.o.virtualedit = 'block' + vim.o.winborder = 'rounded' + + vim.opt.termguicolors = true + -- Enable mouse mode, can be useful for resizing splits for example! vim.o.mouse = 'a' @@ -165,7 +102,7 @@ do vim.o.cursorline = true -- Minimal number of screen lines to keep above and below the cursor. - vim.o.scrolloff = 10 + vim.o.scrolloff = 5 -- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`), -- instead raise a dialog asking if you wish to save the current file(s) @@ -205,35 +142,19 @@ do vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) - -- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier - -- for people to discover. Otherwise, you normally need to press , which - -- is not what someone will guess without a bit more experience. - -- - -- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping - -- or just use to exit terminal mode - vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) - - -- TIP: Disable arrow keys in normal mode - -- vim.keymap.set('n', '', 'echo "Use h to move!!"') - -- vim.keymap.set('n', '', 'echo "Use l to move!!"') - -- vim.keymap.set('n', '', 'echo "Use k to move!!"') - -- vim.keymap.set('n', '', 'echo "Use j to move!!"') + vim.keymap.set('n', '', 'echo "Use h to move!!"') + vim.keymap.set('n', '', 'echo "Use l to move!!"') + vim.keymap.set('n', '', 'echo "Use k to move!!"') + vim.keymap.set('n', '', 'echo "Use j to move!!"') -- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows -- - -- See `:help wincmd` for a list of all window commands vim.keymap.set('n', '', '', { desc = 'Move focus to the left window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the right window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the lower window' }) vim.keymap.set('n', '', '', { desc = 'Move focus to the upper window' }) - -- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes - -- vim.keymap.set("n", "", "H", { desc = "Move window to the left" }) - -- vim.keymap.set("n", "", "L", { desc = "Move window to the right" }) - -- vim.keymap.set("n", "", "J", { desc = "Move window to the lower" }) - -- vim.keymap.set("n", "", "K", { desc = "Move window to the upper" }) - -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -391,10 +312,14 @@ do }, } + vim.pack.add { gh 'navarasu/onedark.nvim' } + require('onedark').setup { + style = 'deep', + } -- Load the colorscheme here. -- Like many other themes, this one has different styles, and you could load -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' + vim.cmd.colorscheme 'onedark' -- Highlight todo, notes, etc in comments vim.pack.add { gh 'folke/todo-comments.nvim' } @@ -404,6 +329,10 @@ do -- A collection of various small independent plugins/modules vim.pack.add { gh 'nvim-mini/mini.nvim' } + vim.pack.add { + gh 'nvim-treesitter/nvim-treesitter-textobjects', + } + -- Better Around/Inside textobjects -- -- Examples: @@ -686,10 +615,42 @@ do -- See `:help lsp-config` for information about keys and how to configure ---@type table local servers = { - -- clangd = {}, + clangd = { + cmd = { + 'clangd', + '--background-index', + '--clang-tidy', + '--header-insertion=iwyu', + '--completion-style=detailed', + }, + }, -- gopls = {}, - -- pyright = {}, - -- rust_analyzer = {}, + pyright = { + settings = { + python = { + analysis = { + typeCheckingMode = 'basic', + }, + }, + }, + }, + rust_analyzer = { + settings = { + ['rust-analyzer'] = { + cargo = { + allFeatures = true, + }, + + checkOnSave = true, + + procMacro = { + enable = true, + }, + }, + }, + }, + marksman = {}, + cmake = {}, -- -- Some languages (like typescript) have entire language plugins that can be useful: -- https://github.com/pmizio/typescript-tools.nvim @@ -776,8 +737,12 @@ do format_on_save = function(bufnr) -- You can specify filetypes to autoformat on save here: local enabled_filetypes = { - -- lua = true, - -- python = true, + lua = true, + python = true, + rust = true, + c = true, + cpp = true, + cmake = true, } if enabled_filetypes[vim.bo[bufnr].filetype] then return { timeout_ms = 500 } @@ -790,9 +755,16 @@ do }, -- You can also specify external formatters in here. formatters_by_ft = { - -- rust = { 'rustfmt' }, + lua = { 'stylua' }, + rust = { 'rustfmt' }, -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, + python = { 'isort', 'black' }, + + c = { 'clang_format' }, + cpp = { 'clang_format' }, + cmake = { 'cmake_format' }, + + markdown = { 'prettier' }, -- -- You can use 'stop_after_first' to run the first available formatter from the list -- javascript = { "prettierd", "prettier", stop_after_first = true }, @@ -818,38 +790,35 @@ do -- See the README about individual language/framework/plugin snippets: -- https://github.com/rafamadriz/friendly-snippets -- - -- vim.pack.add { gh 'rafamadriz/friendly-snippets' } - -- require('luasnip.loaders.from_vscode').lazy_load() + vim.pack.add { gh 'rafamadriz/friendly-snippets' } + require('luasnip.loaders.from_vscode').lazy_load() -- [[ Autocomplete Engine ]] vim.pack.add { { src = gh 'saghen/blink.cmp', version = vim.version.range '1.*' } } require('blink.cmp').setup { keymap = { - -- 'default' (recommended) for mappings similar to built-in completions - -- to accept ([y]es) the completion. - -- This will auto-import if your LSP supports it. - -- This will expand snippets if the LSP sent a snippet. - -- 'super-tab' for tab to accept - -- 'enter' for enter to accept - -- 'none' for no mappings - -- - -- For an understanding of why the 'default' preset is recommended, - -- you will need to read `:help ins-completion` - -- - -- No, but seriously. Please read `:help ins-completion`, it is really good! - -- - -- All presets have the following mappings: - -- /: move to right/left of your snippet expansion - -- : Open menu or open docs if already open - -- / or /: Select next/previous item - -- : Hide menu - -- : Toggle signature help - -- - -- See `:help blink-cmp-config-keymap` for defining your own keymap - preset = 'default', + preset = 'none', - -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: - -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps + [''] = { + 'select_next', + 'snippet_forward', + 'fallback', + }, + + [''] = { + 'select_prev', + 'snippet_backward', + 'fallback', + }, + + [''] = { + 'accept', + 'fallback', + }, + + [''] = { 'show', 'show_documentation', 'hide_documentation' }, + + [''] = { 'hide' }, }, appearance = { @@ -859,13 +828,25 @@ do }, completion = { + menu = { + border = 'rounded', + }, -- By default, you may press `` to show the documentation. -- Optionally, set `auto_show = true` to show the documentation after a delay. - documentation = { auto_show = false, auto_show_delay_ms = 500 }, + documentation = { + window = { + border = 'rounded', + }, + auto_show = true, + auto_show_delay_ms = 500, + }, + ghost_text = { + enabled = true, + }, }, sources = { - default = { 'lsp', 'path', 'snippets' }, + default = { 'lsp', 'path', 'snippets', 'buffer' }, }, snippets = { preset = 'luasnip' }, @@ -898,7 +879,30 @@ do vim.pack.add { { src = gh 'nvim-treesitter/nvim-treesitter', version = 'main' } } -- Ensure basic parsers are installed - local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' } + local parsers = { + 'bash', + 'c', + 'cpp', + 'rust', + 'python', + 'cmake', + 'markdown', + 'markdown_inline', + 'diff', + 'html', + 'css', + 'javascript', + 'json', + 'yaml', + 'toml', + 'lua', + 'luadoc', + 'markdown', + 'markdown_inline', + 'query', + 'vim', + 'vimdoc', + } require('nvim-treesitter').install(parsers) ---@param buf integer @@ -911,8 +915,9 @@ do -- Enable treesitter based folds -- For more info on folds see `:help folds` - -- vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()' - -- vim.wo.foldmethod = 'expr' + vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()' + vim.wo.foldmethod = 'expr' + vim.opt.foldlevel = 99 -- Check if treesitter indentation is available for this language, and if so enable it -- in case there is no indent query, the indentexpr will fallback to the vim's built in one @@ -960,17 +965,17 @@ do -- Here are some example plugins that I've included in the Kickstart repository. -- Uncomment any of the lines below to enable them (you will need to restart nvim). -- - -- require 'kickstart.plugins.debug' - -- require 'kickstart.plugins.indent_line' - -- require 'kickstart.plugins.lint' - -- require 'kickstart.plugins.autopairs' - -- require 'kickstart.plugins.neo-tree' - -- require 'kickstart.plugins.gitsigns' -- adds gitsigns recommended keymaps + require 'kickstart.plugins.debug' + require 'kickstart.plugins.indent_line' + require 'kickstart.plugins.lint' + require 'kickstart.plugins.autopairs' + require 'kickstart.plugins.neo-tree' + require 'kickstart.plugins.gitsigns' -- adds gitsigns recommended keymaps -- NOTE: You can add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- require 'custom.plugins' + require 'custom.plugins' end -- The line beneath this is called `modeline`. See `:help modeline` diff --git a/lua/custom/plugins/buffertabs.lua b/lua/custom/plugins/buffertabs.lua new file mode 100644 index 0000000..a5ff4a6 --- /dev/null +++ b/lua/custom/plugins/buffertabs.lua @@ -0,0 +1,122 @@ +-- ============================================================ +-- BUFFERLINE +-- Buffer tabs +-- ============================================================ + +local plugins = { + { + src = 'https://github.com/akinsho/bufferline.nvim', + version = vim.version.range '*', + }, +} + +if vim.g.have_nerd_font then table.insert(plugins, 'https://github.com/nvim-tree/nvim-web-devicons') end + +vim.pack.add(plugins) + +-- ============================================================ +-- SETUP +-- ============================================================ + +require('bufferline').setup { + options = { + mode = 'buffers', + + numbers = 'none', + + close_command = 'bdelete! %d', + right_mouse_command = 'bdelete! %d', + + left_mouse_command = 'buffer %d', + middle_mouse_command = nil, + + indicator = { + style = 'underline', + }, + + buffer_close_icon = '󰅖', + modified_icon = '●', + close_icon = '', + left_trunc_marker = '', + right_trunc_marker = '', + + max_name_length = 24, + max_prefix_length = 18, + tab_size = 20, + + diagnostics = 'nvim_lsp', + + diagnostics_indicator = function(_, _, diagnostics_dict) + local s = ' ' + for e, n in pairs(diagnostics_dict) do + local sym = e == 'error' and ' ' or (e == 'warning' and ' ') or ' ' + + s = s .. n .. sym + end + return s + end, + + offsets = { + { + filetype = 'neo-tree', + text = 'File Explorer', + highlight = 'Directory', + text_align = 'left', + }, + }, + + show_buffer_icons = true, + show_buffer_close_icons = false, + show_close_icon = false, + + show_tab_indicators = true, + + persist_buffer_sort = true, + separator_style = 'slant', + + enforce_regular_tabs = false, + always_show_bufferline = true, + + hover = { + enabled = true, + delay = 200, + reveal = { 'close' }, + }, + }, +} + +-- ============================================================ +-- KEYMAPS +-- ============================================================ + +-- Next buffer +vim.keymap.set('n', '', 'BufferLineCycleNext', { + desc = 'Next Buffer', + silent = true, +}) + +-- Previous buffer +vim.keymap.set('n', '', 'BufferLineCyclePrev', { + desc = 'Previous Buffer', + silent = true, +}) + +-- Pin buffer +vim.keymap.set('n', 'bp', 'BufferLineTogglePin', { + desc = 'Pin Buffer', + silent = true, +}) + +-- Close buffer +vim.keymap.set('n', 'bc', 'bdelete', { + desc = 'Close Buffer', + silent = true, +}) + +-- Go to buffer by number +for i = 1, 9 do + vim.keymap.set('n', '' .. i, function() require('bufferline').go_to(i, true) end, { + desc = 'Go to buffer ' .. i, + silent = true, + }) +end diff --git a/lua/custom/plugins/lualine.lua b/lua/custom/plugins/lualine.lua new file mode 100644 index 0000000..a858ca0 --- /dev/null +++ b/lua/custom/plugins/lualine.lua @@ -0,0 +1,104 @@ +-- ============================================================ +-- LUALINE +-- Statusline +-- ============================================================ + +vim.pack.add { + { + src = 'https://github.com/nvim-lualine/lualine.nvim', + }, + + { + src = 'https://github.com/nvim-tree/nvim-web-devicons', + }, +} + +require('lualine').setup { + options = { + theme = 'onedark', + + icons_enabled = true, + + component_separators = { + left = '│', + right = '│', + }, + + section_separators = { + left = '', + right = '', + }, + + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + + ignore_focus = {}, + + always_divide_middle = true, + + globalstatus = true, + + refresh = { + statusline = 100, + tabline = 100, + winbar = 100, + }, + }, + + sections = { + lualine_a = { { + 'mode', + upper = true, + } }, + + lualine_b = { + 'branch', + 'diff', + 'diagnostics', + }, + + lualine_c = { + { + 'filename', + path = 1, + }, + }, + + lualine_x = { + { + 'encoding', + show_bomb = true, + }, + + 'fileformat', + 'filetype', + }, + + lualine_y = { + 'progress', + }, + + lualine_z = { + 'location', + }, + }, + + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { 'filename' }, + lualine_x = { 'location' }, + lualine_y = {}, + lualine_z = {}, + }, + + extensions = { + 'trouble', + 'quickfix', + 'fzf', + 'lazy', + 'mason', + }, +} diff --git a/lua/custom/plugins/toggleterm.lua b/lua/custom/plugins/toggleterm.lua new file mode 100644 index 0000000..0bb4444 --- /dev/null +++ b/lua/custom/plugins/toggleterm.lua @@ -0,0 +1,65 @@ +-- ============================================================ +-- TOGGLETERM +-- Floating terminal +-- ============================================================ + +vim.pack.add { + { + src = 'https://github.com/akinsho/toggleterm.nvim', + version = vim.version.range '*', + }, +} + +require('toggleterm').setup { + size = 20, + + open_mapping = [[tt]], + + hide_numbers = true, + + shade_filetypes = {}, + + shade_terminals = true, + + start_in_insert = true, + + insert_mappings = true, + + terminal_mappings = true, + + persist_size = true, + + persist_mode = true, + + direction = 'float', + + close_on_exit = true, + + shell = vim.o.shell, + + float_opts = { + border = 'rounded', + + winblend = 0, + }, +} + +-- ============================================================ +-- TERMINAL KEYMAPS +-- ============================================================ + +vim.api.nvim_create_autocmd('TermOpen', { + pattern = 'term://*', + callback = function() + local opts = { buffer = 0 } + + -- ESC exits terminal insert mode + vim.keymap.set('t', '', [[]], opts) + + -- Better window navigation + vim.keymap.set('t', '', [[wincmd h]], opts) + vim.keymap.set('t', '', [[wincmd j]], opts) + vim.keymap.set('t', '', [[wincmd k]], opts) + vim.keymap.set('t', '', [[wincmd l]], opts) + end, +}) diff --git a/lua/custom/plugins/trouble.lua b/lua/custom/plugins/trouble.lua new file mode 100644 index 0000000..f258fd2 --- /dev/null +++ b/lua/custom/plugins/trouble.lua @@ -0,0 +1,67 @@ +-- ============================================================ +-- TROUBLE.NVIM +-- Better diagnostics / references / quickfix UI +-- ============================================================ + +vim.pack.add { + { + src = 'https://github.com/folke/trouble.nvim', + }, +} + +require('trouble').setup { + auto_close = false, + auto_open = false, + auto_preview = true, + + focus = true, + + modes = { + diagnostics = { + auto_open = false, + }, + }, + + icons = { + indent = { + top = '│ ', + middle = '├╴', + last = '└╴', + fold_open = ' ', + fold_closed = ' ', + ws = ' ', + }, + }, +} + +local trouble = require 'trouble' + +-- ============================================================ +-- KEYMAPS +-- ============================================================ + +-- General diagnostics +vim.keymap.set('n', 'xx', function() trouble.toggle 'diagnostics' end, { desc = 'Trouble: Diagnostics' }) + +-- Workspace diagnostics +vim.keymap.set('n', 'xw', function() trouble.toggle 'workspace_diagnostics' end, { desc = 'Trouble: Workspace Diagnostics' }) + +-- Current buffer diagnostics +vim.keymap.set('n', 'xd', function() trouble.toggle 'document_diagnostics' end, { desc = 'Trouble: Document Diagnostics' }) + +-- Quickfix +vim.keymap.set('n', 'xq', function() trouble.toggle 'quickfix' end, { desc = 'Trouble: Quickfix' }) + +-- Location list +vim.keymap.set('n', 'xl', function() trouble.toggle 'loclist' end, { desc = 'Trouble: Location List' }) + +-- LSP references +vim.keymap.set('n', 'gr', function() trouble.toggle 'lsp_references' end, { desc = 'Trouble: References' }) + +-- Symbols +vim.keymap.set('n', 'xs', function() trouble.toggle 'symbols' end, { desc = 'Trouble: Symbols' }) + +-- Toggle previous/next diagnostics +vim.keymap.set('n', '[x', function() trouble.prev { skip_groups = true, jump = true } end, { desc = 'Previous Trouble Item' }) + +vim.keymap.set('n', ']x', function() trouble.next { skip_groups = true, jump = true } end, { desc = 'Next Trouble Item' }) diff --git a/lua/kickstart/plugins/neo-tree.lua b/lua/kickstart/plugins/neo-tree.lua index d9d6993..b71499a 100644 --- a/lua/kickstart/plugins/neo-tree.lua +++ b/lua/kickstart/plugins/neo-tree.lua @@ -1,25 +1,82 @@ --- Neo-tree is a Neovim plugin to browse the file system --- https://github.com/nvim-neo-tree/neo-tree.nvim +-- ============================================================ +-- NEO-TREE +-- File explorer +-- ============================================================ local plugins = { - { src = 'https://github.com/nvim-neo-tree/neo-tree.nvim', version = vim.version.range '*' }, + { + src = 'https://github.com/nvim-neo-tree/neo-tree.nvim', + version = vim.version.range '*', + }, + 'https://github.com/nvim-lua/plenary.nvim', 'https://github.com/MunifTanjim/nui.nvim', } -if vim.g.have_nerd_font then - table.insert(plugins, 'https://github.com/nvim-tree/nvim-web-devicons') -- not strictly required, but recommended -end +if vim.g.have_nerd_font then table.insert(plugins, 'https://github.com/nvim-tree/nvim-web-devicons') end vim.pack.add(plugins) -vim.keymap.set('n', '\\', 'Neotree reveal', { desc = 'NeoTree reveal', silent = true }) +-- ============================================================ +-- KEYMAPS +-- ============================================================ + +vim.keymap.set('n', 'e', 'Neotree toggle', { + desc = 'Toggle NeoTree', + silent = true, +}) + +-- ============================================================ +-- SETUP +-- ============================================================ require('neo-tree').setup { + close_if_last_window = true, + + popup_border_style = 'rounded', + + enable_git_status = true, + enable_diagnostics = true, + filesystem = { + filtered_items = { + visible = false, + hide_dotfiles = false, + hide_gitignored = false, + }, + + follow_current_file = { + enabled = true, + }, + + use_libuv_file_watcher = true, + window = { + width = 32, + mappings = { - ['\\'] = 'close_window', + ['e'] = 'close_window', + }, + }, + }, + + default_component_configs = { + indent = { + with_markers = true, + indent_size = 2, + }, + + git_status = { + symbols = { + added = '✚', + modified = '', + deleted = '✖', + renamed = '󰁕', + untracked = '', + ignored = '', + unstaged = '󰄱', + staged = '', + conflict = '', }, }, },