diff options
| author | Kyren223 <Kyren223@proton.me> | 2025-04-24 11:36:39 +0300 |
|---|---|---|
| committer | Kyren223 <Kyren223@proton.me> | 2025-04-24 11:36:39 +0300 |
| commit | 6bef8f32b19778fdfe52f0eb39719425508dcc7b (patch) | |
| tree | f293141ed7e8676b76bb06c07a0fa9472b10e2ac /.config/nvim/lua/plugins | |
| parent | dbd9a6fdd0c44e26b200fb706aacd120a2e09c47 (diff) | |
Refactored nvim config to make it easier and less insanely nested
Diffstat (limited to '.config/nvim/lua/plugins')
61 files changed, 1383 insertions, 0 deletions
diff --git a/.config/nvim/lua/plugins/activity-watch.lua b/.config/nvim/lua/plugins/activity-watch.lua new file mode 100644 index 0000000..1fef86c --- /dev/null +++ b/.config/nvim/lua/plugins/activity-watch.lua @@ -0,0 +1,9 @@ +return { + 'lowitea/aw-watcher.nvim', + opts = { + aw_server = { + host = '127.0.0.1', + port = 5600, + }, + }, +} diff --git a/.config/nvim/lua/plugins/alpha.lua b/.config/nvim/lua/plugins/alpha.lua new file mode 100644 index 0000000..00a7d56 --- /dev/null +++ b/.config/nvim/lua/plugins/alpha.lua @@ -0,0 +1,69 @@ +return { + 'goolord/alpha-nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + cmd = "Alpha", + config = function() + local alpha = require('alpha') + local dashboard = require('alpha.themes.dashboard') + + local function get_natural_day(day) + local suffix = 'th' + local day_mod = day % 10 + + if day_mod == 1 and day ~= 11 then + suffix = 'st' + elseif day_mod == 2 and day ~= 12 then + suffix = 'nd' + elseif day_mod == 3 and day ~= 13 then + suffix = 'rd' + end + + return tostring(day) .. suffix + end + + local find_file_path = '$HOME' + local date = os.date(' %A, %B ') .. get_natural_day(tonumber(os.date('%d'))) + local plugins = ' ' .. require('lazy').stats().count .. ' plugins ' + local v = vim.version() + local version = ' v' .. v.major .. '.' .. v.minor .. '.' .. v.patch + local info_line = date .. plugins .. version + + -- WARN: Just hardcoded the length of the first line in the header + local header_length = #' ' + local padding = (header_length - #info_line) / 2 + info_line = string.rep(' ', padding) .. info_line + + dashboard.section.header.val = { + [[ ]], + [[ ████ ██████ █████ ██ ██ ]], + [[ ███████████ █████ ███ ]], + [[ █████████ ███████████████████ ███ ███████████ ]], + [[ █████████ ███ █████████████ █████ ██████████████ ]], + [[ █████████ ██████████ █████████ █████ █████ ████ █████ ]], + [[ ███████████ ███ ███ █████████ █████ █████ ████ █████ ]], + [[ ██████ █████████████████████ ████ █████ █████ ████ ██████ ]], + [[ ]], + info_line, + } + + dashboard.section.buttons.opts.spacing = 0 + dashboard.section.buttons.val = { + dashboard.button('e', ' > New file', '<cmd>ene <BAR> startinsert<cr>'), + dashboard.button('f', ' > Find file', '<cmd>cd ' .. find_file_path .. ' | Telescope find_files<cr>'), + dashboard.button('r', ' > Recent', '<cmd>Telescope oldfiles<cr>'), + dashboard.button('c', ' > Configuration', '<cmd>e $MYVIMRC<cr> | <cmd>cd %:p:h<cr>'), + -- FIX: doesn't seem to work so great, probably just use a project manager + -- will most likely make my own project manager plugin + -- dashboard.button( + -- 's', + -- ' > Last Session', + -- '<cmd>lua require("auto-session.session-lens.actions").alternate_session()<cr>' + -- ), + dashboard.button('q', ' > Quit NVIM', '<cmd>qa<cr>'), + } + + dashboard.section.footer.val = require('alpha.fortune')() + + alpha.setup(dashboard.opts) + end, +} diff --git a/.config/nvim/lua/plugins/auto-save.lua b/.config/nvim/lua/plugins/auto-save.lua new file mode 100644 index 0000000..5da836b --- /dev/null +++ b/.config/nvim/lua/plugins/auto-save.lua @@ -0,0 +1,33 @@ +return { + 'okuuva/auto-save.nvim', + cmd = 'ASToggle', + event = { 'InsertLeave', 'TextChanged' }, + opts = function() + -- Disable autoformat between automatic saves + vim.api.nvim_create_autocmd('User', { + pattern = 'AutoSaveWritePre', + group = vim.api.nvim_create_augroup('autosave-pre', { clear = true }), + callback = function(opts) + local bufnr = opts.data.saved_buffer + vim.b[bufnr].disable_autoformat = true + end, + }) + + vim.api.nvim_create_autocmd('User', { + pattern = 'AutoSaveWritePost', + group = vim.api.nvim_create_augroup('autosave-post', { clear = true }), + callback = function(opts) + local bufnr = opts.data.saved_buffer + vim.b[bufnr].disable_autoformat = false + end, + }) + + return { + -- execution_message = { enabled = false }, removed + condition = function(buf) + -- Save only if the buffer is not a "special buffer" + return vim.fn.getbufvar(buf, '&buftype') == '' + end, + } + end, +} diff --git a/.config/nvim/lua/plugins/auto-session.lua b/.config/nvim/lua/plugins/auto-session.lua new file mode 100644 index 0000000..cd8d7a4 --- /dev/null +++ b/.config/nvim/lua/plugins/auto-session.lua @@ -0,0 +1,29 @@ +return { + 'rmagatti/auto-session', + lazy = false, + config = function() + vim.opt.sessionoptions = 'blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions' + require('auto-session').setup({ + log_level = 'error', + auto_session_suppress_dirs = { '~/', '/' }, + session_lens = { load_on_setup = false }, + no_restore_cmds = { + function() + if vim.fn.argc() == 0 then + vim.cmd('Alpha') + end + end, + }, + }) + + local session_lens_setup_done = false + local function search_session() + if not session_lens_setup_done then + require('auto-session').setup_session_lens() + session_lens_setup_done = true + end + require('auto-session.session-lens').search_session() + end + vim.keymap.set('n', '<C-s>', search_session, { desc = '[S]ession Manager' }) + end, +} diff --git a/.config/nvim/lua/plugins/buffer-manager.lua b/.config/nvim/lua/plugins/buffer-manager.lua new file mode 100644 index 0000000..6bce4b8 --- /dev/null +++ b/.config/nvim/lua/plugins/buffer-manager.lua @@ -0,0 +1,13 @@ +return { + 'j-morano/buffer_manager.nvim', + dependencies = { 'nvim-lua/plenary.nvim' }, + keys = { + { + '<leader>bl', + function() + require('buffer_manager.ui').toggle_quick_menu() + end, + desc = '[B]uffer [L]ist', + }, + }, +} diff --git a/.config/nvim/lua/plugins/buffer-vaccum.lua b/.config/nvim/lua/plugins/buffer-vaccum.lua new file mode 100644 index 0000000..b064b45 --- /dev/null +++ b/.config/nvim/lua/plugins/buffer-vaccum.lua @@ -0,0 +1,5 @@ +return { + 'ChuufMaster/buffer-vacuum', + opts = { max_buffers = 6 }, + event = 'VeryLazy', +} diff --git a/.config/nvim/lua/plugins/bullets.lua b/.config/nvim/lua/plugins/bullets.lua new file mode 100644 index 0000000..5c81e75 --- /dev/null +++ b/.config/nvim/lua/plugins/bullets.lua @@ -0,0 +1,4 @@ +return { + -- 'bullets-vim/bullets.vim', + -- event = { 'BufReadPre', 'BufNewFile' }, +} diff --git a/.config/nvim/lua/plugins/ccc.lua b/.config/nvim/lua/plugins/ccc.lua new file mode 100644 index 0000000..74c033e --- /dev/null +++ b/.config/nvim/lua/plugins/ccc.lua @@ -0,0 +1,13 @@ +return { + 'uga-rosa/ccc.nvim', + opts = { + highlighter = { auto_enable = true }, + -- highlight_mode = 'virtual', + -- virtual_pos = 'inline-right', + }, + event = 'VeryLazy', + keys = { + { '<leader>cp', '<cmd>CccPick<cr>', desc = '[C]olor [P]icker' }, + { '<leader>ct', '<cmd>CccHighlighterToggle<cr>', desc = '[C]olor [T]oggle' }, + }, +} diff --git a/.config/nvim/lua/plugins/clangd_extensions.lua b/.config/nvim/lua/plugins/clangd_extensions.lua new file mode 100644 index 0000000..07f9dc0 --- /dev/null +++ b/.config/nvim/lua/plugins/clangd_extensions.lua @@ -0,0 +1,38 @@ +return { + 'p00f/clangd_extensions.nvim', + dependencies = { 'microsoft/vscode-codicons' }, -- NOTE: for the ast icons + cmd = { + 'ClangdSwitchSourceHeader', + 'ClangdSetInlayHints', + 'ClangdDisableInlayHints', + 'ClangdToggleInlayHints', + 'ClangdAST', + 'ClangdSymbolInfo', + 'ClangdTypeHierarchy', + 'ClangdMemoryUsage', + }, + opts = { + inlay_hints = { + inline = false, + }, + ast = { + role_icons = { + type = '', + declaration = '', + expression = '', + specifier = '', + statement = '', + ['template argument'] = '', + }, + kind_icons = { + Compound = '', + Recovery = '', + TranslationUnit = '', + PackExpansion = '', + TemplateTypeParm = '', + TemplateTemplateParm = '', + TemplateParamObject = '', + }, + }, + }, +} diff --git a/.config/nvim/lua/plugins/code-playground.lua b/.config/nvim/lua/plugins/code-playground.lua new file mode 100644 index 0000000..751de5b --- /dev/null +++ b/.config/nvim/lua/plugins/code-playground.lua @@ -0,0 +1,7 @@ +return { + 'GustavEikaas/code-playground.nvim', + lazy = false, + config = function() + require('code-playground').setup() + end, +} diff --git a/.config/nvim/lua/plugins/colorscheme.lua b/.config/nvim/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..916eae2 --- /dev/null +++ b/.config/nvim/lua/plugins/colorscheme.lua @@ -0,0 +1,14 @@ +return { + { + 'folke/tokyonight.nvim', + lazy = false, + priority = 1000, + config = function() + -- vim.cmd.colorscheme('tokyonight-night') + -- require('colorschemes.dapui').set() + -- vim.cmd.colorscheme('carbonight-tokyo') + vim.cmd.colorscheme('carbonight') + end, + }, + { dir = '~/projects/carbonight.nvim' }, +} diff --git a/.config/nvim/lua/plugins/comment.lua b/.config/nvim/lua/plugins/comment.lua new file mode 100644 index 0000000..b61675a --- /dev/null +++ b/.config/nvim/lua/plugins/comment.lua @@ -0,0 +1,25 @@ +return { + -- 'numToStr/Comment.nvim', + 'os-mey/Comment.nvim', + branch = 'fix-inline-visual-linewise-comment', + keys = { + { 'gc', mode = { 'n', 'v' } }, + { 'gb', mode = { 'n', 'v' } }, + { '<C-_>', mode = { 'n', 'v' } }, + { 'gcc', mode = 'n' }, + { 'gcb', mode = 'n' }, + }, + config = function() + require('Comment').setup() + local api = require('Comment.api') + local esc = vim.api.nvim_replace_termcodes('<ESC>', true, false, true) + local toggle_linewise_selection = function() + vim.api.nvim_feedkeys(esc, 'nx', false) + api.toggle.linewise(vim.fn.visualmode()) + end + + -- <C-_> means Ctrl slash, `_` is a `/` + vim.keymap.set('n', '<C-_>', api.toggle.linewise.current, { noremap = true, silent = true }) + vim.keymap.set('v', '<C-_>', toggle_linewise_selection, { noremap = true, silent = true }) + end, +} diff --git a/.config/nvim/lua/plugins/conform.lua b/.config/nvim/lua/plugins/conform.lua new file mode 100644 index 0000000..fe3356f --- /dev/null +++ b/.config/nvim/lua/plugins/conform.lua @@ -0,0 +1,38 @@ +return { + 'stevearc/conform.nvim', + event = { 'BufWritePre' }, + cmd = { 'ConformInfo' }, + keys = { + { '<leader>ft', '<cmd>FormatToggle<cr>', desc = '[F]ormat [T]oggle Globally' }, + { '<leader>fT', '<cmd>FormatToggle!<cr>', desc = '[F]ormat [T]oggle Locally' }, + { '<leader>ff', '<cmd>Format<cr>', desc = '[F]ormat [F]ile' }, + { '<leader>f', '<cmd>Format<cr><esc>', desc = '[F]ormat', mode = 'v' }, + }, + ---@module "conform" + ---@type conform.setupOpts + opts = { + formatters_by_ft = { + ['lua'] = { 'stylua' }, + ['c'] = { 'clang-format' }, + -- ['python'] = { 'isort', 'black' }, + -- ['rust'] = { 'rustfmt' }, + ['go'] = { 'gofumpt', 'goimports-reviser' }, + ['markdown'] = { 'prettierd', 'prettier', stop_after_first = true }, + ['yaml'] = { 'prettierd' }, + ['json'] = { 'jq' }, + ['html'] = { 'prettierd', 'prettier', stop_after_first = true }, + ['css'] = { 'prettierd', 'prettier', stop_after_first = true }, + ['javascript'] = { 'prettierd', 'prettier', stop_after_first = true }, + ['typescript'] = { 'prettierd', 'prettier', stop_after_first = true }, + }, + format_on_save = function(bufnr) + -- Disable with a global or buffer local variable + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + return { timeout_ms = 500, lsp_fallback = true } + end, + notify_on_error = true, + lsp_fallback = true, + }, +} diff --git a/.config/nvim/lua/plugins/diffview.lua b/.config/nvim/lua/plugins/diffview.lua new file mode 100644 index 0000000..875e458 --- /dev/null +++ b/.config/nvim/lua/plugins/diffview.lua @@ -0,0 +1,20 @@ +return { + 'sindrets/diffview.nvim', + cmd = { 'DiffviewOpen', 'DiffviewClose', 'DiffviewFileHistory' }, + keys = { + { '<leader>gd', '<cmd>DiffviewOpen<cr>' }, + { '<leader>gl', '<cmd>DiffviewFileHistory<cr>' }, + }, + opts = function() + local quit_keymap = { 'n', 'q', '<cmd>DiffviewClose<cr>', { desc = 'Quit the diffview' } } + return { + enhanced_diff_hl = true, + default = { winbar_info = true }, + keymaps = { + view = { quit_keymap }, + file_panel = { quit_keymap }, + file_history_panel = { quit_keymap }, + }, + } + end, +} diff --git a/.config/nvim/lua/plugins/edgy.lua b/.config/nvim/lua/plugins/edgy.lua new file mode 100644 index 0000000..872247f --- /dev/null +++ b/.config/nvim/lua/plugins/edgy.lua @@ -0,0 +1,28 @@ +return { + 'folke/edgy.nvim', + event = 'VeryLazy', + opts = { + bottom = { + 'Trouble', + { ft = 'qf', title = 'QuickFix' }, + { + ft = 'help', + size = { height = 20 }, + filter = function(buf) -- only show help buffers + return vim.bo[buf].buftype == 'help' + end, + }, + { ft = 'spectre_panel', size = { height = 0.4 } }, + }, + left = { + { + title = 'Neo-Tree', + ft = 'neo-tree', + filter = function(buf) + return vim.b[buf].neo_tree_source == 'filesystem' + end, + size = { height = 0.5 }, + }, + }, + }, +} diff --git a/.config/nvim/lua/plugins/gitsigns.lua b/.config/nvim/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..953cd80 --- /dev/null +++ b/.config/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,33 @@ +return { + 'lewis6991/gitsigns.nvim', + cmd = 'Gitsigns', + -- INFO: Disabled lazy loading to see if the errors stop + -- Not sure if it's an issue with lazy loading or just a gitsigns bug + lazy = false, + config = function() + require('gitsigns').setup() + + local function stage_visual_chunk() + require('gitsigns').stage_hunk({ vim.fn.line('.'), vim.fn.line('v') }) + end + local function reset_visual_chunk() + require('gitsigns').reset_hunk({ vim.fn.line('.'), vim.fn.line('v') }) + end + + vim.keymap.set('n', '<leader>gD', '<cmd>Gitsigns toggle_deleted<cr>', { desc = '[G]it [D]eleted' }) + vim.keymap.set('n', '<leader>hp', '<cmd>Gitsigns preview_hunk<cr>', { desc = '[H]unk [P]review' }) + vim.keymap.set('n', '<leader>hs', '<cmd>Gitsigns stage_hunk<cr>', { desc = '[H]unk [S]tage' }) + vim.keymap.set('n', '<leader>hr', '<cmd>Gitsigns reset_hunk<cr>', { desc = '[H]unk [R]eset' }) + vim.keymap.set('v', '<leader>hs', stage_visual_chunk, { desc = '[H]unk [S]tage' }) + vim.keymap.set('v', '<leader>hr', reset_visual_chunk, { desc = '[H]unk [S]tage' }) + vim.keymap.set('n', '<leader>hS', '<cmd>Gitsigns stage_buffer<cr>', { desc = '[S]tage Buffer' }) + vim.keymap.set('n', '<leader>hR', '<cmd>Gitsigns reset_buffer<cr>', { desc = '[R]eset Buffer' }) + vim.keymap.set('n', '<leader>hu', '<cmd>Gitsigns undo_stage_hunk<cr>', { desc = '[H]unk [U]ndo' }) + vim.keymap.set( + 'n', + '<leader>gB', + '<cmd>Gitsigns toggle_current_line_blame<cr>', + { desc = '[G]it [B]lame Line' } + ) + end, +} diff --git a/.config/nvim/lua/plugins/gopher.lua b/.config/nvim/lua/plugins/gopher.lua new file mode 100644 index 0000000..4bbcc92 --- /dev/null +++ b/.config/nvim/lua/plugins/gopher.lua @@ -0,0 +1,9 @@ +return { + 'olexsmir/gopher.nvim', + ft = 'go', + build = function() + vim.cmd.GoInstallDeps() + end, + ---@type gopher.Config + opts = {}, +} diff --git a/.config/nvim/lua/plugins/harpoon.lua b/.config/nvim/lua/plugins/harpoon.lua new file mode 100644 index 0000000..5627e2f --- /dev/null +++ b/.config/nvim/lua/plugins/harpoon.lua @@ -0,0 +1,23 @@ +return { + 'ThePrimeagen/harpoon', + branch = 'harpoon2', + dependencies = { 'nvim-lua/plenary.nvim' }, + keys = { '<C-e>', '<leader>a', '<leader>1', '<leader>2', '<leader>3', '<leader>4', '<leader>5' }, + config = function() + local harpoon = require('harpoon') + harpoon:setup() + + vim.keymap.set('n', '<leader>a', function() + harpoon:list():add() + end) + vim.keymap.set('n', '<C-e>', function() + harpoon.ui:toggle_quick_menu(harpoon:list()) + end) + + for i = 1, 9 do + vim.keymap.set('n', string.format('<leader>%d', i), function() + harpoon:list():select(i) + end) + end + end, +} diff --git a/.config/nvim/lua/plugins/helpview.lua b/.config/nvim/lua/plugins/helpview.lua new file mode 100644 index 0000000..098548b --- /dev/null +++ b/.config/nvim/lua/plugins/helpview.lua @@ -0,0 +1,7 @@ +return { + 'OXY2DEV/helpview.nvim', + ft = 'help', + dependencies = { + 'nvim-treesitter/nvim-treesitter', + }, +} diff --git a/.config/nvim/lua/plugins/indent-blankline.lua b/.config/nvim/lua/plugins/indent-blankline.lua new file mode 100644 index 0000000..fb18add --- /dev/null +++ b/.config/nvim/lua/plugins/indent-blankline.lua @@ -0,0 +1,11 @@ +return { + 'lukas-reineke/indent-blankline.nvim', + main = 'ibl', + event = 'VeryLazy', + opts = { + scope = { + show_start = false, + show_end = false, + }, + }, +} diff --git a/.config/nvim/lua/plugins/lazydev.lua b/.config/nvim/lua/plugins/lazydev.lua new file mode 100644 index 0000000..59d2366 --- /dev/null +++ b/.config/nvim/lua/plugins/lazydev.lua @@ -0,0 +1,12 @@ +return { + 'folke/lazydev.nvim', + ft = 'lua', + cmd = 'LazyDev', + opts = { + library = { + { path = '${3rd}/luv/library', words = { 'vim%.uv' } }, + { path = 'snacks.nvim', words = { 'Snacks' } }, + { path = 'lazy.nvim', words = { 'LazyVim' } }, + }, + }, +} diff --git a/.config/nvim/lua/plugins/leap.lua b/.config/nvim/lua/plugins/leap.lua new file mode 100644 index 0000000..6d1eeeb --- /dev/null +++ b/.config/nvim/lua/plugins/leap.lua @@ -0,0 +1,15 @@ +return { + 'ggandor/leap.nvim', + lazy = false, + dependencies = { 'tpope/vim-repeat' }, + config = function() + require('leap').opts.equivalence_classes = { ' \t\r\n', '([{', ')]}', '\'"`' } + vim.api.nvim_set_hl(0, 'LeapBackdrop', { fg = '#777777' }) + + vim.keymap.set({ 'n', 'x' }, 's', '<Plug>(leap)') + vim.keymap.set('n', 'S', '<Plug>(leap-from-window)') + vim.keymap.set('n', 's', require('leap.remote').action) + vim.keymap.set('o', 'z', '<Plug>(leap-forward)') + vim.keymap.set('o', 'Z', '<Plug>(leap-backward)') + end, +} diff --git a/.config/nvim/lua/plugins/lsp-signature.lua b/.config/nvim/lua/plugins/lsp-signature.lua new file mode 100644 index 0000000..718cd62 --- /dev/null +++ b/.config/nvim/lua/plugins/lsp-signature.lua @@ -0,0 +1,12 @@ +return { + -- FIXME: fork the repo and fix the following issues + -- Make both insert and normal be toggelable rather than insert always showing and normal toggleable + 'ray-x/lsp_signature.nvim', + event = 'LspAttach', + opts = { + bind = true, -- This is mandatory, otherwise border config won't get registered. + handler_opts = { border = 'single' }, + doc_lines = 0, + hint_enable = false, + }, +} diff --git a/.config/nvim/lua/plugins/lspsaga.lua b/.config/nvim/lua/plugins/lspsaga.lua new file mode 100644 index 0000000..a8fe588 --- /dev/null +++ b/.config/nvim/lua/plugins/lspsaga.lua @@ -0,0 +1,44 @@ +return { + -- 'nvimdev/lspsaga.nvim', + 'Kyren223/lspsaga.nvim', + dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, + event = 'LspAttach', + opts = { + ui = { + border = 'rounded', + foldericon = false, + title = false, + kind = nil, + }, + hover = { open_cmd = '!firefox.exe' }, + diagnostic = { + show_layout = 'float', + keys = { + exec_action = 'o', + quit = 'q', + toggle_or_jump = '<CR>', + quit_in_show = { 'q', '<ESC>' }, + }, + }, + code_action = { show_preview = false }, + lightbulb = { enable = false }, + rename = { + pre_hook = function() + pcall(function() + vim.cmd('IlluminateToggle') + end) + end, + post_hook = function() + pcall(function() + vim.cmd('IlluminateToggle') + end) + end, + keys = { + quit = '<C-c>', + exec = '<CR>', + select = 'x', + }, + }, + symbol_in_winbar = { enable = false }, + }, +} diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..e331310 --- /dev/null +++ b/.config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,8 @@ +return { + 'nvim-lualine/lualine.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons', 'linrongbin16/lsp-progress.nvim' }, + event = 'VeryLazy', + config = function() + require('lualine_helper') + end, +} diff --git a/.config/nvim/lua/plugins/markdown-toggle.lua b/.config/nvim/lua/plugins/markdown-toggle.lua new file mode 100644 index 0000000..39a932c --- /dev/null +++ b/.config/nvim/lua/plugins/markdown-toggle.lua @@ -0,0 +1,12 @@ +return { + 'roodolv/markdown-toggle.nvim', + event = 'VeryLazy', + config = function() + require('markdown-toggle').setup() + local opts = { silent = true, noremap = true } + local toggle = require('markdown-toggle') + vim.keymap.set({ 'n', 'x' }, '<leader>tu', toggle.list, opts) + vim.keymap.set({ 'n', 'x' }, '<leader>to', toggle.olist, opts) + vim.keymap.set({ 'n', 'x' }, '<leader>tm', toggle.checkbox, opts) + end, +} diff --git a/.config/nvim/lua/plugins/mason.lua b/.config/nvim/lua/plugins/mason.lua new file mode 100644 index 0000000..9bbb01b --- /dev/null +++ b/.config/nvim/lua/plugins/mason.lua @@ -0,0 +1,38 @@ +return { + { + 'williamboman/mason.nvim', + lazy = false, + opts = { + ui = { + icons = { + package_installed = '✓', + package_pending = '➜', + package_uninstalled = '✗', + }, + }, + }, + }, + { + 'WhoIsSethDaniel/mason-tool-installer.nvim', + lazy = false, + opts = { + ensure_installed = { + 'stylua', -- lua formatting + 'clang-format', -- C/C++ formatter + 'codelldb', -- C/C++ debugger + 'cpplint', -- C/C++ linter + -- 'black', -- python formatter + -- 'isort', -- python formatter for imports + -- 'flake8', -- python linter + 'gofumpt', -- go formatter + 'golangci-lint', -- go linter + 'prettierd', -- multi-lang formatter + 'prettier', -- prettierd but slower, used as a fallback + 'jq', -- json formatter + 'jsonlint', -- json linter + 'shellcheck', -- bash linter + 'beautysh', -- shell formatter + }, + }, + }, +} diff --git a/.config/nvim/lua/plugins/mini.lua b/.config/nvim/lua/plugins/mini.lua new file mode 100644 index 0000000..61d04b6 --- /dev/null +++ b/.config/nvim/lua/plugins/mini.lua @@ -0,0 +1,16 @@ +return { + 'echasnovski/mini.nvim', + version = false, + keys = { + { + 'Q', + function() + if vim.bo.modified then + vim.cmd.write() + end + require('mini.bufremove').delete(0) + end, + desc = '[Q]uit Buffer', + }, + }, +} diff --git a/.config/nvim/lua/plugins/neogen.lua b/.config/nvim/lua/plugins/neogen.lua new file mode 100644 index 0000000..fdefdbd --- /dev/null +++ b/.config/nvim/lua/plugins/neogen.lua @@ -0,0 +1,5 @@ +return { + 'danymat/neogen', + keys = { { '<leader>ng', '<<cmd>Neogen<cr>', desc = '[N]eo[G]en' } }, + opts = { snippet_engine = 'luasnip' }, +} diff --git a/.config/nvim/lua/plugins/neogit.lua b/.config/nvim/lua/plugins/neogit.lua new file mode 100644 index 0000000..e1e164f --- /dev/null +++ b/.config/nvim/lua/plugins/neogit.lua @@ -0,0 +1,33 @@ +return { + 'NeogitOrg/neogit', + cmd = 'Neogit', + keys = { + { '<leader>gb', '<cmd>Neogit branch<cr>' }, + { '<leader>gs', '<cmd>Neogit<cr>' }, + { '<leader>gL', '<cmd>Neogit log<cr>' }, + { '<leader>gc', '<cmd>Neogit commit<cr>' }, + { '<leader>gp', '<cmd>Neogit push<cr>' }, + { '<leader>gP', '<cmd>Neogit pull<cr>' }, + { '<leader>gr', '<cmd>Neogit rebase<cr>' }, + { '<leader>gm', '<cmd>Neogit merge<cr>' }, + }, + opts = function() + return { + commit_editor = { spell_check = false }, + mappings = { + commit_editor = { + ['<C-y>'] = 'Submit', + ['<C-n>'] = 'Abort', + }, + commit_editor_I = { + ['<C-y>'] = 'Submit', + ['<C-n>'] = 'Abort', + }, + popup = { + ['p'] = 'PushPopup', + ['P'] = 'PullPopup', + }, + }, + } + end, +} diff --git a/.config/nvim/lua/plugins/nvim-autopairs.lua b/.config/nvim/lua/plugins/nvim-autopairs.lua new file mode 100644 index 0000000..264004a --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-autopairs.lua @@ -0,0 +1,11 @@ +return { + 'windwp/nvim-autopairs', + event = 'InsertEnter', + opts = { + check_ts = true, + ts_config = { + lua = { 'string' }, -- don't add pairs inside lua strings + javascript = { 'template_string' }, -- FIX: remove me + }, + }, +} diff --git a/.config/nvim/lua/plugins/nvim-cmp.lua b/.config/nvim/lua/plugins/nvim-cmp.lua new file mode 100644 index 0000000..221c756 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-cmp.lua @@ -0,0 +1,14 @@ +return { + 'hrsh7th/nvim-cmp', + event = 'InsertEnter', + dependencies = { + 'onsails/lspkind.nvim', -- icons for completion type + 'hrsh7th/cmp-path', -- complete filepaths + 'hrsh7th/cmp-nvim-lsp', -- lsp source for nvim-cmp + 'saadparwaiz1/cmp_luasnip', -- snippets source for nvim-cmp + { 'L3MON4D3/LuaSnip', build = 'make install_jsregexp' }, -- snippets plugin + }, + config = function() + require('cmp_helper') + end, +} diff --git a/.config/nvim/lua/plugins/nvim-dap-ui.lua b/.config/nvim/lua/plugins/nvim-dap-ui.lua new file mode 100644 index 0000000..cddad45 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-dap-ui.lua @@ -0,0 +1,26 @@ +return { + 'rcarriga/nvim-dap-ui', + dependencies = { 'mfussenegger/nvim-dap', 'nvim-neotest/nvim-nio' }, + event = 'VeryLazy', + config = function() + local dap = require('dap') + local dapui = require('dapui') + dapui.setup() + dap.listeners.before.attach.dapui_config = function() + dapui.open() + vim.cmd.Hardtime('disable') + end + dap.listeners.after.event_initialized['dapui_config'] = function() + dapui.open() + vim.cmd.Hardtime('disable') + end + dap.listeners.before.event_terminated['dapui_config'] = function() + dapui.close() + vim.cmd.Hardtime('enable') + end + dap.listeners.before.event_exited['dapui_config'] = function() + dapui.close() + vim.cmd.Hardtime('enable') + end + end, +} diff --git a/.config/nvim/lua/plugins/nvim-dap.lua b/.config/nvim/lua/plugins/nvim-dap.lua new file mode 100644 index 0000000..dd4bbee --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-dap.lua @@ -0,0 +1,58 @@ +return { + 'mfussenegger/nvim-dap', + dependencies = { 'williamboman/mason.nvim' }, + -- NOTE:nvim-dap has no setup function + -- if there is just opts, lazy will attempt to call setup which causes an error + -- Having an empty config function makes lazy not call setup which fixes the issue + config = function() end, + opts = function() + -- Load dap keymaps + require('dap-keymaps') + local dap = require('dap') + + -- Setup C/C++ dap + if not dap.adapters['codelldb'] then + dap.adapters['codelldb'] = { + type = 'server', + host = 'localhost', + port = '${port}', + executable = { + command = 'codelldb', + args = { + '--port', + '${port}', + }, + }, + } + end + for _, lang in ipairs({ 'c', 'cpp' }) do + dap.configurations[lang] = { + { + type = 'codelldb', + request = 'launch', + name = 'Launch file', + program = function() + if vim.g.dap_codelldb_exe then + return vim.fn.getcwd() .. '/' .. vim.g.dap_codelldb_exe + end + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + args = function() + if vim.g.dap_codelldb_args then + return vim.g.dap_codelldb_args + end + return {} + end, + cwd = '${workspaceFolder}', + }, + { + type = 'codelldb', + request = 'attach', + name = 'Attach to process', + pid = require('dap.utils').pick_process, + cwd = '${workspaceFolder}', + }, + } + end + end, +} diff --git a/.config/nvim/lua/plugins/nvim-dbee.lua b/.config/nvim/lua/plugins/nvim-dbee.lua new file mode 100644 index 0000000..43baa80 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-dbee.lua @@ -0,0 +1,12 @@ +return { + 'kndndrj/nvim-dbee', + dependencies = { 'MunifTanjim/nui.nvim' }, + build = function() + -- Install tries to automatically detect the install method. + -- if it fails, try calling it with one of these parameters: + -- "curl", "wget", "bitsadmin", "go" + require('dbee').install() + end, + cmd = 'Dbee', + opts = {}, +} diff --git a/.config/nvim/lua/plugins/nvim-java.lua b/.config/nvim/lua/plugins/nvim-java.lua new file mode 100644 index 0000000..4bd321d --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-java.lua @@ -0,0 +1,5 @@ +return { + 'nvim-java/nvim-java', + lazy = false, + opts = {} +} diff --git a/.config/nvim/lua/plugins/nvim-lint.lua b/.config/nvim/lua/plugins/nvim-lint.lua new file mode 100644 index 0000000..7bb3a16 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-lint.lua @@ -0,0 +1,41 @@ +return { + 'mfussenegger/nvim-lint', + lazy = false, + config = function() + local lint = require('lint') + lint.linters_by_ft = { + -- c = { 'clangtidy' }, + -- cpp = { 'clangtidy' }, + go = { 'golangcilint' }, + -- python = { 'flake8' }, + json = { 'jsonlint' }, + bash = { 'shellcheck' }, + } + + vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave', 'TextChanged', 'TextChangedI' }, { + group = vim.api.nvim_create_augroup('nvim-lint', { clear = true }), + callback = function() + require('lint').try_lint() + end, + }) + + -- NOTE: most if not all of clangt-idy warnings are + -- also reported by clangd, so this function filters clang-tidy warnings + -- to avoid duplication of warnings + -- local clangtidy_parser = lint.linters.clangtidy.parser + -- lint.linters.clangtidy.parser = function(output, bufnr, linter_cwd) + -- local diagnostics = clangtidy_parser(output, bufnr, linter_cwd) + -- diagnostics = vim.tbl_filter(function(diagnostic) + -- if diagnostic.severity == vim.diagnostic.severity.WARN then + -- return false + -- end + -- if diagnostic.severity == vim.diagnostic.severity.ERROR then + -- return false + -- end + -- + -- return true + -- end, diagnostics) + -- return diagnostics + -- end + end, +} diff --git a/.config/nvim/lua/plugins/nvim-lspconfig.lua b/.config/nvim/lua/plugins/nvim-lspconfig.lua new file mode 100644 index 0000000..1dd0a77 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-lspconfig.lua @@ -0,0 +1,32 @@ +return { + -- NOTE: Make sure the order is as follows: + -- Mason loads -> Mason lspconfig loads -> Lspconfig loads + 'neovim/nvim-lspconfig', + event = { 'BufReadPre', 'BufNewFile' }, + dependencies = { + 'hrsh7th/cmp-nvim-lsp', + { 'antosha417/nvim-lsp-file-operations', conifg = true }, + { + 'williamboman/mason-lspconfig.nvim', + build = ':MasonUpdate', + config = function() + local language_servers = require('language-servers') + local ensure_installed = vim.tbl_filter(function(key) + local server = language_servers[key] + if type(server) == 'table' then + if server.mason ~= nil then + return server.mason + end + return true + else + return server + end + end, vim.tbl_keys(language_servers)) + require('mason-lspconfig').setup({ ensure_installed = ensure_installed, auto_install = true }) + end, + }, + }, + config = function() + require('lsp') + end, +} diff --git a/.config/nvim/lua/plugins/nvim-scrollbar.lua b/.config/nvim/lua/plugins/nvim-scrollbar.lua new file mode 100644 index 0000000..f475ac7 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-scrollbar.lua @@ -0,0 +1,29 @@ +return { + 'petertriho/nvim-scrollbar', + event = 'VeryLazy', + opts = { + marks = { + Search = { + text = { '', '' }, + }, + Error = { + text = { '', '' }, + }, + Warn = { + text = { '', '' }, + }, + Info = { + text = { '', '' }, + }, + Hint = { + text = { '', '' }, + }, + Misc = { + text = { '', '' }, + }, + }, + handlers = { + cursor = false, + }, + }, +} diff --git a/.config/nvim/lua/plugins/nvim-spectre.lua b/.config/nvim/lua/plugins/nvim-spectre.lua new file mode 100644 index 0000000..df58de9 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-spectre.lua @@ -0,0 +1,7 @@ +return { + -- NOTE: No keybindings, use `:Spectre` or `:Spectre <file>` + -- Spectre has no undo, so it should be rarely used, which is why no keybindings are defined + 'nvim-pack/nvim-spectre', + cmd = 'Spectre', + config = true, +} diff --git a/.config/nvim/lua/plugins/nvim-surround.lua b/.config/nvim/lua/plugins/nvim-surround.lua new file mode 100644 index 0000000..54d8754 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-surround.lua @@ -0,0 +1,21 @@ +return { + 'kylechui/nvim-surround', + version = '*', + keys = { + { 'ys' }, + { 'yss' }, + { 'S' }, + { 'cs' }, + { 'ds' }, + { '(', '<Plug>(nvim-surround-visual)(', mode = 'v' }, + { ')', '<Plug>(nvim-surround-visual))', mode = 'v' }, + { '{', '<Plug>(nvim-surround-visual){', mode = 'v' }, + { '}', '<Plug>(nvim-surround-visual)}', mode = 'v' }, + { '[', '<Plug>(nvim-surround-visual)[', mode = 'v' }, + { ']', '<Plug>(nvim-surround-visual)]', mode = 'v' }, + { '`', '<Plug>(nvim-surround-visual)`', mode = 'v' }, + { '"', '<Plug>(nvim-surround-visual)"', mode = 'v' }, + { "'", "<Plug>(nvim-surround-visual)'", mode = 'v' }, + }, + opts = {}, +} diff --git a/.config/nvim/lua/plugins/nvim-treesitter.lua b/.config/nvim/lua/plugins/nvim-treesitter.lua new file mode 100644 index 0000000..96ac728 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-treesitter.lua @@ -0,0 +1,87 @@ +return { + { + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + config = function() + ---@type userdata + ---@diagnostic disable-next-line: missing-fields + require('nvim-treesitter.configs').setup({ + auto_install = true, + highlight = { enable = true }, + indent = { enable = true }, + rainbow = { + enable = true, + extended_mode = true, + max_file_lines = nil, + }, + }) + + -- HACK: Workaround to have syntax highlighting in zsh until a zsh parser is added + -- https://github.com/nvim-treesitter/nvim-treesitter/issues/655 + local ft_to_lang = require('nvim-treesitter.parsers').ft_to_lang + ---@diagnostic disable-next-line: duplicate-set-field + require('nvim-treesitter.parsers').ft_to_lang = function(ft) + if ft == 'zsh' then + return 'bash' + end + return ft_to_lang(ft) + end + end, + }, + { + 'nvim-treesitter/nvim-treesitter-textobjects', + event = 'VeryLazy', + dependencies = { 'nvim-treesitter/nvim-treesitter' }, + config = function() + ---@diagnostic disable-next-line: missing-fields + require('nvim-treesitter.configs').setup({ + textobjects = { + select = { + enable = true, + lookahead = true, -- automatically jump forward to textobj, similar to targets.vim + keymaps = { + -- You can use the capture groups defined in textobjects.scm + ['af'] = { query = '@function.outer', desc = 'Select entire function' }, + ['if'] = { query = '@function.inner', desc = 'Select function body' }, + ['ac'] = { query = '@class.outer', desc = 'Select entire class' }, + ['ic'] = { query = '@class.inner', desc = 'Select class body' }, + -- ['as'] = { query = '@scope', query_group = 'locals', desc = 'Select language scope' }, + ['ia'] = { query = '@assignment.rhs', desc = 'Select assignment rhs' }, + ['ip'] = { query = '@parameter.inner', desc = 'Select parameter' }, + }, + selection_modes = { + ['@parameter.outer'] = 'v', -- charwise + ['@function.outer'] = 'V', -- linewise + ['@class.outer'] = '<c-v>', -- blockwise + ['@assignment.rhs'] = 'v', -- charwise + }, + }, + swap = { + enable = true, + swap_next = { + ['<leader>sa'] = { query = '@parameter.inner', desc = 'Swap Argument (next)' }, + }, + swap_previous = { + ['<leader>sA'] = { query = '@parameter.inner', desc = 'Swap Argument (prev)' }, + }, + }, + }, + }) + + local ts_repeat_move = require('nvim-treesitter.textobjects.repeatable_move') + -- Repeat movement with ; and , + vim.keymap.set({ 'n', 'x', 'o' }, ';', ts_repeat_move.repeat_last_move_next) + vim.keymap.set({ 'n', 'x', 'o' }, ',', ts_repeat_move.repeat_last_move_previous) + + -- NOTE: You need this, otherwise the normal ; and , won't work for fFtT + vim.keymap.set({ 'n', 'x', 'o' }, 'f', ts_repeat_move.builtin_f_expr, { expr = true }) + vim.keymap.set({ 'n', 'x', 'o' }, 'F', ts_repeat_move.builtin_F_expr, { expr = true }) + vim.keymap.set({ 'n', 'x', 'o' }, 't', ts_repeat_move.builtin_t_expr, { expr = true }) + vim.keymap.set({ 'n', 'x', 'o' }, 'T', ts_repeat_move.builtin_T_expr, { expr = true }) + end, + }, + -- NOTE: Might conflict with treeobj but it adds IQ and AQ for any quotes which is cool + -- The rest can probably be disabled, but I will try it out and only disable if it annoys me + -- Also it does (/{ etc ignore whitespace but )/} don't, which is interesting ig + -- { 'echasnovski/mini.ai', version = false, opts = {}, lazy = false }, +} diff --git a/.config/nvim/lua/plugins/nvim-ts-autotag.lua b/.config/nvim/lua/plugins/nvim-ts-autotag.lua new file mode 100644 index 0000000..e806a45 --- /dev/null +++ b/.config/nvim/lua/plugins/nvim-ts-autotag.lua @@ -0,0 +1,5 @@ +return { + 'windwp/nvim-ts-autotag', + event = { 'BufReadPre', 'BufNewFile' }, + opts = { opts = { enable_close_on_slash = true } }, +} diff --git a/.config/nvim/lua/plugins/octo.lua b/.config/nvim/lua/plugins/octo.lua new file mode 100644 index 0000000..26c1dbb --- /dev/null +++ b/.config/nvim/lua/plugins/octo.lua @@ -0,0 +1,23 @@ +return { + 'pwntester/octo.nvim', + cmd = 'Octo', + keys = { + { '<leader>gi', '<cmd>Octo issue search<cr>', desc = '[G]ithub [I]ssues (local)' }, + { '<leader>pr', '<cmd>Octo pr search<cr>', desc = 'Github [PR]s (local)' }, + { '<leader>gI', '<cmd>Octo search is:issue is:open author:@me<cr>', desc = '[G]ithub [I]ssues (global)' }, + { '<leader>pR', '<cmd>Octo search is:pr author:@me<cr>', desc = 'Github [PR]s (global)' }, + }, + config = function() + require('octo').setup({ suppress_missing_scope = { projects_v2 = true } }) + + vim.treesitter.language.register('markdown', 'octo') + vim.api.nvim_create_autocmd('FileType', { + pattern = 'octo', + callback = function() + -- Autocomplete for @ (user mention) and # (issue) + vim.keymap.set('i', '@', '@<C-x><C-o>', { silent = true, buffer = true }) + vim.keymap.set('i', '#', '#<C-x><C-o>', { silent = true, buffer = true }) + end, + }) + end, +} diff --git a/.config/nvim/lua/plugins/oil.lua b/.config/nvim/lua/plugins/oil.lua new file mode 100644 index 0000000..7b7521d --- /dev/null +++ b/.config/nvim/lua/plugins/oil.lua @@ -0,0 +1,40 @@ +return { + 'stevearc/oil.nvim', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + keys = { { '<leader>fo', '<cmd>Oil<cr>', desc = '[F]ilesystem [O]il' } }, + opts = { + delete_to_trash = true, + default_file_explorer = true, + skip_confirm_for_simple_edits = true, + keymaps = { + ['gs'] = false, + ['<C-h>'] = false, + ['<C-l>'] = false, + ['<C-k>'] = false, + ['<C-j>'] = false, + ['<M-h>'] = 'actions.select_split', + ['<M-v>'] = 'actions.select_vsplit', + ['<C-r>'] = 'actions.refresh', + ['Q'] = 'actions.close', + ['gS'] = 'actions.change_sort', + ['gy'] = 'actions.copy_to_system_clipboard', + ['gp'] = 'actions.paste_from_system_clipboard', + }, + view_options = { + show_hidden = true, + natural_order = true, + }, + + lsp_file_methods = { + -- Enable or disable LSP file operations + enabled = true, + -- Time to wait for LSP file operations to complete before skipping + timeout_ms = 1000, + -- Set to true to autosave buffers that are updated with LSP willRenameFiles + -- Set to "unmodified" to only save unmodified buffers + autosave_changes = false, + }, + }, + cmd = 'Oil', + event = 'VimEnter', +} diff --git a/.config/nvim/lua/plugins/overseer.lua b/.config/nvim/lua/plugins/overseer.lua new file mode 100644 index 0000000..bd27efc --- /dev/null +++ b/.config/nvim/lua/plugins/overseer.lua @@ -0,0 +1,49 @@ +return { + 'stevearc/overseer.nvim', + -- NOTE: without telescope the UI is not custom, so making sure telescope is loaded first + dependencies = { 'nvim-telescope/telescope.nvim' }, + -- event = 'VeryLazy', + keys = function() + local overseer = require('overseer') + local RUN_TAG = overseer.TAG.RUN + local BUILD_TAG = overseer.TAG.BUILD + local TEST_TAG = overseer.TAG.TEST + local function run_template(tag, show_prompt) + return function() + local prompt = show_prompt and 'always' or 'avoid' + overseer.run_template({ tags = { tag }, first = true, prompt = prompt }) + -- overseer.open({ enter = false }) -- don't focus + end + end + return { + { '<leader>or', run_template(RUN_TAG, false), desc = '[O]verseer [R]un' }, + { '<leader>oR', run_template(RUN_TAG, true), desc = '[O]verseer [R]un (with params)' }, + + { '<leader>ob', run_template(BUILD_TAG, false), desc = '[O]verseer [B]uild' }, + { '<leader>oB', run_template(BUILD_TAG, true), desc = '[O]verseer [B]uild (with params)' }, + + { '<leader>ot', run_template(TEST_TAG, false), desc = '[O]verseer [T]est' }, + { '<leader>oT', run_template(TEST_TAG, true), desc = '[O]verseer [T]est (with params)' }, + + { '<leader>ow', '<cmd>OverseerToggle!<cr>', desc = '[O]verseer [W]indow (toggle)' }, + { '<leader>oW', '<cmd>OverseerQuickAction open float<cr>', desc = '[O]verseer [W]indow (terminal float)' }, + } + end, + opts = { + templates = { 'builtin', 'custom' }, + task_list = { + min_height = 0.5, + bindings = { + ['o'] = false, + ['<C-v>'] = false, + ['<C-s>'] = false, + ['<C-h>'] = false, + ['<C-j>'] = false, + ['<C-k>'] = false, + ['<C-l>'] = false, + ['<C-u>'] = 'ScrollOutputUp', + ['<C-d>'] = 'ScrollOutputDown', + }, + }, + }, +} diff --git a/.config/nvim/lua/plugins/pretty-hover.lua b/.config/nvim/lua/plugins/pretty-hover.lua new file mode 100644 index 0000000..5be5381 --- /dev/null +++ b/.config/nvim/lua/plugins/pretty-hover.lua @@ -0,0 +1,5 @@ +return { + 'Fildo7525/pretty_hover', + event = 'LspAttach', + opts = {}, +} diff --git a/.config/nvim/lua/plugins/render-markdown.lua b/.config/nvim/lua/plugins/render-markdown.lua new file mode 100644 index 0000000..a7ae2b7 --- /dev/null +++ b/.config/nvim/lua/plugins/render-markdown.lua @@ -0,0 +1,16 @@ +return { + 'MeanderingProgrammer/render-markdown.nvim', + event = { 'BufReadPre', 'BufNewFile' }, + keys = { + { '<leader>mt', '<<cmd>RenderMarkdown toggle<cr>'} + }, + opts = { + render_modes = true, + sign = { enabled = false }, + bullet = { icons = { '', '◆' } }, + checkbox = { + unchecked = { icon = ' ' }, + checked = { icon = ' ' }, + }, + }, +} diff --git a/.config/nvim/lua/plugins/rustaceanvim.lua b/.config/nvim/lua/plugins/rustaceanvim.lua new file mode 100644 index 0000000..564e046 --- /dev/null +++ b/.config/nvim/lua/plugins/rustaceanvim.lua @@ -0,0 +1,8 @@ +return { + 'mrcjkb/rustaceanvim', + version = '^5', + lazy = false, -- already lazy + init = function() + require('rustaceanvim') + end, +} diff --git a/.config/nvim/lua/plugins/snacks.lua b/.config/nvim/lua/plugins/snacks.lua new file mode 100644 index 0000000..50f4ff2 --- /dev/null +++ b/.config/nvim/lua/plugins/snacks.lua @@ -0,0 +1,45 @@ +return { + 'folke/snacks.nvim', + priority = 1000, + lazy = false, + ---@type snacks.Config + opts = { + image = {}, + ---@class snacks.notifier.Config + notifier = { + ---@type snacks.notifier.style + style = 'compact', + filter = function(notif) + local filtered_messages = { 'No information available', 'No code actions available' } + for _, msg in ipairs(filtered_messages) do + if notif.msg == msg then + return false + end + end + return true + end, + }, + }, + keys = { + { + '<leader>si', + function() + Snacks.image.hover() + end, + }, + { + '<leader>nd', + function() + Snacks.notifier.hide() + end, + desc = '[N]otifications [D]ismiss All', + }, + { + '<leader>nh', + function() + Snacks.notifier.show_history() + end, + desc = '[N]otifications [D]ismiss All', + }, + }, +} diff --git a/.config/nvim/lua/plugins/sqls.lua b/.config/nvim/lua/plugins/sqls.lua new file mode 100644 index 0000000..a060415 --- /dev/null +++ b/.config/nvim/lua/plugins/sqls.lua @@ -0,0 +1,3 @@ +return { + 'nanotee/sqls.nvim', +} diff --git a/.config/nvim/lua/plugins/suda.lua b/.config/nvim/lua/plugins/suda.lua new file mode 100644 index 0000000..39866cd --- /dev/null +++ b/.config/nvim/lua/plugins/suda.lua @@ -0,0 +1,4 @@ +return { + 'lambdalisue/vim-suda', + event = { 'BufReadPre', 'BufNewFile' }, +} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..b3e09af --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,22 @@ +return { + 'nvim-telescope/telescope.nvim', + tag = '0.1.5', + dependencies = { + 'nvim-lua/plenary.nvim', + { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, + 'nvim-telescope/telescope-ui-select.nvim', + }, + cmd = 'Telescope', + config = function() + require('telescope_helper') + end, + keys = { + '<leader>fs', + '<leader>fa', + '<leader>fh', + '<leader>fm', + '<leader>lv', + '<leader>f.', + '<leader>th', + }, +} diff --git a/.config/nvim/lua/plugins/tiny-inline-diagnostic.lua b/.config/nvim/lua/plugins/tiny-inline-diagnostic.lua new file mode 100644 index 0000000..620f20f --- /dev/null +++ b/.config/nvim/lua/plugins/tiny-inline-diagnostic.lua @@ -0,0 +1,24 @@ +return { + 'rachartier/tiny-inline-diagnostic.nvim', + event = { 'BufReadPre', 'BufNewFile' }, + opts = { + options = { + -- Throttle the update of the diagnostic when moving cursor, in milliseconds. + -- You can increase it if you have performance issues. + -- Or set it to 0 to have better visuals. + throttle = 0, + + -- The minimum length of the message, otherwise it will be on a new line. + softwrap = 15, + + -- If multiple diagnostics are under the cursor, display all of them. + multiple_diag_under_cursor = true, + + --- Enable it if you want to always have message with `after` characters length. + break_line = { + enabled = false, + after = 30, + }, + }, + }, +} diff --git a/.config/nvim/lua/plugins/todo-comments.lua b/.config/nvim/lua/plugins/todo-comments.lua new file mode 100644 index 0000000..799afd8 --- /dev/null +++ b/.config/nvim/lua/plugins/todo-comments.lua @@ -0,0 +1,95 @@ +-- NORMAL: lorem ipsum +-- TODO: lorem ipsum +-- FIX: lorem ipsum +-- OPTIMIZE: lorem ipsum +-- WARN: lorem ipsum +-- PERF: lorem ipsum +-- HACK: lorem ipsum +-- NOTE: lorem ipsum +-- TEST: lorem ipsum +-- UNSAFE: lorem ipsum +return { + 'folke/todo-comments.nvim', + dependencies = { 'nvim-lua/plenary.nvim' }, + event = 'VeryLazy', + keys = { + { '<leader>st', '<cmd>TodoTelescope keywords=TODO,FIX<cr>', desc = '[S]earch [T]odos' }, + { '<leader>lt', '<cmd>TodoTrouble<cr>', desc = '[L]ist [T]odos' }, + }, + config = function() + require('todo-comments').setup({ + signs = false, -- show icons in the signs column + sign_priority = 8, -- sign priority + keywords = { + -- NOTE: These are "todos" + TODO = { icon = ' ', color = 'info', alt = { 'todo' } }, + FIX = { icon = ' ', color = 'error', alt = { 'FIXME', 'BUG', 'ISSUE' } }, + OPTIMIZE = { icon = ' ', color = 'performance' }, + -- NOTE: These are "notes" + WARN = { icon = ' ', color = 'warning', alt = { 'WARNING' } }, + PERF = { icon = ' ', color = 'performance', alt = { 'PERFORMANCE' } }, + HACK = { icon = ' ', color = 'warning', alt = { 'SMELL', 'CODE SMELL', 'BAD', 'BAD PRACTICE' } }, + NOTE = { icon = ' ', color = 'hint', alt = { 'INFO' } }, + TEST = { icon = ' ', color = 'test', alt = { 'TESTING', 'PASSED', 'FAILED' } }, + UNSAFE = { icon = ' ', color = 'error', alt = { 'SAFETY' } }, + }, + gui_style = { + fg = 'NONE', + bg = 'BOLD', + }, + merge_keywords = true, -- when true, custom keywords will be merged with the defaults + -- highlighting of the line containing the todo comment + -- * before: highlights before the keyword (typically comment characters) + -- * keyword: highlights of the keyword + -- * after: highlights after the keyword (todo text) + highlight = { + multiline = true, + multiline_pattern = '^.', -- lua pattern to match the next multiline from the start of the matched keyword + multiline_context = 10, -- extra lines that will be re-evaluated when changing a line + before = '', -- "fg" or "bg" or empty + keyword = 'wide', -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg) + after = 'fg', -- "fg" or "bg" or empty + -- TODO(): + pattern = { + -- [[.*<(KEYWORDS)\s*(.*)?\s*:]], -- default + [[.*<(KEYWORDS)\s*:]], -- default + [[.*<(KEYWORDS)\s*!?\(\):]], -- keyword!() syntax + -- [[.*<(KEYWORDS)\s*\(.*\):]], -- keyword(anything) syntax + [[.*<(KEYWORDS)\s* ?\(.*\):]], -- keyword(anything) syntax + [[.*<(KEYWORDSky)\s*:]], -- keyword(anything) syntax + }, -- pattern or table of patterns, used for highlighting (vim regex) + comments_only = false, + max_line_len = 400, + exclude = {}, -- list of excluded filetypes + }, + -- list of named colors where we try to extract the gui fg from the + -- list of highlight groups or use the hex color if hl not found as a fallback + colors = { + default = { 'Identifier', '#7C3AED' }, + error = { 'DiagnosticError', 'ErrorMsg', '#DC2626' }, + warning = { 'DiagnosticWarn', 'WarningMsg', '#FBBF24' }, + info = { 'DiagnosticInfo', '#2563EB' }, + hint = { '#10B981' }, + test = { 'Identifier', '#FF00FF' }, + performance = { '#7C3AED' }, + }, + search = { + command = 'rg', + args = { + '--color=never', + '--no-heading', + '--with-filename', + '--line-number', + '--column', + -- "--hidden", -- show todos in hidden directories and files + '--follow', -- follow symlinks + }, + -- regex that will be used to match keywords. + -- don't replace the (KEYWORDS) placeholder + pattern = [[\b(KEYWORDS)(?:\(([^)]*)\))?:]], -- supports optional `(anything)` before colon + -- pattern = [[\b(KEYWORDS):]], -- default + -- pattern = [[\b(KEYWORDS)\b]], -- no colon + }, + }) + end, +} diff --git a/.config/nvim/lua/plugins/trouble.lua b/.config/nvim/lua/plugins/trouble.lua new file mode 100644 index 0000000..3239aa7 --- /dev/null +++ b/.config/nvim/lua/plugins/trouble.lua @@ -0,0 +1,40 @@ +return { + 'folke/trouble.nvim', + opts = {}, + cmd = 'Trouble', + -- TODO: Consider maybe using this for outlines (code structure) + -- and also configuring some of the keys to better fit me + -- and probably removing most of them in the process + keys = { + { + '<leader>xx', + '<cmd>Trouble diagnostics toggle<cr>', + desc = 'Diagnostics (Trouble)', + }, + { + '<leader>xX', + '<cmd>Trouble diagnostics toggle filter.buf=0<cr>', + desc = 'Buffer Diagnostics (Trouble)', + }, + { + '<leader>cs', + '<cmd>Trouble symbols toggle focus=false<cr>', + desc = 'Symbols (Trouble)', + }, + { + '<leader>cl', + '<cmd>Trouble lsp toggle focus=false win.position=right<cr>', + desc = 'LSP Definitions / references / ... (Trouble)', + }, + { + '<leader>xL', + '<cmd>Trouble loclist toggle<cr>', + desc = 'Location List (Trouble)', + }, + { + '<leader>xQ', + '<cmd>Trouble qflist toggle<cr>', + desc = 'Quickfix List (Trouble)', + }, + }, +} diff --git a/.config/nvim/lua/plugins/undotree.lua b/.config/nvim/lua/plugins/undotree.lua new file mode 100644 index 0000000..cbbeffb --- /dev/null +++ b/.config/nvim/lua/plugins/undotree.lua @@ -0,0 +1,14 @@ +return { + 'mbbill/undotree', + keys = { { '<leader>ut', vim.cmd.UndotreeToggle } }, + config = function() + vim.g.undotree_DiffAutoOpen = false + vim.g.undotree_DiffpanelHeight = 0 + vim.g.undotree_SetFocusWhenToggle = false + vim.g.undotree_HelpLine = false + vim.g.undotree_TreeNodeShape = '' + vim.g.undotree_TreeVertShape = '│' + vim.g.undotree_TreeSplitShape = '─┘' + vim.g.undotree_TreeReturnShape = '─┐' + end, +} diff --git a/.config/nvim/lua/plugins/vim-be-good.lua b/.config/nvim/lua/plugins/vim-be-good.lua new file mode 100644 index 0000000..03fd98f --- /dev/null +++ b/.config/nvim/lua/plugins/vim-be-good.lua @@ -0,0 +1,4 @@ +return { + 'ThePrimeagen/vim-be-good', + cmd = 'VimBeGood', +} diff --git a/.config/nvim/lua/plugins/vim-illuminate.lua b/.config/nvim/lua/plugins/vim-illuminate.lua new file mode 100644 index 0000000..69091db --- /dev/null +++ b/.config/nvim/lua/plugins/vim-illuminate.lua @@ -0,0 +1,7 @@ +return { + 'RRethy/vim-illuminate', + event = 'LspAttach', + keys = { + { '<leader>it', '<cmd>IlluminateToggle<cr>', desc = '[I]lluminate [Tloggle]' }, + }, +} diff --git a/.config/nvim/lua/plugins/vim-tmux-navigator.lua b/.config/nvim/lua/plugins/vim-tmux-navigator.lua new file mode 100644 index 0000000..de08d82 --- /dev/null +++ b/.config/nvim/lua/plugins/vim-tmux-navigator.lua @@ -0,0 +1,9 @@ +return { + 'christoomey/vim-tmux-navigator', + keys = { + { '<C-h>', '<cmd>TmuxNavigateLeft<cr>', mode = { 'n', 'i' } }, + { '<C-j>', '<cmd>TmuxNavigateDown<cr>', mode = { 'n', 'i' } }, + { '<C-k>', '<cmd>TmuxNavigateUp<cr>', mode = { 'n', 'i' } }, + { '<C-l>', '<cmd>TmuxNavigateRight<cr>', mode = { 'n', 'i' } }, + }, +} diff --git a/.config/nvim/lua/plugins/vim-wakatime.lua b/.config/nvim/lua/plugins/vim-wakatime.lua new file mode 100644 index 0000000..515c6d0 --- /dev/null +++ b/.config/nvim/lua/plugins/vim-wakatime.lua @@ -0,0 +1,4 @@ +return { + 'wakatime/vim-wakatime', + event = 'VeryLazy', +} |
