diff --git a/doc/kickstart.txt b/doc/kickstart.txt deleted file mode 100644 index cb87ac3f1de..00000000000 --- a/doc/kickstart.txt +++ /dev/null @@ -1,24 +0,0 @@ -================================================================================ -INTRODUCTION *kickstart.nvim* - -Kickstart.nvim is a project to help you get started on your neovim journey. - - *kickstart-is-not* -It is not: -- Complete framework for every plugin under the sun -- Place to add every plugin that could ever be useful - - *kickstart-is* -It is: -- Somewhere that has a good start for the most common "IDE" type features: - - autocompletion - - goto-definition - - find references - - fuzzy finding - - and hinting at what more can be done :) -- A place to _kickstart_ your journey. - - You should fork this project and use/modify it so that it matches your - style and preferences. If you don't want to do that, there are probably - other projects that would fit much better for you (and that's great!)! - - vim:tw=78:ts=8:ft=help:norl: diff --git a/doc/tags b/doc/tags deleted file mode 100644 index 687ae7721d9..00000000000 --- a/doc/tags +++ /dev/null @@ -1,3 +0,0 @@ -kickstart-is kickstart.txt /*kickstart-is* -kickstart-is-not kickstart.txt /*kickstart-is-not* -kickstart.nvim kickstart.txt /*kickstart.nvim* diff --git a/init.lua b/init.lua index d5ae6dc9b2a..21ad5050861 100644 --- a/init.lua +++ b/init.lua @@ -91,7 +91,7 @@ vim.g.mapleader = ' ' 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` @@ -102,7 +102,7 @@ vim.g.have_nerd_font = false 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.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.o.mouse = 'a' @@ -277,11 +277,11 @@ require('lazy').setup({ 'lewis6991/gitsigns.nvim', opts = { signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, + add = { text = '▎' }, + change = { text = '▎' }, + delete = { text = '▎' }, + topdelete = { text = '▎' }, + changedelete = { text = '▎' }, }, }, }, @@ -305,6 +305,7 @@ require('lazy').setup({ event = 'VimEnter', opts = { -- delay between pressing a key and opening which-key (milliseconds) + preset = 'helix', delay = 0, icons = { mappings = vim.g.have_nerd_font }, @@ -313,6 +314,13 @@ require('lazy').setup({ { 's', group = '[S]earch', mode = { 'n', 'v' } }, { 't', group = '[T]oggle' }, { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, + { 'w', group = '[W]indow' }, + { 'b', group = '[B]uffer' }, + { 'u', group = '[U]I/Toggle' }, + { 'g', group = '[G]it' }, + { 'x', group = 'Quickfi[X]/Location' }, + { 'c', group = '[C]ode' }, + { '', group = '[Tab]s' }, }, }, }, @@ -324,153 +332,9 @@ require('lazy').setup({ -- -- Use the `dependencies` key to specify the dependencies of a particular plugin - { -- Fuzzy Finder (files, lsp, etc) - 'nvim-telescope/telescope.nvim', - -- By default, Telescope is included and acts as your picker for everything. - - -- If you would like to switch to a different picker (like snacks, or fzf-lua) - -- you can disable the Telescope plugin by setting enabled to false and enable - -- your replacement picker by requiring it explicitly (e.g. 'custom.plugins.snacks') - - -- Note: If you customize your config for yourself, - -- it’s best to remove the Telescope plugin config entirely - -- instead of just disabling it here, to keep your config clean. - enabled = true, - event = 'VimEnter', - dependencies = { - 'nvim-lua/plenary.nvim', - { -- If encountering errors, see telescope-fzf-native README for installation instructions - 'nvim-telescope/telescope-fzf-native.nvim', - - -- `build` is used to run some command when the plugin is installed/updated. - -- This is only run then, not every time Neovim starts up. - build = 'make', - - -- `cond` is a condition used to determine whether this plugin should be - -- installed and loaded. - cond = function() return vim.fn.executable 'make' == 1 end, - }, - { 'nvim-telescope/telescope-ui-select.nvim' }, - - -- Useful for getting pretty icons, but requires a Nerd Font. - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, - }, - config = function() - -- Telescope is a fuzzy finder that comes with a lot of different things that - -- it can fuzzy find! It's more than just a "file finder", it can search - -- many different aspects of Neovim, your workspace, LSP, and more! - -- - -- The easiest way to use Telescope, is to start by doing something like: - -- :Telescope help_tags - -- - -- After running this command, a window will open up and you're able to - -- type in the prompt window. You'll see a list of `help_tags` options and - -- a corresponding preview of the help. - -- - -- Two important keymaps to use while in Telescope are: - -- - Insert mode: - -- - Normal mode: ? - -- - -- This opens a window that shows you all of the keymaps for the current - -- Telescope picker. This is really useful to discover what Telescope can - -- do as well as how to actually do it! - - -- [[ Configure Telescope ]] - -- See `:help telescope` and `:help telescope.setup()` - require('telescope').setup { - -- You can put your default mappings / updates / etc. in here - -- All the info you're looking for is in `:help telescope.setup()` - -- - -- defaults = { - -- mappings = { - -- i = { [''] = 'to_fuzzy_refine' }, - -- }, - -- }, - -- pickers = {} - extensions = { - ['ui-select'] = { require('telescope.themes').get_dropdown() }, - }, - } - - -- Enable Telescope extensions if they are installed - pcall(require('telescope').load_extension, 'fzf') - pcall(require('telescope').load_extension, 'ui-select') - - -- See `:help telescope.builtin` - local builtin = require 'telescope.builtin' - vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) - vim.keymap.set('n', 'sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) - vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) - vim.keymap.set('n', 'ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) - vim.keymap.set({ 'n', 'v' }, 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) - vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) - vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) - vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]esume' }) - vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) - vim.keymap.set('n', 'sc', builtin.commands, { desc = '[S]earch [C]ommands' }) - vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) - - -- This runs on LSP attach per buffer (see main LSP attach function in 'neovim/nvim-lspconfig' config for more info, - -- it is better explained there). This allows easily switching between pickers if you prefer using something else! - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('telescope-lsp-attach', { clear = true }), - callback = function(event) - local buf = event.buf - - -- Find references for the word under your cursor. - vim.keymap.set('n', 'grr', builtin.lsp_references, { buffer = buf, desc = '[G]oto [R]eferences' }) - - -- Jump to the implementation of the word under your cursor. - -- Useful when your language has ways of declaring types without an actual implementation. - vim.keymap.set('n', 'gri', builtin.lsp_implementations, { buffer = buf, desc = '[G]oto [I]mplementation' }) - - -- Jump to the definition of the word under your cursor. - -- This is where a variable was first declared, or where a function is defined, etc. - -- To jump back, press . - vim.keymap.set('n', 'grd', builtin.lsp_definitions, { buffer = buf, desc = '[G]oto [D]efinition' }) - - -- Fuzzy find all the symbols in your current document. - -- Symbols are things like variables, functions, types, etc. - vim.keymap.set('n', 'gO', builtin.lsp_document_symbols, { buffer = buf, desc = 'Open Document Symbols' }) - - -- Fuzzy find all the symbols in your current workspace. - -- Similar to document symbols, except searches over your entire project. - vim.keymap.set('n', 'gW', builtin.lsp_dynamic_workspace_symbols, { buffer = buf, desc = 'Open Workspace Symbols' }) - - -- Jump to the type of the word under your cursor. - -- Useful when you're not sure what type a variable is and you want to see - -- the definition of its *type*, not where it was *defined*. - vim.keymap.set('n', 'grt', builtin.lsp_type_definitions, { buffer = buf, desc = '[G]oto [T]ype Definition' }) - end, - }) - - -- Override default behavior and theme when searching - vim.keymap.set('n', '/', function() - -- You can pass additional configuration to Telescope to change the theme, layout, etc. - builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { - winblend = 10, - previewer = false, - }) - end, { desc = '[/] Fuzzily search in current buffer' }) - - -- It's also possible to pass additional configuration options. - -- See `:help telescope.builtin.live_grep()` for information about particular keys - vim.keymap.set( - 'n', - 's/', - function() - builtin.live_grep { - grep_open_files = true, - prompt_title = 'Live Grep in Open Files', - } - end, - { desc = '[S]earch [/] in Open Files' } - ) - - -- Shortcut for searching your Neovim configuration files - vim.keymap.set('n', 'sn', function() builtin.find_files { cwd = vim.fn.stdpath 'config' } end, { desc = '[S]earch [N]eovim files' }) - end, - }, + -- NOTE: Snacks picker is configured in lua/custom/plugins/snacks.lua + -- All picker keymaps use s prefix (e.g. sf for files, sg for grep) + -- LSP pickers are configured via Snacks LSP integration (gd, grr, gri, grt, gO, gW) -- LSP Plugins { @@ -544,6 +408,14 @@ require('lazy').setup({ -- For example, in C this would take you to the header. map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + -- LSP Navigation using Snacks Pickers (fuzzy searchable results) + map('gd', function() Snacks.picker.lsp_definitions() end, '[G]oto [D]efinition') + map('grr', function() Snacks.picker.lsp_references() end, '[G]oto [R]eferences') + map('gri', function() Snacks.picker.lsp_implementations() end, '[G]oto [I]mplementation') + map('grt', function() Snacks.picker.lsp_type_definitions() end, '[G]oto [T]ype Definition') + map('gO', function() Snacks.picker.lsp_symbols() end, 'Document Symbols') + map('gW', function() Snacks.picker.lsp_workspace_symbols() end, 'Workspace Symbols') + -- The following two autocommands are used to highlight references of the -- word under your cursor when your cursor rests there for a little while. -- See `:help CursorHold` for information about when this is executed @@ -573,6 +445,9 @@ require('lazy').setup({ }) end + -- Disable hover from Ruff (ty provides better type information) + if client and client.name == 'ruff' then client.server_capabilities.hoverProvider = false end + -- The following code creates a keymap to toggle inlay hints in your -- code, if the language server you are using supports them -- @@ -614,8 +489,14 @@ require('lazy').setup({ -- You can press `g?` for help in this menu. local ensure_installed = vim.tbl_keys(servers or {}) vim.list_extend(ensure_installed, { - 'lua_ls', -- Lua Language server + 'lua-language-server', -- Lua Language server 'stylua', -- Used to format Lua code + 'ruff', -- Python linter/formatter LSP + 'ty', -- Python type checker LSP + 'pyright', -- Python language server for completions + 'yaml-language-server', -- YAML LSP with Kubernetes schemas + 'helm-ls', -- Helm chart language server + 'prettier', -- YAML/JSON formatter -- You can add other tools here that you want Mason to install }) @@ -653,6 +534,101 @@ require('lazy').setup({ }, }) vim.lsp.enable 'lua_ls' + + -- Ruff LSP for Python linting and formatting + vim.lsp.config('ruff', { + cmd = { vim.fn.stdpath 'data' .. '/mason/bin/ruff', 'server' }, + init_options = { + settings = { + lineLength = 88, + logLevel = 'warn', + }, + }, + }) + vim.lsp.enable 'ruff' + + -- ty LSP for Python type checking + vim.lsp.config('ty', { + cmd = { vim.fn.stdpath 'data' .. '/mason/bin/ty', 'server' }, + settings = { + ty = { + configuration = { + rules = { + ['unresolved-reference'] = 'warn', + }, + }, + }, + }, + }) + vim.lsp.enable 'ty' + + -- Pyright LSP for Python completions and intellisense + vim.lsp.config('pyright', { + cmd = { vim.fn.stdpath 'data' .. '/mason/bin/pyright-langserver', '--stdio' }, + capabilities = capabilities, + settings = { + python = { + analysis = { + autoSearchPaths = true, + useLibraryCodeForTypes = true, + diagnosticMode = 'openFilesOnly', + }, + }, + }, + }) + vim.lsp.enable 'pyright' + + -- YAML Language Server with Kubernetes and CRD support + vim.lsp.config('yamlls', { + cmd = { vim.fn.stdpath 'data' .. '/mason/bin/yaml-language-server', '--stdio' }, + capabilities = capabilities, + settings = { + redhat = { telemetry = { enabled = false } }, + yaml = { + keyOrdering = false, + format = { enable = true }, + validate = true, + schemaStore = { + enable = false, -- Disable built-in, use SchemaStore.nvim + url = '', + }, + -- Enable CRD schemas from datreeio/CRDs-catalog + kubernetesCRDStore = { + enable = true, + url = 'https://raw.githubusercontent.com/datreeio/CRDs-catalog/main', + }, + schemas = vim.tbl_deep_extend('force', require('schemastore').yaml.schemas(), { + kubernetes = { + '**/k8s/**/*.yaml', + '**/kubernetes/**/*.yaml', + '**/manifests/**/*.yaml', + '**/deploy/**/*.yaml', + '**/base/**/*.yaml', + '**/overlays/**/*.yaml', + '*.k8s.yaml', + '*.yaml', + }, + }), + }, + }, + }) + vim.lsp.enable 'yamlls' + + -- Helm Language Server + vim.lsp.config('helm_ls', { + cmd = { vim.fn.stdpath 'data' .. '/mason/bin/helm_ls', 'serve' }, + capabilities = capabilities, + settings = { + ['helm-ls'] = { + logLevel = 'info', + yamlls = { + enabled = true, + path = vim.fn.stdpath 'data' .. '/mason/bin/yaml-language-server', + }, + }, + }, + }) + vim.lsp.enable 'helm_ls' end, }, @@ -687,7 +663,15 @@ require('lazy').setup({ formatters_by_ft = { lua = { 'stylua' }, -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, + python = { + -- To fix auto-fixable lint errors. + 'ruff_fix', + -- To run the Ruff formatter. + 'ruff_format', + -- To organize the imports. + 'ruff_organize_imports', + }, + yaml = { 'prettier' }, -- -- You can use 'stop_after_first' to run the first available formatter from the list -- javascript = { "prettierd", "prettier", stop_after_first = true }, @@ -750,7 +734,7 @@ require('lazy').setup({ -- : Toggle signature help -- -- See :h blink-cmp-config-keymap for defining your own keymap - preset = 'default', + preset = 'super-tab', -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps @@ -788,25 +772,18 @@ require('lazy').setup({ }, }, - { -- You can easily change to a different colorscheme. - -- Change the name of the colorscheme plugin below, and then - -- change the command in the config to whatever the name of that colorscheme is. - -- - -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`. - 'folke/tokyonight.nvim', - priority = 1000, -- Make sure to load this before all the other start plugins. + { -- Catppuccin colorscheme + 'catppuccin/nvim', + name = 'catppuccin', + priority = 1000, config = function() - ---@diagnostic disable-next-line: missing-fields - require('tokyonight').setup { + require('catppuccin').setup { + flavour = 'mocha', styles = { - comments = { italic = false }, -- Disable italics in comments + comments = {}, -- Disable italics in comments (empty = no styling) }, } - - -- 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 'catppuccin' end, }, @@ -831,19 +808,6 @@ require('lazy').setup({ -- - sr)' - [S]urround [R]eplace [)] ['] require('mini.surround').setup() - -- Simple and easy statusline. - -- You could remove this setup call if you don't like it, - -- and try some other statusline plugin - local statusline = require 'mini.statusline' - -- set use_icons to true if you have a Nerd Font - statusline.setup { use_icons = vim.g.have_nerd_font } - - -- You can configure sections in the statusline by overriding their - -- default behavior. For example, here we set the section for - -- cursor location to LINE:COLUMN - ---@diagnostic disable-next-line: duplicate-set-field - statusline.section_location = function() return '%2l:%-2v' end - -- ... and there is more! -- Check out: https://github.com/nvim-mini/mini.nvim end, @@ -852,7 +816,7 @@ require('lazy').setup({ { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', config = function() - local filetypes = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' } + local filetypes = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'yaml', 'helm' } require('nvim-treesitter').install(filetypes) vim.api.nvim_create_autocmd('FileType', { pattern = filetypes, @@ -870,23 +834,22 @@ require('lazy').setup({ -- 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 recommend keymaps + require 'kickstart.plugins.debug', + require 'kickstart.plugins.indent_line', + require 'kickstart.plugins.lint', + require 'kickstart.plugins.autopairs', + require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` - -- Or use telescope! + -- Or use Snacks picker! -- In normal mode type `sh` then write `lazy.nvim-plugin` - -- you can continue same window with `sr` which resumes last telescope search + -- you can continue same window with `sr` which resumes last search }, { ui = { -- If you are using a Nerd Font: set icons to an empty table which will use the @@ -909,5 +872,7 @@ require('lazy').setup({ }, }) +require('custom.keymaps') + -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et diff --git a/lua/custom/keymaps.lua b/lua/custom/keymaps.lua new file mode 100644 index 00000000000..c09a91c31b0 --- /dev/null +++ b/lua/custom/keymaps.lua @@ -0,0 +1,193 @@ +local map = vim.keymap.set + +---------------------------------------------------------------------- +-- WINDOW MANAGEMENT (w) +---------------------------------------------------------------------- +map('n', 'w|', 'v', { desc = 'Split window right' }) +map('n', 'w-', 's', { desc = 'Split window below' }) +map('n', 'wd', 'c', { desc = '[W]indow [D]elete' }) +map('n', 'wo', 'o', { desc = '[W]indow [O]nly (close others)' }) +map('n', 'wm', function() + if vim.t.maximized then + vim.cmd('wincmd =') + vim.t.maximized = false + else + vim.cmd('wincmd _|') + vim.t.maximized = true + end +end, { desc = '[W]indow toggle [M]aximize' }) +map('n', 'w=', '=', { desc = 'Equalize window sizes' }) +map('n', '', 'resize +2', { desc = 'Increase window height' }) +map('n', '', 'resize -2', { desc = 'Decrease window height' }) +map('n', '', 'vertical resize -2', { desc = 'Decrease window width' }) +map('n', '', 'vertical resize +2', { desc = 'Increase window width' }) + +---------------------------------------------------------------------- +-- BUFFER MANAGEMENT (b) +---------------------------------------------------------------------- +map('n', 'bd', 'bdelete', { desc = '[B]uffer [D]elete' }) +map('n', 'bD', 'bdelete!', { desc = '[B]uffer [D]elete (force)' }) +map('n', 'bo', function() + local current = vim.api.nvim_get_current_buf() + for _, buf in ipairs(vim.api.nvim_list_bufs()) do + if buf ~= current and vim.api.nvim_buf_is_loaded(buf) then + vim.api.nvim_buf_delete(buf, { force = false }) + end + end +end, { desc = '[B]uffer delete [O]thers' }) +map('n', 'bb', 'b#', { desc = '[B]uffer [B]ack to alternate' }) +map('n', 'b1', '1gt', { desc = 'Go to tab 1' }) +map('n', 'b2', '2gt', { desc = 'Go to tab 2' }) +map('n', 'b3', '3gt', { desc = 'Go to tab 3' }) +map('n', 'b4', '4gt', { desc = 'Go to tab 4' }) +map('n', 'b5', '5gt', { desc = 'Go to tab 5' }) +map('n', 'b6', '6gt', { desc = 'Go to tab 6' }) +map('n', 'b7', '7gt', { desc = 'Go to tab 7' }) +map('n', 'b8', '8gt', { desc = 'Go to tab 8' }) +map('n', 'b9', '9gt', { desc = 'Go to tab 9' }) +map('n', '', 'bprevious', { desc = 'Previous buffer' }) +map('n', '', 'bnext', { desc = 'Next buffer' }) +map('n', '[b', 'bprevious', { desc = 'Previous buffer' }) +map('n', ']b', 'bnext', { desc = 'Next buffer' }) + +---------------------------------------------------------------------- +-- TAB MANAGEMENT () +---------------------------------------------------------------------- +map('n', '', 'tabnew', { desc = 'New tab' }) +map('n', 'd', 'tabclose', { desc = 'Close tab' }) +map('n', ']', 'tabnext', { desc = 'Next tab' }) +map('n', '[', 'tabprevious', { desc = 'Previous tab' }) +map('n', 'f', 'tabfirst', { desc = 'First tab' }) +map('n', 'l', 'tablast', { desc = 'Last tab' }) +map('n', 'o', 'tabonly', { desc = 'Close other tabs' }) +map('n', '1', '1gt', { desc = 'Go to tab 1' }) +map('n', '2', '2gt', { desc = 'Go to tab 2' }) +map('n', '3', '3gt', { desc = 'Go to tab 3' }) +map('n', '4', '4gt', { desc = 'Go to tab 4' }) +map('n', '5', '5gt', { desc = 'Go to tab 5' }) +map('n', '6', '6gt', { desc = 'Go to tab 6' }) +map('n', '7', '7gt', { desc = 'Go to tab 7' }) +map('n', '8', '8gt', { desc = 'Go to tab 8' }) +map('n', '9', '9gt', { desc = 'Go to tab 9' }) + +---------------------------------------------------------------------- +-- TOGGLES (u) +---------------------------------------------------------------------- +map('n', 'ul', function() vim.wo.number = not vim.wo.number end, { desc = 'Toggle [L]ine numbers' }) +map('n', 'uL', function() vim.wo.relativenumber = not vim.wo.relativenumber end, { desc = 'Toggle relative line [L]numbers' }) +map('n', 'uw', function() vim.wo.wrap = not vim.wo.wrap end, { desc = 'Toggle [W]rap' }) +map('n', 'us', function() vim.wo.spell = not vim.wo.spell end, { desc = 'Toggle [S]pell' }) +map('n', 'uc', function() + vim.wo.conceallevel = vim.wo.conceallevel == 0 and 2 or 0 +end, { desc = 'Toggle [C]onceal' }) +map('n', 'ub', function() + vim.o.background = vim.o.background == 'dark' and 'light' or 'dark' +end, { desc = 'Toggle [B]ackground' }) +map('n', 'uS', function() vim.wo.list = not vim.wo.list end, { desc = 'Toggle [S]how whitespace' }) +map('n', 'uh', 'set hlsearch!', { desc = 'Toggle search [H]ighlight' }) +map('n', 'ud', function() + local config = vim.diagnostic.config() + vim.diagnostic.config({ virtual_text = not config.virtual_text }) +end, { desc = 'Toggle [D]iagnostics' }) +map('n', 'ur', 'nohlsearchredraw', { desc = '[U]I [R]edraw / clear highlight' }) + +---------------------------------------------------------------------- +-- GIT (g) +---------------------------------------------------------------------- +map('n', 'gb', function() + local ok, gitsigns = pcall(require, 'gitsigns') + if ok then + gitsigns.blame_line({ full = true }) + else + vim.cmd('Git blame') + end +end, { desc = '[G]it [B]lame' }) +map('n', 'gl', function() + vim.cmd('new') + vim.cmd('terminal git log --oneline -20') + vim.cmd('startinsert') +end, { desc = '[G]it [L]og' }) +map('n', 'gL', function() + vim.cmd('new') + vim.cmd('terminal git log --oneline -20 -- ' .. vim.fn.expand('%')) + vim.cmd('startinsert') +end, { desc = '[G]it [L]og (current file)' }) +map('n', 'gg', function() + vim.cmd('terminal lazygit') + vim.cmd('startinsert') +end, { desc = '[G]it [G]ui (LazyGit)' }) +map('n', 'gS', 'Git', { desc = '[G]it [S]tatus' }) +map('n', 'gd', function() vim.cmd('Gvdiffsplit') end, { desc = '[G]it [D]iff' }) + +---------------------------------------------------------------------- +-- QUICKFIX / LOCATION LIST (x) +---------------------------------------------------------------------- +map('n', 'xq', 'copen', { desc = 'Quickfix list' }) +map('n', 'xl', 'lopen', { desc = 'Location list' }) +map('n', 'xc', 'cclose', { desc = 'Close quickfix' }) +map('n', 'xC', 'lclose', { desc = 'Close location list' }) +map('n', ']q', 'cnext', { desc = 'Next quickfix item' }) +map('n', '[q', 'cprevious', { desc = 'Previous quickfix item' }) +map('n', ']Q', 'clast', { desc = 'Last quickfix item' }) +map('n', '[Q', 'cfirst', { desc = 'First quickfix item' }) +map('n', ']l', 'lnext', { desc = 'Next location item' }) +map('n', '[l', 'lprevious', { desc = 'Previous location item' }) + +---------------------------------------------------------------------- +-- LSP / CODE (c) +---------------------------------------------------------------------- +map('n', 'ca', vim.lsp.buf.code_action, { desc = '[C]ode [A]ction' }) +map('x', 'ca', vim.lsp.buf.code_action, { desc = '[C]ode [A]ction' }) +map('n', 'cr', vim.lsp.buf.rename, { desc = '[C]ode [R]ename' }) +map('n', 'cA', function() + vim.lsp.buf.code_action({ context = { only = { 'source' } }, apply = true }) +end, { desc = '[C]ode [A]ction (source)' }) +map('n', 'cl', 'LspInfo', { desc = '[C]ode [L]SP Info' }) +map('n', 'cd', vim.diagnostic.open_float, { desc = 'Line [D]iagnostics' }) +map('n', ']e', function() vim.diagnostic.goto_next({ severity = vim.diagnostic.severity.ERROR }) end, { desc = 'Next [E]rror' }) +map('n', '[e', function() vim.diagnostic.goto_prev({ severity = vim.diagnostic.severity.ERROR }) end, { desc = 'Previous [E]rror' }) +map('n', ']w', function() vim.diagnostic.goto_next({ severity = vim.diagnostic.severity.WARN }) end, { desc = 'Next [W]arning' }) +map('n', '[w', function() vim.diagnostic.goto_prev({ severity = vim.diagnostic.severity.WARN }) end, { desc = 'Previous [W]arning' }) + +---------------------------------------------------------------------- +-- UTILITIES +---------------------------------------------------------------------- +map({ 'i', 'x', 'n', 's' }, '', 'w', { desc = 'Save file' }) +map('n', 'n', 'nzzzv', { desc = 'Next search result (centered)' }) +map('n', 'N', 'Nzzzv', { desc = 'Previous search result (centered)' }) +map('n', 'J', 'mzJ`z', { desc = 'Join lines (keep position)' }) +map('n', '', 'm .+1==', { desc = 'Move line down' }) +map('n', '', 'm .-2==', { desc = 'Move line up' }) +map('i', '', 'm .+1==gi', { desc = 'Move line down' }) +map('i', '', 'm .-2==gi', { desc = 'Move line up' }) +map('v', '', "m '>+1gv=gv", { desc = 'Move selection down' }) +map('v', '', "m '<-2gv=gv", { desc = 'Move selection up' }) +map('v', '<', '', '>gv', { desc = 'Indent right' }) +map('n', 'fn', 'enew', { desc = '[F]ile [N]ew' }) +map('n', 'qq', 'qa', { desc = '[Q]uit [Q]all' }) +map('n', 'qQ', 'qa!', { desc = '[Q]uit [Q]all (force)' }) +map('n', 'K', 'norm! K', { desc = 'Keywordprg' }) +map('n', 'l', 'Lazy', { desc = 'Open [L]azy' }) +map('n', 'cf', function() require('conform').format({ async = true, lsp_format = 'fallback' }) end, { desc = '[C]ode [F]ormat' }) +map('x', 'cf', function() require('conform').format({ async = true, lsp_format = 'fallback' }) end, { desc = '[C]ode [F]ormat' }) + +---------------------------------------------------------------------- +-- TERMINAL +---------------------------------------------------------------------- +map('n', 'ft', function() + vim.cmd('split') + vim.cmd('terminal') + vim.cmd('startinsert') +end, { desc = '[F]ile [T]erminal' }) +map('n', '', function() + vim.cmd('terminal') + vim.cmd('startinsert') +end, { desc = 'Open terminal' }) +map('t', '', 'close', { desc = 'Close terminal' }) +map('t', '', 'wincmd h', { desc = 'Go to left window' }) +map('t', '', 'wincmd j', { desc = 'Go to lower window' }) +map('t', '', 'wincmd k', { desc = 'Go to upper window' }) +map('t', '', 'wincmd l', { desc = 'Go to right window' }) + +return {} diff --git a/lua/custom/plugins/kubernetes.lua b/lua/custom/plugins/kubernetes.lua new file mode 100644 index 00000000000..ef610ff09a8 --- /dev/null +++ b/lua/custom/plugins/kubernetes.lua @@ -0,0 +1,14 @@ +return { + -- SchemaStore for YAML schemas (GitHub Actions, Docker Compose, etc.) + { + 'b0o/SchemaStore.nvim', + lazy = true, + version = false, + }, + + -- Helm filetype detection and syntax + { + 'towolf/vim-helm', + ft = 'helm', + }, +} diff --git a/lua/custom/plugins/lensline.lua b/lua/custom/plugins/lensline.lua new file mode 100644 index 00000000000..e6bc1c66c98 --- /dev/null +++ b/lua/custom/plugins/lensline.lua @@ -0,0 +1,8 @@ +return { + { + 'oribarilan/lensline.nvim', + tag = '2.0.0', + event = 'LspAttach', + config = function() require('lensline').setup() end, + }, +} diff --git a/lua/custom/plugins/lualine.lua b/lua/custom/plugins/lualine.lua new file mode 100644 index 00000000000..9a37b099057 --- /dev/null +++ b/lua/custom/plugins/lualine.lua @@ -0,0 +1,20 @@ +return { + { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + require('lualine').setup { + options = { + icons_enabled = vim.g.have_nerd_font, + theme = 'auto', -- Auto-detects catppuccin + section_separators = { left = '', right = '' }, + component_separators = { left = '', right = '' }, + }, + sections = { + lualine_c = { { 'filename', path = 1 } }, -- Show relative path + lualine_z = { '%2l:%-2v' }, -- Match previous LINE:COLUMN format + }, + } + end, + }, +} diff --git a/lua/custom/plugins/snacks.lua b/lua/custom/plugins/snacks.lua new file mode 100644 index 00000000000..d153ee10284 --- /dev/null +++ b/lua/custom/plugins/snacks.lua @@ -0,0 +1,82 @@ +return { + -- Main Snacks Configuration with Core Features & Keymaps + { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + ---@type snacks.Config + opts = { + bigfile = { enabled = true }, + dashboard = { enabled = true }, + explorer = { enabled = true }, + indent = { enabled = true }, + input = { enabled = true }, + notifier = { enabled = true }, + quickfile = { enabled = true }, + scope = { enabled = true }, + scroll = { enabled = true }, + statuscolumn = { enabled = true }, + words = { enabled = true }, + picker = { + enabled = true, + win = { + input = { + keys = { + -- Toggle between root and cwd + [""] = { "toggle_cwd", mode = { "n", "i" } }, + }, + }, + }, + }, + }, + -- stylua: ignore + keys = { + -- Quick Access + { ",", function() Snacks.picker.buffers() end, desc = "Buffers" }, + { "/", function() Snacks.picker.lines() end, desc = "Buffer Lines" }, + { "", function() Snacks.picker.buffers() end, desc = "Buffers" }, + + -- Find (f prefix) + { "fb", function() Snacks.picker.buffers() end, desc = "[F]ind [B]uffers" }, + { "fc", function() Snacks.picker.files({ cwd = vim.fn.stdpath('config') }) end, desc = "[F]ind [C]onfig Files" }, + { "ff", function() Snacks.picker.files() end, desc = "[F]ind [F]iles" }, + { "fg", function() Snacks.picker.git_files() end, desc = "[F]ind [G]it Files" }, + { "fr", function() Snacks.picker.recent() end, desc = "[F]ind [R]ecent Files" }, + + -- Git (g prefix) + { "gd", function() Snacks.picker.git_diff() end, desc = "Git [D]iff" }, + { "gs", function() Snacks.picker.git_status() end, desc = "Git [S]tatus" }, + { "gS", function() Snacks.picker.git_stash() end, desc = "Git [S]tash" }, + + -- Search (s prefix) - Matching Telescope keymaps + { "s.", function() Snacks.picker.recent() end, desc = "[S]earch Recent Files" }, + { "s/", function() Snacks.picker.grep_buffers() end, desc = "[S]earch in Open Files" }, + { "sb", function() Snacks.picker.lines() end, desc = "[S]earch [B]uffer Lines" }, + { "sB", function() Snacks.picker.grep_buffers() end, desc = "[S]earch Open [B]uffers" }, + { "sc", function() Snacks.picker.commands() end, desc = "[S]earch [C]ommands" }, + { "sd", function() Snacks.picker.diagnostics() end, desc = "[S]earch [D]iagnostics" }, + { "sf", function() Snacks.picker.files() end, desc = "[S]earch [F]iles" }, + { "sg", function() Snacks.picker.grep() end, desc = "[S]earch by [G]rep" }, + { "sh", function() Snacks.picker.help() end, desc = "[S]earch [H]elp" }, + { "sk", function() Snacks.picker.keymaps() end, desc = "[S]earch [K]eymaps" }, + { "sm", function() Snacks.picker.marks() end, desc = "[S]earch [M]arks" }, + { "sn", function() Snacks.picker.files({ cwd = vim.fn.stdpath('config') }) end, desc = "[S]earch [N]eovim files" }, + { "sr", function() Snacks.picker.resume() end, desc = "[S]earch [R]esume" }, + { "ss", function() Snacks.picker() end, desc = "[S]earch [S]elect Picker" }, + { "sw", function() Snacks.picker.grep_word() end, desc = "[S]earch current [W]ord", mode = { "n", "x" } }, + + -- Notifications + { "n", function() Snacks.picker.notifications() end, desc = "Notification History" }, + { "un", function() Snacks.notifier.hide() end, desc = "Dismiss Notifications" }, + + -- Explorer + { "fe", function() Snacks.explorer({ cwd = vim.fs.root(0, ".git") or vim.fn.getcwd() }) end, desc = "[F]ile [E]xplorer (root)" }, + { "fE", function() Snacks.explorer() end, desc = "[F]ile [E]xplorer (cwd)" }, + { "e", "fe", desc = "Explorer (root)", remap = true }, + { "E", "fE", desc = "Explorer (cwd)", remap = true }, + + -- UI + { "uC", function() Snacks.picker.colorschemes() end, desc = "Colorschemes" }, + }, + }, +} diff --git a/lua/kickstart/plugins/neo-tree.lua b/lua/kickstart/plugins/neo-tree.lua deleted file mode 100644 index c7067891df0..00000000000 --- a/lua/kickstart/plugins/neo-tree.lua +++ /dev/null @@ -1,25 +0,0 @@ --- Neo-tree is a Neovim plugin to browse the file system --- https://github.com/nvim-neo-tree/neo-tree.nvim - -return { - 'nvim-neo-tree/neo-tree.nvim', - version = '*', - dependencies = { - 'nvim-lua/plenary.nvim', - 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended - 'MunifTanjim/nui.nvim', - }, - lazy = false, - keys = { - { '\\', ':Neotree reveal', desc = 'NeoTree reveal', silent = true }, - }, - opts = { - filesystem = { - window = { - mappings = { - ['\\'] = 'close_window', - }, - }, - }, - }, -}