diff --git a/modules/home-manager/neovim/nvim/init.lua b/modules/home-manager/neovim/nvim/init.lua index 895bbc9..3831c72 100644 --- a/modules/home-manager/neovim/nvim/init.lua +++ b/modules/home-manager/neovim/nvim/init.lua @@ -39,18 +39,19 @@ opt.undofile = true --Save undo history opt.ignorecase = true --Case insensitive searching unless /C or capital in search opt.smartcase = true -- Smart case opt.updatetime = 50 --Decrease update time -opt.signcolumn = "yes" -- Always show sign column -opt.clipboard = "unnamedplus" -- Access system clipboard +opt.signcolumn = 'yes' -- Always show sign column +opt.clipboard = 'unnamedplus' -- Access system clipboard opt.laststatus = 3 -- Global status line opt.swapfile = false opt.wrap = false vim.opt_local.conceallevel = 2 +vim.opt.inccommand = 'split' -- Time in milliseconds to wait for a mapped sequence to complete. opt.timeoutlen = 300 opt.showmode = false -- Do not need to show the mode. We use the statusline instead. --- opt.scrolloff = 8 -- Lines of context +opt.scrolloff = 10 -- Lines of context opt.smartindent = true --Smart indent opt.expandtab = true opt.smarttab = true @@ -89,9 +90,10 @@ vim.keymap.set("n", "fe", "Oil") vim.keymap.set("i", "jk", "") -vim.cmd[[ -augroup highlight_yank -autocmd! -au TextYankPost * silent! lua vim.highlight.on_yank({higroup="Visual", timeout=200}) -augroup END -]] +vim.api.nvim_create_autocmd('TextYankPost', { + desc = 'Highlight when yanking (copying) text', + group = vim.api.nvim_create_augroup('highlight-yank', { clear = true }), + callback = function() + vim.highlight.on_yank() + end, +}) diff --git a/modules/home-manager/neovim/nvim/lua/plugins/catppuccin.lua b/modules/home-manager/neovim/nvim/lua/plugins/catppuccin.lua index f6dff5b..9dd458f 100644 --- a/modules/home-manager/neovim/nvim/lua/plugins/catppuccin.lua +++ b/modules/home-manager/neovim/nvim/lua/plugins/catppuccin.lua @@ -11,6 +11,11 @@ return { harpoon = true, leap = true, mason = true, + mini = { + enabled = true, + }, + neotest = true, + markdown = true, telescope = { enabled = true, }, diff --git a/modules/home-manager/neovim/nvim/lua/plugins/gitsigns.lua b/modules/home-manager/neovim/nvim/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..f25ff44 --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,12 @@ +return { -- 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 = '~' }, + } + } +} diff --git a/modules/home-manager/neovim/nvim/lua/plugins/lint.lua b/modules/home-manager/neovim/nvim/lua/plugins/lint.lua new file mode 100644 index 0000000..a2cff75 --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/lint.lua @@ -0,0 +1,52 @@ +return { -- Linting + 'mfussenegger/nvim-lint', + event = { 'BufReadPre', 'BufNewFile' }, + config = function() + local lint = require 'lint' + lint.linters_by_ft = { + vue = { 'stylelint' }, + } + + -- To allow other plugins to add linters to require('lint').linters_by_ft, + -- instead set linters_by_ft like this: + -- lint.linters_by_ft = lint.linters_by_ft or {} + -- lint.linters_by_ft['markdown'] = { 'markdownlint' } + -- + -- However, note that this will enable a set of default linters, + -- which will cause errors unless these tools are available: + -- { + -- clojure = { "clj-kondo" }, + -- dockerfile = { "hadolint" }, + -- inko = { "inko" }, + -- janet = { "janet" }, + -- json = { "jsonlint" }, + -- markdown = { "vale" }, + -- rst = { "vale" }, + -- ruby = { "ruby" }, + -- terraform = { "tflint" }, + -- text = { "vale" } + -- } + -- + -- 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 + + -- Create autocommand which carries out the actual linting + -- on the specified events. + local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true }) + vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { + group = lint_augroup, + callback = function() + require('lint').try_lint() + end, + }) + end, +} diff --git a/modules/home-manager/neovim/nvim/lua/plugins/mini.lua b/modules/home-manager/neovim/nvim/lua/plugins/mini.lua new file mode 100644 index 0000000..bf7f26d --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/mini.lua @@ -0,0 +1,37 @@ +return { -- 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 [']quote + -- - 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 = true } + + -- 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/modules/home-manager/neovim/nvim/lua/plugins/neotest.lua b/modules/home-manager/neovim/nvim/lua/plugins/neotest.lua new file mode 100644 index 0000000..a469763 --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/neotest.lua @@ -0,0 +1,29 @@ +return { + "nvim-neotest/neotest", + lazy = false, + dependencies = { + "nvim-neotest/nvim-nio", + "nvim-lua/plenary.nvim", + "antoinemadec/FixCursorHold.nvim", + "nvim-treesitter/nvim-treesitter", + "marilari88/neotest-vitest", + }, + config = function() + require("neotest").setup({ + adapters = { + require("neotest-vitest") { + -- Filter directories when searching for test files. Useful in large projects (see Filter directories notes). + filter_dir = function(name, rel_path, root) + return name ~= "node_modules" and name ~=".direnv" + end, + }, + } + }) + + vim.keymap.set("n", "tt", function() require("neotest").run.run() end) + vim.keymap.set("n", "tf", function() require("neotest").run.run(vim.fn.expand("%")) end) + vim.keymap.set("n", "ts", function() require("neotest").summary.toggle() end) + vim.keymap.set("n", "to", function() require("neotest").output.open({ enter = true }) end) + vim.keymap.set("n", "tp", function() require("neotest").output_panel.toggle() end) + end, +} diff --git a/modules/home-manager/neovim/nvim/lua/plugins/vim-sleuth.lua b/modules/home-manager/neovim/nvim/lua/plugins/vim-sleuth.lua new file mode 100644 index 0000000..684e3f6 --- /dev/null +++ b/modules/home-manager/neovim/nvim/lua/plugins/vim-sleuth.lua @@ -0,0 +1,3 @@ +return { + 'tpope/vim-sleuth' +}