diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua index 9a6995e..53625ca 100644 --- a/lua/config/autocmds.lua +++ b/lua/config/autocmds.lua @@ -1,8 +1,8 @@ -- Highlight on yank 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.highlight.on_yank() - end, + desc = 'Highlight when yanking (copying) text', + group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), + callback = function() + vim.highlight.on_yank() + end, }) diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 99d27fc..dd62a06 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -24,16 +24,17 @@ lazy.setup({ }, defaults = { lazy = false, - version = false, + version = "*", }, install = { colorscheme = { "moonfly", "wildcharm" } }, checker = { enabled = true, notify = false }, + change_detection = { notify = false }, performance = { rtp = { disabled_plugins = { "gzip", - -- "matchit", - -- "matchparen", + "matchit", + "matchparen", "netrwPlugin", "tarPlugin", "tohtml", diff --git a/lua/config/options.lua b/lua/config/options.lua index 9787970..3bacbca 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -1,6 +1,6 @@ -- Leader -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' +vim.g.mapleader = " " +vim.g.maplocalleader = " " vim.opt.timeoutlen = 300 -- Numbers @@ -8,11 +8,11 @@ vim.opt.number = true vim.opt.relativenumber = true -- Mouse -vim.opt.mouse = 'a' +vim.opt.mouse = "a" -- Use system clipboard vim.schedule(function() - vim.opt.clipboard = 'unnamedplus' + vim.opt.clipboard = "unnamedplus" end) -- Indent @@ -27,7 +27,7 @@ vim.opt.ignorecase = true vim.opt.smartcase = true -- UI -vim.opt.signcolumn = 'yes' +vim.opt.signcolumn = "yes" vim.opt.scrolloff = 5 vim.opt.wrap = false @@ -37,10 +37,11 @@ vim.opt.splitbelow = true -- Whitespaces vim.opt.list = true -vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } +-- vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" } +vim.opt.listchars = { tab = "▎ ", trail = "·", nbsp = "␣" } -- Preview substitutions -vim.opt.inccommand = 'split' +vim.opt.inccommand = "split" -- Colors vim.opt.termguicolors = true diff --git a/lua/plugins/autopairs.lua b/lua/plugins/autopairs.lua deleted file mode 100644 index bc0bba1..0000000 --- a/lua/plugins/autopairs.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - "windwp/nvim-autopairs", - event = "InsertEnter", - opts = {}, -} diff --git a/lua/plugins/blink-cmp.lua b/lua/plugins/blink-cmp.lua index 970938e..4ca46f4 100644 --- a/lua/plugins/blink-cmp.lua +++ b/lua/plugins/blink-cmp.lua @@ -1,27 +1,9 @@ return { "saghen/blink.cmp", dependencies = "rafamadriz/friendly-snippets", - version = "*", event = "InsertEnter", - ---@module 'blink.cmp' - ---@type blink.cmp.Config opts = { - keymap = { - preset = "enter", - }, - appearance = { - use_nvim_cmp_as_default = false, - nerd_font_variant = "mono", - }, - completion = { - documentation = { - auto_show = true, - auto_show_delay_ms = 500, - }, - }, - sources = { - default = { "lsp", "path", "snippets", "buffer" }, - }, + keymap = { preset = "enter" }, + completion = { documentation = { auto_show = true } }, }, - opts_extend = { "sources.default" }, } diff --git a/lua/plugins/bufferline.lua b/lua/plugins/bufferline.lua index 838b92c..e6e4ac4 100644 --- a/lua/plugins/bufferline.lua +++ b/lua/plugins/bufferline.lua @@ -1,6 +1,5 @@ return { "akinsho/bufferline.nvim", - version = "*", dependencies = { "nvim-tree/nvim-web-devicons" }, event = "VeryLazy", opts = { diff --git a/lua/plugins/flash.lua b/lua/plugins/flash.lua new file mode 100644 index 0000000..97d3ec0 --- /dev/null +++ b/lua/plugins/flash.lua @@ -0,0 +1,13 @@ +return { + "folke/flash.nvim", + event = "VeryLazy", + opts = {}, + -- stylua: ignore + keys = { + { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, + { "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, + { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, + { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, + { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, + }, +} diff --git a/lua/plugins/fzf.lua b/lua/plugins/fzf.lua index 6d00632..b395422 100644 --- a/lua/plugins/fzf.lua +++ b/lua/plugins/fzf.lua @@ -2,11 +2,12 @@ return { "ibhagwan/fzf-lua", dependencies = { "nvim-tree/nvim-web-devicons" }, event = "VeryLazy", - config = function() + opts = {}, + config = function(_, opts) local fzf_lua = require("fzf-lua") -- Setup - fzf_lua.setup({}) + fzf_lua.setup(opts) -- Register as the UI for vim.ui.select fzf_lua.register_ui_select() diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..1feb09a --- /dev/null +++ b/lua/plugins/gitsigns.lua @@ -0,0 +1,5 @@ +return { + "lewis6991/gitsigns.nvim", + event = { "BufReadPost", "BufNewFile" }, + opts = {}, +} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 78e26cf..f9afb28 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -1,6 +1,15 @@ return { + { + "williamboman/mason-lspconfig.nvim", + dependencies = { "williamboman/mason.nvim", "neovim/nvim-lspconfig" }, + event = { "BufReadPre", "BufNewFile" }, + opts = { + ensure_installed = { "lua_ls" }, + }, + }, { "williamboman/mason.nvim", + lazy = true, cmd = "Mason", keys = { { "cm", "Mason" } }, opts = { @@ -13,45 +22,46 @@ return { }, }, }, - { - "williamboman/mason-lspconfig.nvim", - event = { "BufReadPre", "BufNewFile" }, - dependencies = { "williamboman/mason.nvim" }, - opts = { - ensure_installed = { "lua_ls", "gopls" }, - }, - }, { "neovim/nvim-lspconfig", - event = { "BufReadPost", "BufNewFile" }, + lazy = true, cmd = { "LspInfo", "LspInstall", "LspUninstall" }, - opts = { - servers = { - lua_ls = {}, - ccls = {}, - gopls = {}, - }, - }, - config = function(_, opts) - local lspconfig = require("lspconfig") - - -- Servers - for server, config in pairs(opts.servers) do - config.capabilities = require("blink.cmp").get_lsp_capabilities(config.capabilities) - lspconfig[server].setup(config) - end - + config = function() -- Keybinds vim.keymap.set("n", "gd", vim.lsp.buf.definition) vim.keymap.set("n", "cr", vim.lsp.buf.rename) vim.keymap.set("n", "ca", vim.lsp.buf.code_action) - -- Signs - local signs = { Error = "󰅚 ", Warn = "󰀪 ", Hint = "󰌶 ", Info = " " } - for type, icon in pairs(signs) do - local hl = "DiagnosticSign" .. type - vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) - end + -- Diagnostics + vim.diagnostic.config({ + underline = true, + update_in_insert = false, + virtual_text = { + spacing = 4, + source = "if_many", + prefix = "●", + }, + severity_sort = true, + signs = { + text = { + [vim.diagnostic.severity.ERROR] = "󰅚", + [vim.diagnostic.severity.WARN] = "󰀪", + [vim.diagnostic.severity.HINT] = "󰌶", + [vim.diagnostic.severity.INFO] = "", + }, + }, + }) + + -- Add `vim` to globals + vim.lsp.config("lua_ls", { + settings = { + Lua = { + diagnostics = { + globals = { "vim" }, + }, + }, + }, + }) end, }, } diff --git a/lua/plugins/mini.lua b/lua/plugins/mini.lua new file mode 100644 index 0000000..a622c44 --- /dev/null +++ b/lua/plugins/mini.lua @@ -0,0 +1,12 @@ +return { + { + "echasnovski/mini.ai", + event = "VeryLazy", + opts = {}, + }, + { + "echasnovski/mini.pairs", + event = "VeryLazy", + opts = {}, + }, +} diff --git a/lua/plugins/nvim-tree.lua b/lua/plugins/nvim-tree.lua index cf2b47c..2db867c 100644 --- a/lua/plugins/nvim-tree.lua +++ b/lua/plugins/nvim-tree.lua @@ -1,14 +1,16 @@ return { "nvim-tree/nvim-tree.lua", - version = "*", dependencies = { "nvim-tree/nvim-web-devicons" }, - event = "VeryLazy", - -- lazy = false, - config = function() - require("nvim-tree").setup({}) - - local api = require("nvim-tree.api") - - vim.keymap.set("n", "e", api.tree.toggle) - end, + lazy = false, + keys = { + { + "e", + function() + require("nvim-tree.api").tree.toggle() + end, + }, + }, + opts = { + view = { side = "right" }, + }, } diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 3e1a2aa..69e7509 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -2,47 +2,19 @@ return { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", event = "VeryLazy", - config = function() - local configs = require("nvim-treesitter.configs") - configs.setup({ - sync_install = false, - highlight = { enable = true }, - indent = { enable = true }, - ensure_installed = { - "bash", - "c", - "diff", - "html", - "javascript", - "jsdoc", - "json", - "jsonc", - "lua", - "luadoc", - "luap", - "markdown", - "markdown_inline", - "printf", - "python", - "query", - "regex", - "toml", - "tsx", - "typescript", - "vim", - "vimdoc", - "xml", - "yaml", + main = "nvim-treesitter.configs", + opts = { + ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline" }, + highlight = { enable = true }, + indent = { enable = true }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = false, + node_decremental = "", }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = "", - node_incremental = "", - scope_incremental = false, - node_decremental = "", - }, - }, - }) - end, + }, + }, }