From acc7165a057cc02099a4ce591d7c7b57c2e7308b Mon Sep 17 00:00:00 2001 From: Gustavo Date: Tue, 1 Jul 2025 23:26:27 +0200 Subject: [PATCH 01/19] feat: the basics of my nvim setup These are just some required things to use neovim --- .gitignore | 1 - init.lua | 157 +++++++++++------------------------ lazy-lock.json | 30 +++++++ lua/custom/plugins/init.lua | 5 -- lua/custom/plugins/noice.lua | 18 ++++ 5 files changed, 98 insertions(+), 113 deletions(-) create mode 100644 lazy-lock.json delete mode 100644 lua/custom/plugins/init.lua create mode 100644 lua/custom/plugins/noice.lua diff --git a/.gitignore b/.gitignore index 005b535b606..8a192cab54d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,3 @@ test.sh nvim spell/ -lazy-lock.json diff --git a/init.lua b/init.lua index b98ffc6198a..af5566d9da1 100644 --- a/init.lua +++ b/init.lua @@ -20,69 +20,15 @@ ===================================================================== ===================================================================== -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! :) ---]] +-- [[ Setting options ]] +-- See `:help vim.o` +-- NOTE: You can change these options as you wish! +-- For more options, you can see `:help option-list` +-- +-- Set to true if you have a Nerd Font installed and selected in the terminal +vim.g.have_nerd_font = true -- Set as the leader key -- See `:help mapleader` @@ -90,19 +36,11 @@ P.S. You can delete this when you're done too. It's your config now! :) 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 - --- [[ 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.relativenumber = true -- Enable mouse mode, can be useful for resizing splits for example! vim.o.mouse = 'a' @@ -184,12 +122,6 @@ vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagn -- 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!!"') - -- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows -- @@ -344,7 +276,7 @@ require('lazy').setup({ -- Document existing key chains spec = { - { 's', group = '[S]earch' }, + { 'f', group = '[F]ind' }, { 't', group = '[T]oggle' }, { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, }, @@ -407,11 +339,17 @@ require('lazy').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' }, - -- }, - -- }, + defaults = { + layout_strategy = 'horizontal', + layout_config = { + width = 0.9, + height = 0.9, + }, + preview_width = 0.6, + mappings = { + i = { [''] = 'to_fuzzy_refine' }, + }, + }, -- pickers = {} extensions = { ['ui-select'] = { @@ -426,15 +364,15 @@ require('lazy').setup({ -- 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', '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', 'fh', builtin.help_tags, { desc = '[F]ind [H]elp' }) + vim.keymap.set('n', 'fk', builtin.keymaps, { desc = '[F]ind [K]eymaps' }) + vim.keymap.set('n', 'ff', builtin.find_files, { desc = '[F]ind [F]iles' }) + vim.keymap.set('n', 'fs', builtin.builtin, { desc = '[F]ind [S]elect Telescope' }) + vim.keymap.set('n', 'fw', builtin.grep_string, { desc = '[F]ind current [W]ord' }) + vim.keymap.set('n', 'fg', builtin.live_grep, { desc = '[F]ind by [G]rep' }) + vim.keymap.set('n', 'fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostics' }) + vim.keymap.set('n', 'f.', builtin.resume, { desc = '[F]ind [R]esume' }) + vim.keymap.set('n', 'fr', builtin.oldfiles, { desc = '[F]ind [R]ecent Files' }) vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) -- Slightly advanced example of overriding default behavior and theme @@ -442,23 +380,23 @@ require('lazy').setup({ -- 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, + previewer = true, }) 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() + vim.keymap.set('n', 'f/', function() builtin.live_grep { grep_open_files = true, prompt_title = 'Live Grep in Open Files', } - end, { desc = '[S]earch [/] in Open Files' }) + end, { desc = '[F]ind [/] in Open Files' }) -- Shortcut for searching your Neovim configuration files - vim.keymap.set('n', 'sn', function() + vim.keymap.set('n', 'fn', function() builtin.find_files { cwd = vim.fn.stdpath 'config' } - end, { desc = '[S]earch [N]eovim files' }) + end, { desc = '[F]ind [N]eovim files' }) end, }, @@ -672,16 +610,16 @@ require('lazy').setup({ -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { -- clangd = {}, - -- gopls = {}, + gopls = {}, -- pyright = {}, - -- rust_analyzer = {}, + rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- -- Some languages (like typescript) have entire language plugins that can be useful: -- https://github.com/pmizio/typescript-tools.nvim -- -- But for many setups, the LSP (`ts_ls`) will work just fine - -- ts_ls = {}, + ts_ls = {}, -- lua_ls = { @@ -742,7 +680,7 @@ require('lazy').setup({ cmd = { 'ConformInfo' }, keys = { { - 'f', + '=', function() require('conform').format { async = true, lsp_format = 'fallback' } end, @@ -773,6 +711,8 @@ require('lazy').setup({ -- -- You can use 'stop_after_first' to run the first available formatter from the list -- javascript = { "prettierd", "prettier", stop_after_first = true }, + typescript = { 'prettierd' }, + typescriptreact = { 'prettierd' }, }, }, }, @@ -835,7 +775,7 @@ require('lazy').setup({ -- : Toggle signature help -- -- See :h blink-cmp-config-keymap for defining your own keymap - preset = 'default', + preset = 'enter', -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps @@ -850,7 +790,7 @@ require('lazy').setup({ completion = { -- 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 = { auto_show = true, auto_show_delay_ms = 500 }, }, sources = { @@ -886,7 +826,10 @@ require('lazy').setup({ config = function() ---@diagnostic disable-next-line: missing-fields require('tokyonight').setup { + transparent = true, styles = { + sidebars = 'transparent', + floats = 'transparent', comments = { italic = false }, -- Disable italics in comments }, } @@ -974,17 +917,17 @@ require('lazy').setup({ -- 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.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.autopairs', + require 'kickstart.plugins.neo-tree', + 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! diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 00000000000..2ab819dabf6 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,30 @@ +{ + "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, + "blink.cmp": { "branch": "main", "commit": "9bcb14b43852a6f2bfd5ac9ef29cb5cf09b1b39b" }, + "conform.nvim": { "branch": "master", "commit": "4c9003aab62879612c50136649baa1b8ed36cfa1" }, + "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, + "gitsigns.nvim": { "branch": "main", "commit": "588264bee92993df92535b6742576f5655c91b1c" }, + "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, + "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "c4c84f4521d62de595c0d0f718a9a40c1890c8ce" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, + "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, + "mini.nvim": { "branch": "main", "commit": "48f48e4b3f317e9da34ee7a01958b4c5018e2d34" }, + "neo-tree.nvim": { "branch": "main", "commit": "f481de16a0eb59c985abac8985e3f2e2f75b4875" }, + "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" }, + "nvim-lspconfig": { "branch": "master", "commit": "1cb30b1bafe5a63a5c6ac20dc39f83487df38855" }, + "nvim-notify": { "branch": "master", "commit": "a22f5d7ac511c2df2fd3290a9f04c48d5a822e2e" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-web-devicons": { "branch": "master", "commit": "19d6211c78169e78bab372b585b6fb17ad974e82" }, + "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, + "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, + "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, + "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, + "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } +} diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua deleted file mode 100644 index be0eb9d8d7a..00000000000 --- a/lua/custom/plugins/init.lua +++ /dev/null @@ -1,5 +0,0 @@ --- You can add your own plugins here or in other files in this directory! --- I promise not to create any merge conflicts in this directory :) --- --- See the kickstart.nvim README for more information -return {} diff --git a/lua/custom/plugins/noice.lua b/lua/custom/plugins/noice.lua new file mode 100644 index 00000000000..7e3de12f278 --- /dev/null +++ b/lua/custom/plugins/noice.lua @@ -0,0 +1,18 @@ +return { + -- lazy.nvim + { + 'folke/noice.nvim', + event = 'VeryLazy', + opts = { + -- add any options here + }, + dependencies = { + -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries + 'MunifTanjim/nui.nvim', + -- OPTIONAL: + -- `nvim-notify` is only needed, if you want to use the notification view. + -- If not available, we use `mini` as the fallback + 'rcarriga/nvim-notify', + }, + }, +} From 2ee03191ccf60d60f74fb0193665cca790d73a30 Mon Sep 17 00:00:00 2001 From: Gustavo Date: Tue, 1 Jul 2025 23:28:54 +0200 Subject: [PATCH 02/19] feat: added linting and debugging plugins --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index af5566d9da1..c12ea4a6c5d 100644 --- a/init.lua +++ b/init.lua @@ -916,9 +916,9 @@ 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.debug', require 'kickstart.plugins.indent_line', - -- require 'kickstart.plugins.lint', + require 'kickstart.plugins.lint', require 'kickstart.plugins.autopairs', require 'kickstart.plugins.neo-tree', require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps From a61f73853d6cf97b91007dd7bbcee028630b3ec6 Mon Sep 17 00:00:00 2001 From: Gustavo Date: Thu, 3 Jul 2025 14:05:24 +0200 Subject: [PATCH 03/19] added a few more plugins to make my life easier :) --- lazy-lock.json | 10 ++++++++- lua/custom/plugins/autotags.lua | 25 ++++++++++++++++++++++ lua/custom/plugins/hidden-diagnostic.lua | 11 ++++++++++ lua/custom/plugins/init.lua | 8 +++++++ lua/custom/plugins/lazygit.lua | 20 ++++++++++++++++++ lua/kickstart/plugins/lint.lua | 27 +++++++++++++++--------- 6 files changed, 90 insertions(+), 11 deletions(-) create mode 100644 lua/custom/plugins/autotags.lua create mode 100644 lua/custom/plugins/hidden-diagnostic.lua create mode 100644 lua/custom/plugins/init.lua create mode 100644 lua/custom/plugins/lazygit.lua diff --git a/lazy-lock.json b/lazy-lock.json index 2ab819dabf6..1e6efa495de 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -8,22 +8,30 @@ "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, + "lazygit.nvim": { "branch": "main", "commit": "4839ab642962cc76bb1bf278427dc4c59be15072" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "c4c84f4521d62de595c0d0f718a9a40c1890c8ce" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, "mini.nvim": { "branch": "main", "commit": "48f48e4b3f317e9da34ee7a01958b4c5018e2d34" }, "neo-tree.nvim": { "branch": "main", "commit": "f481de16a0eb59c985abac8985e3f2e2f75b4875" }, "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, - "nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" }, + "nvim-dap": { "branch": "master", "commit": "14fe46ae16eb272629144a93f7738f5279665a4f" }, + "nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" }, + "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" }, + "nvim-lint": { "branch": "master", "commit": "2b0039b8be9583704591a13129c600891ac2c596" }, "nvim-lspconfig": { "branch": "master", "commit": "1cb30b1bafe5a63a5c6ac20dc39f83487df38855" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-notify": { "branch": "master", "commit": "a22f5d7ac511c2df2fd3290a9f04c48d5a822e2e" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, "nvim-web-devicons": { "branch": "master", "commit": "19d6211c78169e78bab372b585b6fb17ad974e82" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, + "tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "d52d70780ca6497ed28ad1b11bb1e981f666f62a" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } diff --git a/lua/custom/plugins/autotags.lua b/lua/custom/plugins/autotags.lua new file mode 100644 index 00000000000..2972cba776c --- /dev/null +++ b/lua/custom/plugins/autotags.lua @@ -0,0 +1,25 @@ +return { + 'windwp/nvim-ts-autotag', + dependencies = { 'nvim-treesitter/nvim-treesitter' }, + config = function() + require('nvim-ts-autotag').setup { + autotag = { + enable = true, + enable_rename = true, + enable_close = true, + enable_close_on_slash = true, + filetypes = { + 'html', + 'xml', + 'javascript', + 'javascriptreact', + 'typescript', + 'typescriptreact', + 'vue', + 'svelte', + }, + }, + } + end, + event = 'InsertEnter', +} diff --git a/lua/custom/plugins/hidden-diagnostic.lua b/lua/custom/plugins/hidden-diagnostic.lua new file mode 100644 index 00000000000..861c621af45 --- /dev/null +++ b/lua/custom/plugins/hidden-diagnostic.lua @@ -0,0 +1,11 @@ +return { + 'rachartier/tiny-inline-diagnostic.nvim', + event = 'VeryLazy', + priority = 1000, + config = function() + require('tiny-inline-diagnostic').setup() + vim.diagnostic.config { + virtual_text = false, + } -- Only if needed in your configuration, if you already have native LSP diagnostics + end, +} diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua new file mode 100644 index 00000000000..18673e62c62 --- /dev/null +++ b/lua/custom/plugins/init.lua @@ -0,0 +1,8 @@ +return { + 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', +} diff --git a/lua/custom/plugins/lazygit.lua b/lua/custom/plugins/lazygit.lua new file mode 100644 index 00000000000..254236bcc0e --- /dev/null +++ b/lua/custom/plugins/lazygit.lua @@ -0,0 +1,20 @@ +return { + 'kdheepak/lazygit.nvim', + lazy = true, + cmd = { + 'LazyGit', + 'LazyGitConfig', + 'LazyGitCurrentFile', + 'LazyGitFilter', + 'LazyGitFilterCurrentFile', + }, + -- optional for floating window border decoration + dependencies = { + 'nvim-lua/plenary.nvim', + }, + -- setting the keybinding for LazyGit with 'keys' is recommended in + -- order to load the plugin when the command is run for the first time + keys = { + { 'lg', 'LazyGit', desc = 'LazyGit' }, + }, +} diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index dec42f097c6..776aa4253a3 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -7,6 +7,14 @@ return { local lint = require 'lint' lint.linters_by_ft = { markdown = { 'markdownlint' }, + dockerfile = { 'hadolint' }, + json = { 'jsonlint' }, + rst = { 'vale' }, + text = { 'vale' }, + javascript = { 'eslint' }, + javascripttreact = { 'eslint' }, + typescript = { 'eslint' }, + typescriptreact = { 'eslint' }, } -- To allow other plugins to add linters to require('lint').linters_by_ft, @@ -30,16 +38,15 @@ return { -- } -- -- You can disable the default linters by setting their filetypes to nil: - -- lint.linters_by_ft['clojure'] = nil - -- lint.linters_by_ft['dockerfile'] = nil - -- lint.linters_by_ft['inko'] = nil - -- lint.linters_by_ft['janet'] = nil - -- lint.linters_by_ft['json'] = nil - -- lint.linters_by_ft['markdown'] = nil - -- lint.linters_by_ft['rst'] = nil - -- lint.linters_by_ft['ruby'] = nil - -- lint.linters_by_ft['terraform'] = nil - -- lint.linters_by_ft['text'] = nil + lint.linters_by_ft['markdown'] = nil + lint.linters_by_ft['dockerfile'] = nil + lint.linters_by_ft['json'] = nil + lint.linters_by_ft['rst'] = nil + lint.linters_by_ft['text'] = nil + lint.linters_by_ft['javascript'] = nil + lint.linters_by_ft['javascripttreact'] = nil + lint.linters_by_ft['typescript'] = nil + lint.linters_by_ft['typescriptreact'] = nil -- Create autocommand which carries out the actual linting -- on the specified events. From 0b4c1a94e9ce98fec89b8a9b79b48adc01578641 Mon Sep 17 00:00:00 2001 From: Gustavo Date: Thu, 3 Jul 2025 23:32:57 +0200 Subject: [PATCH 04/19] Telescope must still be fixed to navigate with j and k but the tree is much better etc. --- init.lua | 80 +++++++++++++++++--------- lazy-lock.json | 15 +++-- lua/custom/plugins/init.lua | 8 --- lua/custom/plugins/lazygit.lua | 2 +- lua/custom/plugins/tree.lua | 89 +++++++++++++++++++++++++++++ lua/custom/plugins/trouble.lua | 33 +++++++++++ lua/kickstart/plugins/autopairs.lua | 3 - lua/kickstart/plugins/debug.lua | 4 +- lua/kickstart/plugins/gitsigns.lua | 22 +++---- lua/kickstart/plugins/lint.lua | 25 ++++---- lua/kickstart/plugins/lualine.lua | 45 +++++++++++++++ lua/kickstart/plugins/neo-tree.lua | 25 -------- 12 files changed, 259 insertions(+), 92 deletions(-) delete mode 100644 lua/custom/plugins/init.lua create mode 100644 lua/custom/plugins/tree.lua create mode 100644 lua/custom/plugins/trouble.lua create mode 100644 lua/kickstart/plugins/lualine.lua delete mode 100644 lua/kickstart/plugins/neo-tree.lua diff --git a/init.lua b/init.lua index c12ea4a6c5d..b8a5280ed0c 100644 --- a/init.lua +++ b/init.lua @@ -112,7 +112,7 @@ vim.o.confirm = true vim.keymap.set('n', '', 'nohlsearch') -- Diagnostic keymaps -vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) +-- vim.keymap.set('n', 'dq', 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 @@ -137,6 +137,9 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the upper win -- vim.keymap.set("n", "", "J", { desc = "Move window to the lower" }) -- vim.keymap.set("n", "", "K", { desc = "Move window to the upper" }) +-- NOTE These are Custom +vim.keymap.set('n', 'x', ':q', { desc = 'Kill buffer' }) + -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -278,7 +281,9 @@ require('lazy').setup({ spec = { { 'f', group = '[F]ind' }, { 't', group = '[T]oggle' }, - { 'h', group = 'Git [H]unk', mode = { 'n', 'v' } }, + { 'd', group = '[D]ebug' }, + { 'g', group = 'Git', mode = { 'n', 'v' } }, + { 'q', group = 'Quickfix' }, }, }, }, @@ -333,12 +338,12 @@ require('lazy').setup({ -- Telescope picker. This is really useful to discover what Telescope can -- do as well as how to actually do it! + local actions = require 'telescope.actions' -- [[ 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 = { layout_strategy = 'horizontal', layout_config = { @@ -346,11 +351,25 @@ require('lazy').setup({ height = 0.9, }, preview_width = 0.6, + + path_display = { 'truncate' }, mappings = { - i = { [''] = 'to_fuzzy_refine' }, + n = { + [''] = actions.add_selected_to_qflist + actions.open_qflist, + }, + i = { + [''] = 'to_fuzzy_refine', + [''] = actions.cycle_history_next, + [''] = actions.cycle_history_prev, + [''] = actions.add_selected_to_qflist + actions.open_qflist, + }, + }, + }, + pickers = { + find_files = { + find_command = { 'rg', '--files', '--hidden', '--glob', '!**/.git/*' }, }, }, - -- pickers = {} extensions = { ['ui-select'] = { require('telescope.themes').get_dropdown(), @@ -619,7 +638,11 @@ require('lazy').setup({ -- https://github.com/pmizio/typescript-tools.nvim -- -- But for many setups, the LSP (`ts_ls`) will work just fine - ts_ls = {}, + ts_ls = { + capabilities = capabilities, + }, + vue_ls = {}, + eslint = {}, -- lua_ls = { @@ -706,13 +729,30 @@ require('lazy').setup({ end, formatters_by_ft = { lua = { 'stylua' }, - -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, - -- - -- You can use 'stop_after_first' to run the first available formatter from the list - -- javascript = { "prettierd", "prettier", stop_after_first = true }, - typescript = { 'prettierd' }, - typescriptreact = { 'prettierd' }, + svelte = { { 'prettierd', 'prettier', stop_after_first = true } }, + astro = { { 'prettierd', 'prettier', stop_after_first = true } }, + javascript = { { 'prettierd', 'prettier', stop_after_first = true } }, + typescript = { { 'prettierd', 'prettier', stop_after_first = true } }, + javascriptreact = { { 'prettierd', 'prettier', stop_after_first = true } }, + typescriptreact = { { 'prettierd', 'prettier', stop_after_first = true } }, + json = { { 'prettierd', 'prettier', stop_after_first = true } }, + graphql = { { 'prettierd', 'prettier', stop_after_first = true } }, + java = { 'google-java-format' }, + kotlin = { 'ktlint' }, + ruby = { 'standardrb' }, + markdown = { { 'prettierd', 'prettier', stop_after_first = true } }, + erb = { 'htmlbeautifier' }, + html = { 'htmlbeautifier' }, + bash = { 'beautysh' }, + proto = { 'buf' }, + rust = { 'rustfmt' }, + yaml = { 'yamlfix' }, + toml = { 'taplo' }, + css = { { 'prettierd', 'prettier', stop_after_first = true } }, + scss = { { 'prettierd', 'prettier', stop_after_first = true } }, + sh = { 'shellcheck' }, + go = { 'gofmt' }, + xml = { 'xmllint' }, }, }, }, @@ -911,22 +951,10 @@ require('lazy').setup({ -- init.lua. If you want these files, they are in the repository, so you can just download them and -- place them in the correct locations. - -- NOTE: Next step on your Neovim journey: Add/Configure additional plugins for Kickstart - -- - -- 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 - -- 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 = 'kickstart.plugins' }, { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` diff --git a/lazy-lock.json b/lazy-lock.json index 1e6efa495de..9451613347f 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,29 +1,31 @@ { "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, "blink.cmp": { "branch": "main", "commit": "9bcb14b43852a6f2bfd5ac9ef29cb5cf09b1b39b" }, - "conform.nvim": { "branch": "master", "commit": "4c9003aab62879612c50136649baa1b8ed36cfa1" }, + "conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" }, "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, - "gitsigns.nvim": { "branch": "main", "commit": "588264bee92993df92535b6742576f5655c91b1c" }, + "gitsigns.nvim": { "branch": "main", "commit": "c80e0b4bfc411d5740a47adc8775fd1070f2028b" }, "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, "lazygit.nvim": { "branch": "main", "commit": "4839ab642962cc76bb1bf278427dc4c59be15072" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "c4c84f4521d62de595c0d0f718a9a40c1890c8ce" }, + "lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "73e0143385d8a2185944b42ed44d728b94ee19a3" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, "mini.nvim": { "branch": "main", "commit": "48f48e4b3f317e9da34ee7a01958b4c5018e2d34" }, - "neo-tree.nvim": { "branch": "main", "commit": "f481de16a0eb59c985abac8985e3f2e2f75b4875" }, "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, - "nvim-dap": { "branch": "master", "commit": "14fe46ae16eb272629144a93f7738f5279665a4f" }, + "nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" }, + "nvim-dap": { "branch": "master", "commit": "1c75a797b4017fec6491f509cf196c8c8833f26f" }, "nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" }, "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" }, "nvim-lint": { "branch": "master", "commit": "2b0039b8be9583704591a13129c600891ac2c596" }, - "nvim-lspconfig": { "branch": "master", "commit": "1cb30b1bafe5a63a5c6ac20dc39f83487df38855" }, + "nvim-lspconfig": { "branch": "master", "commit": "1ddc1a2e692b120cda6d33c890461e49cb85d6bf" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-notify": { "branch": "master", "commit": "a22f5d7ac511c2df2fd3290a9f04c48d5a822e2e" }, + "nvim-tree.lua": { "branch": "master", "commit": "6b5b36659688767fb9f133bb83024ab1466fe5cd" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, "nvim-web-devicons": { "branch": "master", "commit": "19d6211c78169e78bab372b585b6fb17ad974e82" }, @@ -34,5 +36,6 @@ "tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "d52d70780ca6497ed28ad1b11bb1e981f666f62a" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, + "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } } diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua deleted file mode 100644 index 18673e62c62..00000000000 --- a/lua/custom/plugins/init.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - 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', -} diff --git a/lua/custom/plugins/lazygit.lua b/lua/custom/plugins/lazygit.lua index 254236bcc0e..dc1a44a29f1 100644 --- a/lua/custom/plugins/lazygit.lua +++ b/lua/custom/plugins/lazygit.lua @@ -15,6 +15,6 @@ return { -- setting the keybinding for LazyGit with 'keys' is recommended in -- order to load the plugin when the command is run for the first time keys = { - { 'lg', 'LazyGit', desc = 'LazyGit' }, + { 'gg', 'LazyGit', desc = 'LazyGit' }, }, } diff --git a/lua/custom/plugins/tree.lua b/lua/custom/plugins/tree.lua new file mode 100644 index 00000000000..bfbf3a8a6ee --- /dev/null +++ b/lua/custom/plugins/tree.lua @@ -0,0 +1,89 @@ +return { + 'nvim-tree/nvim-tree.lua', + version = '*', + lazy = false, + dependencies = { + 'nvim-tree/nvim-web-devicons', + }, + config = function() + local function custom_attach(bufnr) + local api = require 'nvim-tree.api' + + local function opts(desc) + return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } + end + local function edit_or_open() + local node = api.tree.get_node_under_cursor() + + if node.nodes ~= nil then + -- expand or collapse folder + api.node.open.edit() + else + -- open file + api.node.open.edit() + -- Close the tree if file was opened + api.tree.close() + end + end + + -- open as vsplit on current node + local function vsplit_preview() + local node = api.tree.get_node_under_cursor() + + if node.nodes ~= nil then + -- expand or collapse folder + api.node.open.edit() + else + -- open file as vsplit + api.node.open.vertical() + end + + -- Finally refocus on tree if it was lost + api.tree.focus() + end + + -- default mappings + api.config.mappings.default_on_attach(bufnr) + + -- custom mappings + vim.keymap.set('n', '', api.tree.change_root_to_parent, opts 'Up') + vim.keymap.set('n', '?', api.tree.toggle_help, opts 'Help') + -- + -- global + vim.api.nvim_set_keymap('n', '', ':NvimTreeToggle', { silent = true, noremap = true }) + + -- on_attach + vim.keymap.set('n', 'l', edit_or_open, opts 'Edit Or Open') + vim.keymap.set('n', 'L', vsplit_preview, opts 'Vsplit Preview') + vim.keymap.set('n', 'h', api.tree.close, opts 'Close') + vim.keymap.set('n', 'H', api.tree.collapse_all, opts 'Collapse All') + end + + require('nvim-tree').setup { + on_attach = custom_attach, + sort = { + sorter = 'case_sensitive', + }, + view = { + width = 30, + }, + renderer = { + group_empty = true, + }, + filters = { + dotfiles = true, + }, + } + end, +} +-- 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/lua/custom/plugins/trouble.lua b/lua/custom/plugins/trouble.lua new file mode 100644 index 00000000000..a750f808ccf --- /dev/null +++ b/lua/custom/plugins/trouble.lua @@ -0,0 +1,33 @@ +return { + 'folke/trouble.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + cmd = { 'Trouble' }, + opts = {}, -- Use default options + keys = { + { + 'qx', + 'Trouble diagnostics toggle', + desc = 'Toggle Diagnostics', + }, + { + 'qd', + 'Trouble diagnostics toggle filter.buf=0', + desc = 'Toggle Document Diagnostics', + }, + { + 'qq', + 'Trouble quickfix toggle', + desc = 'Toggle Quickfix List', + }, + { + 'ql', + 'Trouble loclist toggle', + desc = 'Toggle Location List', + }, + { + 'qr', + 'Trouble lsp toggle focus=false win.position=right', + desc = 'Toggle LSP References', + }, + }, +} diff --git a/lua/kickstart/plugins/autopairs.lua b/lua/kickstart/plugins/autopairs.lua index 386d392e7ad..2106204c41f 100644 --- a/lua/kickstart/plugins/autopairs.lua +++ b/lua/kickstart/plugins/autopairs.lua @@ -1,6 +1,3 @@ --- autopairs --- https://github.com/windwp/nvim-autopairs - return { 'windwp/nvim-autopairs', event = 'InsertEnter', diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 8e332bf2ff9..fccec92b9ac 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -55,14 +55,14 @@ return { desc = 'Debug: Step Out', }, { - 'b', + 'db', function() require('dap').toggle_breakpoint() end, desc = 'Debug: Toggle Breakpoint', }, { - 'B', + 'dB', function() require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') end, diff --git a/lua/kickstart/plugins/gitsigns.lua b/lua/kickstart/plugins/gitsigns.lua index cbbd22d24fc..8426f8adec0 100644 --- a/lua/kickstart/plugins/gitsigns.lua +++ b/lua/kickstart/plugins/gitsigns.lua @@ -41,20 +41,20 @@ return { gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [r]eset hunk' }) -- normal mode - map('n', 'hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) - map('n', 'hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) - map('n', 'hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' }) - map('n', 'hu', gitsigns.stage_hunk, { desc = 'git [u]ndo stage hunk' }) - map('n', 'hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' }) - map('n', 'hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' }) - map('n', 'hb', gitsigns.blame_line, { desc = 'git [b]lame line' }) - map('n', 'hd', gitsigns.diffthis, { desc = 'git [d]iff against index' }) - map('n', 'hD', function() + map('n', 'gs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) + map('n', 'gr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) + map('n', 'gS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' }) + map('n', 'gu', gitsigns.stage_hunk, { desc = 'git [u]ndo stage hunk' }) + map('n', 'gR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' }) + map('n', 'gp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' }) + map('n', 'gb', gitsigns.blame_line, { desc = 'git [b]lame line' }) + map('n', 'gd', gitsigns.diffthis, { desc = 'git [d]iff against index' }) + map('n', 'gD', function() gitsigns.diffthis '@' end, { desc = 'git [D]iff against last commit' }) -- Toggles - map('n', 'tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) - map('n', 'tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' }) + map('n', 'tgb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) + map('n', 'tgD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' }) end, }, }, diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index 776aa4253a3..37e7c987cf6 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -14,7 +14,9 @@ return { javascript = { 'eslint' }, javascripttreact = { 'eslint' }, typescript = { 'eslint' }, - typescriptreact = { 'eslint' }, + svelte = { 'eslint_d' }, + kotlin = { 'ktlint' }, + terraform = { 'tflint' }, } -- To allow other plugins to add linters to require('lint').linters_by_ft, @@ -38,15 +40,18 @@ return { -- } -- -- You can disable the default linters by setting their filetypes to nil: - lint.linters_by_ft['markdown'] = nil - lint.linters_by_ft['dockerfile'] = nil - lint.linters_by_ft['json'] = nil - lint.linters_by_ft['rst'] = nil - lint.linters_by_ft['text'] = nil - lint.linters_by_ft['javascript'] = nil - lint.linters_by_ft['javascripttreact'] = nil - lint.linters_by_ft['typescript'] = nil - lint.linters_by_ft['typescriptreact'] = nil + lint.linters_by_ft['markdown'] = nil + lint.linters_by_ft['dockerfile'] = nil + lint.linters_by_ft['json'] = nil + lint.linters_by_ft['rst'] = nil + lint.linters_by_ft['text'] = nil + lint.linters_by_ft['javascript'] = nil + lint.linters_by_ft['javascripttreact'] = nil + lint.linters_by_ft['typescript'] = nil + lint.linters_by_ft['typescriptreact'] = nil + lint.linters_by_ft['svelte'] = nil + lint.linters_by_ft['kotlin'] = nil + lint.linters_by_ft['terraform'] = nil -- Create autocommand which carries out the actual linting -- on the specified events. diff --git a/lua/kickstart/plugins/lualine.lua b/lua/kickstart/plugins/lualine.lua new file mode 100644 index 00000000000..9446f8e7842 --- /dev/null +++ b/lua/kickstart/plugins/lualine.lua @@ -0,0 +1,45 @@ +return { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + require('lualine').setup { + options = { + theme = 'tokyonight', + component_separators = '', + section_separators = { left = '', right = '' }, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + }, + }, + sections = { + lualine_a = { { 'mode', separator = { left = '' }, right_padding = 2 } }, + lualine_b = { 'branch', 'diagnostics' }, + lualine_c = { { 'filename', path = 1 } }, + + lualine_x = {}, + lualine_y = { 'filetype', 'progress' }, + lualine_z = { + { 'location', separator = { right = '' }, left_padding = 2 }, + }, + }, + inactive_sections = { + lualine_a = { 'filename' }, + lualine_b = {}, + lualine_c = {}, + lualine_x = {}, + lualine_y = {}, + lualine_z = { 'location' }, + }, + tabline = {}, + extensions = {}, + } + end, +} 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', - }, - }, - }, - }, -} From 6e6e7e050d533226d1fad3a60bebe1b5b5714981 Mon Sep 17 00:00:00 2001 From: Gustavo <84131579+GuustTaillieu@users.noreply.github.com> Date: Tue, 15 Jul 2025 00:19:52 +0200 Subject: [PATCH 05/19] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4113950550d..003ed28d736 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ too - it's ignored in the kickstart repo to make maintenance easier, but it's
Linux and Mac ```sh -git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim +git clone https://github.com/GuustTaillieu/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvim ```
@@ -84,13 +84,13 @@ git clone https://github.com/nvim-lua/kickstart.nvim.git "${XDG_CONFIG_HOME:-$HO If you're using `cmd.exe`: ``` -git clone https://github.com/nvim-lua/kickstart.nvim.git "%localappdata%\nvim" +git clone https://github.com/GuustTaillieu/kickstart.nvim.git "%localappdata%\nvim" ``` If you're using `powershell.exe` ``` -git clone https://github.com/nvim-lua/kickstart.nvim.git "${env:LOCALAPPDATA}\nvim" +git clone https://github.com/GuustTaillieu/kickstart.nvim.git "${env:LOCALAPPDATA}\nvim" ``` From 1fae90350f4240f79be967c67c02e28a4e5088dc Mon Sep 17 00:00:00 2001 From: Gustavo Date: Tue, 5 Aug 2025 17:05:46 +0200 Subject: [PATCH 06/19] Changed tree viewer to oil.nvim --- lazy-lock.json | 2 +- lua/custom/plugins/oil.lua | 29 ++++++++++++ lua/custom/plugins/tree.lua | 89 ------------------------------------- 3 files changed, 30 insertions(+), 90 deletions(-) create mode 100644 lua/custom/plugins/oil.lua delete mode 100644 lua/custom/plugins/tree.lua diff --git a/lazy-lock.json b/lazy-lock.json index 9451613347f..a3d4515a803 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -25,10 +25,10 @@ "nvim-lspconfig": { "branch": "master", "commit": "1ddc1a2e692b120cda6d33c890461e49cb85d6bf" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-notify": { "branch": "master", "commit": "a22f5d7ac511c2df2fd3290a9f04c48d5a822e2e" }, - "nvim-tree.lua": { "branch": "master", "commit": "6b5b36659688767fb9f133bb83024ab1466fe5cd" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, "nvim-web-devicons": { "branch": "master", "commit": "19d6211c78169e78bab372b585b6fb17ad974e82" }, + "oil.nvim": { "branch": "master", "commit": "bbad9a76b2617ce1221d49619e4e4b659b3c61fc" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua new file mode 100644 index 00000000000..babe51ff98e --- /dev/null +++ b/lua/custom/plugins/oil.lua @@ -0,0 +1,29 @@ +return { + 'stevearc/oil.nvim', + lazy = false, + ---@module 'oil' + ---@type oil.SetupOpts + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + local oil = require 'oil' + + oil.setup { + columns = { 'icon' }, + keymaps = { + ['g?'] = { 'actions.show_help', mode = 'n' }, + ['gs'] = { 'actions.change_sort', mode = 'n' }, + [''] = { 'actions.select' }, + [''] = { 'actions.select' }, + [''] = { 'actions.parent' }, + [''] = { 'actions.select_split' }, + [''] = { 'actions.close', mode = 'n' }, + [''] = { 'actions.close', mode = 'n' }, + }, + view_options = { + show_hidden = true, + }, + } + + vim.keymap.set('n', '-', oil.toggle_float, { desc = 'Open parent directory' }) + end, +} diff --git a/lua/custom/plugins/tree.lua b/lua/custom/plugins/tree.lua deleted file mode 100644 index bfbf3a8a6ee..00000000000 --- a/lua/custom/plugins/tree.lua +++ /dev/null @@ -1,89 +0,0 @@ -return { - 'nvim-tree/nvim-tree.lua', - version = '*', - lazy = false, - dependencies = { - 'nvim-tree/nvim-web-devicons', - }, - config = function() - local function custom_attach(bufnr) - local api = require 'nvim-tree.api' - - local function opts(desc) - return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } - end - local function edit_or_open() - local node = api.tree.get_node_under_cursor() - - if node.nodes ~= nil then - -- expand or collapse folder - api.node.open.edit() - else - -- open file - api.node.open.edit() - -- Close the tree if file was opened - api.tree.close() - end - end - - -- open as vsplit on current node - local function vsplit_preview() - local node = api.tree.get_node_under_cursor() - - if node.nodes ~= nil then - -- expand or collapse folder - api.node.open.edit() - else - -- open file as vsplit - api.node.open.vertical() - end - - -- Finally refocus on tree if it was lost - api.tree.focus() - end - - -- default mappings - api.config.mappings.default_on_attach(bufnr) - - -- custom mappings - vim.keymap.set('n', '', api.tree.change_root_to_parent, opts 'Up') - vim.keymap.set('n', '?', api.tree.toggle_help, opts 'Help') - -- - -- global - vim.api.nvim_set_keymap('n', '', ':NvimTreeToggle', { silent = true, noremap = true }) - - -- on_attach - vim.keymap.set('n', 'l', edit_or_open, opts 'Edit Or Open') - vim.keymap.set('n', 'L', vsplit_preview, opts 'Vsplit Preview') - vim.keymap.set('n', 'h', api.tree.close, opts 'Close') - vim.keymap.set('n', 'H', api.tree.collapse_all, opts 'Collapse All') - end - - require('nvim-tree').setup { - on_attach = custom_attach, - sort = { - sorter = 'case_sensitive', - }, - view = { - width = 30, - }, - renderer = { - group_empty = true, - }, - filters = { - dotfiles = true, - }, - } - end, -} --- return { --- 'nvim-tree/nvim-tree.lua', --- version = '*', --- lazy = false, --- dependencies = { --- 'nvim-tree/nvim-web-devicons', --- }, --- config = function() --- require('nvim-tree').setup {} --- end, --- } From 0d337386ab0315cb2db1fc821567bbdbaaeee418 Mon Sep 17 00:00:00 2001 From: Gustavo Date: Sat, 16 Aug 2025 00:27:51 +0200 Subject: [PATCH 07/19] added structure and some updates --- init.lua | 1277 +++++++-------------- lazy-lock.json | 3 + lua/custom/plugins/oil-gitsigns.lua | 37 + lua/custom/plugins/oil.lua | 23 + lua/custom/plugins/tmux-navigator.lua | 18 + lua/kickstart/plugins/auto-completion.lua | 108 ++ lua/kickstart/plugins/colorscheme.lua | 79 ++ lua/kickstart/plugins/format.lua | 59 + lua/kickstart/plugins/git-signs.lua | 13 + lua/kickstart/plugins/guess-indent.lua | 3 + lua/kickstart/plugins/lsp/lazydev.lua | 12 + lua/kickstart/plugins/lsp/main-lsp.lua | 264 +++++ lua/kickstart/plugins/mini.lua | 38 + lua/kickstart/plugins/telescope.lua | 126 ++ lua/kickstart/plugins/todo-comments.lua | 7 + lua/kickstart/plugins/treesitter.lua | 40 + lua/kickstart/plugins/which-key.lua | 55 + 17 files changed, 1295 insertions(+), 867 deletions(-) create mode 100644 lua/custom/plugins/oil-gitsigns.lua create mode 100644 lua/custom/plugins/tmux-navigator.lua create mode 100644 lua/kickstart/plugins/auto-completion.lua create mode 100644 lua/kickstart/plugins/colorscheme.lua create mode 100644 lua/kickstart/plugins/format.lua create mode 100644 lua/kickstart/plugins/git-signs.lua create mode 100644 lua/kickstart/plugins/guess-indent.lua create mode 100644 lua/kickstart/plugins/lsp/lazydev.lua create mode 100644 lua/kickstart/plugins/lsp/main-lsp.lua create mode 100644 lua/kickstart/plugins/mini.lua create mode 100644 lua/kickstart/plugins/telescope.lua create mode 100644 lua/kickstart/plugins/todo-comments.lua create mode 100644 lua/kickstart/plugins/treesitter.lua create mode 100644 lua/kickstart/plugins/which-key.lua diff --git a/init.lua b/init.lua index b8a5280ed0c..06e2cfd41d9 100644 --- a/init.lua +++ b/init.lua @@ -24,29 +24,96 @@ -- [[ Setting options ]] -- See `:help vim.o` --- NOTE: You can change these options as you wish! --- For more options, you can see `:help option-list` --- + -- Set to true if you have a Nerd Font installed and selected in the terminal vim.g.have_nerd_font = true --- Set as the leader key --- See `:help mapleader` --- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' - --- 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 - --- Enable mouse mode, can be useful for resizing splits for example! -vim.o.mouse = 'a' +-- Key mappings +vim.g.mapleader = ' ' -- Set leader key to space +vim.g.maplocalleader = ' ' -- Set local leader key (NEW) + +-- Make background transparent +vim.api.nvim_set_hl(0, 'Normal', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NormalNC', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'EndOfBuffer', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'SignColumn', { bg = 'none' }) -- Make sign column transparent +vim.opt.number = true -- Line numbers + +-- Basic settings +vim.opt.relativenumber = true -- Relative line numbers +vim.opt.cursorline = true -- Highlight current line +vim.opt.wrap = false -- Don't wrap lines +vim.opt.scrolloff = 10 -- Keep 10 lines above/below cursor +vim.opt.sidescrolloff = 8 -- Keep 8 columns left/right of cursor + +-- Indentation +vim.opt.tabstop = 2 -- Tab width +vim.opt.shiftwidth = 2 -- Indent width +vim.opt.softtabstop = 2 -- Soft tab stop +vim.opt.expandtab = true -- Use spaces instead of tabs +vim.opt.smartindent = true -- Smart auto-indenting +vim.opt.autoindent = true -- Copy indent from current line +vim.o.breakindent = true --- Don't show the mode, since it's already in the status line -vim.o.showmode = false +-- Search settings +vim.opt.ignorecase = true -- Case insensitive search +vim.opt.smartcase = true -- Case sensitive if uppercase in search +vim.opt.hlsearch = false -- Don't highlight search results +vim.opt.incsearch = true -- Show matches as you type + +-- Visual settings +vim.opt.termguicolors = true -- Enable 24-bit colors +vim.opt.signcolumn = 'yes' -- Always show sign column +vim.opt.showmatch = true -- Highlight matching brackets +vim.opt.matchtime = 2 -- How long to show matching bracket +vim.opt.cmdheight = 1 -- Command line height +vim.opt.completeopt = 'menuone,noinsert,noselect' -- Completion options +vim.opt.showmode = false -- Don't show mode in command line +vim.opt.pumheight = 10 -- Popup menu height +vim.opt.pumblend = 10 -- Popup menu transparency +vim.opt.winblend = 0 -- Floating window transparency +vim.opt.concealcursor = '' -- Don't hide cursor line markup +vim.opt.conceallevel = 0 -- Don't hide markup +-- vim.opt.lazyredraw = true -- Don't redraw during macros +vim.opt.synmaxcol = 300 -- Syntax highlighting limit +vim.o.winborder = 'rounded' -- Make floating windows have a rounded border +vim.o.list = true +vim.opt.listchars = { tab = ' ', trail = '·', nbsp = '␣' } -- Sets how whitespace chars will be displayed + +-- Folding settings +vim.opt.foldmethod = 'expr' -- Use expression for folding +-- vim.wo.vim.foldexpr = 'v:lua.vim.treesitter.foldexpr()' -- Use treesitter for folding +vim.opt.foldlevel = 99 -- Start with all folds open + +-- File handling +vim.opt.backup = false -- Don't create backup files +vim.opt.writebackup = false -- Don't create backup before writing +vim.opt.swapfile = false -- Don't create swap files +vim.opt.undofile = true -- Persistent undo +vim.o.undofile = true -- Save undo history +vim.opt.undodir = vim.fn.expand '~/.vim/undodir' -- Undo directory +vim.opt.updatetime = 250 -- Faster completion +vim.opt.timeoutlen = 500 -- Key timeout duration +vim.opt.ttimeoutlen = 0 -- Key code timeout +vim.opt.autoread = true -- Auto reload files changed outside vim +vim.opt.autowrite = false -- Don't auto save + +-- Behavior settings +vim.opt.hidden = true -- Allow hidden buffers +vim.opt.errorbells = false -- No error bells +vim.opt.backspace = 'indent,eol,start' -- Better backspace behavior +vim.opt.autochdir = false -- Don't auto change directory +vim.opt.iskeyword:append '-' -- Treat dash as part of word +vim.opt.path:append '**' -- include subdirectories in search +vim.opt.selection = 'exclusive' -- Selection behavior +vim.opt.mouse = 'a' -- Enable mouse support +vim.opt.clipboard:append 'unnamedplus' -- Use system clipboard +vim.opt.modifiable = true -- Allow buffer modifications +vim.opt.encoding = 'UTF-8' -- Set encoding +vim.opt.splitbelow = true -- Horizontal splits go below +vim.opt.splitright = true -- Vertical splits go right +vim.o.inccommand = 'split' +vim.o.confirm = true -- Ask before closing (unsaved changes) -- Sync clipboard between OS and Neovim. -- Schedule the setting after `UiEnter` because it can increase startup-time. @@ -56,68 +123,16 @@ vim.schedule(function() vim.o.clipboard = 'unnamedplus' end) --- Enable break indent -vim.o.breakindent = true - --- Save undo history -vim.o.undofile = true - --- Case-insensitive searching UNLESS \C or one or more capital letters in the search term -vim.o.ignorecase = true -vim.o.smartcase = true - --- Keep signcolumn on by default -vim.o.signcolumn = 'yes' - --- Decrease update time -vim.o.updatetime = 250 - --- Decrease mapped sequence wait time -vim.o.timeoutlen = 300 - --- Configure how new splits should be opened -vim.o.splitright = true -vim.o.splitbelow = true - --- Sets how neovim will display certain whitespace characters in the editor. --- See `:help 'list'` --- and `:help 'listchars'` --- --- Notice listchars is set using `vim.opt` instead of `vim.o`. --- It is very similar to `vim.o` but offers an interface for conveniently interacting with tables. --- See `:help lua-options` --- and `:help lua-options-guide` -vim.o.list = true -vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } - --- Preview substitutions live, as you type! -vim.o.inccommand = 'split' - --- Show which line your cursor is on -vim.o.cursorline = true - --- Minimal number of screen lines to keep above and below the cursor. -vim.o.scrolloff = 10 - --- 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) --- See `:help 'confirm'` -vim.o.confirm = true - -- [[ Basic Keymaps ]] --- See `:help vim.keymap.set()` -- Clear highlights on search when pressing in normal mode --- See `:help hlsearch` -vim.keymap.set('n', '', 'nohlsearch') +vim.keymap.set('n', '', 'nohlsearch', { desc = 'Clear search highlights' }) +vim.keymap.set('n', '', 'nohlsearch', { desc = 'Clear search highlights' }) -- Diagnostic keymaps -- vim.keymap.set('n', 'dq', 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' }) @@ -131,21 +146,65 @@ vim.keymap.set('n', '', '', { desc = 'Move focus to the right win 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" }) +-- Splitting & Resizing +vim.keymap.set('n', 'w|', 'vsplit', { desc = 'Split window vertically' }) +vim.keymap.set('n', 'w-', 'split', { desc = 'Split window horizontally' }) --- NOTE These are Custom -vim.keymap.set('n', 'x', ':q', { desc = 'Kill buffer' }) +vim.keymap.set('n', '', 'resize +2', { desc = 'Increase window height' }) +vim.keymap.set('n', '', 'resize -2', { desc = 'Decrease window height' }) +vim.keymap.set('n', '', 'vertical resize +2', { desc = 'Increase window width' }) +vim.keymap.set('n', '', 'vertical resize -2', { desc = 'Decrease window width' }) + +-- Ctrl-Shift-letter doesnt work with my setup -> Fixed by using xxd and using litteral input str +vim.keymap.set('n', '^[[1;9h', 'H', { desc = 'Move window to the left' }) +vim.keymap.set('n', '^[[1;9l', 'L', { desc = 'Move window to the right' }) +vim.keymap.set('n', '^[[1;9j', 'J', { desc = 'Move window to the lower' }) +vim.keymap.set('n', '^[[1;9k', 'K', { desc = 'Move window to the upper' }) -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` --- Highlight when yanking (copying) text --- Try it with `yap` in normal mode --- See `:help vim.hl.on_yank()` +-- Center screen when jumping +vim.keymap.set('n', 'n', 'nzzzv', { desc = 'Next search result (centered)' }) +vim.keymap.set('n', 'N', 'Nzzzv', { desc = 'Previous search result (centered)' }) +vim.keymap.set('n', '', 'zz', { desc = 'Half page down (centered)' }) +vim.keymap.set('n', '', 'zz', { desc = 'Half page up (centered)' }) + +-- Delete without yanking +vim.keymap.set({ 'n', 'v' }, 'd', '"_d', { desc = 'Delete without yanking' }) + +-- Buffer navigation +vim.keymap.set('n', 'bn', 'bnext', { desc = 'Next buffer' }) +vim.keymap.set('n', 'bp', 'bprevious', { desc = 'Previous buffer' }) + +-- Move lines up/down +vim.keymap.set('n', '', 'm .+1==', { desc = 'Move line down' }) +vim.keymap.set('n', '', 'm .-2==', { desc = 'Move line up' }) +vim.keymap.set('v', '', "m '>+1gv=gv", { desc = 'Move selection down' }) +vim.keymap.set('v', '', "m '<-2gv=gv", { desc = 'Move selection up' }) + +-- Better indenting in visual mode +vim.keymap.set('v', '<', '', '>gv', { desc = 'Indent right and reselect' }) + +-- Better J behavior +vim.keymap.set('n', 'J', 'mzJ`z', { desc = 'Join lines and keep cursor position' }) + +-- ============================================================================ +-- USEFUL FUNCTIONS +-- ============================================================================ + +-- Copy Full File-Path +vim.keymap.set('n', 'ypa', function() + local path = vim.fn.expand '%:p' + vim.fn.setreg('+', path) + print('file:', path) +end) + +-- Basic autocommands +local augroup = vim.api.nvim_create_augroup('UserConfig', {}) + +-- Highlight yanked text vim.api.nvim_create_autocmd('TextYankPost', { desc = 'Highlight when yanking (copying) text', group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), @@ -154,6 +213,273 @@ vim.api.nvim_create_autocmd('TextYankPost', { end, }) +-- Return to last edit position when opening files +vim.api.nvim_create_autocmd('BufReadPost', { + group = augroup, + callback = function() + local mark = vim.api.nvim_buf_get_mark(0, '"') + local lcount = vim.api.nvim_buf_line_count(0) + if mark[1] > 0 and mark[1] <= lcount then + pcall(vim.api.nvim_win_set_cursor, 0, mark) + end + end, +}) + +-- Set filetype-specific settings +vim.api.nvim_create_autocmd('FileType', { + group = augroup, + pattern = { 'lua', 'python' }, + callback = function() + vim.opt_local.tabstop = 4 + vim.opt_local.shiftwidth = 4 + end, +}) + +vim.api.nvim_create_autocmd('FileType', { + group = augroup, + pattern = { 'javascript', 'typescript', 'javascriptreact', 'typescriptreact', 'json', 'html', 'css' }, + callback = function() + vim.opt_local.tabstop = 2 + vim.opt_local.shiftwidth = 2 + end, +}) + +-- Auto-close terminal when process exits +vim.api.nvim_create_autocmd('TermClose', { + group = augroup, + callback = function() + if vim.v.event.status == 0 then + vim.api.nvim_buf_delete(0, {}) + end + end, +}) + +-- Disable line numbers in terminal +vim.api.nvim_create_autocmd('TermOpen', { + group = augroup, + callback = function() + vim.opt_local.number = false + vim.opt_local.relativenumber = false + vim.opt_local.signcolumn = 'no' + end, +}) + +-- Auto-resize splits when window is resized +vim.api.nvim_create_autocmd('VimResized', { + group = augroup, + callback = function() + vim.cmd 'tabdo wincmd =' + end, +}) + +-- Create directories when saving files +vim.api.nvim_create_autocmd('BufWritePre', { + group = augroup, + callback = function() + local dir = vim.fn.expand ':p:h' + if vim.fn.isdirectory(dir) == 0 then + vim.fn.mkdir(dir, 'p') + end + end, +}) + +-- Command-line completion +vim.opt.wildmenu = true +vim.opt.wildmode = 'longest:full,full' +vim.opt.wildignore:append { '*.o', '*.obj', '*.pyc', '*.class', '*.jar' } + +-- Better diff options +vim.opt.diffopt:append 'linematch:60' + +-- Performance improvements +vim.opt.redrawtime = 10000 +vim.opt.maxmempattern = 20000 + +-- Create undo directory if it doesn't exist +local undodir = vim.fn.expand '~/.vim/undodir' +if vim.fn.isdirectory(undodir) == 0 then + vim.fn.mkdir(undodir, 'p') +end + +-- ============================================================================ +-- FLOATING TERMINAL +-- ============================================================================ + +-- terminal +local terminal_state = { + buf = nil, + win = nil, + is_open = false, +} + +local function FloatingTerminal() + -- If terminal is already open, close it (toggle behavior) + if terminal_state.is_open and vim.api.nvim_win_is_valid(terminal_state.win) then + vim.api.nvim_win_close(terminal_state.win, false) + terminal_state.is_open = false + return + end + + -- Create buffer if it doesn't exist or is invalid + if not terminal_state.buf or not vim.api.nvim_buf_is_valid(terminal_state.buf) then + terminal_state.buf = vim.api.nvim_create_buf(false, true) + -- Set buffer options for better terminal experience + vim.api.nvim_buf_set_option(terminal_state.buf, 'bufhidden', 'hide') + end + + -- Calculate window dimensions + local width = math.floor(vim.o.columns * 0.8) + local height = math.floor(vim.o.lines * 0.8) + local row = math.floor((vim.o.lines - height) / 2) + local col = math.floor((vim.o.columns - width) / 2) + + -- Create the floating window + terminal_state.win = vim.api.nvim_open_win(terminal_state.buf, true, { + relative = 'editor', + width = width, + height = height, + row = row, + col = col, + style = 'minimal', + border = 'rounded', + }) + + -- Set transparency for the floating window + vim.api.nvim_win_set_option(terminal_state.win, 'winblend', 0) + + -- Set transparent background for the window + vim.api.nvim_win_set_option(terminal_state.win, 'winhighlight', 'Normal:FloatingTermNormal,FloatBorder:FloatingTermBorder') + + -- Define highlight groups for transparency + vim.api.nvim_set_hl(0, 'FloatingTermNormal', { bg = 'none' }) + vim.api.nvim_set_hl(0, 'FloatingTermBorder', { bg = 'none' }) + + -- Start terminal if not already running + local has_terminal = false + local lines = vim.api.nvim_buf_get_lines(terminal_state.buf, 0, -1, false) + for _, line in ipairs(lines) do + if line ~= '' then + has_terminal = true + break + end + end + + if not has_terminal then + vim.fn.termopen(os.getenv 'SHELL') + end + + terminal_state.is_open = true + vim.cmd 'startinsert' + + -- Set up auto-close on buffer leave + vim.api.nvim_create_autocmd('BufLeave', { + buffer = terminal_state.buf, + callback = function() + if terminal_state.is_open and vim.api.nvim_win_is_valid(terminal_state.win) then + vim.api.nvim_win_close(terminal_state.win, false) + terminal_state.is_open = false + end + end, + once = true, + }) +end + +-- Function to explicitly close the terminal +local function CloseFloatingTerminal() + if terminal_state.is_open and vim.api.nvim_win_is_valid(terminal_state.win) then + vim.api.nvim_win_close(terminal_state.win, false) + terminal_state.is_open = false + end +end + +-- Key mappings +vim.keymap.set('n', 'tft', FloatingTerminal, { noremap = true, silent = true, desc = 'Toggle floating terminal' }) +vim.keymap.set('n', 'tt', 'horizontal terminal', { noremap = true, silent = true, desc = 'Toggle terminal' }) +vim.keymap.set('t', '', function() + if terminal_state.is_open then + vim.api.nvim_win_close(terminal_state.win, false) + terminal_state.is_open = false + end +end, { noremap = true, silent = true, desc = 'Close floating terminal from terminal mode' }) + +-- ============================================================================ +-- TABS +-- ============================================================================ + +-- Tab display settings +vim.opt.showtabline = 1 -- Always show tabline (0=never, 1=when multiple tabs, 2=always) +vim.opt.tabline = '' -- Use default tabline (empty string uses built-in) + +-- Transparent tabline appearance +vim.cmd [[ + hi TabLineFill guibg=NONE ctermfg=242 ctermbg=NONE +]] + +-- Alternative navigation (more intuitive) +vim.keymap.set('n', 'tn', 'tabnew', { desc = 'New tab' }) +vim.keymap.set('n', 'tx', 'tabclose', { desc = 'Close tab' }) + +-- Tab moving +vim.keymap.set('n', 'tm', 'tabmove', { desc = 'Move tab' }) +vim.keymap.set('n', 't>', 'tabmove +1', { desc = 'Move tab right' }) +vim.keymap.set('n', 't<', 'tabmove -1', { desc = 'Move tab left' }) + +-- Function to open file in new tab +local function open_file_in_tab() + vim.ui.input({ prompt = 'File to open in new tab: ', completion = 'file' }, function(input) + if input and input ~= '' then + vim.cmd('tabnew ' .. input) + end + end) +end + +-- Function to duplicate current tab +local function duplicate_tab() + local current_file = vim.fn.expand '%:p' + if current_file ~= '' then + vim.cmd('tabnew ' .. current_file) + else + vim.cmd 'tabnew' + end +end + +-- Function to close tabs to the right +local function close_tabs_right() + local current_tab = vim.fn.tabpagenr() + local last_tab = vim.fn.tabpagenr '$' + + for i = last_tab, current_tab + 1, -1 do + vim.cmd(i .. 'tabclose') + end +end + +-- Function to close tabs to the left +local function close_tabs_left() + local current_tab = vim.fn.tabpagenr() + + for i = current_tab - 1, 1, -1 do + vim.cmd '1tabclose' + end +end + +-- Enhanced keybindings +vim.keymap.set('n', 'tO', open_file_in_tab, { desc = 'Open file in new tab' }) +vim.keymap.set('n', 'td', duplicate_tab, { desc = 'Duplicate current tab' }) +vim.keymap.set('n', 'tr', close_tabs_right, { desc = 'Close tabs to the right' }) +vim.keymap.set('n', 'tL', close_tabs_left, { desc = 'Close tabs to the left' }) + +-- Function to close buffer but keep tab if it's the only buffer in tab +local function smart_close_buffer() + local buffers_in_tab = #vim.fn.tabpagebuflist() + if buffers_in_tab > 1 then + vim.cmd 'bdelete' + else + -- If it's the only buffer in tab, close the tab + vim.cmd 'tabclose' + end +end +vim.keymap.set('n', 'x', smart_close_buffer, { desc = 'Smart close buffer/tab' }) + -- [[ Install `lazy.nvim` plugin manager ]] -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' @@ -170,795 +496,12 @@ local rtp = vim.opt.rtp rtp:prepend(lazypath) -- [[ Configure and install plugins ]] --- --- To check the current status of your plugins, run --- :Lazy --- --- You can press `?` in this menu for help. Use `:q` to close the window --- --- To update plugins you can run --- :Lazy update --- --- NOTE: Here is where you install your plugins. require('lazy').setup({ - -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). - 'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically - - -- NOTE: Plugins can also be added by using a table, - -- with the first argument being the link and the following - -- keys can be used to configure plugin behavior/loading/etc. - -- - -- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded. - -- - - -- Alternatively, use `config = function() ... end` for full control over the configuration. - -- If you prefer to call `setup` explicitly, use: - -- { - -- 'lewis6991/gitsigns.nvim', - -- config = function() - -- require('gitsigns').setup({ - -- -- Your gitsigns configuration here - -- }) - -- end, - -- } - -- - -- Here is a more advanced example where we pass configuration - -- options to `gitsigns.nvim`. - -- - -- See `:help gitsigns` to understand what the configuration keys do - { -- Adds git related signs to the gutter, as well as utilities for managing changes - 'lewis6991/gitsigns.nvim', - opts = { - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - }, - }, - }, - - -- NOTE: Plugins can also be configured to run Lua code when they are loaded. - -- - -- This is often very useful to both group configuration, as well as handle - -- lazy loading plugins that don't need to be loaded immediately at startup. - -- - -- For example, in the following configuration, we use: - -- event = 'VimEnter' - -- - -- which loads which-key before all the UI elements are loaded. Events can be - -- normal autocommands events (`:help autocmd-events`). - -- - -- Then, because we use the `opts` key (recommended), the configuration runs - -- after the plugin has been loaded as `require(MODULE).setup(opts)`. - - { -- Useful plugin to show you pending keybinds. - 'folke/which-key.nvim', - event = 'VimEnter', -- Sets the loading event to 'VimEnter' - opts = { - -- delay between pressing a key and opening which-key (milliseconds) - -- this setting is independent of vim.o.timeoutlen - delay = 0, - icons = { - -- set icon mappings to true if you have a Nerd Font - mappings = vim.g.have_nerd_font, - -- If you are using a Nerd Font: set icons.keys to an empty table which will use the - -- default which-key.nvim defined Nerd Font icons, otherwise define a string table - keys = vim.g.have_nerd_font and {} or { - Up = ' ', - Down = ' ', - Left = ' ', - Right = ' ', - C = ' ', - M = ' ', - D = ' ', - S = ' ', - CR = ' ', - Esc = ' ', - ScrollWheelDown = ' ', - ScrollWheelUp = ' ', - NL = ' ', - BS = ' ', - Space = ' ', - Tab = ' ', - F1 = '', - F2 = '', - F3 = '', - F4 = '', - F5 = '', - F6 = '', - F7 = '', - F8 = '', - F9 = '', - F10 = '', - F11 = '', - F12 = '', - }, - }, - - -- Document existing key chains - spec = { - { 'f', group = '[F]ind' }, - { 't', group = '[T]oggle' }, - { 'd', group = '[D]ebug' }, - { 'g', group = 'Git', mode = { 'n', 'v' } }, - { 'q', group = 'Quickfix' }, - }, - }, - }, - - -- NOTE: Plugins can specify dependencies. - -- - -- The dependencies are proper plugin specifications as well - anything - -- you do for a plugin at the top level, you can do for a dependency. - -- - -- Use the `dependencies` key to specify the dependencies of a particular plugin - - { -- Fuzzy Finder (files, lsp, etc) - 'nvim-telescope/telescope.nvim', - 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! - - local actions = require 'telescope.actions' - -- [[ 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 = { - layout_strategy = 'horizontal', - layout_config = { - width = 0.9, - height = 0.9, - }, - preview_width = 0.6, - - path_display = { 'truncate' }, - mappings = { - n = { - [''] = actions.add_selected_to_qflist + actions.open_qflist, - }, - i = { - [''] = 'to_fuzzy_refine', - [''] = actions.cycle_history_next, - [''] = actions.cycle_history_prev, - [''] = actions.add_selected_to_qflist + actions.open_qflist, - }, - }, - }, - pickers = { - find_files = { - find_command = { 'rg', '--files', '--hidden', '--glob', '!**/.git/*' }, - }, - }, - 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', 'fh', builtin.help_tags, { desc = '[F]ind [H]elp' }) - vim.keymap.set('n', 'fk', builtin.keymaps, { desc = '[F]ind [K]eymaps' }) - vim.keymap.set('n', 'ff', builtin.find_files, { desc = '[F]ind [F]iles' }) - vim.keymap.set('n', 'fs', builtin.builtin, { desc = '[F]ind [S]elect Telescope' }) - vim.keymap.set('n', 'fw', builtin.grep_string, { desc = '[F]ind current [W]ord' }) - vim.keymap.set('n', 'fg', builtin.live_grep, { desc = '[F]ind by [G]rep' }) - vim.keymap.set('n', 'fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostics' }) - vim.keymap.set('n', 'f.', builtin.resume, { desc = '[F]ind [R]esume' }) - vim.keymap.set('n', 'fr', builtin.oldfiles, { desc = '[F]ind [R]ecent Files' }) - vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) - - -- Slightly advanced example of overriding default behavior and theme - 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 = true, - }) - 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', 'f/', function() - builtin.live_grep { - grep_open_files = true, - prompt_title = 'Live Grep in Open Files', - } - end, { desc = '[F]ind [/] in Open Files' }) - - -- Shortcut for searching your Neovim configuration files - vim.keymap.set('n', 'fn', function() - builtin.find_files { cwd = vim.fn.stdpath 'config' } - end, { desc = '[F]ind [N]eovim files' }) - end, - }, - - -- LSP Plugins - { - -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins - -- used for completion, annotations and signatures of Neovim apis - 'folke/lazydev.nvim', - ft = 'lua', - opts = { - library = { - -- Load luvit types when the `vim.uv` word is found - { path = '${3rd}/luv/library', words = { 'vim%.uv' } }, - }, - }, - }, - { - -- Main LSP Configuration - 'neovim/nvim-lspconfig', - dependencies = { - -- Automatically install LSPs and related tools to stdpath for Neovim - -- Mason must be loaded before its dependents so we need to set it up here. - -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` - { 'mason-org/mason.nvim', opts = {} }, - 'mason-org/mason-lspconfig.nvim', - 'WhoIsSethDaniel/mason-tool-installer.nvim', - - -- Useful status updates for LSP. - { 'j-hui/fidget.nvim', opts = {} }, - - -- Allows extra capabilities provided by blink.cmp - 'saghen/blink.cmp', - }, - config = function() - -- Brief aside: **What is LSP?** - -- - -- LSP is an initialism you've probably heard, but might not understand what it is. - -- - -- LSP stands for Language Server Protocol. It's a protocol that helps editors - -- and language tooling communicate in a standardized fashion. - -- - -- In general, you have a "server" which is some tool built to understand a particular - -- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers - -- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone - -- processes that communicate with some "client" - in this case, Neovim! - -- - -- LSP provides Neovim with features like: - -- - Go to definition - -- - Find references - -- - Autocompletion - -- - Symbol Search - -- - and more! - -- - -- Thus, Language Servers are external tools that must be installed separately from - -- Neovim. This is where `mason` and related plugins come into play. - -- - -- If you're wondering about lsp vs treesitter, you can check out the wonderfully - -- and elegantly composed help section, `:help lsp-vs-treesitter` - - -- This function gets run when an LSP attaches to a particular buffer. - -- That is to say, every time a new file is opened that is associated with - -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this - -- function will be executed to configure the current buffer - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), - callback = function(event) - -- NOTE: Remember that Lua is a real programming language, and as such it is possible - -- to define small helper and utility functions so you don't have to repeat yourself. - -- - -- In this case, we create a function that lets us more easily define mappings specific - -- for LSP related items. It sets the mode, buffer and description for us each time. - local map = function(keys, func, desc, mode) - mode = mode or 'n' - vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) - end - - -- Rename the variable under your cursor. - -- Most Language Servers support renaming across files, etc. - map('grn', vim.lsp.buf.rename, '[R]e[n]ame') - - -- Execute a code action, usually your cursor needs to be on top of an error - -- or a suggestion from your LSP for this to activate. - map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) - - -- Find references for the word under your cursor. - map('grr', require('telescope.builtin').lsp_references, '[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. - map('gri', require('telescope.builtin').lsp_implementations, '[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 . - map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') - - -- WARN: This is not Goto Definition, this is Goto Declaration. - -- For example, in C this would take you to the header. - map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - - -- Fuzzy find all the symbols in your current document. - -- Symbols are things like variables, functions, types, etc. - map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols') - - -- Fuzzy find all the symbols in your current workspace. - -- Similar to document symbols, except searches over your entire project. - map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, '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*. - map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') - - -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10) - ---@param client vim.lsp.Client - ---@param method vim.lsp.protocol.Method - ---@param bufnr? integer some lsp support methods only in specific files - ---@return boolean - local function client_supports_method(client, method, bufnr) - if vim.fn.has 'nvim-0.11' == 1 then - return client:supports_method(method, bufnr) - else - return client.supports_method(method, { bufnr = bufnr }) - end - end - - -- 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 - -- - -- When you move your cursor, the highlights will be cleared (the second autocommand). - local client = vim.lsp.get_client_by_id(event.data.client_id) - if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then - local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) - vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.document_highlight, - }) - - vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.clear_references, - }) - - vim.api.nvim_create_autocmd('LspDetach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }), - callback = function(event2) - vim.lsp.buf.clear_references() - vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf } - end, - }) - end - - -- The following code creates a keymap to toggle inlay hints in your - -- code, if the language server you are using supports them - -- - -- This may be unwanted, since they displace some of your code - if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then - map('th', function() - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) - end, '[T]oggle Inlay [H]ints') - end - end, - }) - - -- Diagnostic Config - -- See :help vim.diagnostic.Opts - vim.diagnostic.config { - severity_sort = true, - float = { border = 'rounded', source = 'if_many' }, - underline = { severity = vim.diagnostic.severity.ERROR }, - signs = vim.g.have_nerd_font and { - text = { - [vim.diagnostic.severity.ERROR] = '󰅚 ', - [vim.diagnostic.severity.WARN] = '󰀪 ', - [vim.diagnostic.severity.INFO] = '󰋽 ', - [vim.diagnostic.severity.HINT] = '󰌶 ', - }, - } or {}, - virtual_text = { - source = 'if_many', - spacing = 2, - format = function(diagnostic) - local diagnostic_message = { - [vim.diagnostic.severity.ERROR] = diagnostic.message, - [vim.diagnostic.severity.WARN] = diagnostic.message, - [vim.diagnostic.severity.INFO] = diagnostic.message, - [vim.diagnostic.severity.HINT] = diagnostic.message, - } - return diagnostic_message[diagnostic.severity] - end, - }, - } - - -- LSP servers and clients are able to communicate to each other what features they support. - -- By default, Neovim doesn't support everything that is in the LSP specification. - -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities. - -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers. - local capabilities = require('blink.cmp').get_lsp_capabilities() - - -- Enable the following language servers - -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. - -- - -- Add any additional override configuration in the following tables. Available keys are: - -- - cmd (table): Override the default command used to start the server - -- - filetypes (table): Override the default list of associated filetypes for the server - -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. - -- - settings (table): Override the default settings passed when initializing the server. - -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ - local servers = { - -- clangd = {}, - gopls = {}, - -- pyright = {}, - rust_analyzer = {}, - -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs - -- - -- Some languages (like typescript) have entire language plugins that can be useful: - -- https://github.com/pmizio/typescript-tools.nvim - -- - -- But for many setups, the LSP (`ts_ls`) will work just fine - ts_ls = { - capabilities = capabilities, - }, - vue_ls = {}, - eslint = {}, - -- - - lua_ls = { - -- cmd = { ... }, - -- filetypes = { ... }, - -- capabilities = {}, - settings = { - Lua = { - completion = { - callSnippet = 'Replace', - }, - -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings - -- diagnostics = { disable = { 'missing-fields' } }, - }, - }, - }, - } - - -- Ensure the servers and tools above are installed - -- - -- To check the current status of installed tools and/or manually install - -- other tools, you can run - -- :Mason - -- - -- You can press `g?` for help in this menu. - -- - -- `mason` had to be setup earlier: to configure its options see the - -- `dependencies` table for `nvim-lspconfig` above. - -- - -- You can add other tools here that you want Mason to install - -- for you, so that they are available from within Neovim. - local ensure_installed = vim.tbl_keys(servers or {}) - vim.list_extend(ensure_installed, { - 'stylua', -- Used to format Lua code - }) - require('mason-tool-installer').setup { ensure_installed = ensure_installed } - - require('mason-lspconfig').setup { - ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) - automatic_installation = false, - handlers = { - function(server_name) - local server = servers[server_name] or {} - -- This handles overriding only values explicitly passed - -- by the server configuration above. Useful when disabling - -- certain features of an LSP (for example, turning off formatting for ts_ls) - server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) - require('lspconfig')[server_name].setup(server) - end, - }, - } - end, - }, - - { -- Autoformat - 'stevearc/conform.nvim', - event = { 'BufWritePre' }, - cmd = { 'ConformInfo' }, - keys = { - { - '=', - function() - require('conform').format { async = true, lsp_format = 'fallback' } - end, - mode = '', - desc = '[F]ormat buffer', - }, - }, - opts = { - notify_on_error = false, - format_on_save = function(bufnr) - -- Disable "format_on_save lsp_fallback" for languages that don't - -- have a well standardized coding style. You can add additional - -- languages here or re-enable it for the disabled ones. - local disable_filetypes = { c = true, cpp = true } - if disable_filetypes[vim.bo[bufnr].filetype] then - return nil - else - return { - timeout_ms = 500, - lsp_format = 'fallback', - } - end - end, - formatters_by_ft = { - lua = { 'stylua' }, - svelte = { { 'prettierd', 'prettier', stop_after_first = true } }, - astro = { { 'prettierd', 'prettier', stop_after_first = true } }, - javascript = { { 'prettierd', 'prettier', stop_after_first = true } }, - typescript = { { 'prettierd', 'prettier', stop_after_first = true } }, - javascriptreact = { { 'prettierd', 'prettier', stop_after_first = true } }, - typescriptreact = { { 'prettierd', 'prettier', stop_after_first = true } }, - json = { { 'prettierd', 'prettier', stop_after_first = true } }, - graphql = { { 'prettierd', 'prettier', stop_after_first = true } }, - java = { 'google-java-format' }, - kotlin = { 'ktlint' }, - ruby = { 'standardrb' }, - markdown = { { 'prettierd', 'prettier', stop_after_first = true } }, - erb = { 'htmlbeautifier' }, - html = { 'htmlbeautifier' }, - bash = { 'beautysh' }, - proto = { 'buf' }, - rust = { 'rustfmt' }, - yaml = { 'yamlfix' }, - toml = { 'taplo' }, - css = { { 'prettierd', 'prettier', stop_after_first = true } }, - scss = { { 'prettierd', 'prettier', stop_after_first = true } }, - sh = { 'shellcheck' }, - go = { 'gofmt' }, - xml = { 'xmllint' }, - }, - }, - }, - - { -- Autocompletion - 'saghen/blink.cmp', - event = 'VimEnter', - version = '1.*', - dependencies = { - -- Snippet Engine - { - 'L3MON4D3/LuaSnip', - version = '2.*', - build = (function() - -- Build Step is needed for regex support in snippets. - -- This step is not supported in many windows environments. - -- Remove the below condition to re-enable on windows. - if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then - return - end - return 'make install_jsregexp' - end)(), - dependencies = { - -- `friendly-snippets` contains a variety of premade snippets. - -- See the README about individual language/framework/plugin snippets: - -- https://github.com/rafamadriz/friendly-snippets - -- { - -- 'rafamadriz/friendly-snippets', - -- config = function() - -- require('luasnip.loaders.from_vscode').lazy_load() - -- end, - -- }, - }, - opts = {}, - }, - 'folke/lazydev.nvim', - }, - --- @module 'blink.cmp' - --- @type blink.cmp.Config - opts = { - 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 :h blink-cmp-config-keymap for defining your own keymap - preset = 'enter', - - -- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see: - -- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps - }, - - appearance = { - -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' - -- Adjusts spacing to ensure icons are aligned - nerd_font_variant = 'mono', - }, - - completion = { - -- By default, you may press `` to show the documentation. - -- Optionally, set `auto_show = true` to show the documentation after a delay. - documentation = { auto_show = true, auto_show_delay_ms = 500 }, - }, - - sources = { - default = { 'lsp', 'path', 'snippets', 'lazydev' }, - providers = { - lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 }, - }, - }, - - snippets = { preset = 'luasnip' }, - - -- Blink.cmp includes an optional, recommended rust fuzzy matcher, - -- which automatically downloads a prebuilt binary when enabled. - -- - -- By default, we use the Lua implementation instead, but you may enable - -- the rust implementation via `'prefer_rust_with_warning'` - -- - -- See :h blink-cmp-config-fuzzy for more information - fuzzy = { implementation = 'lua' }, - - -- Shows a signature help window while you type arguments for a function - signature = { enabled = true }, - }, - }, - - { -- 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. - config = function() - ---@diagnostic disable-next-line: missing-fields - require('tokyonight').setup { - transparent = true, - styles = { - sidebars = 'transparent', - floats = 'transparent', - comments = { italic = false }, -- Disable italics in comments - }, - } - - -- 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' - end, - }, - -- Highlight todo, notes, etc in comments - { 'folke/todo-comments.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim' }, opts = { signs = false } }, - - { -- Collection of various small independent plugins/modules - 'echasnovski/mini.nvim', - config = function() - -- Better Around/Inside textobjects - -- - -- Examples: - -- - va) - [V]isually select [A]round [)]paren - -- - yinq - [Y]ank [I]nside [N]ext [Q]uote - -- - ci' - [C]hange [I]nside [']quote - require('mini.ai').setup { n_lines = 500 } - - -- Add/delete/replace surroundings (brackets, quotes, etc.) - -- - -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren - -- - sd' - [S]urround [D]elete [']quotes - -- - 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/echasnovski/mini.nvim - end, - }, - { -- Highlight, edit, and navigate code - 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', - main = 'nvim-treesitter.configs', -- Sets main module to use for opts - -- [[ Configure Treesitter ]] See `:help nvim-treesitter` - opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, - -- Autoinstall languages that are not installed - auto_install = true, - highlight = { - enable = true, - -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. - -- If you are experiencing weird indenting issues, add the language to - -- the list of additional_vim_regex_highlighting and disabled languages for indent. - additional_vim_regex_highlighting = { 'ruby' }, - }, - indent = { enable = true, disable = { 'ruby' } }, - }, - -- There are additional nvim-treesitter modules that you can use to interact - -- with nvim-treesitter. You should go explore a few and see what interests you: - -- - -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` - -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context - -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects - }, - - -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the - -- init.lua. If you want these files, they are in the repository, so you can just download them and - -- place them in the correct locations. - - -- 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. - -- { import = 'kickstart.plugins' }, + { import = 'kickstart.plugins.lsp' }, { import = 'custom.plugins' }, -- - -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` - -- Or use telescope! -- In normal mode type `sh` then write `lazy.nvim-plugin` -- you can continue same window with `sr` which resumes last telescope search }, { diff --git a/lazy-lock.json b/lazy-lock.json index a3d4515a803..b7f3ed5d19a 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,6 +1,7 @@ { "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, "blink.cmp": { "branch": "main", "commit": "9bcb14b43852a6f2bfd5ac9ef29cb5cf09b1b39b" }, + "catppuccin": { "branch": "main", "commit": "76a8d0515024cc55d8bd26fc13f1af88faef3ebf" }, "conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" }, "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, "gitsigns.nvim": { "branch": "main", "commit": "c80e0b4bfc411d5740a47adc8775fd1070f2028b" }, @@ -28,6 +29,7 @@ "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, "nvim-web-devicons": { "branch": "master", "commit": "19d6211c78169e78bab372b585b6fb17ad974e82" }, + "oil-git-status.nvim": { "branch": "main", "commit": "4b5cf53842c17a09420919e655a6a559da3112d7" }, "oil.nvim": { "branch": "master", "commit": "bbad9a76b2617ce1221d49619e4e4b659b3c61fc" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, @@ -37,5 +39,6 @@ "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, + "vim-tmux-navigator": { "branch": "master", "commit": "c45243dc1f32ac6bcf6068e5300f3b2b237e576a" }, "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } } diff --git a/lua/custom/plugins/oil-gitsigns.lua b/lua/custom/plugins/oil-gitsigns.lua new file mode 100644 index 00000000000..9005b3a54a6 --- /dev/null +++ b/lua/custom/plugins/oil-gitsigns.lua @@ -0,0 +1,37 @@ +return { + 'refractalize/oil-git-status.nvim', + dependencies = { + 'stevearc/oil.nvim', + }, + config = function() + require('oil-git-status').setup { + show_ignored = true, -- show files that match gitignore with !! + symbols = { -- customize the symbols that appear in the git status columns + index = { + ['!'] = '!', + ['?'] = '?', + ['A'] = 'A', + ['C'] = 'C', + ['D'] = 'D', + ['M'] = 'M', + ['R'] = 'R', + ['T'] = 'T', + ['U'] = 'U', + [' '] = ' ', + }, + working_tree = { + ['!'] = '!', + ['?'] = '?', + ['A'] = 'A', + ['C'] = 'C', + ['D'] = 'D', + ['M'] = 'M', + ['R'] = 'R', + ['T'] = 'T', + ['U'] = 'U', + [' '] = ' ', + }, + }, + } + end, +} diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua index babe51ff98e..86195cb5d41 100644 --- a/lua/custom/plugins/oil.lua +++ b/lua/custom/plugins/oil.lua @@ -8,6 +8,10 @@ return { local oil = require 'oil' oil.setup { + default_file_explorer = true, + delete_to_trash = true, + skip_confirm_for_simple_edits = true, + columns = { 'icon' }, keymaps = { ['g?'] = { 'actions.show_help', mode = 'n' }, @@ -21,9 +25,28 @@ return { }, view_options = { show_hidden = true, + natural_order = true, + is_always_hidden = function(name, _) + return name == '..' or name == '.git' + end, + }, + win_options = { + signcolumn = 'yes:2', + wrap = true, }, } vim.keymap.set('n', '-', oil.toggle_float, { desc = 'Open parent directory' }) + + -- Always show preview + vim.api.nvim_create_autocmd('User', { + pattern = 'OilEnter', + callback = vim.schedule_wrap(function(args) + local oil = require 'oil' + if vim.api.nvim_get_current_buf() == args.data.buf and oil.get_cursor_entry() then + oil.open_preview() + end + end), + }) end, } diff --git a/lua/custom/plugins/tmux-navigator.lua b/lua/custom/plugins/tmux-navigator.lua new file mode 100644 index 00000000000..26fb72ba14c --- /dev/null +++ b/lua/custom/plugins/tmux-navigator.lua @@ -0,0 +1,18 @@ +return { + 'christoomey/vim-tmux-navigator', + cmd = { + 'TmuxNavigateLeft', + 'TmuxNavigateDown', + 'TmuxNavigateUp', + 'TmuxNavigateRight', + 'TmuxNavigatePrevious', + 'TmuxNavigatorProcessList', + }, + keys = { + { '', 'TmuxNavigateLeft' }, + { '', 'TmuxNavigateDown' }, + { '', 'TmuxNavigateUp' }, + { '', 'TmuxNavigateRight' }, + { '', 'TmuxNavigatePrevious' }, + }, +} diff --git a/lua/kickstart/plugins/auto-completion.lua b/lua/kickstart/plugins/auto-completion.lua new file mode 100644 index 00000000000..9ac75d6be0c --- /dev/null +++ b/lua/kickstart/plugins/auto-completion.lua @@ -0,0 +1,108 @@ +-- Autocompletion +return { + 'saghen/blink.cmp', + event = 'VimEnter', + version = '1.*', + dependencies = { + -- Snippet Engine + { + 'L3MON4D3/LuaSnip', + version = '2.*', + build = (function() + -- Build Step is needed for regex support in snippets. + -- This step is not supported in many windows environments. + -- Remove the below condition to re-enable on windows. + if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then + return + end + return 'make install_jsregexp' + end)(), + dependencies = { + -- `friendly-snippets` contains a variety of premade snippets. + -- See the README about individual language/framework/plugin snippets: + -- https://github.com/rafamadriz/friendly-snippets + -- { + -- 'rafamadriz/friendly-snippets', + -- config = function() + -- require('luasnip.loaders.from_vscode').lazy_load() + -- end, + -- }, + }, + opts = {}, + }, + 'folke/lazydev.nvim', + }, + --- @module 'blink.cmp' + --- @type blink.cmp.Config + opts = { + 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 + [''] = { 'select_and_accept', 'fallback' }, + [''] = { 'select_and_accept', 'fallback' }, + [''] = { 'select_and_accept', 'fallback' }, + [''] = { 'select_prev', 'fallback' }, + [''] = { 'select_next', 'fallback' }, + [''] = { 'select_prev', 'fallback' }, + [''] = { 'select_next', 'fallback' }, + [''] = { 'select_prev', 'fallback' }, + [''] = { 'select_next', 'fallback' }, + + -- See :h blink-cmp-config-keymap for defining your own keymap + 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 + }, + + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = 'mono', + }, + + completion = { + -- By default, you may press `` to show the documentation. + -- Optionally, set `auto_show = true` to show the documentation after a delay. + documentation = { auto_show = true, auto_show_delay_ms = 500 }, + }, + + sources = { + default = { 'lsp', 'path', 'snippets', 'lazydev' }, + providers = { + lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 }, + }, + }, + + snippets = { preset = 'luasnip' }, + + -- Blink.cmp includes an optional, recommended rust fuzzy matcher, + -- which automatically downloads a prebuilt binary when enabled. + -- + -- By default, we use the Lua implementation instead, but you may enable + -- the rust implementation via `'prefer_rust_with_warning'` + -- + -- See :h blink-cmp-config-fuzzy for more information + fuzzy = { implementation = 'lua' }, + + -- Shows a signature help window while you type arguments for a function + signature = { enabled = true }, + }, +} diff --git a/lua/kickstart/plugins/colorscheme.lua b/lua/kickstart/plugins/colorscheme.lua new file mode 100644 index 00000000000..eaf0b3914ac --- /dev/null +++ b/lua/kickstart/plugins/colorscheme.lua @@ -0,0 +1,79 @@ +return { -- You can easily change to a different colorscheme. + -- 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. + config = function() + ---@diagnostic disable-next-line: missing-fields + require('tokyonight').setup { + transparent = true, + styles = { + sidebars = 'transparent', + floats = 'transparent', + comments = { italic = false }, -- Disable italics in comments + }, + } + + -- Load the colorscheme here. + -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. + -- vim.cmd.colorscheme 'tokyonight-night' + end, + }, + { + 'catppuccin/nvim', + name = 'catppuccin', + priority = 1000, + config = function() + require('catppuccin').setup { + flavour = 'mocha', -- latte, frappe, macchiato, mocha + background = { -- :h background + light = 'latte', + dark = 'mocha', + }, + transparent_background = true, -- disables setting the background color. + float = { + transparent = true, -- enable transparent floating windows + solid = false, -- use solid styling for floating windows, see |winborder| + }, + show_end_of_buffer = false, -- shows the '~' characters after the end of buffers + term_colors = true, -- sets terminal colors (e.g. `g:terminal_color_0`) + dim_inactive = { + enabled = false, -- dims the background color of inactive window + shade = 'dark', + percentage = 0.15, -- percentage of the shade to apply to the inactive window + }, + styles = { -- Handles the styles of general hi groups (see `:h highlight-args`): + comments = { 'italic' }, -- Change the style of comments + conditionals = { 'italic' }, + loops = {}, + functions = { 'italic' }, + keywords = { 'bold' }, + strings = {}, + variables = {}, + numbers = {}, + booleans = { 'bold' }, + properties = {}, + types = { 'italic' }, + operators = {}, + -- miscs = {}, -- Uncomment to turn off hard-coded styles + }, + default_integrations = true, + auto_integrations = false, + integrations = { + cmp = true, + gitsigns = true, + nvimtree = true, + treesitter = true, + notify = true, + mini = { + enabled = true, + indentscope_color = '', + }, + -- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations) + }, + } + + vim.cmd.colorscheme 'catppuccin' + end, + }, +} diff --git a/lua/kickstart/plugins/format.lua b/lua/kickstart/plugins/format.lua new file mode 100644 index 00000000000..8213c80cff7 --- /dev/null +++ b/lua/kickstart/plugins/format.lua @@ -0,0 +1,59 @@ +return { -- Autoformat + 'stevearc/conform.nvim', + event = { 'BufWritePre' }, + cmd = { 'ConformInfo' }, + keys = { + { + '=', + function() + require('conform').format { async = true, lsp_format = 'fallback' } + end, + mode = '', + desc = '[F]ormat buffer', + }, + }, + opts = { + notify_on_error = false, + format_on_save = function(bufnr) + -- Disable "format_on_save lsp_fallback" for languages that don't + -- have a well standardized coding style. You can add additional + -- languages here or re-enable it for the disabled ones. + local disable_filetypes = { c = true, cpp = true } + if disable_filetypes[vim.bo[bufnr].filetype] then + return nil + else + return { + timeout_ms = 500, + lsp_format = 'fallback', + } + end + end, + formatters_by_ft = { + lua = { 'stylua' }, + svelte = { { 'prettierd', 'prettier', stop_after_first = true } }, + astro = { { 'prettierd', 'prettier', stop_after_first = true } }, + javascript = { { 'prettierd', 'prettier', stop_after_first = true } }, + typescript = { { 'prettierd', 'prettier', stop_after_first = true } }, + javascriptreact = { { 'prettierd', 'prettier', stop_after_first = true } }, + typescriptreact = { { 'prettierd', 'prettier', stop_after_first = true } }, + json = { { 'prettierd', 'prettier', stop_after_first = true } }, + graphql = { { 'prettierd', 'prettier', stop_after_first = true } }, + java = { 'google-java-format' }, + kotlin = { 'ktlint' }, + ruby = { 'standardrb' }, + markdown = { { 'prettierd', 'prettier', stop_after_first = true } }, + erb = { 'htmlbeautifier' }, + html = { 'htmlbeautifier' }, + bash = { 'beautysh' }, + proto = { 'buf' }, + rust = { 'rustfmt' }, + yaml = { 'yamlfix' }, + toml = { 'taplo' }, + css = { { 'prettierd', 'prettier', stop_after_first = true } }, + scss = { { 'prettierd', 'prettier', stop_after_first = true } }, + sh = { 'shellcheck' }, + go = { 'gofmt' }, + xml = { 'xmllint' }, + }, + }, +} diff --git a/lua/kickstart/plugins/git-signs.lua b/lua/kickstart/plugins/git-signs.lua new file mode 100644 index 00000000000..352081684b4 --- /dev/null +++ b/lua/kickstart/plugins/git-signs.lua @@ -0,0 +1,13 @@ +-- Adds git related signs to the gutter, as well as utilities for managing changes +return { + 'lewis6991/gitsigns.nvim', + opts = { + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + }, + }, +} diff --git a/lua/kickstart/plugins/guess-indent.lua b/lua/kickstart/plugins/guess-indent.lua new file mode 100644 index 00000000000..0cdf312f4b9 --- /dev/null +++ b/lua/kickstart/plugins/guess-indent.lua @@ -0,0 +1,3 @@ +return { + 'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically +} diff --git a/lua/kickstart/plugins/lsp/lazydev.lua b/lua/kickstart/plugins/lsp/lazydev.lua new file mode 100644 index 00000000000..447ce668751 --- /dev/null +++ b/lua/kickstart/plugins/lsp/lazydev.lua @@ -0,0 +1,12 @@ +return { + -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins + -- used for completion, annotations and signatures of Neovim apis + 'folke/lazydev.nvim', + ft = 'lua', + opts = { + library = { + -- Load luvit types when the `vim.uv` word is found + { path = '${3rd}/luv/library', words = { 'vim%.uv' } }, + }, + }, +} diff --git a/lua/kickstart/plugins/lsp/main-lsp.lua b/lua/kickstart/plugins/lsp/main-lsp.lua new file mode 100644 index 00000000000..0cf02c6c55d --- /dev/null +++ b/lua/kickstart/plugins/lsp/main-lsp.lua @@ -0,0 +1,264 @@ +return { + -- Main LSP Configuration + 'neovim/nvim-lspconfig', + dependencies = { + -- Automatically install LSPs and related tools to stdpath for Neovim + -- Mason must be loaded before its dependents so we need to set it up here. + -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` + { 'mason-org/mason.nvim', opts = {} }, + 'mason-org/mason-lspconfig.nvim', + 'WhoIsSethDaniel/mason-tool-installer.nvim', + + -- Useful status updates for LSP. + { 'j-hui/fidget.nvim', opts = {} }, + + -- Allows extra capabilities provided by blink.cmp + 'saghen/blink.cmp', + }, + config = function() + -- Brief aside: **What is LSP?** + -- + -- LSP is an initialism you've probably heard, but might not understand what it is. + -- + -- LSP stands for Language Server Protocol. It's a protocol that helps editors + -- and language tooling communicate in a standardized fashion. + -- + -- In general, you have a "server" which is some tool built to understand a particular + -- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers + -- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone + -- processes that communicate with some "client" - in this case, Neovim! + -- + -- LSP provides Neovim with features like: + -- - Go to definition + -- - Find references + -- - Autocompletion + -- - Symbol Search + -- - and more! + -- + -- Thus, Language Servers are external tools that must be installed separately from + -- Neovim. This is where `mason` and related plugins come into play. + -- + -- If you're wondering about lsp vs treesitter, you can check out the wonderfully + -- and elegantly composed help section, `:help lsp-vs-treesitter` + + -- This function gets run when an LSP attaches to a particular buffer. + -- That is to say, every time a new file is opened that is associated with + -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this + -- function will be executed to configure the current buffer + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), + callback = function(event) + -- NOTE: Remember that Lua is a real programming language, and as such it is possible + -- to define small helper and utility functions so you don't have to repeat yourself. + -- + -- In this case, we create a function that lets us more easily define mappings specific + -- for LSP related items. It sets the mode, buffer and description for us each time. + local map = function(keys, func, desc, mode) + mode = mode or 'n' + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + end + + -- Rename the variable under your cursor. + -- Most Language Servers support renaming across files, etc. + map('grn', vim.lsp.buf.rename, '[R]e[n]ame') + + -- Execute a code action, usually your cursor needs to be on top of an error + -- or a suggestion from your LSP for this to activate. + map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) + + -- Find references for the word under your cursor. + map('grr', require('telescope.builtin').lsp_references, '[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. + map('gri', require('telescope.builtin').lsp_implementations, '[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 . + map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + + -- WARN: This is not Goto Definition, this is Goto Declaration. + -- For example, in C this would take you to the header. + map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + + -- Fuzzy find all the symbols in your current document. + -- Symbols are things like variables, functions, types, etc. + map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols') + + -- Fuzzy find all the symbols in your current workspace. + -- Similar to document symbols, except searches over your entire project. + map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, '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*. + map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') + + -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10) + ---@param client vim.lsp.Client + ---@param method vim.lsp.protocol.Method + ---@param bufnr? integer some lsp support methods only in specific files + ---@return boolean + local function client_supports_method(client, method, bufnr) + if vim.fn.has 'nvim-0.11' == 1 then + return client:supports_method(method, bufnr) + else + return client.supports_method(method, { bufnr = bufnr }) + end + end + + -- 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 + -- + -- When you move your cursor, the highlights will be cleared (the second autocommand). + local client = vim.lsp.get_client_by_id(event.data.client_id) + if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then + local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) + vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.document_highlight, + }) + + vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.clear_references, + }) + + vim.api.nvim_create_autocmd('LspDetach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }), + callback = function(event2) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf } + end, + }) + end + + -- The following code creates a keymap to toggle inlay hints in your + -- code, if the language server you are using supports them + -- + -- This may be unwanted, since they displace some of your code + if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then + map('th', function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) + end, '[T]oggle Inlay [H]ints') + end + end, + }) + + -- Diagnostic Config + -- See :help vim.diagnostic.Opts + vim.diagnostic.config { + severity_sort = true, + float = { border = 'rounded', source = 'if_many' }, + underline = { severity = vim.diagnostic.severity.ERROR }, + signs = vim.g.have_nerd_font and { + text = { + [vim.diagnostic.severity.ERROR] = '󰅚 ', + [vim.diagnostic.severity.WARN] = '󰀪 ', + [vim.diagnostic.severity.INFO] = '󰋽 ', + [vim.diagnostic.severity.HINT] = '󰌶 ', + }, + } or {}, + virtual_text = { + source = 'if_many', + spacing = 2, + format = function(diagnostic) + local diagnostic_message = { + [vim.diagnostic.severity.ERROR] = diagnostic.message, + [vim.diagnostic.severity.WARN] = diagnostic.message, + [vim.diagnostic.severity.INFO] = diagnostic.message, + [vim.diagnostic.severity.HINT] = diagnostic.message, + } + return diagnostic_message[diagnostic.severity] + end, + }, + } + + -- LSP servers and clients are able to communicate to each other what features they support. + -- By default, Neovim doesn't support everything that is in the LSP specification. + -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities. + -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers. + local capabilities = require('blink.cmp').get_lsp_capabilities() + + -- Enable the following language servers + -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. + -- + -- Add any additional override configuration in the following tables. Available keys are: + -- - cmd (table): Override the default command used to start the server + -- - filetypes (table): Override the default list of associated filetypes for the server + -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. + -- - settings (table): Override the default settings passed when initializing the server. + -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ + local servers = { + -- clangd = {}, + gopls = {}, + -- pyright = {}, + rust_analyzer = {}, + -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs + -- + -- Some languages (like typescript) have entire language plugins that can be useful: + -- https://github.com/pmizio/typescript-tools.nvim + -- + -- But for many setups, the LSP (`ts_ls`) will work just fine + ts_ls = { + capabilities = capabilities, + }, + vue_ls = {}, + eslint = {}, + -- + + lua_ls = { + -- cmd = { ... }, + -- filetypes = { ... }, + -- capabilities = {}, + settings = { + Lua = { + completion = { + callSnippet = 'Replace', + }, + -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings + -- diagnostics = { disable = { 'missing-fields' } }, + }, + }, + }, + } + + -- Ensure the servers and tools above are installed + -- + -- To check the current status of installed tools and/or manually install + -- other tools, you can run + -- :Mason + -- + -- You can press `g?` for help in this menu. + -- + -- `mason` had to be setup earlier: to configure its options see the + -- `dependencies` table for `nvim-lspconfig` above. + -- + -- You can add other tools here that you want Mason to install + -- for you, so that they are available from within Neovim. + local ensure_installed = vim.tbl_keys(servers or {}) + vim.list_extend(ensure_installed, { + 'stylua', -- Used to format Lua code + }) + require('mason-tool-installer').setup { ensure_installed = ensure_installed } + + require('mason-lspconfig').setup { + ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) + automatic_installation = false, + handlers = { + function(server_name) + local server = servers[server_name] or {} + -- This handles overriding only values explicitly passed + -- by the server configuration above. Useful when disabling + -- certain features of an LSP (for example, turning off formatting for ts_ls) + server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) + require('lspconfig')[server_name].setup(server) + end, + }, + } + end, +} diff --git a/lua/kickstart/plugins/mini.lua b/lua/kickstart/plugins/mini.lua new file mode 100644 index 00000000000..49db3a868c5 --- /dev/null +++ b/lua/kickstart/plugins/mini.lua @@ -0,0 +1,38 @@ +-- Collection of various small independent plugins/modules +return { + 'echasnovski/mini.nvim', + config = function() + -- Better Around/Inside textobjects + -- + -- Examples: + -- - va) - [V]isually select [A]round [)]paren + -- - yinq - [Y]ank [I]nside [N]ext [Q]uote + -- - ci' - [C]hange [I]nside [']quote + require('mini.ai').setup { n_lines = 500 } + + -- Add/delete/replace surroundings (brackets, quotes, etc.) + -- + -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren + -- - sd' - [S]urround [D]elete [']quotes + -- - 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/echasnovski/mini.nvim + end, +} diff --git a/lua/kickstart/plugins/telescope.lua b/lua/kickstart/plugins/telescope.lua new file mode 100644 index 00000000000..6b854a504a1 --- /dev/null +++ b/lua/kickstart/plugins/telescope.lua @@ -0,0 +1,126 @@ +return { -- Fuzzy Finder (files, lsp, etc) + 'nvim-telescope/telescope.nvim', + 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! + + local actions = require 'telescope.actions' + -- [[ 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 = { + layout_strategy = 'horizontal', + layout_config = { + width = 0.9, + height = 0.9, + }, + preview_width = 0.6, + + path_display = { 'truncate' }, + mappings = { + n = { + [''] = actions.add_selected_to_qflist + actions.open_qflist, + }, + i = { + [''] = 'to_fuzzy_refine', + [''] = actions.move_selection_next, + [''] = actions.move_selection_previous, + [''] = actions.add_selection, + [''] = actions.add_selection, + [''] = actions.add_selected_to_qflist + actions.open_qflist, + [''] = actions.close, + }, + }, + }, + pickers = { + find_files = { + find_command = { 'rg', '--files', '--hidden', '--glob', '!**/.git/*' }, + }, + }, + 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', 'fh', builtin.help_tags, { desc = '[F]ind [H]elp' }) + vim.keymap.set('n', 'fk', builtin.keymaps, { desc = '[F]ind [K]eymaps' }) + vim.keymap.set('n', 'ff', builtin.find_files, { desc = '[F]ind [F]iles' }) + vim.keymap.set('n', 'fs', builtin.builtin, { desc = '[F]ind [S]elect Telescope' }) + vim.keymap.set('n', 'fw', builtin.grep_string, { desc = '[F]ind current [W]ord' }) + vim.keymap.set('n', 'fg', builtin.live_grep, { desc = '[F]ind by [G]rep' }) + vim.keymap.set('n', 'fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostics' }) + vim.keymap.set('n', 'f.', builtin.resume, { desc = '[F]ind [R]esume' }) + vim.keymap.set('n', 'fr', builtin.oldfiles, { desc = '[F]ind [R]ecent Files' }) + vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + + -- Slightly advanced example of overriding default behavior and theme + 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 = true, + }) + 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', 'f/', function() + builtin.live_grep { + grep_open_files = true, + prompt_title = 'Live Grep in Open Files', + } + end, { desc = '[F]ind [/] in Open Files' }) + + -- Shortcut for searching your Neovim configuration files + vim.keymap.set('n', 'fn', function() + builtin.find_files { cwd = vim.fn.stdpath 'config' } + end, { desc = '[F]ind [N]eovim files' }) + end, +} diff --git a/lua/kickstart/plugins/todo-comments.lua b/lua/kickstart/plugins/todo-comments.lua new file mode 100644 index 00000000000..73b4202e4ce --- /dev/null +++ b/lua/kickstart/plugins/todo-comments.lua @@ -0,0 +1,7 @@ +-- Highlight todo, notes, etc in comments +return { + 'folke/todo-comments.nvim', + event = 'VimEnter', + dependencies = { 'nvim-lua/plenary.nvim' }, + opts = { signs = false }, +} diff --git a/lua/kickstart/plugins/treesitter.lua b/lua/kickstart/plugins/treesitter.lua new file mode 100644 index 00000000000..298e50aaba3 --- /dev/null +++ b/lua/kickstart/plugins/treesitter.lua @@ -0,0 +1,40 @@ +return { -- Highlight, edit, and navigate code + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + main = 'nvim-treesitter.configs', -- Sets main module to use for opts + -- [[ Configure Treesitter ]] See `:help nvim-treesitter` + opts = { + ensure_installed = { + 'bash', + 'c', + 'diff', + 'html', + 'lua', + 'luadoc', + 'markdown', + 'markdown_inline', + 'query', + 'vim', + 'vimdoc', + 'go', + 'typescript', + 'javascript', + }, + -- Autoinstall languages that are not installed + auto_install = true, + highlight = { + enable = true, + -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. + -- If you are experiencing weird indenting issues, add the language to + -- the list of additional_vim_regex_highlighting and disabled languages for indent. + additional_vim_regex_highlighting = { 'ruby' }, + }, + indent = { enable = true, disable = { 'ruby' } }, + }, + -- There are additional nvim-treesitter modules that you can use to interact + -- with nvim-treesitter. You should go explore a few and see what interests you: + -- + -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` + -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context + -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects +} diff --git a/lua/kickstart/plugins/which-key.lua b/lua/kickstart/plugins/which-key.lua new file mode 100644 index 00000000000..13b1366fc96 --- /dev/null +++ b/lua/kickstart/plugins/which-key.lua @@ -0,0 +1,55 @@ +-- Useful plugin to show you pending keybinds. +return { + 'folke/which-key.nvim', + event = 'VimEnter', -- Sets the loading event to 'VimEnter' + opts = { + -- delay between pressing a key and opening which-key (milliseconds) + -- this setting is independent of vim.o.timeoutlen + delay = 0, + icons = { + -- set icon mappings to true if you have a Nerd Font + mappings = vim.g.have_nerd_font, + -- If you are using a Nerd Font: set icons.keys to an empty table which will use the + -- default which-key.nvim defined Nerd Font icons, otherwise define a string table + keys = vim.g.have_nerd_font and {} or { + Up = ' ', + Down = ' ', + Left = ' ', + Right = ' ', + C = ' ', + M = ' ', + D = ' ', + S = ' ', + CR = ' ', + Esc = ' ', + ScrollWheelDown = ' ', + ScrollWheelUp = ' ', + NL = ' ', + BS = ' ', + Space = ' ', + Tab = ' ', + F1 = '', + F2 = '', + F3 = '', + F4 = '', + F5 = '', + F6 = '', + F7 = '', + F8 = '', + F9 = '', + F10 = '', + F11 = '', + F12 = '', + }, + }, + + -- Document existing key chains + spec = { + { 'f', group = '[F]ind' }, + { 't', group = '[T]oggle' }, + { 'd', group = '[D]ebug' }, + { 'g', group = 'Git', mode = { 'n', 'v' } }, + { 'q', group = 'Quickfix' }, + }, + }, +} From 02aeedc67d3b4387b546b2770bc72d57eb936dfb Mon Sep 17 00:00:00 2001 From: Gustavo Date: Sat, 16 Aug 2025 00:47:22 +0200 Subject: [PATCH 08/19] Fix: Bug with plenary and lazygit removed the need for plenary in lazygit since it had an error when trying to close it --- lazy-lock.json | 38 +++++++++++++++++----------------- lua/custom/plugins/lazygit.lua | 6 +++--- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index b7f3ed5d19a..9ac65060d84 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,41 +1,41 @@ { "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, - "blink.cmp": { "branch": "main", "commit": "9bcb14b43852a6f2bfd5ac9ef29cb5cf09b1b39b" }, - "catppuccin": { "branch": "main", "commit": "76a8d0515024cc55d8bd26fc13f1af88faef3ebf" }, + "blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" }, + "catppuccin": { "branch": "main", "commit": "3aaf3ab60221bca8edb1354e41bd514a22c89de2" }, "conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" }, - "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, - "gitsigns.nvim": { "branch": "main", "commit": "c80e0b4bfc411d5740a47adc8775fd1070f2028b" }, + "fidget.nvim": { "branch": "main", "commit": "2cb5edb2dd6700a958a446b20bb2be04d318da9d" }, + "gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" }, "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, - "lazygit.nvim": { "branch": "main", "commit": "4839ab642962cc76bb1bf278427dc4c59be15072" }, - "lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "73e0143385d8a2185944b42ed44d728b94ee19a3" }, - "mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" }, + "lazygit.nvim": { "branch": "main", "commit": "3c524ebec6072568064235c407195e9f9fd0cb8a" }, + "lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "7f0bf635082bb9b7d2b37766054526a6ccafdb85" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "86389a3dd687cfaa647b6f44731e492970034baa" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, - "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, - "mini.nvim": { "branch": "main", "commit": "48f48e4b3f317e9da34ee7a01958b4c5018e2d34" }, + "mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" }, + "mini.nvim": { "branch": "main", "commit": "9909241424d305ef8f64d0d4697b45b59d1238ea" }, "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" }, - "nvim-dap": { "branch": "master", "commit": "1c75a797b4017fec6491f509cf196c8c8833f26f" }, - "nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" }, - "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" }, - "nvim-lint": { "branch": "master", "commit": "2b0039b8be9583704591a13129c600891ac2c596" }, - "nvim-lspconfig": { "branch": "master", "commit": "1ddc1a2e692b120cda6d33c890461e49cb85d6bf" }, + "nvim-dap": { "branch": "master", "commit": "a479e25ed5b5d331fb46ee4b9e160ff02ac64310" }, + "nvim-dap-go": { "branch": "main", "commit": "b4421153ead5d726603b02743ea40cf26a51ed5f" }, + "nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, + "nvim-lint": { "branch": "master", "commit": "7ef127aaede2a4d5ad8df8321e2eb4e567f29594" }, + "nvim-lspconfig": { "branch": "master", "commit": "b0caeef0d835fbe19df6ad71dbc4345eaaea649c" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, - "nvim-notify": { "branch": "master", "commit": "a22f5d7ac511c2df2fd3290a9f04c48d5a822e2e" }, + "nvim-notify": { "branch": "master", "commit": "397c7c1184745fca649e5104de659e6392ef5a4d" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, - "nvim-web-devicons": { "branch": "master", "commit": "19d6211c78169e78bab372b585b6fb17ad974e82" }, + "nvim-web-devicons": { "branch": "master", "commit": "c2599a81ecabaae07c49ff9b45dcd032a8d90f1a" }, "oil-git-status.nvim": { "branch": "main", "commit": "4b5cf53842c17a09420919e655a6a559da3112d7" }, "oil.nvim": { "branch": "master", "commit": "bbad9a76b2617ce1221d49619e4e4b659b3c61fc" }, - "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, - "tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "d52d70780ca6497ed28ad1b11bb1e981f666f62a" }, + "tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "7dcf8542059fb15c978de845fc8665428ae13a04" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, diff --git a/lua/custom/plugins/lazygit.lua b/lua/custom/plugins/lazygit.lua index dc1a44a29f1..298465daee9 100644 --- a/lua/custom/plugins/lazygit.lua +++ b/lua/custom/plugins/lazygit.lua @@ -9,9 +9,9 @@ return { 'LazyGitFilterCurrentFile', }, -- optional for floating window border decoration - dependencies = { - 'nvim-lua/plenary.nvim', - }, + -- dependencies = { + -- 'nvim-lua/plenary.nvim', + -- }, -- setting the keybinding for LazyGit with 'keys' is recommended in -- order to load the plugin when the command is run for the first time keys = { From 2ecb05585d8198d07c81af8397768e6282331f6a Mon Sep 17 00:00:00 2001 From: Gustavo Date: Thu, 21 Aug 2025 11:04:18 +0200 Subject: [PATCH 09/19] fix: Fix oil manager to not create a :oil dir Fixed oil.nvim and also changed and added some keybinds for easier use of yanking, deleting and all the lsp related things like "g" --- init.lua | 36 ++++++++++++++++++------------------ lua/custom/plugins/oil.lua | 21 ++++++++++++++++++--- 2 files changed, 36 insertions(+), 21 deletions(-) diff --git a/init.lua b/init.lua index 06e2cfd41d9..d1fba00d716 100644 --- a/init.lua +++ b/init.lua @@ -125,6 +125,11 @@ end) -- [[ Basic Keymaps ]] +vim.keymap.set('n', 'Ss', 'SessionSave', { desc = 'Save session' }) +vim.keymap.set('n', 'Sl', 'SessionLoad', { desc = 'Load session' }) + +vim.keymap.set('n', '', 'w', { desc = 'Save file' }) + -- Clear highlights on search when pressing in normal mode vim.keymap.set('n', '', 'nohlsearch', { desc = 'Clear search highlights' }) vim.keymap.set('n', '', 'nohlsearch', { desc = 'Clear search highlights' }) @@ -171,7 +176,10 @@ vim.keymap.set('n', '', 'zz', { desc = 'Half page down (centered)' }) vim.keymap.set('n', '', 'zz', { desc = 'Half page up (centered)' }) -- Delete without yanking -vim.keymap.set({ 'n', 'v' }, 'd', '"_d', { desc = 'Delete without yanking' }) +vim.keymap.set({ 'n', 'v' }, 'D', '"_d', { desc = 'Delete without yanking' }) + +-- Paste without yanking +vim.keymap.set('x', 'p', [["_dP]], { desc = 'Paste without yanking' }) -- Buffer navigation vim.keymap.set('n', 'bn', 'bnext', { desc = 'Next buffer' }) @@ -195,7 +203,7 @@ vim.keymap.set('n', 'J', 'mzJ`z', { desc = 'Join lines and keep cursor position' -- ============================================================================ -- Copy Full File-Path -vim.keymap.set('n', 'ypa', function() +vim.keymap.set('n', 'yp', function() local path = vim.fn.expand '%:p' vim.fn.setreg('+', path) print('file:', path) @@ -237,7 +245,7 @@ vim.api.nvim_create_autocmd('FileType', { vim.api.nvim_create_autocmd('FileType', { group = augroup, - pattern = { 'javascript', 'typescript', 'javascriptreact', 'typescriptreact', 'json', 'html', 'css' }, + pattern = { 'javascript', 'typescript', 'javascriptreact', 'typescriptreact', 'json', 'html', 'css', 'go' }, callback = function() vim.opt_local.tabstop = 2 vim.opt_local.shiftwidth = 2 @@ -274,11 +282,13 @@ vim.api.nvim_create_autocmd('VimResized', { -- Create directories when saving files vim.api.nvim_create_autocmd('BufWritePre', { - group = augroup, callback = function() - local dir = vim.fn.expand ':p:h' - if vim.fn.isdirectory(dir) == 0 then - vim.fn.mkdir(dir, 'p') + local filepath = vim.fn.expand ':p:h' + if filepath:match '^oil://' or vim.uv.fs_realpath(filepath) == nil then + return + end + if vim.fn.isdirectory(filepath) == 0 then + vim.fn.mkdir(filepath, 'p') end end, }) @@ -468,17 +478,7 @@ vim.keymap.set('n', 'td', duplicate_tab, { desc = 'Duplicate current tab vim.keymap.set('n', 'tr', close_tabs_right, { desc = 'Close tabs to the right' }) vim.keymap.set('n', 'tL', close_tabs_left, { desc = 'Close tabs to the left' }) --- Function to close buffer but keep tab if it's the only buffer in tab -local function smart_close_buffer() - local buffers_in_tab = #vim.fn.tabpagebuflist() - if buffers_in_tab > 1 then - vim.cmd 'bdelete' - else - -- If it's the only buffer in tab, close the tab - vim.cmd 'tabclose' - end -end -vim.keymap.set('n', 'x', smart_close_buffer, { desc = 'Smart close buffer/tab' }) +vim.keymap.set('n', 'x', 'q', { desc = 'Smart close buffer/tab' }) -- [[ Install `lazy.nvim` plugin manager ]] -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua index 86195cb5d41..6a2d7d02133 100644 --- a/lua/custom/plugins/oil.lua +++ b/lua/custom/plugins/oil.lua @@ -8,7 +8,7 @@ return { local oil = require 'oil' oil.setup { - default_file_explorer = true, + -- default_file_explorer = true, delete_to_trash = true, skip_confirm_for_simple_edits = true, @@ -19,13 +19,15 @@ return { [''] = { 'actions.select' }, [''] = { 'actions.select' }, [''] = { 'actions.parent' }, - [''] = { 'actions.select_split' }, [''] = { 'actions.close', mode = 'n' }, [''] = { 'actions.close', mode = 'n' }, + [''] = { 'actions.select', opts = { vertical = true } }, + [''] = { 'actions.select', opts = { horizontal = true } }, + [''] = { 'actions.select', opts = { tab = true } }, }, view_options = { show_hidden = true, - natural_order = true, + natural_order = 'fast', is_always_hidden = function(name, _) return name == '..' or name == '.git' end, @@ -34,6 +36,19 @@ return { signcolumn = 'yes:2', wrap = true, }, + preview_win = { + disable_preview = function(filename) + return filename:match '^%.' + end, + }, + sort = { + { 'name', 'asc' }, + }, + buf_options = { + buflisted = false, + bufhidden = 'delete', -- Delete the buffer immediately when hidden + }, + cleanup_delay_ms = 0, -- Or set to false to disable auto-cleanup entirely if you prefer } vim.keymap.set('n', '-', oil.toggle_float, { desc = 'Open parent directory' }) From ff1b9952e958b08871a0df60786373ce5a957d60 Mon Sep 17 00:00:00 2001 From: Gustavo Date: Thu, 21 Aug 2025 11:04:48 +0200 Subject: [PATCH 10/19] feat: add new groups to which key --- lua/kickstart/plugins/which-key.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lua/kickstart/plugins/which-key.lua b/lua/kickstart/plugins/which-key.lua index 13b1366fc96..4cbc6853c66 100644 --- a/lua/kickstart/plugins/which-key.lua +++ b/lua/kickstart/plugins/which-key.lua @@ -47,7 +47,12 @@ return { spec = { { 'f', group = '[F]ind' }, { 't', group = '[T]oggle' }, - { 'd', group = '[D]ebug' }, + { 'D', group = '[D]ebug' }, + { 'd', group = '[D]iagnostic' }, + { 'b', group = '[B]uffer' }, + { 'w', group = '[W]indow' }, + { 'y', group = '[Y]ank' }, + { 'S', group = '[S]ession' }, { 'g', group = 'Git', mode = { 'n', 'v' } }, { 'q', group = 'Quickfix' }, }, From a68fec9cbc913e17364f87f4bb9d4e206cace649 Mon Sep 17 00:00:00 2001 From: Gustavo Date: Thu, 21 Aug 2025 11:05:59 +0200 Subject: [PATCH 11/19] feat: updated tools to fit my needs --- lua/kickstart/plugins/auto-completion.lua | 16 +- lua/kickstart/plugins/lsp/main-lsp.lua | 489 +++++++++++----------- lua/kickstart/plugins/telescope.lua | 5 +- lua/kickstart/plugins/treesitter.lua | 11 +- 4 files changed, 272 insertions(+), 249 deletions(-) diff --git a/lua/kickstart/plugins/auto-completion.lua b/lua/kickstart/plugins/auto-completion.lua index 9ac75d6be0c..f51dbffc0b4 100644 --- a/lua/kickstart/plugins/auto-completion.lua +++ b/lua/kickstart/plugins/auto-completion.lua @@ -18,15 +18,12 @@ return { return 'make install_jsregexp' end)(), dependencies = { - -- `friendly-snippets` contains a variety of premade snippets. - -- See the README about individual language/framework/plugin snippets: - -- https://github.com/rafamadriz/friendly-snippets - -- { - -- 'rafamadriz/friendly-snippets', - -- config = function() - -- require('luasnip.loaders.from_vscode').lazy_load() - -- end, - -- }, + { + 'rafamadriz/friendly-snippets', + config = function() + require('luasnip.loaders.from_vscode').lazy_load() + end, + }, }, opts = {}, }, @@ -64,6 +61,7 @@ return { [''] = { 'select_next', 'fallback' }, [''] = { 'select_prev', 'fallback' }, [''] = { 'select_next', 'fallback' }, + [''] = false, -- See :h blink-cmp-config-keymap for defining your own keymap preset = 'super-tab', diff --git a/lua/kickstart/plugins/lsp/main-lsp.lua b/lua/kickstart/plugins/lsp/main-lsp.lua index 0cf02c6c55d..66e1ca2e87b 100644 --- a/lua/kickstart/plugins/lsp/main-lsp.lua +++ b/lua/kickstart/plugins/lsp/main-lsp.lua @@ -1,264 +1,279 @@ return { - -- Main LSP Configuration - 'neovim/nvim-lspconfig', - dependencies = { - -- Automatically install LSPs and related tools to stdpath for Neovim - -- Mason must be loaded before its dependents so we need to set it up here. - -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` - { 'mason-org/mason.nvim', opts = {} }, - 'mason-org/mason-lspconfig.nvim', - 'WhoIsSethDaniel/mason-tool-installer.nvim', + -- Main LSP Configuration + 'neovim/nvim-lspconfig', + dependencies = { + -- Automatically install LSPs and related tools to stdpath for Neovim + -- Mason must be loaded before its dependents so we need to set it up here. + -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` + { 'mason-org/mason.nvim', opts = {} }, + 'mason-org/mason-lspconfig.nvim', + 'WhoIsSethDaniel/mason-tool-installer.nvim', - -- Useful status updates for LSP. - { 'j-hui/fidget.nvim', opts = {} }, + -- Useful status updates for LSP. + { 'j-hui/fidget.nvim', opts = {} }, - -- Allows extra capabilities provided by blink.cmp - 'saghen/blink.cmp', - }, - config = function() - -- Brief aside: **What is LSP?** - -- - -- LSP is an initialism you've probably heard, but might not understand what it is. - -- - -- LSP stands for Language Server Protocol. It's a protocol that helps editors - -- and language tooling communicate in a standardized fashion. - -- - -- In general, you have a "server" which is some tool built to understand a particular - -- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers - -- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone - -- processes that communicate with some "client" - in this case, Neovim! - -- - -- LSP provides Neovim with features like: - -- - Go to definition - -- - Find references - -- - Autocompletion - -- - Symbol Search - -- - and more! - -- - -- Thus, Language Servers are external tools that must be installed separately from - -- Neovim. This is where `mason` and related plugins come into play. - -- - -- If you're wondering about lsp vs treesitter, you can check out the wonderfully - -- and elegantly composed help section, `:help lsp-vs-treesitter` - - -- This function gets run when an LSP attaches to a particular buffer. - -- That is to say, every time a new file is opened that is associated with - -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this - -- function will be executed to configure the current buffer - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), - callback = function(event) - -- NOTE: Remember that Lua is a real programming language, and as such it is possible - -- to define small helper and utility functions so you don't have to repeat yourself. - -- - -- In this case, we create a function that lets us more easily define mappings specific - -- for LSP related items. It sets the mode, buffer and description for us each time. - local map = function(keys, func, desc, mode) - mode = mode or 'n' - vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) - end + -- Allows extra capabilities provided by blink.cmp + 'saghen/blink.cmp', + }, + config = function() + -- Brief aside: **What is LSP?** + -- + -- LSP is an initialism you've probably heard, but might not understand what it is. + -- + -- LSP stands for Language Server Protocol. It's a protocol that helps editors + -- and language tooling communicate in a standardized fashion. + -- + -- In general, you have a "server" which is some tool built to understand a particular + -- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers + -- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone + -- processes that communicate with some "client" - in this case, Neovim! + -- + -- LSP provides Neovim with features like: + -- - Go to definition + -- - Find references + -- - Autocompletion + -- - Symbol Search + -- - and more! + -- + -- Thus, Language Servers are external tools that must be installed separately from + -- Neovim. This is where `mason` and related plugins come into play. + -- + -- If you're wondering about lsp vs treesitter, you can check out the wonderfully + -- and elegantly composed help section, `:help lsp-vs-treesitter` - -- Rename the variable under your cursor. - -- Most Language Servers support renaming across files, etc. - map('grn', vim.lsp.buf.rename, '[R]e[n]ame') + -- This function gets run when an LSP attaches to a particular buffer. + -- That is to say, every time a new file is opened that is associated with + -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this + -- function will be executed to configure the current buffer + vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), + callback = function(event) + -- NOTE: Remember that Lua is a real programming language, and as such it is possible + -- to define small helper and utility functions so you don't have to repeat yourself. + -- + -- In this case, we create a function that lets us more easily define mappings specific + -- for LSP related items. It sets the mode, buffer and description for us each time. + local map = function(keys, func, desc, mode) + mode = mode or 'n' + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + end - -- Execute a code action, usually your cursor needs to be on top of an error - -- or a suggestion from your LSP for this to activate. - map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) + -- Rename the variable under your cursor. + -- Most Language Servers support renaming across files, etc. + map('grn', vim.lsp.buf.rename, '[R]e[n]ame') - -- Find references for the word under your cursor. - map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') + -- Execute a code action, usually your cursor needs to be on top of an error + -- or a suggestion from your LSP for this to activate. + map('gca', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) - -- Jump to the implementation of the word under your cursor. - -- Useful when your language has ways of declaring types without an actual implementation. - map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') + -- Find references for the word under your cursor. + map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') - -- 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 . - map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') + -- Jump to the implementation of the word under your cursor. + -- Useful when your language has ways of declaring types without an actual implementation. + map('gi', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - -- WARN: This is not Goto Definition, this is Goto Declaration. - -- For example, in C this would take you to the header. - map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + -- 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 . + map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') - -- Fuzzy find all the symbols in your current document. - -- Symbols are things like variables, functions, types, etc. - map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols') + -- WARN: This is not Goto Definition, this is Goto Declaration. + -- For example, in C this would take you to the header. + map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - -- Fuzzy find all the symbols in your current workspace. - -- Similar to document symbols, except searches over your entire project. - map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, '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*. + map('gt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') - -- 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*. - map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') + -- Fuzzy find all the symbols in your current document. + -- Symbols are things like variables, functions, types, etc. + map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols') - -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10) - ---@param client vim.lsp.Client - ---@param method vim.lsp.protocol.Method - ---@param bufnr? integer some lsp support methods only in specific files - ---@return boolean - local function client_supports_method(client, method, bufnr) - if vim.fn.has 'nvim-0.11' == 1 then - return client:supports_method(method, bufnr) - else - return client.supports_method(method, { bufnr = bufnr }) - end - end + -- Fuzzy find all the symbols in your current workspace. + -- Similar to document symbols, except searches over your entire project. + map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open 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 - -- - -- When you move your cursor, the highlights will be cleared (the second autocommand). - local client = vim.lsp.get_client_by_id(event.data.client_id) - if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then - local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) - vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.document_highlight, - }) + -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10) + ---@param client vim.lsp.Client + ---@param method vim.lsp.protocol.Method + ---@param bufnr? integer some lsp support methods only in specific files + ---@return boolean + local function client_supports_method(client, method, bufnr) + if vim.fn.has 'nvim-0.11' == 1 then + return client:supports_method(method, bufnr) + else + return client.supports_method(method, { bufnr = bufnr }) + end + end - vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.clear_references, - }) + -- 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 + -- + -- When you move your cursor, the highlights will be cleared (the second autocommand). + local client = vim.lsp.get_client_by_id(event.data.client_id) + if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then + local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false }) + vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.document_highlight, + }) - vim.api.nvim_create_autocmd('LspDetach', { - group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }), - callback = function(event2) - vim.lsp.buf.clear_references() - vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf } - end, - }) - end + vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.clear_references, + }) - -- The following code creates a keymap to toggle inlay hints in your - -- code, if the language server you are using supports them - -- - -- This may be unwanted, since they displace some of your code - if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then - map('th', function() - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) - end, '[T]oggle Inlay [H]ints') - end + vim.api.nvim_create_autocmd('LspDetach', { + group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }), + callback = function(event2) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf } end, - }) + }) + end - -- Diagnostic Config - -- See :help vim.diagnostic.Opts - vim.diagnostic.config { - severity_sort = true, - float = { border = 'rounded', source = 'if_many' }, - underline = { severity = vim.diagnostic.severity.ERROR }, - signs = vim.g.have_nerd_font and { - text = { - [vim.diagnostic.severity.ERROR] = '󰅚 ', - [vim.diagnostic.severity.WARN] = '󰀪 ', - [vim.diagnostic.severity.INFO] = '󰋽 ', - [vim.diagnostic.severity.HINT] = '󰌶 ', - }, - } or {}, - virtual_text = { - source = 'if_many', - spacing = 2, - format = function(diagnostic) - local diagnostic_message = { - [vim.diagnostic.severity.ERROR] = diagnostic.message, - [vim.diagnostic.severity.WARN] = diagnostic.message, - [vim.diagnostic.severity.INFO] = diagnostic.message, - [vim.diagnostic.severity.HINT] = diagnostic.message, - } - return diagnostic_message[diagnostic.severity] - end, - }, - } + -- The following code creates a keymap to toggle inlay hints in your + -- code, if the language server you are using supports them + -- + -- This may be unwanted, since they displace some of your code + if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then + map('th', function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) + end, '[T]oggle Inlay [H]ints') + end + end, + }) - -- LSP servers and clients are able to communicate to each other what features they support. - -- By default, Neovim doesn't support everything that is in the LSP specification. - -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities. - -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers. - local capabilities = require('blink.cmp').get_lsp_capabilities() + -- Diagnostic Config + -- See :help vim.diagnostic.Opts + vim.diagnostic.config { + severity_sort = true, + float = { border = 'rounded', source = 'if_many' }, + underline = { severity = vim.diagnostic.severity.ERROR }, + signs = vim.g.have_nerd_font and { + text = { + [vim.diagnostic.severity.ERROR] = '󰅚 ', + [vim.diagnostic.severity.WARN] = '󰀪 ', + [vim.diagnostic.severity.INFO] = '󰋽 ', + [vim.diagnostic.severity.HINT] = '󰌶 ', + }, + } or {}, + virtual_text = { + source = 'if_many', + spacing = 2, + format = function(diagnostic) + local diagnostic_message = { + [vim.diagnostic.severity.ERROR] = diagnostic.message, + [vim.diagnostic.severity.WARN] = diagnostic.message, + [vim.diagnostic.severity.INFO] = diagnostic.message, + [vim.diagnostic.severity.HINT] = diagnostic.message, + } + return diagnostic_message[diagnostic.severity] + end, + }, + } - -- Enable the following language servers - -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. - -- - -- Add any additional override configuration in the following tables. Available keys are: - -- - cmd (table): Override the default command used to start the server - -- - filetypes (table): Override the default list of associated filetypes for the server - -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. - -- - settings (table): Override the default settings passed when initializing the server. - -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ - local servers = { - -- clangd = {}, - gopls = {}, - -- pyright = {}, - rust_analyzer = {}, - -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs - -- - -- Some languages (like typescript) have entire language plugins that can be useful: - -- https://github.com/pmizio/typescript-tools.nvim - -- - -- But for many setups, the LSP (`ts_ls`) will work just fine - ts_ls = { - capabilities = capabilities, + -- LSP servers and clients are able to communicate to each other what features they support. + -- By default, Neovim doesn't support everything that is in the LSP specification. + -- When you add blink.cmp, luasnip, etc. Neovim now has *more* capabilities. + -- So, we create new capabilities with blink.cmp, and then broadcast that to the servers. + local capabilities = require('blink.cmp').get_lsp_capabilities() + local util = require 'lspconfig/util' + + -- Enable the following language servers + -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. + -- + -- Add any additional override configuration in the following tables. Available keys are: + -- - cmd (table): Override the default command used to start the server + -- - filetypes (table): Override the default list of associated filetypes for the server + -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. + -- - settings (table): Override the default settings passed when initializing the server. + -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ + local servers = { + -- clangd = {}, + gopls = { + capabilities = capabilities, + cmd = { 'gopls' }, + filetypes = { 'go', 'gomod', 'gowork', 'gotmpl' }, + root_dir = util.root_pattern('go.work', 'go.mod', '.git'), + settings = { + gopls = { + completeUnimported = true, + usePlaceholders = true, + analyses = { + unusedparams = true, }, - vue_ls = {}, - eslint = {}, - -- + }, + }, + }, + -- pyright = {}, + rust_analyzer = {}, + -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs + -- + -- Some languages (like typescript) have entire language plugins that can be useful: + -- https://github.com/pmizio/typescript-tools.nvim + -- + -- But for many setups, the LSP (`ts_ls`) will work just fine + ts_ls = { + capabilities = capabilities, + }, + vue_ls = {}, + eslint = {}, + -- - lua_ls = { - -- cmd = { ... }, - -- filetypes = { ... }, - -- capabilities = {}, - settings = { - Lua = { - completion = { - callSnippet = 'Replace', - }, - -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings - -- diagnostics = { disable = { 'missing-fields' } }, - }, - }, + lua_ls = { + -- cmd = { ... }, + -- filetypes = { ... }, + -- capabilities = {}, + settings = { + Lua = { + completion = { + callSnippet = 'Replace', }, - } + -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings + -- diagnostics = { disable = { 'missing-fields' } }, + }, + }, + }, + } - -- Ensure the servers and tools above are installed - -- - -- To check the current status of installed tools and/or manually install - -- other tools, you can run - -- :Mason - -- - -- You can press `g?` for help in this menu. - -- - -- `mason` had to be setup earlier: to configure its options see the - -- `dependencies` table for `nvim-lspconfig` above. - -- - -- You can add other tools here that you want Mason to install - -- for you, so that they are available from within Neovim. - local ensure_installed = vim.tbl_keys(servers or {}) - vim.list_extend(ensure_installed, { - 'stylua', -- Used to format Lua code - }) - require('mason-tool-installer').setup { ensure_installed = ensure_installed } + -- Ensure the servers and tools above are installed + -- + -- To check the current status of installed tools and/or manually install + -- other tools, you can run + -- :Mason + -- + -- You can press `g?` for help in this menu. + -- + -- `mason` had to be setup earlier: to configure its options see the + -- `dependencies` table for `nvim-lspconfig` above. + -- + -- You can add other tools here that you want Mason to install + -- for you, so that they are available from within Neovim. + local ensure_installed = vim.tbl_keys(servers or {}) + vim.list_extend(ensure_installed, { + 'stylua', -- Used to format Lua code + }) + require('mason-tool-installer').setup { ensure_installed = ensure_installed } - require('mason-lspconfig').setup { - ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) - automatic_installation = false, - handlers = { - function(server_name) - local server = servers[server_name] or {} - -- This handles overriding only values explicitly passed - -- by the server configuration above. Useful when disabling - -- certain features of an LSP (for example, turning off formatting for ts_ls) - server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) - require('lspconfig')[server_name].setup(server) - end, - }, - } - end, + require('mason-lspconfig').setup { + ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) + automatic_installation = false, + handlers = { + function(server_name) + local server = servers[server_name] or {} + -- This handles overriding only values explicitly passed + -- by the server configuration above. Useful when disabling + -- certain features of an LSP (for example, turning off formatting for ts_ls) + server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) + require('lspconfig')[server_name].setup(server) + end, + }, + } + end, } diff --git a/lua/kickstart/plugins/telescope.lua b/lua/kickstart/plugins/telescope.lua index 6b854a504a1..a49547f088e 100644 --- a/lua/kickstart/plugins/telescope.lua +++ b/lua/kickstart/plugins/telescope.lua @@ -65,7 +65,8 @@ return { -- Fuzzy Finder (files, lsp, etc) [''] = actions.move_selection_next, [''] = actions.move_selection_previous, [''] = actions.add_selection, - [''] = actions.add_selection, + [''] = actions.add_selection, + [''] = actions.select_default, [''] = actions.add_selected_to_qflist + actions.open_qflist, [''] = actions.close, }, @@ -98,7 +99,7 @@ return { -- Fuzzy Finder (files, lsp, etc) vim.keymap.set('n', 'fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostics' }) vim.keymap.set('n', 'f.', builtin.resume, { desc = '[F]ind [R]esume' }) vim.keymap.set('n', 'fr', builtin.oldfiles, { desc = '[F]ind [R]ecent Files' }) - vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + vim.keymap.set('n', 'f', builtin.buffers, { desc = '[ ] Find existing buffers' }) -- Slightly advanced example of overriding default behavior and theme vim.keymap.set('n', '/', function() diff --git a/lua/kickstart/plugins/treesitter.lua b/lua/kickstart/plugins/treesitter.lua index 298e50aaba3..72549744aa8 100644 --- a/lua/kickstart/plugins/treesitter.lua +++ b/lua/kickstart/plugins/treesitter.lua @@ -2,6 +2,13 @@ return { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', main = 'nvim-treesitter.configs', -- Sets main module to use for opts + dependencies = { + { 'nvim-treesitter/nvim-treesitter-textobjects' }, + { + 'nvim-treesitter/nvim-treesitter-context', + opts = { enable = true, mode = 'topline', line_numbers = true }, + }, + }, -- [[ Configure Treesitter ]] See `:help nvim-treesitter` opts = { ensure_installed = { @@ -30,8 +37,10 @@ return { -- Highlight, edit, and navigate code additional_vim_regex_highlighting = { 'ruby' }, }, indent = { enable = true, disable = { 'ruby' } }, + textobjects = { select = { enable = true, lookahead = true } }, }, - -- There are additional nvim-treesitter modules that you can use to interact + -- There are additional nvim-treesitter modules that you can use textobjectsto in + -- eract -- with nvim-treesitter. You should go explore a few and see what interests you: -- -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` From ba163e76292c72aa8974000311d67063b0515055 Mon Sep 17 00:00:00 2001 From: Gustavo Date: Thu, 21 Aug 2025 11:06:12 +0200 Subject: [PATCH 12/19] feat: add inline completion --- lua/custom/plugins/supermaven.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 lua/custom/plugins/supermaven.lua diff --git a/lua/custom/plugins/supermaven.lua b/lua/custom/plugins/supermaven.lua new file mode 100644 index 00000000000..318654c35d1 --- /dev/null +++ b/lua/custom/plugins/supermaven.lua @@ -0,0 +1,22 @@ +return { + 'supermaven-inc/supermaven-nvim', + config = function() + require('supermaven-nvim').setup { + keymaps = { + accept_suggestion = '', + clear_suggestion = '', + accept_word = '', + }, + ignore_filetypes = { cpp = true }, -- or { "cpp", } + color = { + cterm = 244, + }, + log_level = 'info', -- set to "off" to disable logging completely + disable_inline_completion = false, -- disables inline completion for use with cmp + disable_keymaps = false, -- disables built in keymaps for more manual control + condition = function() + return false + end, -- condition to check for stopping supermaven, `true` means to stop supermaven when the condition is true.} + } + end, +} From e9f901da2b9bd42553241feb5da7abf773b8042e Mon Sep 17 00:00:00 2001 From: Gustavo Date: Thu, 21 Aug 2025 11:06:45 +0200 Subject: [PATCH 13/19] fix: changed keybinds to make more sense --- lua/custom/plugins/trouble.lua | 13 +++++++++---- lua/kickstart/plugins/debug.lua | 24 ++++++++++++------------ 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/lua/custom/plugins/trouble.lua b/lua/custom/plugins/trouble.lua index a750f808ccf..cc2c2305b32 100644 --- a/lua/custom/plugins/trouble.lua +++ b/lua/custom/plugins/trouble.lua @@ -5,14 +5,14 @@ return { opts = {}, -- Use default options keys = { { - 'qx', + 'dt', 'Trouble diagnostics toggle', desc = 'Toggle Diagnostics', }, { - 'qd', + 'db', 'Trouble diagnostics toggle filter.buf=0', - desc = 'Toggle Document Diagnostics', + desc = 'Toggle Buffer Diagnostics', }, { 'qq', @@ -25,7 +25,12 @@ return { desc = 'Toggle Location List', }, { - 'qr', + 'qc', + ':lua vim.fn.setqflist({}, "r")', + desc = 'Clear Quickfix List', + }, + { + 'qR', 'Trouble lsp toggle focus=false win.position=right', desc = 'Toggle LSP References', }, diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index fccec92b9ac..5838d0f7327 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -55,14 +55,14 @@ return { desc = 'Debug: Step Out', }, { - 'db', + 'Db', function() require('dap').toggle_breakpoint() end, desc = 'Debug: Toggle Breakpoint', }, { - 'dB', + 'DB', function() require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') end, @@ -121,16 +121,16 @@ return { } -- Change breakpoint icons - -- vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' }) - -- vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' }) - -- local breakpoint_icons = vim.g.have_nerd_font - -- and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' } - -- or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' } - -- for type, icon in pairs(breakpoint_icons) do - -- local tp = 'Dap' .. type - -- local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak' - -- vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl }) - -- end + vim.api.nvim_set_hl(0, 'DapBreak', { fg = '#e51400' }) + vim.api.nvim_set_hl(0, 'DapStop', { fg = '#ffcc00' }) + local breakpoint_icons = vim.g.have_nerd_font + and { Breakpoint = '', BreakpointCondition = '', BreakpointRejected = '', LogPoint = '', Stopped = '' } + or { Breakpoint = '●', BreakpointCondition = '⊜', BreakpointRejected = '⊘', LogPoint = '◆', Stopped = '⭔' } + for type, icon in pairs(breakpoint_icons) do + local tp = 'Dap' .. type + local hl = (type == 'Stopped') and 'DapStop' or 'DapBreak' + vim.fn.sign_define(tp, { text = icon, texthl = hl, numhl = hl }) + end dap.listeners.after.event_initialized['dapui_config'] = dapui.open dap.listeners.before.event_terminated['dapui_config'] = dapui.close From 8aad681e1252118550a03b96b22c0cb98cf69012 Mon Sep 17 00:00:00 2001 From: Gustavo Date: Thu, 21 Aug 2025 11:07:06 +0200 Subject: [PATCH 14/19] feat: added go utils --- lua/kickstart/plugins/format.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/kickstart/plugins/format.lua b/lua/kickstart/plugins/format.lua index 8213c80cff7..3a8d8c72a0f 100644 --- a/lua/kickstart/plugins/format.lua +++ b/lua/kickstart/plugins/format.lua @@ -52,7 +52,7 @@ return { -- Autoformat css = { { 'prettierd', 'prettier', stop_after_first = true } }, scss = { { 'prettierd', 'prettier', stop_after_first = true } }, sh = { 'shellcheck' }, - go = { 'gofmt' }, + go = { 'gofmt', 'goimports', 'goimports_reviser' }, xml = { 'xmllint' }, }, }, From b9e09289e3bcd258a101083a74a018777e7a5459 Mon Sep 17 00:00:00 2001 From: Gustavo Date: Thu, 21 Aug 2025 11:07:16 +0200 Subject: [PATCH 15/19] update of lazylock --- lazy-lock.json | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 9ac65060d84..41ba1f57863 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,9 +1,15 @@ { "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, - "blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" }, - "catppuccin": { "branch": "main", "commit": "3aaf3ab60221bca8edb1354e41bd514a22c89de2" }, - "conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" }, - "fidget.nvim": { "branch": "main", "commit": "2cb5edb2dd6700a958a446b20bb2be04d318da9d" }, + "blink.cmp": { "branch": "main", "commit": "4e9edba1b1cef1585cc65e54287229e5d34e4df8" }, + "catppuccin": { "branch": "main", "commit": "30fa4d122d9b22ad8b2e0ab1b533c8c26c4dde86" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" }, + "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "conform.nvim": { "branch": "master", "commit": "04bfa5f35706410376bf7618a01fcf44e3f35b59" }, + "fidget.nvim": { "branch": "main", "commit": "a837f0653ab0f07b9efb1870372a60a031208ac1" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" }, "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, @@ -11,31 +17,34 @@ "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, "lazygit.nvim": { "branch": "main", "commit": "3c524ebec6072568064235c407195e9f9fd0cb8a" }, "lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "7f0bf635082bb9b7d2b37766054526a6ccafdb85" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "1ec4da522fa49dcecee8d190efda273464dd2192" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "86389a3dd687cfaa647b6f44731e492970034baa" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, "mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" }, - "mini.nvim": { "branch": "main", "commit": "9909241424d305ef8f64d0d4697b45b59d1238ea" }, + "mini.nvim": { "branch": "main", "commit": "0069a71538020a77a19f4f8d5e89f066e264a6dc" }, "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" }, - "nvim-dap": { "branch": "master", "commit": "a479e25ed5b5d331fb46ee4b9e160ff02ac64310" }, + "nvim-dap": { "branch": "master", "commit": "f777d1d20ed50c2f312e286892c062d9c2f1c6fe" }, "nvim-dap-go": { "branch": "main", "commit": "b4421153ead5d726603b02743ea40cf26a51ed5f" }, "nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, "nvim-lint": { "branch": "master", "commit": "7ef127aaede2a4d5ad8df8321e2eb4e567f29594" }, - "nvim-lspconfig": { "branch": "master", "commit": "b0caeef0d835fbe19df6ad71dbc4345eaaea649c" }, + "nvim-lspconfig": { "branch": "master", "commit": "d64ea08d8033543a61af35f2f23cac0f0d05f7b4" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-notify": { "branch": "master", "commit": "397c7c1184745fca649e5104de659e6392ef5a4d" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-treesitter-context": { "branch": "master", "commit": "dca8726fea2c14e1ce6adbaa76a04816fbfaff61" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "71385f191ec06ffc60e80e6b0c9a9d5daed4824c" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, "nvim-web-devicons": { "branch": "master", "commit": "c2599a81ecabaae07c49ff9b45dcd032a8d90f1a" }, "oil-git-status.nvim": { "branch": "main", "commit": "4b5cf53842c17a09420919e655a6a559da3112d7" }, "oil.nvim": { "branch": "master", "commit": "bbad9a76b2617ce1221d49619e4e4b659b3c61fc" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "supermaven-nvim": { "branch": "main", "commit": "07d20fce48a5629686aefb0a7cd4b25e33947d50" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, - "tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "7dcf8542059fb15c978de845fc8665428ae13a04" }, + "tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "f64efd33a51ea89bdb847fb3aaf716e96b83ba1a" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, From 9b2c4071725aff41c44d722f057bd4c000754a00 Mon Sep 17 00:00:00 2001 From: Guust Taillieu Date: Sat, 4 Oct 2025 10:14:07 +0200 Subject: [PATCH 16/19] fixed issue with oil, added after package --- init.lua | 18 ++++++ lazy-lock.json | 52 ++++++++---------- lazyvim.json | 9 +++ lua/custom/after/transparency.lua | 45 +++++++++++++++ lua/custom/plugins/color-picker.lua | 17 ++++++ lua/custom/plugins/noice.lua | 14 +---- lua/custom/plugins/oil.lua | 1 + lua/kickstart/plugins/colorscheme.lua | 79 --------------------------- lua/kickstart/plugins/format.lua | 22 ++++---- lua/kickstart/plugins/theme.lua | 1 + 10 files changed, 127 insertions(+), 131 deletions(-) create mode 100644 lazyvim.json create mode 100644 lua/custom/after/transparency.lua create mode 100644 lua/custom/plugins/color-picker.lua delete mode 100644 lua/kickstart/plugins/colorscheme.lua create mode 120000 lua/kickstart/plugins/theme.lua diff --git a/init.lua b/init.lua index d1fba00d716..5d7418eed8a 100644 --- a/init.lua +++ b/init.lua @@ -209,6 +209,22 @@ vim.keymap.set('n', 'yp', function() print('file:', path) end) +-- Copy all content of the current buffer +vim.keymap.set('n', 'ya', function() + vim.fn.setreg('+', vim.api.nvim_buf_get_lines(0, 0, -1, false)) + vim.notify 'Copied all content of the current buffer' +end) + +-- Delete all content of the current buffer +vim.keymap.set('n', 'da', function() + vim.api.nvim_buf_set_lines(0, 0, -1, false, {}) +end) + +-- Select all content of the current buffer +vim.keymap.set('n', 'sa', function() + vim.api.nvim_feedkeys('ggVG', 'n', false) +end) + -- Basic autocommands local augroup = vim.api.nvim_create_augroup('UserConfig', {}) @@ -526,5 +542,7 @@ require('lazy').setup({ }, }) +require 'custom.after.transparency' + -- The line beneath this is called `modeline`. See `:help modeline` -- vim: ts=2 sts=2 sw=2 et diff --git a/lazy-lock.json b/lazy-lock.json index 41ba1f57863..3e6b93223d2 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,53 +1,47 @@ { + "LazyVim": { "branch": "main", "commit": "b9d38f692015fecaa72d55282b74a3d601e4c9fa" }, "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, - "blink.cmp": { "branch": "main", "commit": "4e9edba1b1cef1585cc65e54287229e5d34e4df8" }, - "catppuccin": { "branch": "main", "commit": "30fa4d122d9b22ad8b2e0ab1b533c8c26c4dde86" }, - "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, - "cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" }, - "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, - "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "conform.nvim": { "branch": "master", "commit": "04bfa5f35706410376bf7618a01fcf44e3f35b59" }, - "fidget.nvim": { "branch": "main", "commit": "a837f0653ab0f07b9efb1870372a60a031208ac1" }, + "blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" }, + "conform.nvim": { "branch": "master", "commit": "c64cc754ace603e185ab30113aaef174187eacf8" }, + "fidget.nvim": { "branch": "main", "commit": "3f5475949679953af6d78654db29b944fa826e6a" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" }, + "gitsigns.nvim": { "branch": "main", "commit": "1ee5c1fd068c81f9dd06483e639c2aa4587dc197" }, "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, - "lazygit.nvim": { "branch": "main", "commit": "3c524ebec6072568064235c407195e9f9fd0cb8a" }, + "lazydev.nvim": { "branch": "main", "commit": "258d2a5ef4a3e3d6d9ba9da72c9725c53e9afcbd" }, + "lazygit.nvim": { "branch": "main", "commit": "2305deed25bc61b866d5d39189e9105a45cf1cfb" }, "lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "1ec4da522fa49dcecee8d190efda273464dd2192" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "155eac5d8609a2f110041f8ac3491664cc126354" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "86389a3dd687cfaa647b6f44731e492970034baa" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, - "mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" }, - "mini.nvim": { "branch": "main", "commit": "0069a71538020a77a19f4f8d5e89f066e264a6dc" }, - "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, - "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "mason.nvim": { "branch": "main", "commit": "a83eabdc8c49c0c93bf5bb162fa3b57404a9d095" }, + "matteblack.nvim": { "branch": "main", "commit": "3bfd406f3b2e41eb3458fe735e06447c08b67d03" }, + "mini.nvim": { "branch": "main", "commit": "126ce3328c78399dcff58272f6f540a373b62a75" }, "nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" }, - "nvim-dap": { "branch": "master", "commit": "f777d1d20ed50c2f312e286892c062d9c2f1c6fe" }, + "nvim-dap": { "branch": "master", "commit": "7367cec8e8f7a0b1e4566af9a7ef5959d11206a7" }, "nvim-dap-go": { "branch": "main", "commit": "b4421153ead5d726603b02743ea40cf26a51ed5f" }, "nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, - "nvim-lint": { "branch": "master", "commit": "7ef127aaede2a4d5ad8df8321e2eb4e567f29594" }, - "nvim-lspconfig": { "branch": "master", "commit": "d64ea08d8033543a61af35f2f23cac0f0d05f7b4" }, + "nvim-lint": { "branch": "master", "commit": "335a6044be16d7701001059cba9baa36fbeef422" }, + "nvim-lspconfig": { "branch": "master", "commit": "db8fef885009fdec0daeff3e5dda92e1f539611e" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, - "nvim-notify": { "branch": "master", "commit": "397c7c1184745fca649e5104de659e6392ef5a4d" }, + "nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, - "nvim-treesitter-context": { "branch": "master", "commit": "dca8726fea2c14e1ce6adbaa76a04816fbfaff61" }, + "nvim-treesitter-context": { "branch": "master", "commit": "41847d3dafb5004464708a3db06b14f12bde548a" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "71385f191ec06ffc60e80e6b0c9a9d5daed4824c" }, - "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, - "nvim-web-devicons": { "branch": "master", "commit": "c2599a81ecabaae07c49ff9b45dcd032a8d90f1a" }, + "nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" }, + "nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" }, "oil-git-status.nvim": { "branch": "main", "commit": "4b5cf53842c17a09420919e655a6a559da3112d7" }, - "oil.nvim": { "branch": "master", "commit": "bbad9a76b2617ce1221d49619e4e4b659b3c61fc" }, + "oil.nvim": { "branch": "master", "commit": "919e155fdf38e9148cdb5304faaaf53c20d703ea" }, + "oklch-color-picker.nvim": { "branch": "master", "commit": "ae318113cd7d0e4988b6b059327c2778911f1187" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "supermaven-nvim": { "branch": "main", "commit": "07d20fce48a5629686aefb0a7cd4b25e33947d50" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, - "tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "f64efd33a51ea89bdb847fb3aaf716e96b83ba1a" }, + "tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "29315861711f11daf75e1cf0953ab92ec1a3e69f" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, - "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, - "trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" }, + "trouble.nvim": { "branch": "main", "commit": "f176232e7759c4f8abd923c21e3e5a5c76cd6837" }, "vim-tmux-navigator": { "branch": "master", "commit": "c45243dc1f32ac6bcf6068e5300f3b2b237e576a" }, - "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } + "which-key.nvim": { "branch": "main", "commit": "904308e6885bbb7b60714c80ab3daf0c071c1492" } } diff --git a/lazyvim.json b/lazyvim.json new file mode 100644 index 00000000000..dc3e179d8bd --- /dev/null +++ b/lazyvim.json @@ -0,0 +1,9 @@ +{ + "extras": [ + + ], + "news": { + "NEWS.md": "11866" + }, + "version": 8 +} \ No newline at end of file diff --git a/lua/custom/after/transparency.lua b/lua/custom/after/transparency.lua new file mode 100644 index 00000000000..d0090f07d6c --- /dev/null +++ b/lua/custom/after/transparency.lua @@ -0,0 +1,45 @@ +-- transparent background +vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) +vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) +vim.api.nvim_set_hl(0, "FloatBorder", { bg = "none" }) +vim.api.nvim_set_hl(0, "Pmenu", { bg = "none" }) +vim.api.nvim_set_hl(0, "Terminal", { bg = "none" }) +vim.api.nvim_set_hl(0, "EndOfBuffer", { bg = "none" }) +vim.api.nvim_set_hl(0, "FoldColumn", { bg = "none" }) +vim.api.nvim_set_hl(0, "Folded", { bg = "none" }) +vim.api.nvim_set_hl(0, "SignColumn", { bg = "none" }) +vim.api.nvim_set_hl(0, "NormalNC", { bg = "none" }) +vim.api.nvim_set_hl(0, "WhichKeyFloat", { bg = "none" }) +vim.api.nvim_set_hl(0, "TelescopeBorder", { bg = "none" }) +vim.api.nvim_set_hl(0, "TelescopeNormal", { bg = "none" }) +vim.api.nvim_set_hl(0, "TelescopePromptBorder", { bg = "none" }) +vim.api.nvim_set_hl(0, "TelescopePromptTitle", { bg = "none" }) + +-- transparent background for neotree +vim.api.nvim_set_hl(0, "NeoTreeNormal", { bg = "none" }) +vim.api.nvim_set_hl(0, "NeoTreeNormalNC", { bg = "none" }) +vim.api.nvim_set_hl(0, "NeoTreeVertSplit", { bg = "none" }) +vim.api.nvim_set_hl(0, "NeoTreeWinSeparator", { bg = "none" }) +vim.api.nvim_set_hl(0, "NeoTreeEndOfBuffer", { bg = "none" }) + +-- transparent background for nvim-tree +vim.api.nvim_set_hl(0, "NvimTreeNormal", { bg = "none" }) +vim.api.nvim_set_hl(0, "NvimTreeVertSplit", { bg = "none" }) +vim.api.nvim_set_hl(0, "NvimTreeEndOfBuffer", { bg = "none" }) + +-- transparent notify background +vim.api.nvim_set_hl(0, "NotifyINFOBody", { bg = "none" }) +vim.api.nvim_set_hl(0, "NotifyERRORBody", { bg = "none" }) +vim.api.nvim_set_hl(0, "NotifyWARNBody", { bg = "none" }) +vim.api.nvim_set_hl(0, "NotifyTRACEBody", { bg = "none" }) +vim.api.nvim_set_hl(0, "NotifyDEBUGBody", { bg = "none" }) +vim.api.nvim_set_hl(0, "NotifyINFOTitle", { bg = "none" }) +vim.api.nvim_set_hl(0, "NotifyERRORTitle", { bg = "none" }) +vim.api.nvim_set_hl(0, "NotifyWARNTitle", { bg = "none" }) +vim.api.nvim_set_hl(0, "NotifyTRACETitle", { bg = "none" }) +vim.api.nvim_set_hl(0, "NotifyDEBUGTitle", { bg = "none" }) +vim.api.nvim_set_hl(0, "NotifyINFOBorder", { bg = "none" }) +vim.api.nvim_set_hl(0, "NotifyERRORBorder", { bg = "none" }) +vim.api.nvim_set_hl(0, "NotifyWARNBorder", { bg = "none" }) +vim.api.nvim_set_hl(0, "NotifyTRACEBorder", { bg = "none" }) +vim.api.nvim_set_hl(0, "NotifyDEBUGBorder", { bg = "none" }) diff --git a/lua/custom/plugins/color-picker.lua b/lua/custom/plugins/color-picker.lua new file mode 100644 index 00000000000..b7ebe7f1a41 --- /dev/null +++ b/lua/custom/plugins/color-picker.lua @@ -0,0 +1,17 @@ +return { + 'eero-lehtinen/oklch-color-picker.nvim', + event = 'VeryLazy', + version = '*', + keys = { + -- One handed keymap recommended, you will be using the mouse + { + 'v', + function() + require('oklch-color-picker').pick_under_cursor() + end, + desc = 'Color pick under cursor', + }, + }, + ---@type oklch.Opts + opts = {}, +} diff --git a/lua/custom/plugins/noice.lua b/lua/custom/plugins/noice.lua index 7e3de12f278..8dcdbc650ad 100644 --- a/lua/custom/plugins/noice.lua +++ b/lua/custom/plugins/noice.lua @@ -1,18 +1,8 @@ return { -- lazy.nvim { - 'folke/noice.nvim', + 'rcarriga/nvim-notify', event = 'VeryLazy', - opts = { - -- add any options here - }, - dependencies = { - -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries - 'MunifTanjim/nui.nvim', - -- OPTIONAL: - -- `nvim-notify` is only needed, if you want to use the notification view. - -- If not available, we use `mini` as the fallback - 'rcarriga/nvim-notify', - }, + opts = {}, }, } diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua index 6a2d7d02133..bdbedd8da13 100644 --- a/lua/custom/plugins/oil.lua +++ b/lua/custom/plugins/oil.lua @@ -24,6 +24,7 @@ return { [''] = { 'actions.select', opts = { vertical = true } }, [''] = { 'actions.select', opts = { horizontal = true } }, [''] = { 'actions.select', opts = { tab = true } }, + [''] = false, }, view_options = { show_hidden = true, diff --git a/lua/kickstart/plugins/colorscheme.lua b/lua/kickstart/plugins/colorscheme.lua deleted file mode 100644 index eaf0b3914ac..00000000000 --- a/lua/kickstart/plugins/colorscheme.lua +++ /dev/null @@ -1,79 +0,0 @@ -return { -- You can easily change to a different colorscheme. - -- 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. - config = function() - ---@diagnostic disable-next-line: missing-fields - require('tokyonight').setup { - transparent = true, - styles = { - sidebars = 'transparent', - floats = 'transparent', - comments = { italic = false }, -- Disable italics in comments - }, - } - - -- Load the colorscheme here. - -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - -- vim.cmd.colorscheme 'tokyonight-night' - end, - }, - { - 'catppuccin/nvim', - name = 'catppuccin', - priority = 1000, - config = function() - require('catppuccin').setup { - flavour = 'mocha', -- latte, frappe, macchiato, mocha - background = { -- :h background - light = 'latte', - dark = 'mocha', - }, - transparent_background = true, -- disables setting the background color. - float = { - transparent = true, -- enable transparent floating windows - solid = false, -- use solid styling for floating windows, see |winborder| - }, - show_end_of_buffer = false, -- shows the '~' characters after the end of buffers - term_colors = true, -- sets terminal colors (e.g. `g:terminal_color_0`) - dim_inactive = { - enabled = false, -- dims the background color of inactive window - shade = 'dark', - percentage = 0.15, -- percentage of the shade to apply to the inactive window - }, - styles = { -- Handles the styles of general hi groups (see `:h highlight-args`): - comments = { 'italic' }, -- Change the style of comments - conditionals = { 'italic' }, - loops = {}, - functions = { 'italic' }, - keywords = { 'bold' }, - strings = {}, - variables = {}, - numbers = {}, - booleans = { 'bold' }, - properties = {}, - types = { 'italic' }, - operators = {}, - -- miscs = {}, -- Uncomment to turn off hard-coded styles - }, - default_integrations = true, - auto_integrations = false, - integrations = { - cmp = true, - gitsigns = true, - nvimtree = true, - treesitter = true, - notify = true, - mini = { - enabled = true, - indentscope_color = '', - }, - -- For more plugins integrations please scroll down (https://github.com/catppuccin/nvim#integrations) - }, - } - - vim.cmd.colorscheme 'catppuccin' - end, - }, -} diff --git a/lua/kickstart/plugins/format.lua b/lua/kickstart/plugins/format.lua index 3a8d8c72a0f..8487dadf961 100644 --- a/lua/kickstart/plugins/format.lua +++ b/lua/kickstart/plugins/format.lua @@ -30,18 +30,18 @@ return { -- Autoformat end, formatters_by_ft = { lua = { 'stylua' }, - svelte = { { 'prettierd', 'prettier', stop_after_first = true } }, - astro = { { 'prettierd', 'prettier', stop_after_first = true } }, - javascript = { { 'prettierd', 'prettier', stop_after_first = true } }, - typescript = { { 'prettierd', 'prettier', stop_after_first = true } }, - javascriptreact = { { 'prettierd', 'prettier', stop_after_first = true } }, - typescriptreact = { { 'prettierd', 'prettier', stop_after_first = true } }, - json = { { 'prettierd', 'prettier', stop_after_first = true } }, - graphql = { { 'prettierd', 'prettier', stop_after_first = true } }, + svelte = { 'prettierd', 'prettier', stop_after_first = true }, + astro = { 'prettierd', 'prettier', stop_after_first = true }, + javascript = { 'prettierd', 'prettier', stop_after_first = true }, + typescript = { 'prettierd', 'prettier', stop_after_first = true }, + javascriptreact = { 'prettierd', 'prettier', stop_after_first = true }, + typescriptreact = { 'prettierd', 'prettier', stop_after_first = true }, + json = { 'prettierd', 'prettier', stop_after_first = true }, + graphql = { 'prettierd', 'prettier', stop_after_first = true }, java = { 'google-java-format' }, kotlin = { 'ktlint' }, ruby = { 'standardrb' }, - markdown = { { 'prettierd', 'prettier', stop_after_first = true } }, + markdown = { 'prettierd', 'prettier', stop_after_first = true }, erb = { 'htmlbeautifier' }, html = { 'htmlbeautifier' }, bash = { 'beautysh' }, @@ -49,8 +49,8 @@ return { -- Autoformat rust = { 'rustfmt' }, yaml = { 'yamlfix' }, toml = { 'taplo' }, - css = { { 'prettierd', 'prettier', stop_after_first = true } }, - scss = { { 'prettierd', 'prettier', stop_after_first = true } }, + css = { 'prettierd', 'prettier', stop_after_first = true }, + scss = { 'prettierd', 'prettier', stop_after_first = true }, sh = { 'shellcheck' }, go = { 'gofmt', 'goimports', 'goimports_reviser' }, xml = { 'xmllint' }, diff --git a/lua/kickstart/plugins/theme.lua b/lua/kickstart/plugins/theme.lua new file mode 120000 index 00000000000..8e7216a98e7 --- /dev/null +++ b/lua/kickstart/plugins/theme.lua @@ -0,0 +1 @@ +/home/gustavo/.config/omarchy/current/theme/neovim.lua \ No newline at end of file From 6260524b90c7425ca8847652391fd70089381c9b Mon Sep 17 00:00:00 2001 From: Guust Taillieu Date: Sun, 7 Dec 2025 12:12:09 +0100 Subject: [PATCH 17/19] update --- ftplugin/java.lua | 157 ++++++++++++++++++++++ init.lua | 1 - lazy-lock.json | 41 +++--- lua/custom/after/transparency.lua | 76 +++++------ lua/custom/plugins/harpoon.lua | 76 +++++++++++ lua/custom/plugins/noice.lua | 8 -- lua/custom/plugins/notify.lua | 22 +++ lua/custom/plugins/oil.lua | 1 - lua/custom/plugins/trouble.lua | 10 ++ lua/custom/snippets/elexir.lua | 11 ++ lua/custom/snippets/kotlin.lua | 33 +++++ lua/kickstart/plugins/auto-completion.lua | 26 +--- lua/kickstart/plugins/format.lua | 8 ++ lua/kickstart/plugins/lsp/jdtls.lua | 5 + lua/kickstart/plugins/lsp/main-lsp.lua | 139 +++++++------------ lua/kickstart/plugins/lualine.lua | 2 +- lua/kickstart/plugins/mini.lua | 20 +-- lua/kickstart/plugins/snippets.lua | 51 +++++++ lua/kickstart/plugins/treesitter.lua | 12 ++ 19 files changed, 497 insertions(+), 202 deletions(-) create mode 100644 ftplugin/java.lua create mode 100644 lua/custom/plugins/harpoon.lua delete mode 100644 lua/custom/plugins/noice.lua create mode 100644 lua/custom/plugins/notify.lua create mode 100644 lua/custom/snippets/elexir.lua create mode 100644 lua/custom/snippets/kotlin.lua create mode 100644 lua/kickstart/plugins/lsp/jdtls.lua create mode 100644 lua/kickstart/plugins/snippets.lua diff --git a/ftplugin/java.lua b/ftplugin/java.lua new file mode 100644 index 00000000000..5b42dbf37ed --- /dev/null +++ b/ftplugin/java.lua @@ -0,0 +1,157 @@ +-- JDTLS (Java LSP) configuration +local home = vim.env.HOME -- Get the home directory + +local jdtls = require 'jdtls' +local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t') +local workspace_dir = home .. '/jdtls-workspace/' .. project_name + +local system_os = '' + +-- Determine OS +if vim.fn.has 'mac' == 1 then + system_os = 'mac' +elseif vim.fn.has 'unix' == 1 then + system_os = 'linux' +elseif vim.fn.has 'win32' == 1 or vim.fn.has 'win64' == 1 then + system_os = 'win' +else + print "OS not found, defaulting to 'linux'" + system_os = 'linux' +end + +-- Needed for debugging +local bundles = { + vim.fn.glob(home .. '/.local/share/nvim/mason/share/java-debug-adapter/com.microsoft.java.debug.plugin.jar'), +} + +-- Needed for running/debugging unit tests +vim.list_extend(bundles, vim.split(vim.fn.glob(home .. '/.local/share/nvim/mason/share/java-test/*.jar', 1), '\n')) + +-- See `:help vim.lsp.start_client` for an overview of the supported `config` options. +local config = { + -- The command that starts the language server + -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line + cmd = { + 'java', + '-Declipse.application=org.eclipse.jdt.ls.core.id1', + '-Dosgi.bundles.defaultStartLevel=4', + '-Declipse.product=org.eclipse.jdt.ls.core.product', + '-Dlog.protocol=true', + '-Dlog.level=ALL', + '-javaagent:' .. home .. '/.local/share/nvim/mason/share/jdtls/lombok.jar', + '-Xmx4g', + '--add-modules=ALL-SYSTEM', + '--add-opens', + 'java.base/java.util=ALL-UNNAMED', + '--add-opens', + 'java.base/java.lang=ALL-UNNAMED', + + -- Eclipse jdtls location + '-jar', + home .. '/.local/share/nvim/mason/share/jdtls/plugins/org.eclipse.equinox.launcher.jar', + '-configuration', + home .. '/.local/share/nvim/mason/packages/jdtls/config_' .. system_os, + '-data', + workspace_dir, + }, + + -- This is the default if not provided, you can remove it. Or adjust as needed. + -- One dedicated LSP server & client will be started per unique root_dir + root_dir = require('jdtls.setup').find_root { '.git', 'mvnw', 'pom.xml', 'build.gradle' }, + + -- Here you can configure eclipse.jdt.ls specific settings + -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request + settings = { + java = { + -- TODO Replace this with the absolute path to your main java version (JDTLS requires JDK 21 or higher) + home = '/usr/lib/jvm/java-21-openjdk', + eclipse = { + downloadSources = true, + }, + configuration = { + updateBuildConfiguration = 'interactive', + -- TODO Update this by adding any runtimes that you need to support your Java projects and removing any that you don't have installed + -- The runtimes' name parameter needs to match a specific Java execution environments. See https://github.com/eclipse-jdtls/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request and search "ExecutionEnvironment". + runtimes = { + { + name = 'JavaSE-21', + path = '/usr/lib/jvm/java-21-openjdk', + }, + { + name = 'JavaSE-25', + path = '/usr/lib/jvm/java-25-openjdk', + }, + }, + }, + maven = { + downloadSources = true, + }, + implementationsCodeLens = { + enabled = true, + }, + referencesCodeLens = { + enabled = true, + }, + references = { + includeDecompiledSources = true, + }, + signatureHelp = { enabled = true }, + format = { + enabled = true, + -- Formatting works by default, but you can refer to a specific file/URL if you choose + -- settings = { + -- url = "https://github.com/google/styleguide/blob/gh-pages/intellij-java-google-style.xml", + -- profile = "GoogleStyle", + -- }, + }, + completion = { + favoriteStaticMembers = { + 'org.hamcrest.MatcherAssert.assertThat', + 'org.hamcrest.Matchers.*', + 'org.hamcrest.CoreMatchers.*', + 'org.junit.jupiter.api.Assertions.*', + 'java.util.Objects.requireNonNull', + 'java.util.Objects.requireNonNullElse', + 'org.mockito.Mockito.*', + }, + importOrder = { + 'java', + 'javax', + 'com', + 'org', + }, + }, + sources = { + organizeImports = { + starThreshold = 9999, + staticStarThreshold = 9999, + }, + }, + codeGeneration = { + toString = { + template = '${object.className}{${member.name()}=${member.value}, ${otherMembers}}', + }, + useBlocks = true, + }, + }, + }, + -- Needed for auto-completion with method signatures and placeholders + capabilities = require('blink-cmp').get_lsp_capabilities(), + flags = { + allow_incremental_sync = true, + }, + init_options = { + -- References the bundles defined above to support Debugging and Unit Testing + bundles = bundles, + extendedClientCapabilities = jdtls.extendedClientCapabilities, + }, +} + +-- Needed for debugging +config['on_attach'] = function(client, bufnr) + jdtls.setup_dap { hotcodereplace = 'auto' } + require('jdtls.dap').setup_dap_main_class_configs() +end + +-- This starts a new client & server, or attaches to an existing client & server based on the `root_dir`. +jdtls.start_or_attach(config) diff --git a/init.lua b/init.lua index 5d7418eed8a..53e57e39efd 100644 --- a/init.lua +++ b/init.lua @@ -513,7 +513,6 @@ rtp:prepend(lazypath) -- [[ Configure and install plugins ]] require('lazy').setup({ - { import = 'kickstart.plugins' }, { import = 'kickstart.plugins.lsp' }, { import = 'custom.plugins' }, diff --git a/lazy-lock.json b/lazy-lock.json index 3e6b93223d2..769805ec675 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,29 +1,29 @@ { - "LazyVim": { "branch": "main", "commit": "b9d38f692015fecaa72d55282b74a3d601e4c9fa" }, "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, "blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" }, - "conform.nvim": { "branch": "master", "commit": "c64cc754ace603e185ab30113aaef174187eacf8" }, + "conform.nvim": { "branch": "master", "commit": "fbcb4fa7f34bfea9be702ffff481a8e336ebf6ed" }, "fidget.nvim": { "branch": "main", "commit": "3f5475949679953af6d78654db29b944fa826e6a" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, "gitsigns.nvim": { "branch": "main", "commit": "1ee5c1fd068c81f9dd06483e639c2aa4587dc197" }, "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, + "harpoon": { "branch": "master", "commit": "1bc17e3e42ea3c46b33c0bbad6a880792692a1b3" }, "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, - "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "lazydev.nvim": { "branch": "main", "commit": "258d2a5ef4a3e3d6d9ba9da72c9725c53e9afcbd" }, + "lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" }, + "lazydev.nvim": { "branch": "main", "commit": "e28ce52fc7ff79fcb76f0e79ee6fb6182fca90b9" }, "lazygit.nvim": { "branch": "main", "commit": "2305deed25bc61b866d5d39189e9105a45cf1cfb" }, - "lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "155eac5d8609a2f110041f8ac3491664cc126354" }, - "mason-nvim-dap.nvim": { "branch": "main", "commit": "86389a3dd687cfaa647b6f44731e492970034baa" }, + "lualine.nvim": { "branch": "master", "commit": "3946f0122255bc377d14a59b27b609fb3ab25768" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "2304ff65ecc8cb2afc2484de3e2ed9a407edf0b9" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "c971971f881d1be90252d281f384054d9d53e745" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, - "mason.nvim": { "branch": "main", "commit": "a83eabdc8c49c0c93bf5bb162fa3b57404a9d095" }, - "matteblack.nvim": { "branch": "main", "commit": "3bfd406f3b2e41eb3458fe735e06447c08b67d03" }, - "mini.nvim": { "branch": "main", "commit": "126ce3328c78399dcff58272f6f540a373b62a75" }, - "nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" }, - "nvim-dap": { "branch": "master", "commit": "7367cec8e8f7a0b1e4566af9a7ef5959d11206a7" }, + "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, + "mini.nvim": { "branch": "main", "commit": "8a7cf7eee8d89bd1b83f6d72f7f3b5598e7ae2cb" }, + "nvim-autopairs": { "branch": "master", "commit": "7a2c97cccd60abc559344042fefb1d5a85b3e33b" }, + "nvim-dap": { "branch": "master", "commit": "6782b097af2417a4c3e33849b0a26ae2188bd7ea" }, "nvim-dap-go": { "branch": "main", "commit": "b4421153ead5d726603b02743ea40cf26a51ed5f" }, "nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, - "nvim-lint": { "branch": "master", "commit": "335a6044be16d7701001059cba9baa36fbeef422" }, - "nvim-lspconfig": { "branch": "master", "commit": "db8fef885009fdec0daeff3e5dda92e1f539611e" }, + "nvim-jdtls": { "branch": "master", "commit": "380ac148f989e1291aac002dc959ecc68c5243d0" }, + "nvim-lint": { "branch": "master", "commit": "9da1fb942dd0668d5182f9c8dee801b9c190e2bb" }, + "nvim-lspconfig": { "branch": "master", "commit": "ac98db2f9f06a56498ec890a96928774eae412c3" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, @@ -32,16 +32,17 @@ "nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" }, "nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" }, "oil-git-status.nvim": { "branch": "main", "commit": "4b5cf53842c17a09420919e655a6a559da3112d7" }, - "oil.nvim": { "branch": "master", "commit": "919e155fdf38e9148cdb5304faaaf53c20d703ea" }, - "oklch-color-picker.nvim": { "branch": "master", "commit": "ae318113cd7d0e4988b6b059327c2778911f1187" }, + "oil.nvim": { "branch": "master", "commit": "71948729cda5fc1b761d6ae60ff774b5525f1d50" }, + "oklch-color-picker.nvim": { "branch": "master", "commit": "da958405624e31336cc76ca0075f4a255e6c448a" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "supermaven-nvim": { "branch": "main", "commit": "07d20fce48a5629686aefb0a7cd4b25e33947d50" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, - "tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "29315861711f11daf75e1cf0953ab92ec1a3e69f" }, - "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, - "trouble.nvim": { "branch": "main", "commit": "f176232e7759c4f8abd923c21e3e5a5c76cd6837" }, + "tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "1cb11cc658ee24a9826e3b909ca0b0f5e60597c7" }, + "todo-comments.nvim": { "branch": "main", "commit": "19d461ddd543e938eb22505fb03fa878800270b6" }, + "tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" }, + "trouble.nvim": { "branch": "main", "commit": "c098362fe603d3922095e7db595961e020bdf2d0" }, "vim-tmux-navigator": { "branch": "master", "commit": "c45243dc1f32ac6bcf6068e5300f3b2b237e576a" }, - "which-key.nvim": { "branch": "main", "commit": "904308e6885bbb7b60714c80ab3daf0c071c1492" } + "which-key.nvim": { "branch": "main", "commit": "b4177e3eaf15fe5eb8357ebac2286d488be1ed00" } } diff --git a/lua/custom/after/transparency.lua b/lua/custom/after/transparency.lua index d0090f07d6c..59845a3469b 100644 --- a/lua/custom/after/transparency.lua +++ b/lua/custom/after/transparency.lua @@ -1,45 +1,45 @@ -- transparent background -vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) -vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" }) -vim.api.nvim_set_hl(0, "FloatBorder", { bg = "none" }) -vim.api.nvim_set_hl(0, "Pmenu", { bg = "none" }) -vim.api.nvim_set_hl(0, "Terminal", { bg = "none" }) -vim.api.nvim_set_hl(0, "EndOfBuffer", { bg = "none" }) -vim.api.nvim_set_hl(0, "FoldColumn", { bg = "none" }) -vim.api.nvim_set_hl(0, "Folded", { bg = "none" }) -vim.api.nvim_set_hl(0, "SignColumn", { bg = "none" }) -vim.api.nvim_set_hl(0, "NormalNC", { bg = "none" }) -vim.api.nvim_set_hl(0, "WhichKeyFloat", { bg = "none" }) -vim.api.nvim_set_hl(0, "TelescopeBorder", { bg = "none" }) -vim.api.nvim_set_hl(0, "TelescopeNormal", { bg = "none" }) -vim.api.nvim_set_hl(0, "TelescopePromptBorder", { bg = "none" }) -vim.api.nvim_set_hl(0, "TelescopePromptTitle", { bg = "none" }) +vim.api.nvim_set_hl(0, 'Normal', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NormalFloat', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'FloatBorder', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'Pmenu', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'Terminal', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'EndOfBuffer', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'FoldColumn', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'Folded', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'SignColumn', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NormalNC', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'WhichKeyFloat', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'TelescopeBorder', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'TelescopeNormal', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'TelescopePromptBorder', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'TelescopePromptTitle', { bg = 'none' }) -- transparent background for neotree -vim.api.nvim_set_hl(0, "NeoTreeNormal", { bg = "none" }) -vim.api.nvim_set_hl(0, "NeoTreeNormalNC", { bg = "none" }) -vim.api.nvim_set_hl(0, "NeoTreeVertSplit", { bg = "none" }) -vim.api.nvim_set_hl(0, "NeoTreeWinSeparator", { bg = "none" }) -vim.api.nvim_set_hl(0, "NeoTreeEndOfBuffer", { bg = "none" }) +vim.api.nvim_set_hl(0, 'NeoTreeNormal', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NeoTreeNormalNC', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NeoTreeVertSplit', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NeoTreeWinSeparator', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NeoTreeEndOfBuffer', { bg = 'none' }) -- transparent background for nvim-tree -vim.api.nvim_set_hl(0, "NvimTreeNormal", { bg = "none" }) -vim.api.nvim_set_hl(0, "NvimTreeVertSplit", { bg = "none" }) -vim.api.nvim_set_hl(0, "NvimTreeEndOfBuffer", { bg = "none" }) +vim.api.nvim_set_hl(0, 'NvimTreeNormal', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NvimTreeVertSplit', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NvimTreeEndOfBuffer', { bg = 'none' }) -- transparent notify background -vim.api.nvim_set_hl(0, "NotifyINFOBody", { bg = "none" }) -vim.api.nvim_set_hl(0, "NotifyERRORBody", { bg = "none" }) -vim.api.nvim_set_hl(0, "NotifyWARNBody", { bg = "none" }) -vim.api.nvim_set_hl(0, "NotifyTRACEBody", { bg = "none" }) -vim.api.nvim_set_hl(0, "NotifyDEBUGBody", { bg = "none" }) -vim.api.nvim_set_hl(0, "NotifyINFOTitle", { bg = "none" }) -vim.api.nvim_set_hl(0, "NotifyERRORTitle", { bg = "none" }) -vim.api.nvim_set_hl(0, "NotifyWARNTitle", { bg = "none" }) -vim.api.nvim_set_hl(0, "NotifyTRACETitle", { bg = "none" }) -vim.api.nvim_set_hl(0, "NotifyDEBUGTitle", { bg = "none" }) -vim.api.nvim_set_hl(0, "NotifyINFOBorder", { bg = "none" }) -vim.api.nvim_set_hl(0, "NotifyERRORBorder", { bg = "none" }) -vim.api.nvim_set_hl(0, "NotifyWARNBorder", { bg = "none" }) -vim.api.nvim_set_hl(0, "NotifyTRACEBorder", { bg = "none" }) -vim.api.nvim_set_hl(0, "NotifyDEBUGBorder", { bg = "none" }) +vim.api.nvim_set_hl(0, 'NotifyINFOBody', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NotifyERRORBody', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NotifyWARNBody', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NotifyTRACEBody', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NotifyDEBUGBody', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NotifyINFOTitle', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NotifyERRORTitle', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NotifyWARNTitle', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NotifyTRACETitle', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NotifyDEBUGTitle', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NotifyINFOBorder', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NotifyERRORBorder', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NotifyWARNBorder', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NotifyTRACEBorder', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NotifyDEBUGBorder', { bg = 'none' }) diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua new file mode 100644 index 00000000000..fc8fc3711de --- /dev/null +++ b/lua/custom/plugins/harpoon.lua @@ -0,0 +1,76 @@ +return { + 'ThePrimeagen/harpoon', + cmd = 'Harpoon', + keys = { + { + 'hh', + 'lua require("harpoon.ui").toggle_quick_menu()', + desc = 'Toggle Harpoon Quick Menu', + }, + { + 'ha', + 'lua require("harpoon.mark").add_file()', + desc = 'Mark Current File', + }, + { + 'hr', + 'lua require("harpoon.mark").clear_file()', + desc = 'Remove Current File', + }, + { + 'hn', + 'lua require("harpoon.ui").nav_next()', + desc = 'Next Harpoon', + }, + { + 'hp', + 'lua require("harpoon.ui").nav_prev()', + desc = 'Previous Harpoon', + }, + { + 'h&', + 'lua require("harpoon.ui").nav_file(1)', + desc = 'Go to 1st Mark', + }, + { + 'hé', + 'lua require("harpoon.ui").nav_file(2)', + desc = 'Go to 2nd Mark', + }, + { + 'h"', + 'lua require("harpoon.ui").nav_file(3)', + desc = 'Go to 3rd Mark', + }, + { + "h'", + 'lua require("harpoon.ui").nav_file(4)', + desc = 'Go to 4th Mark', + }, + { + 'h(', + 'lua require("harpoon.ui").nav_file(5)', + desc = 'Go to 5th Mark', + }, + { + 'h§', + 'lua require("harpoon.ui").nav_file(6)', + desc = 'Go to 6th Mark', + }, + { + 'hè', + 'lua require("harpoon.ui").nav_file(7)', + desc = 'Go to 7th Mark', + }, + { + 'h!', + 'lua require("harpoon.ui").nav_file(8)', + desc = 'Go to 8th Mark', + }, + { + 'hç', + 'lua require("harpoon.ui").nav_file(9)', + desc = 'Go to 9th Mark', + }, + }, +} diff --git a/lua/custom/plugins/noice.lua b/lua/custom/plugins/noice.lua deleted file mode 100644 index 8dcdbc650ad..00000000000 --- a/lua/custom/plugins/noice.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - -- lazy.nvim - { - 'rcarriga/nvim-notify', - event = 'VeryLazy', - opts = {}, - }, -} diff --git a/lua/custom/plugins/notify.lua b/lua/custom/plugins/notify.lua new file mode 100644 index 00000000000..56f50d95cf1 --- /dev/null +++ b/lua/custom/plugins/notify.lua @@ -0,0 +1,22 @@ +return { + 'rcarriga/nvim-notify', + event = 'VeryLazy', + config = function() + local notify = require 'notify' + notify.setup { + merge_duplicates = true, + background_colour = '#000000', + render = 'default', + timeout = 5000, + stages = 'fade', + icons = { + ERROR = '', + WARN = '', + INFO = '', + DEBUG = '', + TRACE = '✎', + }, + } + vim.notify = notify + end, +} diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua index bdbedd8da13..2fdb760b045 100644 --- a/lua/custom/plugins/oil.lua +++ b/lua/custom/plugins/oil.lua @@ -58,7 +58,6 @@ return { vim.api.nvim_create_autocmd('User', { pattern = 'OilEnter', callback = vim.schedule_wrap(function(args) - local oil = require 'oil' if vim.api.nvim_get_current_buf() == args.data.buf and oil.get_cursor_entry() then oil.open_preview() end diff --git a/lua/custom/plugins/trouble.lua b/lua/custom/plugins/trouble.lua index cc2c2305b32..018799e523a 100644 --- a/lua/custom/plugins/trouble.lua +++ b/lua/custom/plugins/trouble.lua @@ -19,6 +19,16 @@ return { 'Trouble quickfix toggle', desc = 'Toggle Quickfix List', }, + { + 'qn', + 'cnext', + desc = 'Diagnostic Next', + }, + { + 'qp', + 'cprevious', + desc = 'Diagnostic Previous', + }, { 'ql', 'Trouble loclist toggle', diff --git a/lua/custom/snippets/elexir.lua b/lua/custom/snippets/elexir.lua new file mode 100644 index 00000000000..a9781802f05 --- /dev/null +++ b/lua/custom/snippets/elexir.lua @@ -0,0 +1,11 @@ +-- Elixir snippets + +local ls = require 'luasnip' +local s = ls.snippet +local i = ls.insert_node + +local fmt = require('luasnip.extras.fmt').fmt + +ls.add_snippets('elixir', { + s('el', fmt('<%= {} %>{}', { i(1), i(0) })), +}) diff --git a/lua/custom/snippets/kotlin.lua b/lua/custom/snippets/kotlin.lua new file mode 100644 index 00000000000..e47db414712 --- /dev/null +++ b/lua/custom/snippets/kotlin.lua @@ -0,0 +1,33 @@ +-- Kotlin snippets + +local ls = require 'luasnip' +local s = ls.snippet +local i = ls.insert_node +local t = ls.text_node +local f = ls.function_node +local c = ls.choice_node +local d = ls.dynamic_node + +local fmt = require('luasnip.extras.fmt').fmt + +ls.add_snippets('kotlin', { + s( + 'comp', + fmt( + [[ + @Composable + fun []([]) { + [] + } + ]], + { + i(1, 'name'), + i(2, 'params'), + i(3, 'body'), + }, + { + delimiters = '[]', + } + ) + ), +}) diff --git a/lua/kickstart/plugins/auto-completion.lua b/lua/kickstart/plugins/auto-completion.lua index f51dbffc0b4..fd34bf36a24 100644 --- a/lua/kickstart/plugins/auto-completion.lua +++ b/lua/kickstart/plugins/auto-completion.lua @@ -4,29 +4,7 @@ return { event = 'VimEnter', version = '1.*', dependencies = { - -- Snippet Engine - { - 'L3MON4D3/LuaSnip', - version = '2.*', - build = (function() - -- Build Step is needed for regex support in snippets. - -- This step is not supported in many windows environments. - -- Remove the below condition to re-enable on windows. - if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then - return - end - return 'make install_jsregexp' - end)(), - dependencies = { - { - 'rafamadriz/friendly-snippets', - config = function() - require('luasnip.loaders.from_vscode').lazy_load() - end, - }, - }, - opts = {}, - }, + 'L3MON4D3/LuaSnip', 'folke/lazydev.nvim', }, --- @module 'blink.cmp' @@ -83,7 +61,7 @@ return { }, sources = { - default = { 'lsp', 'path', 'snippets', 'lazydev' }, + default = { 'lsp', 'path', 'snippets', 'lazydev', 'buffer' }, providers = { lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 }, }, diff --git a/lua/kickstart/plugins/format.lua b/lua/kickstart/plugins/format.lua index 8487dadf961..804b31e9a76 100644 --- a/lua/kickstart/plugins/format.lua +++ b/lua/kickstart/plugins/format.lua @@ -19,8 +19,14 @@ return { -- Autoformat -- have a well standardized coding style. You can add additional -- languages here or re-enable it for the disabled ones. local disable_filetypes = { c = true, cpp = true } + local slow_filetypes = { kotlin = true } if disable_filetypes[vim.bo[bufnr].filetype] then return nil + elseif slow_filetypes[vim.bo[bufnr].filetype] then + return { + timeout_ms = 2500, + lsp_format = 'fallback', + } else return { timeout_ms = 500, @@ -54,6 +60,8 @@ return { -- Autoformat sh = { 'shellcheck' }, go = { 'gofmt', 'goimports', 'goimports_reviser' }, xml = { 'xmllint' }, + c = { 'clang-format' }, + python = { 'black' }, }, }, } diff --git a/lua/kickstart/plugins/lsp/jdtls.lua b/lua/kickstart/plugins/lsp/jdtls.lua new file mode 100644 index 00000000000..45bdf3d2202 --- /dev/null +++ b/lua/kickstart/plugins/lsp/jdtls.lua @@ -0,0 +1,5 @@ +-- Java LSP +return { + 'mfussenegger/nvim-jdtls', + ft = { 'java', 'kotlin', 'kt' }, +} diff --git a/lua/kickstart/plugins/lsp/main-lsp.lua b/lua/kickstart/plugins/lsp/main-lsp.lua index 66e1ca2e87b..cd1b9796ea0 100644 --- a/lua/kickstart/plugins/lsp/main-lsp.lua +++ b/lua/kickstart/plugins/lsp/main-lsp.lua @@ -16,83 +16,23 @@ return { 'saghen/blink.cmp', }, config = function() - -- Brief aside: **What is LSP?** - -- - -- LSP is an initialism you've probably heard, but might not understand what it is. - -- - -- LSP stands for Language Server Protocol. It's a protocol that helps editors - -- and language tooling communicate in a standardized fashion. - -- - -- In general, you have a "server" which is some tool built to understand a particular - -- language (such as `gopls`, `lua_ls`, `rust_analyzer`, etc.). These Language Servers - -- (sometimes called LSP servers, but that's kind of like ATM Machine) are standalone - -- processes that communicate with some "client" - in this case, Neovim! - -- - -- LSP provides Neovim with features like: - -- - Go to definition - -- - Find references - -- - Autocompletion - -- - Symbol Search - -- - and more! - -- - -- Thus, Language Servers are external tools that must be installed separately from - -- Neovim. This is where `mason` and related plugins come into play. - -- - -- If you're wondering about lsp vs treesitter, you can check out the wonderfully - -- and elegantly composed help section, `:help lsp-vs-treesitter` - - -- This function gets run when an LSP attaches to a particular buffer. - -- That is to say, every time a new file is opened that is associated with - -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this - -- function will be executed to configure the current buffer vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), callback = function(event) - -- NOTE: Remember that Lua is a real programming language, and as such it is possible - -- to define small helper and utility functions so you don't have to repeat yourself. - -- - -- In this case, we create a function that lets us more easily define mappings specific - -- for LSP related items. It sets the mode, buffer and description for us each time. local map = function(keys, func, desc, mode) mode = mode or 'n' vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) end - -- Rename the variable under your cursor. - -- Most Language Servers support renaming across files, etc. map('grn', vim.lsp.buf.rename, '[R]e[n]ame') - - -- Execute a code action, usually your cursor needs to be on top of an error - -- or a suggestion from your LSP for this to activate. map('gca', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) + map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - -- Find references for the word under your cursor. map('grr', require('telescope.builtin').lsp_references, '[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. map('gi', require('telescope.builtin').lsp_implementations, '[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 . map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') - - -- WARN: This is not Goto Definition, this is Goto Declaration. - -- For example, in C this would take you to the header. - map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - - -- 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*. map('gt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') - - -- Fuzzy find all the symbols in your current document. - -- Symbols are things like variables, functions, types, etc. map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols') - - -- Fuzzy find all the symbols in your current workspace. - -- Similar to document symbols, except searches over your entire project. map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols') -- This function resolves a difference between neovim nightly (version 0.11) and stable (version 0.10) @@ -137,10 +77,6 @@ return { }) end - -- The following code creates a keymap to toggle inlay hints in your - -- code, if the language server you are using supports them - -- - -- This may be unwanted, since they displace some of your code if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then map('th', function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) @@ -185,17 +121,8 @@ return { local capabilities = require('blink.cmp').get_lsp_capabilities() local util = require 'lspconfig/util' - -- Enable the following language servers - -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. - -- - -- Add any additional override configuration in the following tables. Available keys are: - -- - cmd (table): Override the default command used to start the server - -- - filetypes (table): Override the default list of associated filetypes for the server - -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. - -- - settings (table): Override the default settings passed when initializing the server. - -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ local servers = { - -- clangd = {}, + clangd = {}, gopls = { capabilities = capabilities, cmd = { 'gopls' }, @@ -211,7 +138,7 @@ return { }, }, }, - -- pyright = {}, + pyright = {}, rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- @@ -224,7 +151,10 @@ return { }, vue_ls = {}, eslint = {}, - -- + yamlls = {}, + html = { + filetypes = { 'html', 'htmldjango', 'htmldjango-template', 'htmljinja', 'htmlmin' }, + }, lua_ls = { -- cmd = { ... }, @@ -236,28 +166,42 @@ return { callSnippet = 'Replace', }, -- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings + diagnostics = { + globals = { 'vim' }, + }, -- diagnostics = { disable = { 'missing-fields' } }, }, }, }, + kotlin_language_server = { + settings = { + kotlin = { + enabled = true, + debug = true, + languageVersion = '2.0', + jvmTarget = '21', + includeNonDeclarations = true, + noStdlib = false, + noReflect = false, + incremental = true, + buildServerMode = false, + compilerOptions = { + jvmTarget = '21', + apiVersion = '1.8', + languageVersion = '2.0', + }, + }, + }, + }, } -- Ensure the servers and tools above are installed - -- - -- To check the current status of installed tools and/or manually install - -- other tools, you can run - -- :Mason - -- - -- You can press `g?` for help in this menu. - -- - -- `mason` had to be setup earlier: to configure its options see the - -- `dependencies` table for `nvim-lspconfig` above. - -- - -- You can add other tools here that you want Mason to install - -- for you, so that they are available from within Neovim. local ensure_installed = vim.tbl_keys(servers or {}) vim.list_extend(ensure_installed, { 'stylua', -- Used to format Lua code + 'jdtls', + 'java-debug-adapter', + 'java-test', }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } @@ -266,14 +210,29 @@ return { automatic_installation = false, handlers = { function(server_name) + -- Don't call setup for jdtls, it's already setup in the jdtls.lua file local server = servers[server_name] or {} -- This handles overriding only values explicitly passed -- by the server configuration above. Useful when disabling -- certain features of an LSP (for example, turning off formatting for ts_ls) server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) - require('lspconfig')[server_name].setup(server) + vim.lsp.config(server_name, server) end, }, } + + -- Non Mason LSP servers + -- vim.lsp.enable 'kotlin_lsp' + -- vim.lsp.config('kotlin_lsp', { + -- capabilities = capabilities, + -- }) + + -- Globally configure all LSP floating preview popups (like hover, signature help, etc) + local open_floating_preview = vim.lsp.util.open_floating_preview + function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...) + opts = opts or {} + opts.border = opts.border or 'rounded' -- Set border to rounded + return open_floating_preview(contents, syntax, opts, ...) + end end, } diff --git a/lua/kickstart/plugins/lualine.lua b/lua/kickstart/plugins/lualine.lua index 9446f8e7842..fb495723c75 100644 --- a/lua/kickstart/plugins/lualine.lua +++ b/lua/kickstart/plugins/lualine.lua @@ -4,7 +4,7 @@ return { config = function() require('lualine').setup { options = { - theme = 'tokyonight', + theme = vim.g.colors_name or 'auto', component_separators = '', section_separators = { left = '', right = '' }, disabled_filetypes = { diff --git a/lua/kickstart/plugins/mini.lua b/lua/kickstart/plugins/mini.lua index 49db3a868c5..69a98f44d03 100644 --- a/lua/kickstart/plugins/mini.lua +++ b/lua/kickstart/plugins/mini.lua @@ -2,24 +2,9 @@ return { 'echasnovski/mini.nvim', config = function() - -- Better Around/Inside textobjects - -- - -- Examples: - -- - va) - [V]isually select [A]round [)]paren - -- - yinq - [Y]ank [I]nside [N]ext [Q]uote - -- - ci' - [C]hange [I]nside [']quote require('mini.ai').setup { n_lines = 500 } - - -- Add/delete/replace surroundings (brackets, quotes, etc.) - -- - -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren - -- - sd' - [S]urround [D]elete [']quotes - -- - 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 + require('mini.move').setup() 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 } @@ -31,8 +16,5 @@ return { statusline.section_location = function() return '%2l:%-2v' end - - -- ... and there is more! - -- Check out: https://github.com/echasnovski/mini.nvim end, } diff --git a/lua/kickstart/plugins/snippets.lua b/lua/kickstart/plugins/snippets.lua new file mode 100644 index 00000000000..236bca1efe3 --- /dev/null +++ b/lua/kickstart/plugins/snippets.lua @@ -0,0 +1,51 @@ +return { + 'L3MON4D3/LuaSnip', + event = 'VimEnter', + version = '2.*', + build = (function() + -- Build Step is needed for regex support in snippets. + -- This step is not supported in many windows environments. + -- Remove the below condition to re-enable on windows. + if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then + return + end + return 'make install_jsregexp' + end)(), + dependencies = { + { + 'rafamadriz/friendly-snippets', + config = function() + require('luasnip.loaders.from_vscode').lazy_load() + end, + }, + }, + config = function() + local ls = require 'luasnip' + ls.config.set_config { + history = false, + updateevents = 'TextChanged,TextChangedI', + } + + for _, ft_path in ipairs(vim.api.nvim_get_runtime_file('lua/custom/snippets/*lua', true)) do + loadfile(ft_path)() + end + + vim.keymap.set({ 'i', 's' }, '', function() + if ls.expand_or_jumpable() then + ls.expand_or_jump() + end + end, { silent = true }) + + vim.keymap.set({ 'i', 's' }, '', function() + if ls.jumpable(-1) then + ls.jump(-1) + end + end, { silent = true }) + + vim.keymap.set({ 'i', 's' }, '', function() + if ls.jumpable(1) then + ls.jump(1) + end + end, { silent = true }) + end, +} diff --git a/lua/kickstart/plugins/treesitter.lua b/lua/kickstart/plugins/treesitter.lua index 72549744aa8..732c1bc98de 100644 --- a/lua/kickstart/plugins/treesitter.lua +++ b/lua/kickstart/plugins/treesitter.lua @@ -26,11 +26,23 @@ return { -- Highlight, edit, and navigate code 'go', 'typescript', 'javascript', + 'kotlin', + 'yaml', + 'html', + 'json', + 'jsonc', + 'markdown', + 'markdown_inline', + 'python', + 'rust', + 'toml', + 'yaml', }, -- Autoinstall languages that are not installed auto_install = true, highlight = { enable = true, + disable = { 'python' }, -- list of language that will be disabled -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. -- If you are experiencing weird indenting issues, add the language to -- the list of additional_vim_regex_highlighting and disabled languages for indent. From cc8b4d651159e90014e25f38725b0fa1a9962601 Mon Sep 17 00:00:00 2001 From: Guust Taillieu Date: Fri, 19 Jun 2026 21:21:02 +0200 Subject: [PATCH 18/19] update --- init.lua | 8 +-- lazy-lock.json | 78 +++++++++++++------------- lua/custom/plugins/markdown.lua | 5 ++ lua/custom/plugins/notify.lua | 22 -------- lua/custom/plugins/oil-gitsigns.lua | 37 ------------ lua/custom/plugins/oil.lua | 67 ---------------------- lua/kickstart/plugins/autopairs.lua | 5 -- lua/kickstart/plugins/lsp/main-lsp.lua | 3 + lua/kickstart/plugins/mini.lua | 56 ++++++++++++++++++ lua/kickstart/plugins/treesitter.lua | 17 +++++- 10 files changed, 120 insertions(+), 178 deletions(-) create mode 100644 lua/custom/plugins/markdown.lua delete mode 100644 lua/custom/plugins/notify.lua delete mode 100644 lua/custom/plugins/oil-gitsigns.lua delete mode 100644 lua/custom/plugins/oil.lua delete mode 100644 lua/kickstart/plugins/autopairs.lua diff --git a/init.lua b/init.lua index 53e57e39efd..c73fa1a8387 100644 --- a/init.lua +++ b/init.lua @@ -186,10 +186,10 @@ vim.keymap.set('n', 'bn', 'bnext', { desc = 'Next buffer' }) vim.keymap.set('n', 'bp', 'bprevious', { desc = 'Previous buffer' }) -- Move lines up/down -vim.keymap.set('n', '', 'm .+1==', { desc = 'Move line down' }) -vim.keymap.set('n', '', 'm .-2==', { desc = 'Move line up' }) -vim.keymap.set('v', '', "m '>+1gv=gv", { desc = 'Move selection down' }) -vim.keymap.set('v', '', "m '<-2gv=gv", { desc = 'Move selection up' }) +-- vim.keymap.set('n', '', 'm .+1==', { desc = 'Move line down' }) +-- vim.keymap.set('n', '', 'm .-2==', { desc = 'Move line up' }) +-- vim.keymap.set('v', '', "m '>+1gv=gv", { desc = 'Move selection down' }) +-- vim.keymap.set('v', '', "m '<-2gv=gv", { desc = 'Move selection up' }) -- Better indenting in visual mode vim.keymap.set('v', '<', ''] = { 'actions.select' }, - [''] = { 'actions.select' }, - [''] = { 'actions.parent' }, - [''] = { 'actions.close', mode = 'n' }, - [''] = { 'actions.close', mode = 'n' }, - [''] = { 'actions.select', opts = { vertical = true } }, - [''] = { 'actions.select', opts = { horizontal = true } }, - [''] = { 'actions.select', opts = { tab = true } }, - [''] = false, - }, - view_options = { - show_hidden = true, - natural_order = 'fast', - is_always_hidden = function(name, _) - return name == '..' or name == '.git' - end, - }, - win_options = { - signcolumn = 'yes:2', - wrap = true, - }, - preview_win = { - disable_preview = function(filename) - return filename:match '^%.' - end, - }, - sort = { - { 'name', 'asc' }, - }, - buf_options = { - buflisted = false, - bufhidden = 'delete', -- Delete the buffer immediately when hidden - }, - cleanup_delay_ms = 0, -- Or set to false to disable auto-cleanup entirely if you prefer - } - - vim.keymap.set('n', '-', oil.toggle_float, { desc = 'Open parent directory' }) - - -- Always show preview - vim.api.nvim_create_autocmd('User', { - pattern = 'OilEnter', - callback = vim.schedule_wrap(function(args) - if vim.api.nvim_get_current_buf() == args.data.buf and oil.get_cursor_entry() then - oil.open_preview() - end - end), - }) - end, -} diff --git a/lua/kickstart/plugins/autopairs.lua b/lua/kickstart/plugins/autopairs.lua deleted file mode 100644 index 2106204c41f..00000000000 --- a/lua/kickstart/plugins/autopairs.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - 'windwp/nvim-autopairs', - event = 'InsertEnter', - opts = {}, -} diff --git a/lua/kickstart/plugins/lsp/main-lsp.lua b/lua/kickstart/plugins/lsp/main-lsp.lua index cd1b9796ea0..5a3f876b3d7 100644 --- a/lua/kickstart/plugins/lsp/main-lsp.lua +++ b/lua/kickstart/plugins/lsp/main-lsp.lua @@ -152,6 +152,9 @@ return { vue_ls = {}, eslint = {}, yamlls = {}, + qmlls = { + capabilities = capabilities, + }, html = { filetypes = { 'html', 'htmldjango', 'htmldjango-template', 'htmljinja', 'htmlmin' }, }, diff --git a/lua/kickstart/plugins/mini.lua b/lua/kickstart/plugins/mini.lua index 69a98f44d03..e59ce2938fe 100644 --- a/lua/kickstart/plugins/mini.lua +++ b/lua/kickstart/plugins/mini.lua @@ -5,6 +5,62 @@ return { require('mini.ai').setup { n_lines = 500 } require('mini.surround').setup() require('mini.move').setup() + require('mini.pairs').setup() + require('mini.bracketed').setup() + require('mini.notify').setup { + window = { + winblend = 0, + }, + } + local MiniFiles = require 'mini.files' + MiniFiles.setup { + mappings = { + go_out = '', + go_in = '', + go_in_plus = '', + synchronize = '', + }, + windows = { + preview = true, + width_preview = 100, + }, + } + + local minifiles_toggle = function(dir) + if not MiniFiles.close() then + MiniFiles.open(dir) + end + end + + local open_file_in_minifiles = function() + minifiles_toggle(vim.fn.expand '%:p') + end + + local set_cwd = function() + local path = (MiniFiles.get_fs_entry() or {}).path + if path == nil then + return vim.notify 'Cursor is not on valid entry' + end + vim.fn.chdir(vim.fs.dirname(path)) + end + + -- Yank in register full path of entry under cursor + local yank_path = function() + if MiniFiles.get_explorer_state().target_window ~= nil then + local path = (MiniFiles.get_fs_entry() or {}).path + if path == nil then + return vim.notify 'Cursor is not on valid entry' + end + vim.fn.setreg(vim.v.register, path) + end + end + + vim.keymap.set('n', 're', minifiles_toggle, { desc = 'Open Explorer in root' }) + vim.keymap.set('n', 'e', open_file_in_minifiles, { desc = 'Open Explorer in current file' }) + vim.keymap.set('n', 'cwd', set_cwd, { desc = 'Set cwd' }) + vim.keymap.set('n', 'yp', yank_path, { desc = 'Yank path' }) + vim.keymap.set('n', '', MiniFiles.go_in, { desc = 'Open file' }) + 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 } diff --git a/lua/kickstart/plugins/treesitter.lua b/lua/kickstart/plugins/treesitter.lua index 732c1bc98de..9a7cfabc2c1 100644 --- a/lua/kickstart/plugins/treesitter.lua +++ b/lua/kickstart/plugins/treesitter.lua @@ -33,7 +33,7 @@ return { -- Highlight, edit, and navigate code 'jsonc', 'markdown', 'markdown_inline', - 'python', + -- 'python', 'rust', 'toml', 'yaml', @@ -42,14 +42,25 @@ return { -- Highlight, edit, and navigate code auto_install = true, highlight = { enable = true, - disable = { 'python' }, -- list of language that will be disabled + disable = {}, -- list of language that will be disabled -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. -- If you are experiencing weird indenting issues, add the language to -- the list of additional_vim_regex_highlighting and disabled languages for indent. additional_vim_regex_highlighting = { 'ruby' }, }, indent = { enable = true, disable = { 'ruby' } }, - textobjects = { select = { enable = true, lookahead = true } }, + textobjects = { + select = { + enable = true, + lookahead = true, + keymaps = { + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ac'] = '@class.outer', + ['ic'] = '@class.inner', + }, + }, + }, }, -- There are additional nvim-treesitter modules that you can use textobjectsto in -- eract From 5ea28f0a938f13fcecb1d83e7bf38397d501a586 Mon Sep 17 00:00:00 2001 From: Guust Taillieu Date: Sat, 20 Jun 2026 15:06:13 +0200 Subject: [PATCH 19/19] fix: styling issues --- init.lua | 139 +++++++++------------- lua/custom/plugins/markdown.lua | 2 +- lua/custom/plugins/supermaven.lua | 8 +- lua/kickstart/plugins/auto-completion.lua | 2 +- lua/kickstart/plugins/autopairs.lua | 4 +- lua/kickstart/plugins/debug.lua | 6 +- lua/kickstart/plugins/format.lua | 3 +- lua/kickstart/plugins/gitsigns.lua | 9 +- lua/kickstart/plugins/guess-indent.lua | 2 +- lua/kickstart/plugins/lint.lua | 2 +- lua/kickstart/plugins/lsp.lua | 8 +- lua/kickstart/plugins/mini.lua | 16 +-- lua/kickstart/plugins/snippets.lua | 14 +-- lua/kickstart/plugins/telescope.lua | 21 ++-- lua/kickstart/plugins/which-key.lua | 4 +- 15 files changed, 92 insertions(+), 148 deletions(-) diff --git a/init.lua b/init.lua index 54ed06ee5f2..4d0d82df249 100644 --- a/init.lua +++ b/init.lua @@ -29,7 +29,7 @@ vim.g.have_nerd_font = true -- Key mappings -vim.g.mapleader = ' ' -- Set leader key to space +vim.g.mapleader = ' ' -- Set leader key to space vim.g.maplocalleader = ' ' -- Set local leader key (NEW) -- Make background transparent @@ -37,29 +37,29 @@ vim.api.nvim_set_hl(0, 'Normal', { bg = 'none' }) vim.api.nvim_set_hl(0, 'NormalNC', { bg = 'none' }) vim.api.nvim_set_hl(0, 'EndOfBuffer', { bg = 'none' }) vim.api.nvim_set_hl(0, 'SignColumn', { bg = 'none' }) -- Make sign column transparent -vim.opt.number = true -- Line numbers +vim.opt.number = true -- Line numbers -- Basic settings vim.opt.relativenumber = true -- Relative line numbers -vim.opt.cursorline = true -- Highlight current line -vim.opt.wrap = false -- Don't wrap lines -vim.opt.scrolloff = 10 -- Keep 10 lines above/below cursor -vim.opt.sidescrolloff = 8 -- Keep 8 columns left/right of cursor +vim.opt.cursorline = true -- Highlight current line +vim.opt.wrap = false -- Don't wrap lines +vim.opt.scrolloff = 10 -- Keep 10 lines above/below cursor +vim.opt.sidescrolloff = 8 -- Keep 8 columns left/right of cursor -- Indentation -vim.opt.tabstop = 2 -- Tab width -vim.opt.shiftwidth = 2 -- Indent width -vim.opt.softtabstop = 2 -- Soft tab stop -vim.opt.expandtab = true -- Use spaces instead of tabs +vim.opt.tabstop = 2 -- Tab width +vim.opt.shiftwidth = 2 -- Indent width +vim.opt.softtabstop = 2 -- Soft tab stop +vim.opt.expandtab = true -- Use spaces instead of tabs vim.opt.smartindent = true -- Smart auto-indenting -vim.opt.autoindent = true -- Copy indent from current line +vim.opt.autoindent = true -- Copy indent from current line vim.o.breakindent = true -- Search settings vim.opt.ignorecase = true -- Case insensitive search -vim.opt.smartcase = true -- Case sensitive if uppercase in search -vim.opt.hlsearch = false -- Don't highlight search results -vim.opt.incsearch = true -- Show matches as you type +vim.opt.smartcase = true -- Case sensitive if uppercase in search +vim.opt.hlsearch = false -- Don't highlight search results +vim.opt.incsearch = true -- Show matches as you type -- Visual settings vim.opt.termguicolors = true -- Enable 24-bit colors @@ -83,45 +83,43 @@ vim.opt.listchars = { tab = ' ', trail = '·', nbsp = '␣' } -- Sets how white -- Folding settings vim.opt.foldmethod = 'expr' -- Use expression for folding -- vim.wo.vim.foldexpr = 'v:lua.vim.treesitter.foldexpr()' -- Use treesitter for folding -vim.opt.foldlevel = 99 -- Start with all folds open +vim.opt.foldlevel = 99 -- Start with all folds open -- File handling -vim.opt.backup = false -- Don't create backup files -vim.opt.writebackup = false -- Don't create backup before writing -vim.opt.swapfile = false -- Don't create swap files -vim.opt.undofile = true -- Persistent undo -vim.o.undofile = true -- Save undo history +vim.opt.backup = false -- Don't create backup files +vim.opt.writebackup = false -- Don't create backup before writing +vim.opt.swapfile = false -- Don't create swap files +vim.opt.undofile = true -- Persistent undo +vim.o.undofile = true -- Save undo history vim.opt.undodir = vim.fn.expand '~/.vim/undodir' -- Undo directory -vim.opt.updatetime = 250 -- Faster completion -vim.opt.timeoutlen = 500 -- Key timeout duration -vim.opt.ttimeoutlen = 0 -- Key code timeout -vim.opt.autoread = true -- Auto reload files changed outside vim -vim.opt.autowrite = false -- Don't auto save +vim.opt.updatetime = 250 -- Faster completion +vim.opt.timeoutlen = 500 -- Key timeout duration +vim.opt.ttimeoutlen = 0 -- Key code timeout +vim.opt.autoread = true -- Auto reload files changed outside vim +vim.opt.autowrite = false -- Don't auto save -- Behavior settings -vim.opt.hidden = true -- Allow hidden buffers -vim.opt.errorbells = false -- No error bells +vim.opt.hidden = true -- Allow hidden buffers +vim.opt.errorbells = false -- No error bells vim.opt.backspace = 'indent,eol,start' -- Better backspace behavior -vim.opt.autochdir = false -- Don't auto change directory -vim.opt.iskeyword:append '-' -- Treat dash as part of word -vim.opt.path:append '**' -- include subdirectories in search -vim.opt.selection = 'exclusive' -- Selection behavior -vim.opt.mouse = 'a' -- Enable mouse support +vim.opt.autochdir = false -- Don't auto change directory +vim.opt.iskeyword:append '-' -- Treat dash as part of word +vim.opt.path:append '**' -- include subdirectories in search +vim.opt.selection = 'exclusive' -- Selection behavior +vim.opt.mouse = 'a' -- Enable mouse support vim.opt.clipboard:append 'unnamedplus' -- Use system clipboard -vim.opt.modifiable = true -- Allow buffer modifications -vim.opt.encoding = 'UTF-8' -- Set encoding -vim.opt.splitbelow = true -- Horizontal splits go below -vim.opt.splitright = true -- Vertical splits go right +vim.opt.modifiable = true -- Allow buffer modifications +vim.opt.encoding = 'UTF-8' -- Set encoding +vim.opt.splitbelow = true -- Horizontal splits go below +vim.opt.splitright = true -- Vertical splits go right vim.o.inccommand = 'split' -vim.o.confirm = true -- Ask before closing (unsaved changes) +vim.o.confirm = true -- Ask before closing (unsaved changes) -- Sync clipboard between OS and Neovim. -- Schedule the setting after `UiEnter` because it can increase startup-time. -- Remove this option if you want your OS clipboard to remain independent. -- See `:help 'clipboard'` -vim.schedule(function() - vim.o.clipboard = 'unnamedplus' -end) +vim.schedule(function() vim.o.clipboard = 'unnamedplus' end) -- Don't show the mode, since it's already in the status line vim.o.showmode = false @@ -169,7 +167,6 @@ vim.keymap.set('n', '^[[1;9l', 'L', { desc = 'Move window to the right' }) vim.keymap.set('n', '^[[1;9j', 'J', { desc = 'Move window to the lower' }) vim.keymap.set('n', '^[[1;9k', 'K', { desc = 'Move window to the upper' }) - vim.diagnostic.config { update_in_insert = false, severity_sort = true, @@ -177,7 +174,7 @@ vim.diagnostic.config { underline = { severity = { min = vim.diagnostic.severity.WARN } }, -- Can switch between these as you prefer - virtual_text = true, -- Text shows up at the end of the line + virtual_text = true, -- Text shows up at the end of the line virtual_lines = false, -- Text shows up underneath the line, with virtual lines -- Auto open the float, so you can easily read the errors when jumping with `[d` and `]d` @@ -241,14 +238,10 @@ vim.keymap.set('n', 'ya', function() end) -- Delete all content of the current buffer -vim.keymap.set('n', 'da', function() - vim.api.nvim_buf_set_lines(0, 0, -1, false, {}) -end) +vim.keymap.set('n', 'da', function() vim.api.nvim_buf_set_lines(0, 0, -1, false, {}) end) -- Select all content of the current buffer -vim.keymap.set('n', 'sa', function() - vim.api.nvim_feedkeys('ggVG', 'n', false) -end) +vim.keymap.set('n', 'sa', function() vim.api.nvim_feedkeys('ggVG', 'n', false) end) -- Basic autocommands local augroup = vim.api.nvim_create_augroup('UserConfig', {}) @@ -257,9 +250,7 @@ local augroup = vim.api.nvim_create_augroup('UserConfig', {}) vim.api.nvim_create_autocmd('TextYankPost', { desc = 'Highlight when yanking (copying) text', group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), - callback = function() - vim.hl.on_yank() - end, + callback = function() vim.hl.on_yank() end, }) -- Return to last edit position when opening files @@ -268,9 +259,7 @@ vim.api.nvim_create_autocmd('BufReadPost', { callback = function() local mark = vim.api.nvim_buf_get_mark(0, '"') local lcount = vim.api.nvim_buf_line_count(0) - if mark[1] > 0 and mark[1] <= lcount then - pcall(vim.api.nvim_win_set_cursor, 0, mark) - end + if mark[1] > 0 and mark[1] <= lcount then pcall(vim.api.nvim_win_set_cursor, 0, mark) end end, }) @@ -297,9 +286,7 @@ vim.api.nvim_create_autocmd('FileType', { vim.api.nvim_create_autocmd('TermClose', { group = augroup, callback = function() - if vim.v.event.status == 0 then - vim.api.nvim_buf_delete(0, {}) - end + if vim.v.event.status == 0 then vim.api.nvim_buf_delete(0, {}) end end, }) @@ -316,21 +303,15 @@ vim.api.nvim_create_autocmd('TermOpen', { -- Auto-resize splits when window is resized vim.api.nvim_create_autocmd('VimResized', { group = augroup, - callback = function() - vim.cmd 'tabdo wincmd =' - end, + callback = function() vim.cmd 'tabdo wincmd =' end, }) -- Create directories when saving files vim.api.nvim_create_autocmd('BufWritePre', { callback = function() local filepath = vim.fn.expand ':p:h' - if filepath:match '^oil://' or vim.uv.fs_realpath(filepath) == nil then - return - end - if vim.fn.isdirectory(filepath) == 0 then - vim.fn.mkdir(filepath, 'p') - end + if filepath:match '^oil://' or vim.uv.fs_realpath(filepath) == nil then return end + if vim.fn.isdirectory(filepath) == 0 then vim.fn.mkdir(filepath, 'p') end end, }) @@ -348,9 +329,7 @@ vim.opt.maxmempattern = 20000 -- Create undo directory if it doesn't exist local undodir = vim.fn.expand '~/.vim/undodir' -if vim.fn.isdirectory(undodir) == 0 then - vim.fn.mkdir(undodir, 'p') -end +if vim.fn.isdirectory(undodir) == 0 then vim.fn.mkdir(undodir, 'p') end -- ============================================================================ -- FLOATING TERMINAL @@ -399,8 +378,7 @@ local function FloatingTerminal() vim.api.nvim_win_set_option(terminal_state.win, 'winblend', 0) -- Set transparent background for the window - vim.api.nvim_win_set_option(terminal_state.win, 'winhighlight', - 'Normal:FloatingTermNormal,FloatBorder:FloatingTermBorder') + vim.api.nvim_win_set_option(terminal_state.win, 'winhighlight', 'Normal:FloatingTermNormal,FloatBorder:FloatingTermBorder') -- Define highlight groups for transparency vim.api.nvim_set_hl(0, 'FloatingTermNormal', { bg = 'none' }) @@ -416,9 +394,7 @@ local function FloatingTerminal() end end - if not has_terminal then - vim.fn.termopen(os.getenv 'SHELL') - end + if not has_terminal then vim.fn.termopen(os.getenv 'SHELL') end terminal_state.is_open = true vim.cmd 'startinsert' @@ -446,8 +422,7 @@ end -- Key mappings vim.keymap.set('n', 'tft', FloatingTerminal, { noremap = true, silent = true, desc = 'Toggle floating terminal' }) -vim.keymap.set('n', 'tt', 'horizontal terminal', - { noremap = true, silent = true, desc = 'Toggle terminal' }) +vim.keymap.set('n', 'tt', 'horizontal terminal', { noremap = true, silent = true, desc = 'Toggle terminal' }) vim.keymap.set('t', '', function() if terminal_state.is_open then vim.api.nvim_win_close(terminal_state.win, false) @@ -461,7 +436,7 @@ end, { noremap = true, silent = true, desc = 'Close floating terminal from termi -- Tab display settings vim.opt.showtabline = 1 -- Always show tabline (0=never, 1=when multiple tabs, 2=always) -vim.opt.tabline = '' -- Use default tabline (empty string uses built-in) +vim.opt.tabline = '' -- Use default tabline (empty string uses built-in) -- Transparent tabline appearance vim.cmd [[ @@ -480,9 +455,7 @@ vim.keymap.set('n', 't<', 'tabmove -1', { desc = 'Move tab left -- Function to open file in new tab local function open_file_in_tab() vim.ui.input({ prompt = 'File to open in new tab: ', completion = 'file' }, function(input) - if input and input ~= '' then - vim.cmd('tabnew ' .. input) - end + if input and input ~= '' then vim.cmd('tabnew ' .. input) end end) end @@ -555,10 +528,7 @@ do end if name == 'LuaSnip' then - if vim.fn.has 'win32' ~= 1 and vim.fn.executable 'make' == 1 then - run_build(name, { 'make', 'install_jsregexp' }, - ev.data.path) - end + if vim.fn.has 'win32' ~= 1 and vim.fn.executable 'make' == 1 then run_build(name, { 'make', 'install_jsregexp' }, ev.data.path) end return end @@ -571,7 +541,6 @@ do }) end - -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. require 'kickstart.plugins' require 'custom.plugins' diff --git a/lua/custom/plugins/markdown.lua b/lua/custom/plugins/markdown.lua index d71fd515a84..5bfec172b72 100644 --- a/lua/custom/plugins/markdown.lua +++ b/lua/custom/plugins/markdown.lua @@ -3,6 +3,6 @@ do vim.pack.add { gh 'OXY2DEV/markview.nvim', gh 'saghen/blink.lib', - gh 'saghen/blink.cmp' + gh 'saghen/blink.cmp', } end diff --git a/lua/custom/plugins/supermaven.lua b/lua/custom/plugins/supermaven.lua index 522b37a079a..f2a8d5bc90f 100644 --- a/lua/custom/plugins/supermaven.lua +++ b/lua/custom/plugins/supermaven.lua @@ -11,11 +11,9 @@ do color = { cterm = 244, }, - log_level = 'info', -- set to "off" to disable logging completely + log_level = 'info', -- set to "off" to disable logging completely disable_inline_completion = false, -- disables inline completion for use with cmp - disable_keymaps = false, -- disables built in keymaps for more manual control - condition = function() - return false - end, -- condition to check for stopping supermaven, `true` means to stop supermaven when the condition is true.} + disable_keymaps = false, -- disables built in keymaps for more manual control + condition = function() return false end, -- condition to check for stopping supermaven, `true` means to stop supermaven when the condition is true.} } end diff --git a/lua/kickstart/plugins/auto-completion.lua b/lua/kickstart/plugins/auto-completion.lua index 0e42e30d255..0b78dc04d32 100644 --- a/lua/kickstart/plugins/auto-completion.lua +++ b/lua/kickstart/plugins/auto-completion.lua @@ -1,7 +1,7 @@ -- Autocompletion local function gh(repo) return 'https://github.com/' .. repo end do - vim.pack.add({ gh 'saghen/blink.lib' }) + vim.pack.add { gh 'saghen/blink.lib' } vim.pack.add { { src = gh 'saghen/blink.cmp', version = vim.version.range '2.*' } } vim.pack.add { { src = gh 'saghen/blink.cmp', version = vim.version.range '1.*' } } require('blink.cmp').setup { diff --git a/lua/kickstart/plugins/autopairs.lua b/lua/kickstart/plugins/autopairs.lua index 7c986407d9a..40b70138932 100644 --- a/lua/kickstart/plugins/autopairs.lua +++ b/lua/kickstart/plugins/autopairs.lua @@ -2,6 +2,6 @@ -- https://github.com/windwp/nvim-autopairs local function gh(repo) return 'https://github.com/' .. repo end do - vim.pack.add { gh 'windwp/nvim-autopairs' } - require('nvim-autopairs').setup {} + vim.pack.add { gh 'windwp/nvim-autopairs' } + require('nvim-autopairs').setup {} end diff --git a/lua/kickstart/plugins/debug.lua b/lua/kickstart/plugins/debug.lua index 532a7da5914..8f91b8a9e0f 100644 --- a/lua/kickstart/plugins/debug.lua +++ b/lua/kickstart/plugins/debug.lua @@ -21,10 +21,8 @@ do vim.keymap.set('n', '', function() require('dap').step_into() end, { desc = 'Debug: Step Into' }) vim.keymap.set('n', '', function() require('dap').step_over() end, { desc = 'Debug: Step Over' }) vim.keymap.set('n', '', function() require('dap').step_out() end, { desc = 'Debug: Step Out' }) - vim.keymap.set('n', 'b', function() require('dap').toggle_breakpoint() end, - { desc = 'Debug: Toggle Breakpoint' }) - vim.keymap.set('n', 'B', function() require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') end, - { desc = 'Debug: Set Breakpoint' }) + vim.keymap.set('n', 'b', function() require('dap').toggle_breakpoint() end, { desc = 'Debug: Toggle Breakpoint' }) + vim.keymap.set('n', 'B', function() require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') end, { desc = 'Debug: Set Breakpoint' }) -- Toggle to see last session result. Without this, you can't see session output in case of unhandled exception. vim.keymap.set('n', '', function() require('dapui').toggle() end, { desc = 'Debug: See last session result.' }) diff --git a/lua/kickstart/plugins/format.lua b/lua/kickstart/plugins/format.lua index da3f6358510..6bc66bea22f 100644 --- a/lua/kickstart/plugins/format.lua +++ b/lua/kickstart/plugins/format.lua @@ -48,6 +48,5 @@ do }, } - vim.keymap.set({ 'n', 'v' }, 'f', function() require('conform').format { async = true } end, - { desc = '[F]ormat buffer' }) + vim.keymap.set({ 'n', 'v' }, 'f', function() require('conform').format { async = true } end, { desc = '[F]ormat buffer' }) end diff --git a/lua/kickstart/plugins/gitsigns.lua b/lua/kickstart/plugins/gitsigns.lua index 63ebbfdea25..eb3f34860e9 100644 --- a/lua/kickstart/plugins/gitsigns.lua +++ b/lua/kickstart/plugins/gitsigns.lua @@ -35,10 +35,8 @@ do -- Actions -- visual mode - map('v', 'gs', function() gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } end, - { desc = 'git [s]tage hunk' }) - map('v', 'gr', function() gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end, - { desc = 'git [r]eset hunk' }) + map('v', 'gs', function() gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [s]tage hunk' }) + map('v', 'gr', function() gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } end, { desc = 'git [r]eset hunk' }) -- normal mode map('n', 'gs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) map('n', 'gr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) @@ -49,8 +47,7 @@ do map('n', 'gb', function() gitsigns.blame_line { full = true } end, { desc = 'git [b]lame line' }) map('n', 'gd', gitsigns.diffthis, { desc = 'git [d]iff against index' }) map('n', 'gD', function() gitsigns.diffthis '@' end, { desc = 'git [D]iff against last commit' }) - map('n', 'gQ', function() gitsigns.setqflist 'all' end, - { desc = 'git hunk [Q]uickfix list (all files in repo)' }) + map('n', 'gQ', function() gitsigns.setqflist 'all' end, { desc = 'git hunk [Q]uickfix list (all files in repo)' }) map('n', 'gq', gitsigns.setqflist, { desc = 'git hunk [q]uickfix list (all changes in this file)' }) -- Toggles map('n', 'tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) diff --git a/lua/kickstart/plugins/guess-indent.lua b/lua/kickstart/plugins/guess-indent.lua index 8e9d745d8b4..be19f25f376 100644 --- a/lua/kickstart/plugins/guess-indent.lua +++ b/lua/kickstart/plugins/guess-indent.lua @@ -1,6 +1,6 @@ local function gh(repo) return 'https://github.com/' .. repo end do vim.pack.add { - gh 'NMAC427/guess-indent.nvim' -- Detect tabstop and shiftwidth automatically + gh 'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically } end diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index 31f334f3d24..80701633785 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -16,7 +16,7 @@ do svelte = { 'eslint_d' }, kotlin = { 'ktlint' }, terraform = { 'tflint' }, - ruby = { "ruby" }, + ruby = { 'ruby' }, } -- Create autocommand which carries out the actual linting diff --git a/lua/kickstart/plugins/lsp.lua b/lua/kickstart/plugins/lsp.lua index a68981afac7..b45e0ee1b79 100644 --- a/lua/kickstart/plugins/lsp.lua +++ b/lua/kickstart/plugins/lsp.lua @@ -3,7 +3,6 @@ do vim.pack.add { gh 'j-hui/fidget.nvim' } require('fidget').setup {} - vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }), callback = function(event) @@ -65,9 +64,7 @@ do -- -- This may be unwanted, since they displace some of your code if client and client:supports_method('textDocument/inlayHint', event.buf) then - map('th', - function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) end, - '[T]oggle Inlay [H]ints') + map('th', function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) end, '[T]oggle Inlay [H]ints') end end, }) @@ -119,7 +116,6 @@ do }, }, - stylua = {}, -- Used to format Lua code -- Special Lua Config, as recommended by neovim help docs @@ -216,8 +212,6 @@ vim.diagnostic.config { }, } - - -- Globally configure all LSP floating preview popups (like hover, signature help, etc) local open_floating_preview = vim.lsp.util.open_floating_preview function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...) diff --git a/lua/kickstart/plugins/mini.lua b/lua/kickstart/plugins/mini.lua index edf030c759c..a7dab1ae861 100644 --- a/lua/kickstart/plugins/mini.lua +++ b/lua/kickstart/plugins/mini.lua @@ -74,20 +74,14 @@ do } local minifiles_toggle = function(dir) - if not MiniFiles.close() then - MiniFiles.open(dir) - end + if not MiniFiles.close() then MiniFiles.open(dir) end end - local open_file_in_minifiles = function() - minifiles_toggle(vim.fn.expand '%:p') - end + local open_file_in_minifiles = function() minifiles_toggle(vim.fn.expand '%:p') end local set_cwd = function() local path = (MiniFiles.get_fs_entry() or {}).path - if path == nil then - return vim.notify('Cursor is not on valid entry', vim.log.levels.ERROR) - end + if path == nil then return vim.notify('Cursor is not on valid entry', vim.log.levels.ERROR) end vim.fn.chdir(vim.fs.dirname(path)) end @@ -95,9 +89,7 @@ do local yank_path = function() if MiniFiles.get_explorer_state().target_window ~= nil then local path = (MiniFiles.get_fs_entry() or {}).path - if path == nil then - vim.notify('Cursor is not on valid entry', vim.log.levels.ERROR) - end + if path == nil then vim.notify('Cursor is not on valid entry', vim.log.levels.ERROR) end vim.fn.setreg(vim.v.register, path) end end diff --git a/lua/kickstart/plugins/snippets.lua b/lua/kickstart/plugins/snippets.lua index 1d77fe5ff51..c634871b515 100644 --- a/lua/kickstart/plugins/snippets.lua +++ b/lua/kickstart/plugins/snippets.lua @@ -3,7 +3,7 @@ do vim.pack.add { { src = gh 'L3MON4D3/LuaSnip', version = vim.version.range '2.*' } } vim.pack.add { gh 'rafamadriz/friendly-snippets' } require('luasnip.loaders.from_vscode').lazy_load() - local ls = require('luasnip') + local ls = require 'luasnip' ls.setup { history = false, updateevents = 'TextChanged,TextChangedI', @@ -14,20 +14,14 @@ do end vim.keymap.set({ 'i', 's' }, '', function() - if ls.expand_or_jumpable() then - ls.expand_or_jump() - end + if ls.expand_or_jumpable() then ls.expand_or_jump() end end, { silent = true }) vim.keymap.set({ 'i', 's' }, '', function() - if ls.jumpable(-1) then - ls.jump(-1) - end + if ls.jumpable(-1) then ls.jump(-1) end end, { silent = true }) vim.keymap.set({ 'i', 's' }, '', function() - if ls.jumpable(1) then - ls.jump(1) - end + if ls.jumpable(1) then ls.jump(1) end end, { silent = true }) end diff --git a/lua/kickstart/plugins/telescope.lua b/lua/kickstart/plugins/telescope.lua index c0aa16b0009..a93dc69135b 100644 --- a/lua/kickstart/plugins/telescope.lua +++ b/lua/kickstart/plugins/telescope.lua @@ -117,15 +117,18 @@ do -- It's also possible to pass additional configuration options. -- See `:help telescope.builtin.live_grep()` for information about particular keys - vim.keymap.set('n', 'f/', function() - builtin.live_grep { - grep_open_files = true, - prompt_title = 'Live Grep in Open Files', - } - end, { desc = '[F]ind [/] in Open Files' }) + vim.keymap.set( + 'n', + 'f/', + function() + builtin.live_grep { + grep_open_files = true, + prompt_title = 'Live Grep in Open Files', + } + end, + { desc = '[F]ind [/] in Open Files' } + ) -- Shortcut for searching your Neovim configuration files - vim.keymap.set('n', 'fn', function() - builtin.find_files { cwd = vim.fn.stdpath 'config' } - end, { desc = '[F]ind [N]eovim files' }) + vim.keymap.set('n', 'fn', function() builtin.find_files { cwd = vim.fn.stdpath 'config' } end, { desc = '[F]ind [N]eovim files' }) end diff --git a/lua/kickstart/plugins/which-key.lua b/lua/kickstart/plugins/which-key.lua index 2ea63eea334..56867471d2e 100644 --- a/lua/kickstart/plugins/which-key.lua +++ b/lua/kickstart/plugins/which-key.lua @@ -1,7 +1,7 @@ -- Useful plugin to show you pending keybinds. local function gh(repo) return 'https://github.com/' .. repo end do - vim.pack.add({ gh 'folke/which-key.nvim' }) + vim.pack.add { gh 'folke/which-key.nvim' } require('which-key').setup { -- delay between pressing a key and opening which-key (milliseconds) -- this setting is independent of vim.o.timeoutlen @@ -53,7 +53,7 @@ do { 'w', group = '[W]indow' }, { 'y', group = '[Y]ank' }, { 'S', group = '[S]ession' }, - { 'g', group = 'Git', mode = { 'n', 'v' } }, + { 'g', group = 'Git', mode = { 'n', 'v' } }, { 'q', group = 'Quickfix' }, }, }