├── .gitignore ├── .luarc.json ├── LICENSE ├── README.org ├── init.lua ├── lsp ├── clangd.lua ├── copilot.lua ├── gopls.lua ├── lua_ls.lua ├── nixd.lua ├── pyright.lua ├── vtsls.lua ├── vue_ls.lua └── zls.lua ├── lua ├── autocmds.lua ├── custom.lua ├── ffidef.lua ├── init.lua ├── keymaps.lua ├── locals.lua ├── lsp.lua ├── manager.lua ├── misc.lua ├── options.lua ├── plugins │ ├── colorscheme │ │ ├── base16.lua │ │ ├── catppuccin.lua │ │ ├── github.lua │ │ ├── gruvbox.lua │ │ ├── horizon.lua │ │ ├── night-owl.lua │ │ ├── nightfox.lua │ │ ├── onedark.lua │ │ ├── oxocarbon.lua │ │ ├── rose-pine.lua │ │ └── tokyonight.lua │ ├── dap │ │ ├── cmake-tools.lua │ │ ├── dap-go.lua │ │ ├── dap-python.lua │ │ ├── dap-repl-highlights.lua │ │ ├── dap-ui.lua │ │ ├── dap-virtual-text.lua │ │ ├── dap.lua │ │ └── one-small-step-for-vimkind.lua │ ├── edit │ │ ├── blink.lua │ │ ├── cmp.lua │ │ ├── comment.lua │ │ ├── copilot.lua │ │ ├── ibus-sw.lua │ │ ├── iswap.lua │ │ ├── neogen.lua │ │ ├── obsidian.lua │ │ ├── parinfer.lua │ │ ├── scissors.lua │ │ ├── snip.lua │ │ ├── suda.lua │ │ ├── surround.lua │ │ ├── table-mode.lua │ │ └── ultimate-autopair.lua │ ├── efficiency │ │ ├── dial.lua │ │ ├── early-retirement.lua │ │ ├── flash.lua │ │ ├── flatten.lua │ │ ├── gx.lua │ │ ├── ibus-sw.lua │ │ ├── img-clip.lua │ │ ├── next.lua │ │ ├── project.lua │ │ ├── session-manager.lua │ │ ├── sleuth.lua │ │ ├── startuptime.lua │ │ └── winshift.lua │ ├── filetype │ │ ├── crates.lua │ │ ├── csv.lua │ │ ├── gopher.lua │ │ ├── hex.lua │ │ ├── kitty.lua │ │ ├── lilypond-suite.lua │ │ ├── package-info.lua │ │ ├── rest.lua │ │ ├── tailwind-tools.lua │ │ └── tex.lua │ ├── git │ │ ├── diffview.lua │ │ ├── flog.lua │ │ ├── fugitive.lua │ │ ├── gist.lua │ │ ├── git-conflict.lua │ │ ├── gitlinker.lua │ │ ├── gitsigns.lua │ │ ├── neogit.lua │ │ └── octo.lua │ ├── init.lua │ ├── lib │ │ ├── litee.lua │ │ ├── luvit.lua │ │ ├── mini.lua │ │ ├── nio.lua │ │ ├── plenary.lua │ │ └── snacks.lua │ ├── lsp │ │ ├── clangd_extensions.lua │ │ ├── emmet.lua │ │ ├── flutter-tools.lua │ │ ├── jdtls.lua │ │ ├── lazydev.lua │ │ ├── lspconfig.lua │ │ ├── rustacean.lua │ │ ├── schema-store.lua │ │ ├── typescript-tools.lua │ │ └── vtsls.lua │ ├── tool │ │ ├── 2048.lua │ │ ├── aerial.lua │ │ ├── conform.lua │ │ ├── copilot-chat.lua │ │ ├── dadbod-ui.lua │ │ ├── dadbod.lua │ │ ├── direnv.lua │ │ ├── fundo.lua │ │ ├── fzf.lua │ │ ├── gp.lua │ │ ├── image.lua │ │ ├── kitty-scrollback.lua │ │ ├── leetcode.lua │ │ ├── lint.lua │ │ ├── mason.lua │ │ ├── navbuddy.lua │ │ ├── neo-tree.lua │ │ ├── neoconf.lua │ │ ├── neotest.lua │ │ ├── oil.lua │ │ ├── outline.lua │ │ ├── overseer.lua │ │ ├── screenkey.lua │ │ ├── tmux.lua │ │ ├── toggleterm.lua │ │ ├── tree.lua │ │ ├── undotree.lua │ │ ├── which-key.lua │ │ └── window-picker.lua │ ├── treesitter │ │ ├── autotag.lua │ │ ├── commentstring.lua │ │ ├── context.lua │ │ ├── textobjects.lua │ │ ├── treesitter.lua │ │ └── treesj.lua │ └── ui │ │ ├── actions-preview.lua │ │ ├── alpha.lua │ │ ├── bqf.lua │ │ ├── bufferline.lua │ │ ├── ccc.lua │ │ ├── colorizer.lua │ │ ├── dropbar.lua │ │ ├── fidget.lua │ │ ├── illuminate.lua │ │ ├── inc-rename.lua │ │ ├── indent-blankline.lua │ │ ├── lspkind.lua │ │ ├── lualine.lua │ │ ├── marks.lua │ │ ├── nabla.lua │ │ ├── noice.lua │ │ ├── notify.lua │ │ ├── quicker.lua │ │ ├── rainbow-delimiters.lua │ │ ├── regexplainer.lua │ │ ├── scrollview.lua │ │ ├── sentiment.lua │ │ ├── statuscol.lua │ │ ├── tabline.lua │ │ ├── tint.lua │ │ ├── todo-comments.lua │ │ ├── ufo.lua │ │ ├── virt-column.lua │ │ ├── wezterm.lua │ │ └── zen-mode.lua └── utils.lua ├── queries └── typescript │ └── highlights.scm └── stylua.toml /.gitignore: -------------------------------------------------------------------------------- 1 | lua/packer_compiled.lua 2 | lazy-lock.json 3 | 4 | lua/defined-locals.lua 5 | -------------------------------------------------------------------------------- /.luarc.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", 3 | "runtime": { 4 | "version": "LuaJIT" 5 | }, 6 | "workspace": { 7 | "ignoreDir": [ 8 | "lua/snippets" 9 | ] 10 | }, 11 | "diagnostics.disable": [ 12 | "missing-fields" 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 ofseed 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.org: -------------------------------------------------------------------------------- 1 | #+title: Nvim 2 | #+author: Yi Ming 3 | 4 | /NOTE: This ~README~ is outdated, the project structure has been fully changed./ 5 | /The profile requires Neovim nightly now./ 6 | 7 | My personal Neovim configuration, which keeps the structure simple and 8 | straightforward by logically distributing the configuration into various 9 | directories. Aims to be highly customizable and have no hacks. 10 | 11 | [[https://github.com/ofseed/nvim/assets/61115159/dec86ed6-b708-4736-a485-b51755864aed.png]] 12 | 13 | * Table of Contents :toc: 14 | - [[#introduction][Introduction]] 15 | - [[#directory-structure][Directory Structure]] 16 | 17 | * Introduction 18 | This configuration doesn't break any of Neovim's default keymaps, 19 | except for =s=, the source-level equivalent of =cl=, =s= is used as 20 | the [[https://github.com/easymotion/vim-easymotion#default-bindings][easymotion-prefix]](In fact the functionality of easymotion is 21 | provided by a plugin called [[https://github.com/phaazon/hop.nvim][hop.nvim]]). 22 | 23 | This configuration contains more than 100 plugins, but the configuration 24 | of each plugin is placed in a separate file, and these files are 25 | classified into different modules according to the function of the 26 | plugin and placed in different folders. 27 | 28 | In addition, all configuration options and keymaps for each plugin 29 | are listed in their respective files, making it easy to adjust 30 | individual options without having to look up the manual. 31 | 32 | The configuration structure is as shown in the figure below. 33 | 34 | #+begin_src screen 35 | │ ┌──────────────────┐ 36 | nvim/ nvim/lua │ Core Module │ 37 | │ │ ┌──────────────┐ │ 38 | │ │lspconfig.lua │ │ 39 | │ ┌───────────┐ │ └──────────────┘ │ 40 | │keymaps.lua│ ┌─────►│ │ 41 | │ └───────────┘ │ │ ┌──────────────┐ │ 42 | Keymap for lazy │ │ │treesitter.lua│ │ 43 | │ loading plugins │ │ └──────────────┘ │ 44 | ▲ │ │ │ 45 | │ │ │ │ ...other files │ 46 | │ │ └──────────────────┘ 47 | ┌──────────┐ │ ┌─────┴────┐ │ 48 | │ init.lua ├───────►│ init.lua │ │ ┌──────────────────┐ 49 | └──────────┘ │ └──────────┘ │ │ Interface Module │ 50 | Neovim common Neovim extra │ │ ┌──────────────┐ │ 51 | configuration │ configuration │ │ │bufferline.lua│ │ 52 | │ │ │ └──────────────┘ │ 53 | │ │ │ │ │ 54 | ▼ │ │ ┌──────────────┐ │ 55 | │ ┌───────────┐ │ │ │ lualine.lua │ │ 56 | │plugins.lua├─────┼─────►│ └──────────────┘ │ 57 | │ └───────────┘ │ │ │ 58 | Plugin management, │ │ ...other files │ 59 | │ calling each module │ └──────────────────┘ 60 | │ 61 | │ │ ┌──────────────────┐ 62 | └─────►│ ...other modules │ 63 | │ └──────────────────┘ 64 | #+end_src 65 | 66 | * Directory Structure 67 | #+begin_src screen 68 | ├── lua 69 | │ ├── core # Core plugins, often depended on by other plugins 70 | │ │ ├── lspconfig.lua 71 | │ │ ├── treesitter.lua 72 | │ │ └── ... 73 | │ ├── debug # Debug and run 74 | │ │ ├── dap.lua 75 | │ │ ├── dap-ui.lua 76 | │ │ └── ... 77 | │ ├── edit # Text edting 78 | │ │ ├── cmp.lua 79 | │ │ ├── copilot.lua 80 | │ │ └── ... 81 | │ ├── efficiency # Efficiency Improvement 82 | │ │ ├── session-manager.lua 83 | │ │ ├── telescope.lua 84 | │ │ └── ... 85 | │ ├── interface # Interface Extension 86 | │ │ ├── bufferline.lua 87 | │ │ ├── lualine.lua 88 | │ │ └── ... 89 | │ ├── language # Language Specific 90 | │ │ ├── jdtls.lua 91 | │ │ └── tex.lua 92 | │ ├── tool # Tool Integration 93 | │ │ ├── gitsigns.lua 94 | │ │ ├── tree.lua 95 | │ │ └── ... 96 | │ ├── plugins.lua # Plugin management 97 | │ ├── keymaps.lua # Keymap for lazy loading plugins 98 | │ └── init.lua # Neovim extra configuration 99 | ├── .gitignore 100 | ├── stylua.toml 101 | ├── LICENSE 102 | ├── README.org 103 | └── init.lua # Neovim common configuration 104 | #+end_src 105 | -------------------------------------------------------------------------------- /init.lua: -------------------------------------------------------------------------------- 1 | vim.loader.enable() 2 | require "init" 3 | -------------------------------------------------------------------------------- /lsp/clangd.lua: -------------------------------------------------------------------------------- 1 | ---@type vim.lsp.Config 2 | return { 3 | cmd = { "clangd", "--header-insertion-decorators=0" }, 4 | } 5 | -------------------------------------------------------------------------------- /lsp/copilot.lua: -------------------------------------------------------------------------------- 1 | return { 2 | cmd = { 3 | "./node_modules/@github/copilot-language-server/native/linux-x64/copilot-language-server", 4 | "--stdio", 5 | }, 6 | filetypes = { "javascript" }, 7 | init_options = { 8 | editorInfo = { 9 | name = "Neovim", 10 | version = tostring(vim.version()), 11 | }, 12 | editorPluginInfo = { 13 | name = "Neovim", 14 | version = tostring(vim.version()), 15 | }, 16 | }, 17 | settings = { 18 | telemetry = { 19 | telemetryLevel = "all", 20 | }, 21 | }, 22 | on_attach = function(client, bufnr) 23 | vim.keymap.set("n", "", function() 24 | client:request( 25 | ---@diagnostic disable-next-line: param-type-mismatch 26 | "signIn", 27 | -- HACK: Error when passing empty params 28 | { field = "placeholder" }, 29 | function(err, result) 30 | if err then 31 | vim.notify(vim.inspect(err), vim.log.levels.ERROR) 32 | return 33 | end 34 | if result.command then 35 | local command = result.command 36 | local code = result.userCode 37 | vim.fn.setreg("+", code) 38 | vim.fn.setreg("*", code) 39 | client:exec_cmd( 40 | command, 41 | { bufnr = bufnr }, 42 | function(cmd_err, cmd_result) 43 | if cmd_err then 44 | vim.print(cmd_err) 45 | return 46 | end 47 | vim.print(cmd_result) 48 | end 49 | ) 50 | end 51 | vim.print(result) 52 | end 53 | ) 54 | end, { buffer = bufnr, desc = "Sign In" }) 55 | vim.keymap.set("n", "", function() 56 | client:request( 57 | ---@diagnostic disable-next-line: param-type-mismatch 58 | -- HACK: Error when passing empty params 59 | "signOut", 60 | { 61 | field = "placehoder", 62 | }, 63 | function(err, result) 64 | if err then 65 | vim.notify(vim.inspect(err), vim.log.levels.ERROR) 66 | return 67 | end 68 | vim.print(result) 69 | end 70 | ) 71 | end, { buffer = bufnr, desc = "Sign Out" }) 72 | vim.keymap.set("n", "", function() 73 | vim.lsp.inline_completion.trigger() 74 | end, { desc = "Trigger or accept completion", buffer = bufnr }) 75 | vim.keymap.set("n", "", function() 76 | vim.lsp.inline_completion.jump { count = 1 } 77 | end, { desc = "Next completion", buffer = bufnr }) 78 | vim.keymap.set("n", "", function() 79 | vim.lsp.inline_completion.jump { count = -1 } 80 | end, { desc = "Previous completion", buffer = bufnr }) 81 | end, 82 | } 83 | -------------------------------------------------------------------------------- /lsp/gopls.lua: -------------------------------------------------------------------------------- 1 | ---@type vim.lsp.Config 2 | return { 3 | on_attach = function(client) 4 | client.server_capabilities.documentFormattingProvider = false 5 | end, 6 | settings = { 7 | gopls = { 8 | hints = { 9 | assignVariableTypes = true, 10 | compositeLiteralFields = true, 11 | compositeLiteralTypes = true, 12 | constantValues = true, 13 | functionTypeParameters = true, 14 | parameterNames = true, 15 | rangeVariableTypes = true, 16 | }, 17 | }, 18 | }, 19 | } 20 | -------------------------------------------------------------------------------- /lsp/lua_ls.lua: -------------------------------------------------------------------------------- 1 | ---@type vim.lsp.Config 2 | return { 3 | on_attach = function(client) 4 | -- `foldexpr` is `vim.treesitter.foldexpr` by default 5 | vim.wo[0][0].foldexpr = "v:lua.vim.lsp.foldexpr()" 6 | client.server_capabilities.documentFormattingProvider = false 7 | end, 8 | settings = { 9 | Lua = { 10 | runtime = { 11 | version = "LuaJIT", 12 | }, 13 | hint = { 14 | enable = true, 15 | setType = true, 16 | }, 17 | codeLens = { 18 | enable = true, 19 | }, 20 | completion = { 21 | postfix = ".", 22 | showWord = "Disable", 23 | workspaceWord = false, 24 | }, 25 | diagnostics = { 26 | disable = { 27 | "unused-function", 28 | "empty-block", 29 | }, 30 | }, 31 | }, 32 | }, 33 | } 34 | -------------------------------------------------------------------------------- /lsp/nixd.lua: -------------------------------------------------------------------------------- 1 | ---@type vim.lsp.Config 2 | return { 3 | settings = { 4 | nixd = { 5 | nixpkgs = { 6 | expr = 'import (builtins.getFlake "/home/ofseed/flake").inputs.nixpkgs { }', 7 | }, 8 | options = { 9 | nixos = { 10 | expr = '(builtins.getFlake "/home/ofseed/flake").nixosConfigurations.ofseed.options', 11 | }, 12 | home_manager = { 13 | expr = '(builtins.getFlake "/home/ofseed/flake").homeConfigurations.ofseed.options', 14 | }, 15 | }, 16 | }, 17 | }, 18 | } 19 | -------------------------------------------------------------------------------- /lsp/pyright.lua: -------------------------------------------------------------------------------- 1 | ---@type vim.lsp.Config 2 | return { 3 | cmd = { "delance-langserver", "--stdio" }, 4 | settings = { 5 | python = { 6 | analysis = { 7 | typeCheckingMode = "off", 8 | inlayHints = { 9 | callArgumentNames = "partial", 10 | functionReturnTypes = true, 11 | pytestParameters = true, 12 | variableTypes = true, 13 | }, 14 | }, 15 | }, 16 | }, 17 | } 18 | -------------------------------------------------------------------------------- /lsp/vtsls.lua: -------------------------------------------------------------------------------- 1 | ---@type vim.lsp.Config 2 | return { 3 | on_attach = function(client) 4 | client.server_capabilities.documentFormattingProvider = false 5 | end, 6 | settings = { 7 | vtsls = { 8 | autoUseWorkspaceTsdk = true, 9 | }, 10 | typescript = { 11 | preferences = { 12 | importModuleSpecifier = "non-relative", 13 | }, 14 | inlayHints = { 15 | enumMemberValues = { 16 | enabled = true, 17 | }, 18 | functionLikeReturnTypes = { 19 | enabled = true, 20 | }, 21 | parameterNames = { 22 | enabled = "all", 23 | suppressWhenArgumentMatchesName = true, 24 | }, 25 | parameterTypes = { 26 | enabled = true, 27 | }, 28 | propertyDeclarationTypes = { 29 | enabled = true, 30 | }, 31 | variableTypes = { 32 | enabled = true, 33 | suppressWhenTypeMatchesName = true, 34 | }, 35 | }, 36 | }, 37 | }, 38 | } 39 | -------------------------------------------------------------------------------- /lsp/vue_ls.lua: -------------------------------------------------------------------------------- 1 | ---@type vim.lsp.Config 2 | return { 3 | on_attach = function(client) 4 | client.server_capabilities.documentFormattingProvider = false 5 | end, 6 | } 7 | -------------------------------------------------------------------------------- /lsp/zls.lua: -------------------------------------------------------------------------------- 1 | ---@type vim.lsp.Config 2 | return { 3 | settings = { 4 | zls = { 5 | inlay_hints_hide_redundant_param_names = true, 6 | inlay_hints_hide_redundant_param_names_last_token = true, 7 | warn_style = true, 8 | highlight_global_var_declarations = true, 9 | }, 10 | }, 11 | } 12 | -------------------------------------------------------------------------------- /lua/autocmds.lua: -------------------------------------------------------------------------------- 1 | local group = vim.api.nvim_create_augroup("ofseed", {}) 2 | 3 | --[[ 4 | vim.api.nvim_create_autocmd("FileType", { 5 | group = group, 6 | desc = "Enable treesitter highlight for supported filetypes", 7 | callback = function(args) 8 | local bufnr = args.buf 9 | pcall(vim.treesitter.start, bufnr) 10 | end, 11 | }) 12 | --]] 13 | 14 | -- Indent wrapped lines based on indent settings except for ignored filetypes 15 | local ignored_filetypes = { "text", "markdown", "org" } 16 | ---@alias option_scope "global" | "local" | nil 17 | ---@param scope option_scope 18 | local function set_breakindentopt(scope) 19 | local indent 20 | if vim.api.nvim_get_option_value("expandtab", { scope = scope }) then 21 | indent = vim.api.nvim_get_option_value("shiftwidth", { scope = scope }) 22 | else 23 | indent = vim.api.nvim_get_option_value("tabstop", { scope = scope }) 24 | end 25 | vim.api.nvim_set_option_value( 26 | "breakindentopt", 27 | "shift:" .. indent, 28 | { scope = scope } 29 | ) 30 | end 31 | -- This autocmd implicitly rely on `vim-sleuth` to trigger 32 | vim.api.nvim_create_autocmd({ "OptionSet" }, { 33 | group = group, 34 | pattern = { "expandtab", "shiftwidth", "tabstop" }, 35 | desc = "Set 'breakindentopt' based on indent settings", 36 | callback = function(args) 37 | local is_ignored_filetype = 38 | vim.tbl_contains(ignored_filetypes, vim.bo[args.buf].filetype) 39 | ---@type option_scope 40 | local scope = vim.v.option_type 41 | if vim.v.option_command == "set" and not is_ignored_filetype then 42 | scope = nil 43 | end 44 | 45 | if scope == "local" and is_ignored_filetype then 46 | else 47 | set_breakindentopt(scope) 48 | end 49 | end, 50 | }) 51 | 52 | vim.api.nvim_create_autocmd("BufRead", { 53 | group = group, 54 | desc = "Restore last cursor position", 55 | callback = function(args) 56 | local bufnr = args.buf 57 | local line, col = unpack(vim.api.nvim_buf_get_mark(bufnr, '"')) 58 | local winid = vim.api.nvim_get_current_win() 59 | 60 | local end_line = vim.api.nvim_buf_line_count(bufnr) 61 | local end_col = 62 | #vim.api.nvim_buf_get_lines(bufnr, end_line - 1, end_line, true)[1] 63 | if line < end_line or (line == end_line and col <= end_col) then 64 | vim.api.nvim_win_set_cursor(winid, { line, col }) 65 | end 66 | end, 67 | }) 68 | 69 | vim.api.nvim_create_autocmd({ 70 | "FocusGained", 71 | "BufEnter", 72 | "CursorHold", 73 | }, { 74 | group = group, 75 | desc = "Reload buffer on focus", 76 | callback = function() 77 | if vim.fn.getcmdwintype() == "" then 78 | vim.cmd "checktime" 79 | end 80 | end, 81 | }) 82 | 83 | vim.api.nvim_create_autocmd("TextYankPost", { 84 | --- A specific group easy to override 85 | group = vim.api.nvim_create_augroup("highlight_on_yank", {}), 86 | desc = "Briefly highlight yanked text", 87 | callback = function() 88 | vim.highlight.on_yank() 89 | end, 90 | }) 91 | 92 | -- Filetype specific 93 | vim.api.nvim_create_autocmd("FileType", { 94 | group = group, 95 | pattern = "qf", 96 | desc = "Disallow change buf for quickfix", 97 | callback = function() 98 | vim.wo.winfixbuf = true 99 | end, 100 | }) 101 | 102 | vim.api.nvim_create_autocmd("FileType", { 103 | group = group, 104 | pattern = "go", 105 | desc = "Set indent for go", 106 | callback = function() 107 | vim.bo.tabstop = 4 108 | vim.bo.shiftwidth = 4 109 | vim.bo.expandtab = false 110 | end, 111 | }) 112 | -------------------------------------------------------------------------------- /lua/custom.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | -- Colorscheme 4 | M.theme = "catppuccin" 5 | 6 | -- Border style of floating windows 7 | M.border = "rounded" 8 | 9 | -- Width of side windows 10 | M.width = function() 11 | return math.max(math.floor(vim.go.columns * 0.2), 30) 12 | end 13 | 14 | local append_space = function(icons) 15 | local result = {} 16 | for k, v in pairs(icons) do 17 | result[k] = v .. " " 18 | end 19 | return result 20 | end 21 | 22 | local kind_icons = { 23 | Array = "", 24 | Boolean = "", 25 | Class = "", 26 | Color = "", 27 | Constant = "", 28 | Constructor = "", 29 | Enum = "", 30 | EnumMember = "", 31 | Event = "", 32 | Field = "", 33 | File = "", 34 | Folder = "", 35 | Function = "", 36 | Interface = "", 37 | Key = "", 38 | Keyword = "", 39 | Method = "", 40 | Module = "", 41 | Namespace = "", 42 | Null = "", 43 | Number = "", 44 | Object = "", 45 | Operator = "", 46 | Package = "", 47 | Property = "", 48 | Reference = "", 49 | Snippet = "", 50 | String = "", 51 | Struct = "", 52 | Text = "", 53 | TypeParameter = "", 54 | Unit = "", 55 | Value = "", 56 | Variable = "", 57 | } 58 | 59 | M.icons = { 60 | -- LSP diagnostic 61 | diagnostic = { 62 | error = "󰅚 ", 63 | warn = "󰀪 ", 64 | hint = "󰌶 ", 65 | info = "󰋽 ", 66 | }, 67 | -- LSP kinds 68 | kind = kind_icons, 69 | kind_with_space = append_space(kind_icons), 70 | } 71 | 72 | M.cmp_format = { 73 | mode = "symbol", 74 | maxwidth = 50, 75 | menu = { 76 | lazydev = "[DEV]", 77 | luasnip = "[SNP]", 78 | nvim_lsp = "[LSP]", 79 | nvim_lua = "[VIM]", 80 | dap = "[DAP]", 81 | buffer = "[BUF]", 82 | path = "[PTH]", 83 | calc = "[CLC]", 84 | latex_symbols = "[TEX]", 85 | orgmode = "[ORG]", 86 | cmdline = "[CMD]", 87 | }, 88 | } 89 | 90 | return M 91 | -------------------------------------------------------------------------------- /lua/ffidef.lua: -------------------------------------------------------------------------------- 1 | local ffi = require "ffi" 2 | 3 | ---@class foldinfo_T 4 | ---@field start integer 5 | ---@field level integer 6 | ---@field llevel integer 7 | ---@field lines integer 8 | ffi.cdef [[ 9 | typedef struct { 10 | int start; // line number where deepest fold starts 11 | int level; // fold level, when zero other fields are N/A 12 | int llevel; // lowest level that starts in v:lnum 13 | int lines; // number of lines from v:lnum to end of closed fold 14 | } foldinfo_T; 15 | ]] 16 | 17 | ffi.cdef [[ 18 | typedef struct {} Error; 19 | typedef struct {} win_T; 20 | foldinfo_T fold_info(win_T* win, int lnum); 21 | win_T *find_window_by_handle(int Window, Error *err); 22 | ]] 23 | 24 | return ffi 25 | -------------------------------------------------------------------------------- /lua/init.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | require "options" 4 | require "misc" 5 | require "keymaps" 6 | require "autocmds" 7 | require "lsp" 8 | require "manager" 9 | 10 | vim.cmd.colorscheme(custom.theme) 11 | -------------------------------------------------------------------------------- /lua/keymaps.lua: -------------------------------------------------------------------------------- 1 | local utils = require "utils" 2 | 3 | vim.keymap.set("t", "", "") 4 | vim.keymap.set("c", "", "") 5 | vim.keymap.set("c", "", "") 6 | vim.keymap.set("s", "", "startinsert") 7 | vim.keymap.set("s", "", "startinsert") 8 | vim.keymap.set({ "n", "x", "o" }, "j", "gj") 9 | vim.keymap.set({ "n", "x", "o" }, "k", "gk") 10 | vim.keymap.set({ "n", "x", "o" }, "gj", "j") 11 | vim.keymap.set({ "n", "x", "o" }, "gk", "k") 12 | vim.g.mapleader = " " 13 | vim.g.maplocalleader = " " 14 | 15 | local next_diagnostic, prev_diagnostic 16 | next_diagnostic, prev_diagnostic = utils.make_repeatable_move_pair(function() 17 | vim.diagnostic.jump { count = vim.v.count1 } 18 | end, function() 19 | vim.diagnostic.jump { count = -vim.v.count1 } 20 | end) 21 | 22 | vim.keymap.set( 23 | "n", 24 | "]d", 25 | next_diagnostic, 26 | { desc = "Jump to the next diagnostic in the current buffer" } 27 | ) 28 | vim.keymap.set( 29 | "n", 30 | "[d", 31 | prev_diagnostic, 32 | { desc = "Jump to the previous diagnostic in the current buffer" } 33 | ) 34 | vim.keymap.set("n", "td", function() 35 | vim.diagnostic.enable(not vim.diagnostic.is_enabled()) 36 | end, { desc = "Diagnostic" }) 37 | 38 | local function toggle_quickfix() 39 | local wins = vim.fn.getwininfo() 40 | local qf_win = vim 41 | .iter(wins) 42 | :filter(function(win) 43 | return win.quickfix == 1 44 | end) 45 | :totable() 46 | if #qf_win == 0 then 47 | vim.cmd.copen() 48 | else 49 | vim.cmd.cclose() 50 | end 51 | end 52 | 53 | vim.keymap.set("n", "q", toggle_quickfix, { desc = "Quickfix" }) 54 | vim.keymap.set("n", "tq", toggle_quickfix, { desc = "Quickfix" }) 55 | vim.keymap.set("n", "hi", function() 56 | vim.show_pos() 57 | end, { desc = "Inspect" }) 58 | vim.keymap.set("n", "ht", function() 59 | vim.treesitter.inspect_tree() 60 | end, { desc = "Treesitter Tree" }) 61 | vim.keymap.set("n", "hq", function() 62 | vim.treesitter.query.edit() 63 | end, { desc = "Treesitter Query" }) 64 | 65 | local cnext, cprevious = utils.make_repeatable_move_pair(function() 66 | return pcall(function() 67 | vim.cmd.cnext { count = vim.v.count1 } 68 | end) 69 | end, function() 70 | return pcall(function() 71 | vim.cmd.cprevious { count = vim.v.count1 } 72 | end) 73 | end) 74 | vim.keymap.set("n", "]q", cnext, { desc = "Next quickfix" }) 75 | vim.keymap.set("n", "[q", cprevious, { desc = "Prev quickfix" }) 76 | 77 | local bnext, bprevious = utils.make_repeatable_move_pair(function() 78 | return pcall(function() 79 | vim.cmd.bnext { count = vim.v.count1 } 80 | end) 81 | end, function() 82 | return pcall(function() 83 | vim.cmd.bprevious { count = vim.v.count1 } 84 | end) 85 | end) 86 | vim.keymap.set("n", "]b", bnext, { desc = "Next buffer" }) 87 | vim.keymap.set("n", "[b", bprevious, { desc = "Prev buffer" }) 88 | 89 | local filetype_keymaps = 90 | vim.api.nvim_create_augroup("ofseed_filetype_keymaps", {}) 91 | vim.api.nvim_create_autocmd("Filetype", { 92 | group = filetype_keymaps, 93 | pattern = "qf", 94 | callback = function(args) 95 | local bufnr = args.buf 96 | vim.keymap.set("n", "q", "close", { buffer = bufnr }) 97 | end, 98 | }) 99 | 100 | vim.keymap.set( 101 | "n", 102 | "ll", 103 | vim.diagnostic.setloclist, 104 | { desc = "Diagnostic list" } 105 | ) 106 | -------------------------------------------------------------------------------- /lua/locals.lua: -------------------------------------------------------------------------------- 1 | -- Wrapper to avoid local defined variables file non-existent. 2 | local M = {} 3 | 4 | local _, defined = pcall(require, "defined-locals") 5 | 6 | if defined and type(defined) == "table" then 7 | M = defined 8 | end 9 | 10 | return M 11 | -------------------------------------------------------------------------------- /lua/lsp.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | -- Set diagnostic options 4 | vim.diagnostic.config { 5 | virtual_text = { 6 | spacing = 4, 7 | prefix = "●", 8 | severity = vim.diagnostic.severity.ERROR, 9 | }, 10 | float = { 11 | severity_sort = true, 12 | source = "if_many", 13 | }, 14 | severity_sort = true, 15 | signs = { 16 | text = { 17 | [vim.diagnostic.severity.ERROR] = custom.icons.diagnostic.error, 18 | [vim.diagnostic.severity.WARN] = custom.icons.diagnostic.warn, 19 | [vim.diagnostic.severity.HINT] = custom.icons.diagnostic.hint, 20 | [vim.diagnostic.severity.INFO] = custom.icons.diagnostic.info, 21 | }, 22 | }, 23 | } 24 | 25 | ---@type vim.lsp.util.open_floating_preview.Opts 26 | local preview_opts = { 27 | border = custom.border, 28 | title_pos = "center", 29 | } 30 | 31 | -- To instead override globally 32 | local orig_util_open_floating_preview = vim.lsp.util.open_floating_preview 33 | ---@diagnostic disable-next-line: duplicate-set-field 34 | function vim.lsp.util.open_floating_preview(contents, syntax, opts, ...) 35 | opts = vim.tbl_deep_extend("keep", opts, preview_opts) 36 | opts.border = opts.border or custom.border 37 | return orig_util_open_floating_preview(contents, syntax, opts, ...) 38 | end 39 | 40 | vim.lsp.inlay_hint.enable() 41 | if vim.lsp.document_highlight then 42 | vim.lsp.document_highlight.enable() 43 | end 44 | 45 | -- LspAttach events 46 | vim.api.nvim_create_autocmd("LspAttach", { 47 | desc = "General LSP Attach", 48 | callback = function(args) 49 | local bufnr = args.buf 50 | 51 | if vim.lsp.document_highlight then 52 | vim.keymap.set("n", "ld", function() 53 | vim.lsp.document_highlight.enable( 54 | not vim.lsp.document_highlight.is_enabled { bufnr = 0 }, 55 | { bufnr = bufnr } 56 | ) 57 | end, { buffer = bufnr, desc = "Toggle document highlight" }) 58 | vim.keymap.set("n", "]r", function() 59 | vim.lsp.document_highlight.jump { count = vim.v.count1, refresh = true } 60 | end, { buffer = bufnr, desc = "Next reference" }) 61 | vim.keymap.set("n", "[r", function() 62 | vim.lsp.document_highlight.jump { count = -vim.v.count1, refresh = true } 63 | end, { buffer = bufnr, desc = "Previous reference" }) 64 | end 65 | 66 | -- Override default keymap for additional options 67 | vim.keymap.set("n", "grr", function() 68 | vim.lsp.buf.references { includeDeclaration = false } 69 | end, { buffer = bufnr, desc = "References" }) 70 | vim.keymap.set({ "i", "s" }, "", function() 71 | ---@type vim.lsp.buf.signature_help.Opts 72 | local config = {} 73 | vim.lsp.buf.signature_help( 74 | vim.tbl_deep_extend("keep", config, preview_opts) 75 | ) 76 | end, { buffer = bufnr, desc = "References" }) 77 | 78 | -- Setup keymaps 79 | vim.keymap.set( 80 | "n", 81 | "gd", 82 | vim.lsp.buf.definition, 83 | { buffer = bufnr, desc = "Definition" } 84 | ) 85 | -- vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { buffer = bufnr, desc = "Declaration" }) 86 | vim.keymap.set( 87 | "n", 88 | "gD", 89 | vim.lsp.buf.type_definition, 90 | { buffer = bufnr, desc = "Type definition" } 91 | ) 92 | vim.keymap.set( 93 | "n", 94 | "gI", 95 | vim.lsp.buf.implementation, 96 | { buffer = bufnr, desc = "Implementation" } 97 | ) 98 | 99 | vim.keymap.set( 100 | "n", 101 | "lr", 102 | vim.lsp.codelens.run, 103 | { buffer = bufnr, desc = "Run lens" } 104 | ) 105 | 106 | vim.keymap.set( 107 | "n", 108 | "li", 109 | vim.lsp.buf.incoming_calls, 110 | { buffer = bufnr, desc = "Incoming calls" } 111 | ) 112 | vim.keymap.set( 113 | "n", 114 | "lo", 115 | vim.lsp.buf.outgoing_calls, 116 | { buffer = bufnr, desc = "Outgoing calls" } 117 | ) 118 | 119 | vim.keymap.set("n", "lh", function() 120 | vim.lsp.inlay_hint.enable( 121 | not vim.lsp.inlay_hint.is_enabled { bufnr = bufnr }, 122 | { bufnr = bufnr } 123 | ) 124 | end, { buffer = bufnr, desc = "Toggle inlay hints" }) 125 | 126 | -- Use conform instead 127 | -- vim.keymap.set("n", "F", function() 128 | -- vim.lsp.buf.format { async = true } 129 | -- end, { buffer = bufnr, desc = "Format document" }) 130 | 131 | vim.keymap.set( 132 | "n", 133 | "lwa", 134 | vim.lsp.buf.add_workspace_folder, 135 | { buffer = bufnr, desc = "Add workspace folder" } 136 | ) 137 | vim.keymap.set( 138 | "n", 139 | "lwr", 140 | vim.lsp.buf.remove_workspace_folder, 141 | { buffer = bufnr, desc = "Remove workspace folder" } 142 | ) 143 | vim.keymap.set("n", "lwl", function() 144 | print(vim.inspect(vim.lsp.buf.list_workspace_folders())) 145 | end, { buffer = bufnr, desc = "List workspace folders" }) 146 | 147 | -- Enable code lens 148 | -- if client and client.server_capabilities.codeLensProvider then 149 | -- vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "InsertLeave" }, { 150 | -- buffer = bufnr, 151 | -- callback = function() 152 | -- vim.lsp.codelens.refresh() 153 | -- end, 154 | -- }) 155 | -- end 156 | end, 157 | }) 158 | vim.lsp.enable { 159 | "clangd", 160 | "lua_ls", 161 | "pyright", 162 | "gopls", 163 | "vue_ls", 164 | "vtsls", 165 | "zls", 166 | } 167 | -------------------------------------------------------------------------------- /lua/manager.lua: -------------------------------------------------------------------------------- 1 | ---@diagnostic disable-next-line: param-type-mismatch 2 | local lazypath = vim.fs.joinpath(vim.fn.stdpath "data", "lazy", "lazy.nvim") 3 | if not vim.uv.fs_stat(lazypath) then 4 | vim.fn.system { 5 | "git", 6 | "clone", 7 | "--filter=blob:none", 8 | "--single-branch", 9 | "https://github.com/folke/lazy.nvim.git", 10 | lazypath, 11 | } 12 | end 13 | vim.opt.runtimepath:prepend(lazypath) 14 | 15 | local custom = require "custom" 16 | local locals = require "locals" 17 | 18 | require("lazy").setup { 19 | spec = "plugins", 20 | ---@diagnostic disable-next-line: assign-type-mismatch 21 | dev = { 22 | path = "~/neovim/dev", 23 | patterns = locals.under_development, 24 | fallback = true, 25 | }, 26 | install = { 27 | colorscheme = { "default" }, 28 | }, 29 | ui = { 30 | border = custom.border, 31 | }, 32 | diff = { 33 | cmd = "diffview.nvim", 34 | }, 35 | performance = { 36 | rtp = { 37 | -- Required in NixOS 38 | reset = false, 39 | disabled_plugins = { 40 | "gzip", 41 | -- "matchit", 42 | "matchparen", 43 | "netrwPlugin", 44 | "tarPlugin", 45 | "tohtml", 46 | "tutor", 47 | "zipPlugin", 48 | }, 49 | }, 50 | }, 51 | } 52 | 53 | vim.keymap.set("n", "mp", "Lazy", { desc = "Plugins" }) 54 | -------------------------------------------------------------------------------- /lua/misc.lua: -------------------------------------------------------------------------------- 1 | vim.cmd.aunmenu [[PopUp.How-to\ disable\ mouse]] 2 | vim.cmd.aunmenu [[PopUp.-1-]] 3 | -------------------------------------------------------------------------------- /lua/options.lua: -------------------------------------------------------------------------------- 1 | vim.opt.exrc = true 2 | 3 | -- Edit 4 | vim.opt.expandtab = true 5 | vim.opt.softtabstop = 2 6 | vim.opt.shiftwidth = 2 7 | vim.opt.undofile = true 8 | vim.opt.ignorecase = true 9 | vim.opt.smartcase = true 10 | vim.opt.list = true 11 | vim.opt.includeexpr = "substitute(v:fname,'\\.','/','g')" 12 | vim.opt.jumpoptions = "stack" 13 | vim.opt.completeopt = { "menu", "menuone", "noinsert" } 14 | vim.opt.swapfile = false 15 | 16 | -- Interface 17 | vim.opt.confirm = true 18 | vim.opt.splitkeep = "screen" 19 | vim.opt.splitbelow = true 20 | vim.opt.splitright = true 21 | vim.opt.number = true 22 | vim.opt.breakindent = true 23 | vim.opt.linebreak = true 24 | vim.opt.mouse = "a" 25 | vim.opt.mousemoveevent = true 26 | vim.opt.termguicolors = true 27 | vim.opt.title = true 28 | vim.opt.signcolumn = "yes" 29 | vim.opt.cursorline = true 30 | vim.opt.conceallevel = 2 31 | vim.opt.scrolloff = 2 32 | vim.opt.sidescrolloff = 5 33 | vim.opt.smoothscroll = true 34 | vim.opt.pumblend = 12 35 | vim.opt.pumheight = 12 36 | vim.opt.colorcolumn = "81" 37 | vim.opt.guifont = "Cascadia Code NF:h12" 38 | vim.opt.shortmess:append "I" 39 | vim.opt.fillchars = { 40 | eob = " ", 41 | diff = "╱", 42 | foldopen = "", 43 | foldclose = "", 44 | foldsep = "▕", 45 | } 46 | vim.opt.guicursor = { 47 | "n-v-c-sm:block-Cursor/lCursor", 48 | "i-ci-ve:ver25-Cursor/lCursor", 49 | "r-cr-o:hor20-Cursor/lCursor", 50 | } 51 | 52 | ---@diagnostic disable-next-line: param-type-mismatch 53 | vim.opt.runtimepath:append(vim.fs.joinpath(vim.fn.stdpath "data", "site")) 54 | -------------------------------------------------------------------------------- /lua/plugins/colorscheme/base16.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "RRethy/nvim-base16", 4 | lazy = true, 5 | opts = {}, 6 | confg = function(_, opts) 7 | require("base16-colorscheme").with_config(opts) 8 | end, 9 | } 10 | -------------------------------------------------------------------------------- /lua/plugins/colorscheme/catppuccin.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "catppuccin/nvim", 4 | name = "catppuccin", 5 | lazy = true, 6 | opts = { 7 | term_colors = true, 8 | custom_highlights = function(color) 9 | return { 10 | MsgSeparator = { bg = color.mantle }, 11 | 12 | TabLine = { bg = color.surface0, fg = color.subtext0 }, 13 | TabLineFill = { fg = color.subtext0, bg = color.mantle }, 14 | TabLineSel = { fg = color.base, bg = color.overlay1 }, 15 | 16 | MatchParen = { fg = "NONE", bg = color.surface1, style = { "bold" } }, 17 | 18 | -- telescope overrides 19 | TelescopeTitle = { fg = color.base, bg = color.blue }, 20 | TelescopePreviewTitle = { fg = color.base, bg = color.green }, 21 | TelescopePromptTitle = { fg = color.base, bg = color.red }, 22 | TelescopeResultsTitle = { fg = color.mantle, bg = color.lavender }, 23 | 24 | -- window_picker overrides 25 | WindowPickerStatusLine = { 26 | fg = color.surface0, 27 | bg = color.red, 28 | style = { "bold" }, 29 | }, 30 | WindowPickerStatusLineNC = { 31 | fg = color.surface0, 32 | bg = color.red, 33 | style = { "bold" }, 34 | }, 35 | WindowPickerWinBar = { 36 | fg = color.surface0, 37 | bg = color.red, 38 | style = { "bold" }, 39 | }, 40 | WindowPickerWinBarNC = { 41 | fg = color.surface0, 42 | bg = color.red, 43 | style = { "bold" }, 44 | }, 45 | 46 | QuickFixLineNr = { fg = color.overlay0 }, 47 | } 48 | end, 49 | integrations = { 50 | aerial = true, 51 | blink_cmp = true, 52 | fidget = true, 53 | markdown = true, 54 | mason = true, 55 | neotree = true, 56 | native_lsp = { 57 | underlines = { 58 | errors = { "undercurl" }, 59 | hints = { "undercurl" }, 60 | warnings = { "undercurl" }, 61 | information = { "undercurl" }, 62 | }, 63 | }, 64 | navic = { 65 | enabled = true, 66 | }, 67 | noice = true, 68 | notify = true, 69 | treesitter_context = true, 70 | octo = true, 71 | overseer = true, 72 | snacks = { 73 | enabled = true, 74 | }, 75 | symbols_outline = true, 76 | illuminate = true, 77 | ufo = false, 78 | which_key = true, 79 | window_picker = true, 80 | }, 81 | }, 82 | } 83 | -------------------------------------------------------------------------------- /lua/plugins/colorscheme/github.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "projekt0n/github-nvim-theme", 4 | lazy = true, 5 | main = "github-theme", 6 | opts = {}, 7 | } 8 | -------------------------------------------------------------------------------- /lua/plugins/colorscheme/gruvbox.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "ellisonleao/gruvbox.nvim", 4 | lazy = true, 5 | opts = {}, 6 | } 7 | -------------------------------------------------------------------------------- /lua/plugins/colorscheme/horizon.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "akinsho/horizon.nvim", 4 | lazy = true, 5 | opts = {}, 6 | } 7 | -------------------------------------------------------------------------------- /lua/plugins/colorscheme/night-owl.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "oxfist/night-owl.nvim", 4 | lazy = true, 5 | opts = {}, 6 | } 7 | -------------------------------------------------------------------------------- /lua/plugins/colorscheme/nightfox.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "EdenEast/nightfox.nvim", 4 | lazy = true, 5 | opts = { 6 | options = {}, 7 | groups = { 8 | all = { 9 | MatchParen = { fg = "NONE" }, 10 | }, 11 | }, 12 | }, 13 | } 14 | -------------------------------------------------------------------------------- /lua/plugins/colorscheme/onedark.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "navarasu/onedark.nvim", 4 | lazy = true, 5 | opts = {}, 6 | } 7 | -------------------------------------------------------------------------------- /lua/plugins/colorscheme/oxocarbon.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "nyoom-engineering/oxocarbon.nvim", 4 | lazy = true, 5 | } 6 | -------------------------------------------------------------------------------- /lua/plugins/colorscheme/rose-pine.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "rose-pine/neovim", 4 | lazy = true, 5 | name = "rose-pine", 6 | opts = { 7 | highlight_groups = { 8 | EndOfBuffer = { fg = "base" }, 9 | }, 10 | }, 11 | } 12 | -------------------------------------------------------------------------------- /lua/plugins/colorscheme/tokyonight.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "folke/tokyonight.nvim", 4 | lazy = true, 5 | opts = {}, 6 | } 7 | -------------------------------------------------------------------------------- /lua/plugins/dap/cmake-tools.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "Civitasv/cmake-tools.nvim", 4 | ft = { "c", "cpp", "cmake" }, 5 | opts = { 6 | cmake_executor = { 7 | name = "overseer", 8 | }, 9 | }, 10 | } 11 | -------------------------------------------------------------------------------- /lua/plugins/dap/dap-go.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "leoluz/nvim-dap-go", 4 | ft = { "go" }, 5 | opts = {}, 6 | } 7 | -------------------------------------------------------------------------------- /lua/plugins/dap/dap-python.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "mfussenegger/nvim-dap-python", 4 | ft = { "python" }, 5 | config = function() 6 | require("dap-python").setup "debugpy-adapter" 7 | end, 8 | keys = { 9 | { 10 | "dn", 11 | function() 12 | require("dap-python").test_method() 13 | end, 14 | desc = "Test method", 15 | }, 16 | { 17 | "df", 18 | function() 19 | require("dap-python").test_class() 20 | end, 21 | desc = "Test class", 22 | }, 23 | { 24 | "ds", 25 | function() 26 | require("dap-python").debug_selection() 27 | end, 28 | mode = "v", 29 | desc = "Debug selection", 30 | }, 31 | }, 32 | } 33 | -------------------------------------------------------------------------------- /lua/plugins/dap/dap-repl-highlights.lua: -------------------------------------------------------------------------------- 1 | local locals = require "locals" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "LiadOz/nvim-dap-repl-highlights", 6 | build = ":TSInstall dap_repl", 7 | -- Only loads when nvim-dap is loaded 8 | cond = not locals.treesitter_dev, 9 | lazy = true, 10 | opts = {}, 11 | } 12 | -------------------------------------------------------------------------------- /lua/plugins/dap/dap-ui.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "rcarriga/nvim-dap-ui", 6 | ---@type dapui.Config 7 | opts = { 8 | floating = { 9 | border = custom.border, 10 | }, 11 | icons = { 12 | collapsed = "", 13 | current_frame = "", 14 | expanded = "", 15 | }, 16 | }, 17 | keys = { 18 | { 19 | "du", 20 | function() 21 | require("dapui").toggle() 22 | end, 23 | desc = "Toggle full UI", 24 | }, 25 | { 26 | "", 27 | function() 28 | require("dapui").eval() 29 | end, 30 | desc = "Evaluate expression", 31 | mode = { "n", "v" }, 32 | }, 33 | 34 | { 35 | "ds", 36 | function() 37 | require("dapui").float_element("stacks", { 38 | width = 60, 39 | height = 20, 40 | enter = true, 41 | position = "center", 42 | }) 43 | end, 44 | desc = "Open stacks", 45 | }, 46 | { 47 | "dw", 48 | function() 49 | require("dapui").float_element("watches", { 50 | width = 60, 51 | height = 20, 52 | enter = true, 53 | position = "center", 54 | }) 55 | end, 56 | desc = "Open watches", 57 | }, 58 | { 59 | "dv", 60 | function() 61 | require("dapui").float_element("scopes", { 62 | width = 60, 63 | height = 20, 64 | enter = true, 65 | position = "center", 66 | }) 67 | end, 68 | desc = "Open scopes", 69 | }, 70 | { 71 | "dc", 72 | function() 73 | require("dapui").float_element("console", { 74 | width = 60, 75 | height = 20, 76 | enter = true, 77 | position = "center", 78 | }) 79 | end, 80 | desc = "Open console", 81 | }, 82 | { 83 | "dr", 84 | function() 85 | require("dapui").float_element("repl", { 86 | width = 60, 87 | height = 20, 88 | enter = true, 89 | position = "center", 90 | }) 91 | end, 92 | desc = "Open repl", 93 | }, 94 | }, 95 | } 96 | -------------------------------------------------------------------------------- /lua/plugins/dap/dap-virtual-text.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "theHamsta/nvim-dap-virtual-text", 4 | -- Only loads when nvim-dap is loaded 5 | lazy = true, 6 | opts = {}, 7 | } 8 | -------------------------------------------------------------------------------- /lua/plugins/dap/dap.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "mfussenegger/nvim-dap", 4 | init = function() 5 | vim.fn.sign_define( 6 | "DapBreakpoint", 7 | { text = "", texthl = "DiagnosticError" } 8 | ) 9 | vim.fn.sign_define( 10 | "DapBreakpointCondition", 11 | { text = "", texthl = "DiagnosticError" } 12 | ) 13 | vim.fn.sign_define( 14 | "DapLogPoint", 15 | { text = "", texthl = "DiagnosticInfo" } 16 | ) 17 | vim.fn.sign_define( 18 | "DapStopped", 19 | { text = "", texthl = "Constant", linehl = "debugPC" } 20 | ) 21 | vim.fn.sign_define("DapBreakpointRejected", { text = "" }) 22 | end, 23 | dependencies = { 24 | "jay-babu/mason-nvim-dap.nvim", 25 | "LiadOz/nvim-dap-repl-highlights", 26 | "theHamsta/nvim-dap-virtual-text", 27 | "rcarriga/nvim-dap-ui", 28 | }, 29 | config = function() 30 | local dap = require "dap" 31 | dap.defaults.fallback.external_terminal = { 32 | command = "/usr/bin/kitty", 33 | args = { 34 | "--class", 35 | "kitty-dap", 36 | "--hold", 37 | "--detach", 38 | "nvim-dap", 39 | "-c", 40 | "DAP", 41 | }, 42 | } 43 | 44 | dap.adapters["nvim-lua"] = function(callback, config) 45 | callback { 46 | type = "server", 47 | host = config.host or "127.0.0.1", 48 | port = config.port or 8086, 49 | } 50 | end 51 | dap.configurations.lua = { 52 | { 53 | type = "nvim-lua", 54 | request = "attach", 55 | name = "Attach to running Neovim instance", 56 | }, 57 | } 58 | 59 | dap.adapters.gdb = { 60 | type = "executable", 61 | command = "gdb", 62 | args = { "-i", "dap" }, 63 | } 64 | 65 | dap.adapters.codelldb = { 66 | type = "server", 67 | port = "${port}", 68 | executable = { 69 | command = vim.fn.exepath "codelldb", 70 | args = { 71 | "--port", 72 | "${port}", 73 | "--settings", 74 | vim.json.encode { 75 | showDisassembly = "never", 76 | }, 77 | }, 78 | }, 79 | } 80 | vim 81 | .iter({ 82 | { 83 | name = "LLDB: Launch active file", 84 | type = "codelldb", 85 | request = "launch", 86 | program = "${fileBasenameNoExtension}", 87 | cwd = "${workspaceFolder}", 88 | stopOnEntry = false, 89 | args = {}, 90 | console = "integratedTerminal", 91 | preLaunchTask = "C++ build single file", 92 | }, 93 | 94 | { 95 | name = "LLDB: Attach to a running process", 96 | type = "codelldb", 97 | request = "attach", 98 | pid = "${command:pickProcess}", 99 | stopOnEntry = true, 100 | }, 101 | }) 102 | :map(function(configuration) 103 | dap.configurations.cpp = dap.configurations.cpp or {} 104 | table.insert(dap.configurations.cpp, configuration) 105 | end) 106 | vim 107 | .iter({ 108 | { 109 | name = "LLDB: Launch a new process", 110 | type = "codelldb", 111 | request = "launch", 112 | program = "${workspaceFolder}/zig-out/bin/${workspaceFolderBasename}", 113 | cwd = "${workspaceFolder}", 114 | stopOnEntry = false, 115 | args = {}, 116 | console = "integratedTerminal", 117 | preLaunchTask = "zig build", 118 | }, 119 | { 120 | name = "LLDB: Launch a new process with arguments", 121 | type = "codelldb", 122 | request = "launch", 123 | program = "${workspaceFolder}/zig-out/bin/${workspaceFolderBasename}", 124 | cwd = "${workspaceFolder}", 125 | stopOnEntry = false, 126 | args = function() 127 | local args = {} 128 | local input = vim.fn.input "Enter program arguments: " 129 | if input ~= "" then 130 | for arg in vim.gsplit(input, " ") do 131 | table.insert(args, arg) 132 | end 133 | end 134 | return args 135 | end, 136 | console = "integratedTerminal", 137 | preLaunchTask = "zig build", 138 | }, 139 | }) 140 | :map(function(configuration) 141 | dap.configurations.zig = dap.configurations.zig or {} 142 | table.insert(dap.configurations.zig, configuration) 143 | end) 144 | 145 | dap.adapters["pwa-node"] = { 146 | type = "server", 147 | host = "localhost", 148 | port = "${port}", 149 | executable = { 150 | command = vim.fn.exepath "js-debug-adapter", 151 | args = { "${port}" }, 152 | }, 153 | } 154 | for _, filetype in ipairs { "javascript", "typescript" } do 155 | dap.configurations[filetype] = { 156 | { 157 | type = "pwa-node", 158 | request = "launch", 159 | name = "Launch file", 160 | program = "${file}", 161 | cwd = "${workspaceFolder}", 162 | }, 163 | } 164 | end 165 | 166 | ---@diagnostic disable-next-line: undefined-field 167 | require("overseer").enable_dap(true) 168 | require("dap.ext.vscode").json_decode = require("overseer.json").decode 169 | end, 170 | keys = { 171 | { 172 | "", 173 | function() 174 | require("dap").continue() 175 | end, 176 | desc = "Debug: Continue", 177 | }, 178 | { 179 | "", 180 | function() 181 | require("dap").terminate() 182 | end, 183 | desc = "Debug: Terminate", 184 | }, 185 | { 186 | "", 187 | function() 188 | require("dap").step_over() 189 | end, 190 | desc = "Debug: Step over", 191 | }, 192 | { 193 | "", 194 | function() 195 | require("dap").step_into() 196 | end, 197 | desc = "Debug: Step into", 198 | }, 199 | { 200 | "", -- Shift + 201 | function() 202 | require("dap").step_out() 203 | end, 204 | desc = "Debug: Step out", 205 | }, 206 | { 207 | "", 208 | function() 209 | require("dap").toggle_breakpoint() 210 | end, 211 | desc = "Debug: Toggle breakpoint", 212 | }, 213 | 214 | { 215 | "dp", 216 | function() 217 | local condition = vim.fn.input "Breakpoint condition: " 218 | if condition == "" then 219 | return 220 | end 221 | require("dap").set_breakpoint(condition) 222 | end, 223 | desc = "Set condition breakpoint", 224 | }, 225 | { 226 | "dP", 227 | function() 228 | local message = vim.fn.input "Log point message: " 229 | if message == "" then 230 | return 231 | end 232 | require("dap").set_breakpoint(nil, nil, message) 233 | end, 234 | desc = "Set log point", 235 | }, 236 | { 237 | "db", 238 | function() 239 | require("dap").list_breakpoints(true) 240 | end, 241 | desc = "Open breakpoints", 242 | }, 243 | { 244 | "dR", 245 | function() 246 | require("dap").repl.toggle() 247 | end, 248 | desc = "Toggle REPL", 249 | }, 250 | { 251 | "dl", 252 | function() 253 | require("dap").run_last() 254 | end, 255 | desc = "Run last", 256 | }, 257 | }, 258 | } 259 | -------------------------------------------------------------------------------- /lua/plugins/dap/one-small-step-for-vimkind.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "jbyuki/one-small-step-for-vimkind", 4 | keys = { 5 | { 6 | "hd", 7 | function() 8 | require("osv").launch { port = 8086 } 9 | end, 10 | desc = "Launch adapter", 11 | }, 12 | { 13 | "hs", 14 | function() 15 | require("osv").stop() 16 | end, 17 | desc = "Stop adapter", 18 | }, 19 | }, 20 | } 21 | -------------------------------------------------------------------------------- /lua/plugins/edit/blink.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | ---@module 'blink.cmp' 6 | "Saghen/blink.cmp", 7 | version = "*", 8 | -- build = "cargo build --release", 9 | ---@type blink.cmp.Config 10 | opts = { 11 | keymap = { 12 | preset = "enter", 13 | }, 14 | sources = { 15 | default = { 16 | "lsp", 17 | "path", 18 | "snippets", 19 | "buffer", 20 | "lazydev", 21 | }, 22 | providers = { 23 | lsp = { 24 | name = "LSP", 25 | fallbacks = { 26 | "lazydev", 27 | }, 28 | }, 29 | lazydev = { 30 | name = "Development", 31 | module = "lazydev.integrations.blink", 32 | }, 33 | }, 34 | }, 35 | completion = { 36 | list = { 37 | selection = { 38 | preselect = function(ctx) 39 | return ctx.mode ~= "cmdline" 40 | and not require("blink.cmp").snippet_active { direction = 1 } 41 | end, 42 | }, 43 | }, 44 | menu = { 45 | border = "rounded", 46 | -- Minimum width should be controlled by components 47 | min_width = 1, 48 | draw = { 49 | columns = { 50 | { "kind_icon" }, 51 | { "label", "label_description", gap = 1 }, 52 | { "provider" }, 53 | }, 54 | components = { 55 | provider = { 56 | text = function(ctx) 57 | return "[" .. ctx.item.source_name:sub(1, 3):upper() .. "]" 58 | end, 59 | }, 60 | }, 61 | }, 62 | }, 63 | documentation = { 64 | auto_show = true, 65 | auto_show_delay_ms = 0, 66 | update_delay_ms = 50, 67 | window = { 68 | border = "rounded", 69 | winblend = vim.o.pumblend, 70 | }, 71 | }, 72 | }, 73 | signature = { 74 | enabled = true, 75 | window = { 76 | show_documentation = true, 77 | border = "rounded", 78 | winblend = vim.o.pumblend, 79 | }, 80 | }, 81 | appearance = { 82 | nerd_font_variant = "mono", 83 | kind_icons = custom.icons.kind, 84 | }, 85 | }, 86 | } 87 | -------------------------------------------------------------------------------- /lua/plugins/edit/cmp.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "hrsh7th/nvim-cmp", 6 | enabled = false, 7 | event = { 8 | "InsertEnter", 9 | "CmdlineEnter", 10 | }, 11 | init = function() 12 | local filetype = { "dap-repl", "dapui_watches", "dapui_hover" } 13 | vim.api.nvim_create_autocmd("FileType", { 14 | desc = "Setup cmp dap sources", 15 | pattern = filetype, 16 | callback = function() 17 | local cmp = require "cmp" 18 | cmp.setup.filetype(filetype, { 19 | sources = { 20 | { name = "dap" }, 21 | }, 22 | }) 23 | end, 24 | }) 25 | end, 26 | dependencies = { 27 | { "hrsh7th/cmp-buffer" }, 28 | { "hrsh7th/cmp-nvim-lsp" }, 29 | { "hrsh7th/cmp-nvim-lsp-signature-help" }, 30 | { "hrsh7th/cmp-buffer" }, 31 | { "hrsh7th/cmp-path" }, 32 | { "hrsh7th/cmp-cmdline" }, 33 | { "rcarriga/cmp-dap" }, 34 | -- { "saadparwaiz1/cmp_luasnip" }, 35 | { "lukas-reineke/cmp-under-comparator" }, 36 | { "kristijanhusak/vim-dadbod-completion", enabled = false }, 37 | }, 38 | opts = function() 39 | local cmp = require "cmp" 40 | local luasnip = require "luasnip" 41 | local lspkind = require "lspkind" 42 | 43 | -- local has_words_before = function() 44 | -- local line, col = unpack(vim.api.nvim_win_get_cursor(0)) 45 | -- return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil 46 | -- end 47 | 48 | local function is_dap_buffer(bufnr) 49 | local filetype = vim.bo[bufnr or 0].filetype 50 | if vim.startswith(filetype, "dapui_") then 51 | return true 52 | end 53 | if filetype == "dap-repl" then 54 | return true 55 | end 56 | 57 | return false 58 | end 59 | 60 | return { 61 | ---@type cmp.ConfigSchema 62 | global = { 63 | enabled = function() 64 | -- cmp-dap will be available in prompt buffer 65 | return vim.bo[0].buftype ~= "prompt" or is_dap_buffer() 66 | end, 67 | completion = { 68 | completeopt = vim.o.completeopt, 69 | }, 70 | window = { 71 | completion = { 72 | winblend = 0, 73 | border = custom.border, 74 | col_offset = -3, 75 | }, 76 | documentation = { 77 | border = custom.border, 78 | }, 79 | }, 80 | snippet = { 81 | expand = function(args) 82 | luasnip.lsp_expand(args.body) 83 | end, 84 | }, 85 | mapping = { 86 | [""] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }), 87 | [""] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }), 88 | [""] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }), 89 | [""] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }), 90 | [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), 91 | [""] = cmp.mapping(cmp.mapping.close(), { "i", "c" }), 92 | [""] = cmp.mapping(cmp.mapping.close_docs(), { "i", "c" }), 93 | [""] = cmp.mapping.confirm(), 94 | [""] = cmp.mapping(function(fallback) 95 | if luasnip.expand_or_locally_jumpable() then 96 | luasnip.jump(1) 97 | -- elseif has_words_before() then 98 | -- cmp.complete() 99 | else 100 | fallback() --Fallback to tabout of `ultimate-autopair` as expected 101 | end 102 | end, { 103 | "i", 104 | "s", 105 | "c", 106 | }), 107 | [""] = cmp.mapping(function(fallback) 108 | if luasnip.jumpable(-1) then 109 | luasnip.jump(-1) 110 | else 111 | fallback() 112 | end 113 | end, { 114 | "i", 115 | "s", 116 | "c", 117 | }), 118 | }, 119 | sources = cmp.config.sources( 120 | -- Group sources 121 | { 122 | { name = "lazydev" }, 123 | }, 124 | { 125 | { name = "nvim_lsp" }, 126 | { 127 | name = "buffer", 128 | option = { 129 | get_bufnrs = function() 130 | return vim 131 | .iter(vim.api.nvim_list_bufs()) 132 | :filter(function(buf) 133 | return vim.bo[buf].buftype == "" 134 | end) 135 | :totable() 136 | end, 137 | }, 138 | }, 139 | { name = "path" }, 140 | { name = "orgmode" }, 141 | } 142 | ), 143 | formatting = { 144 | format = lspkind.cmp_format(custom.cmp_format), 145 | fields = { 146 | "kind", 147 | "abbr", 148 | "menu", 149 | }, 150 | }, 151 | sorting = { 152 | priority_weight = 2, 153 | comparators = { 154 | function(...) 155 | return require("cmp_buffer"):compare_locality(...) 156 | end, 157 | cmp.config.compare.offset, 158 | cmp.config.compare.exact, 159 | -- cmp.config.compare.scopes, 160 | cmp.config.compare.score, 161 | require("cmp-under-comparator").under, 162 | cmp.config.compare.recently_used, 163 | cmp.config.compare.locality, 164 | cmp.config.compare.kind, 165 | -- cmp.config.compare.sort_text, 166 | cmp.config.compare.length, 167 | cmp.config.compare.order, 168 | }, 169 | }, 170 | }, 171 | cmdline = { 172 | [":"] = { 173 | completion = { 174 | completeopt = "menu,menuone,noselect", 175 | }, 176 | sources = cmp.config.sources({ 177 | { name = "lazydev" }, 178 | }, { 179 | { name = "path" }, 180 | }, { 181 | { name = "cmdline" }, 182 | }), 183 | }, 184 | ["/"] = { 185 | completion = { 186 | completeopt = "menu,menuone,noselect", 187 | }, 188 | sources = { 189 | { name = "buffer" }, 190 | }, 191 | }, 192 | }, 193 | } 194 | end, 195 | config = function(_, opts) 196 | local cmp = require "cmp" 197 | 198 | cmp.setup.global(opts.global) 199 | for type, cmdlineopts in pairs(opts.cmdline) do 200 | cmp.setup.cmdline(type, cmdlineopts) 201 | end 202 | 203 | vim.api.nvim_create_autocmd("BufRead", { 204 | desc = "Setup cmp buffer crates source", 205 | pattern = "Cargo.toml", 206 | callback = function() 207 | cmp.setup.buffer { 208 | sources = { 209 | { name = "crates" }, 210 | }, 211 | } 212 | end, 213 | }) 214 | -- vim.api.nvim_create_autocmd("Filetype", { 215 | -- desc = "Setup cmp buffer sql source", 216 | -- pattern = "sql", 217 | -- callback = function() 218 | -- cmp.setup.buffer { 219 | -- sources = { 220 | -- { name = "vim-dadbod-completion" }, 221 | -- }, 222 | -- } 223 | -- end, 224 | -- }) 225 | end, 226 | } 227 | -------------------------------------------------------------------------------- /lua/plugins/edit/comment.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "numToStr/Comment.nvim", 4 | init = function() 5 | vim.keymap.del("n", "gcc") 6 | end, 7 | keys = { 8 | { "gc", mode = { "n", "v" }, desc = "Comment toggle linewise" }, 9 | { "gb", mode = { "n", "v" }, desc = "Comment toggle blockwise" }, 10 | }, 11 | opts = { 12 | pre_hook = function(...) 13 | return require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook()( 14 | ... 15 | ) 16 | end, 17 | }, 18 | } 19 | -------------------------------------------------------------------------------- /lua/plugins/edit/copilot.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "github/copilot.vim", 4 | event = "VeryLazy", 5 | enabled = false, 6 | init = function() 7 | vim.g.copilot_no_tab_map = true 8 | end, 9 | config = function() 10 | vim.g.copilot_filetypes = { 11 | registers = 0, 12 | markdown = 1, 13 | } 14 | 15 | vim.keymap.set( 16 | "i", 17 | "", 18 | 'copilot#Accept("")', 19 | { silent = true, script = true, expr = true, replace_keycodes = false } 20 | ) 21 | vim.keymap.set("i", "", "Copilot") 22 | end, 23 | } 24 | -------------------------------------------------------------------------------- /lua/plugins/edit/ibus-sw.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "kevinhwang91/nvim-ibus-sw", 4 | event = "InsertLeave", 5 | opts = {}, 6 | } 7 | -------------------------------------------------------------------------------- /lua/plugins/edit/iswap.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "mizlan/iswap.nvim", 4 | opts = { 5 | flash_style = false, 6 | move_cursor = true, 7 | }, 8 | keys = { 9 | { "", "ISwapNodeWithLeft", desc = "Swap with left" }, 10 | { "", "ISwapNodeWithLeft", desc = "Swap with left" }, 11 | { "", "ISwapNodeWithRight", desc = "Swap with right" }, 12 | { "", "ISwapNodeWithRight", desc = "Swap with right" }, 13 | }, 14 | } 15 | -------------------------------------------------------------------------------- /lua/plugins/edit/neogen.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "danymat/neogen", 4 | opts = { 5 | snippet_engine = "luasnip", 6 | }, 7 | keys = { 8 | { 9 | "ia", 10 | function() 11 | require("neogen").generate() 12 | end, 13 | desc = "Annotations", 14 | }, 15 | }, 16 | } 17 | -------------------------------------------------------------------------------- /lua/plugins/edit/obsidian.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "epwalsh/obsidian.nvim", 4 | event = { 5 | "BufReadPre " .. vim.fn.expand "~/Documents/Obsidian/*.md", 6 | "BufNewFile " .. vim.fn.expand "~/Documents/Obsidian/*.md", 7 | }, 8 | opts = { 9 | workspaces = { 10 | { 11 | name = "Obsidian", 12 | path = "~/Documents/Obsidian", 13 | }, 14 | }, 15 | picker = { 16 | name = "fzf-lua", 17 | }, 18 | }, 19 | } 20 | -------------------------------------------------------------------------------- /lua/plugins/edit/parinfer.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "gpanders/nvim-parinfer", 4 | ft = { 5 | "clojure", 6 | "lisp", 7 | "scheme", 8 | "racket", 9 | "fennel", 10 | }, 11 | } 12 | -------------------------------------------------------------------------------- /lua/plugins/edit/scissors.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | ---@module "scissors" 6 | "chrisgrieser/nvim-scissors", 7 | ---@type pluginConfig 8 | opts = { 9 | editSnippetPopup = { 10 | border = custom.border, 11 | }, 12 | backdrop = { 13 | blend = 60, 14 | }, 15 | jsonFormatter = "jq", 16 | }, 17 | keys = { 18 | { 19 | "in", 20 | function() 21 | require("scissors").addNewSnippet() 22 | end, 23 | mode = { "n", "x" }, 24 | desc = "New snippet", 25 | }, 26 | { 27 | "ie", 28 | function() 29 | require("scissors").editSnippet() 30 | end, 31 | desc = "Edit snippet", 32 | }, 33 | }, 34 | } 35 | -------------------------------------------------------------------------------- /lua/plugins/edit/snip.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "L3MON4D3/LuaSnip", 4 | enabled = false, 5 | event = { 6 | "InsertEnter", 7 | "CmdlineEnter", 8 | }, 9 | keys = { 10 | { 11 | "", 12 | function() 13 | require("luasnip").expand() 14 | end, 15 | mode = "i", 16 | }, 17 | { 18 | "", 19 | mode = "x", 20 | }, 21 | }, 22 | opts = function() 23 | local types = require "luasnip.util.types" 24 | 25 | return { 26 | store_selection_keys = "", 27 | update_events = { "TextChanged", "TextChangedI" }, 28 | ext_opts = { 29 | [types.choiceNode] = { 30 | active = { 31 | virt_text = { { "●", "Operator" } }, 32 | virt_text_pos = "inline", 33 | }, 34 | unvisited = { 35 | virt_text = { { "●", "Comment" } }, 36 | virt_text_pos = "inline", 37 | }, 38 | }, 39 | [types.insertNode] = { 40 | active = { 41 | virt_text = { { "●", "Keyword" } }, 42 | virt_text_pos = "inline", 43 | }, 44 | unvisited = { 45 | virt_text = { { "●", "Comment" } }, 46 | virt_text_pos = "inline", 47 | }, 48 | }, 49 | }, 50 | } 51 | end, 52 | config = function(_, opts) 53 | require("luasnip").setup(opts) 54 | require("luasnip.loaders.from_vscode").lazy_load { 55 | paths = "./snippets", 56 | } 57 | end, 58 | } 59 | -------------------------------------------------------------------------------- /lua/plugins/edit/suda.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "lambdalisue/suda.vim", 4 | cmd = { "SudaRead", "SudaWrite" }, 5 | } 6 | -------------------------------------------------------------------------------- /lua/plugins/edit/surround.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "kylechui/nvim-surround", 4 | event = "VeryLazy", 5 | opts = { 6 | keymaps = { 7 | insert = false, 8 | insert_line = false, 9 | }, 10 | }, 11 | } 12 | -------------------------------------------------------------------------------- /lua/plugins/edit/table-mode.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "dhruvasagar/vim-table-mode", 4 | ft = { "markdown", "org" }, 5 | } 6 | -------------------------------------------------------------------------------- /lua/plugins/edit/ultimate-autopair.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "altermo/ultimate-autopair.nvim", 4 | event = { "InsertEnter", "CmdlineEnter" }, 5 | opts = { 6 | tabout = { 7 | enable = true, 8 | map = "", 9 | hopout = true, 10 | do_nothing_if_fail = false, 11 | }, 12 | }, 13 | } 14 | -------------------------------------------------------------------------------- /lua/plugins/efficiency/dial.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "monaqa/dial.nvim", 4 | keys = { 5 | { 6 | "", 7 | function() 8 | require("dial.map").manipulate("increment", "normal") 9 | end, 10 | }, 11 | { 12 | "", 13 | function() 14 | require("dial.map").manipulate("decrement", "normal") 15 | end, 16 | }, 17 | { 18 | "g", 19 | function() 20 | require("dial.map").manipulate("increment", "gnormal") 21 | end, 22 | }, 23 | { 24 | "g", 25 | function() 26 | require("dial.map").manipulate("decrement", "gnormal") 27 | end, 28 | }, 29 | { 30 | "", 31 | function() 32 | require("dial.map").manipulate("increment", "visual") 33 | end, 34 | mode = "v", 35 | }, 36 | { 37 | "", 38 | function() 39 | require("dial.map").manipulate("decrement", "visual") 40 | end, 41 | mode = "v", 42 | }, 43 | { 44 | "g", 45 | function() 46 | require("dial.map").manipulate("increment", "gvisual") 47 | end, 48 | mode = "v", 49 | }, 50 | { 51 | "g", 52 | function() 53 | require("dial.map").manipulate("decrement", "gvisual") 54 | end, 55 | mode = "v", 56 | }, 57 | }, 58 | } 59 | -------------------------------------------------------------------------------- /lua/plugins/efficiency/early-retirement.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "chrisgrieser/nvim-early-retirement", 4 | -- Use it with tabline only 5 | event = "VeryLazy", 6 | opts = {}, 7 | } 8 | -------------------------------------------------------------------------------- /lua/plugins/efficiency/flash.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "folke/flash.nvim", 4 | opts = { 5 | search = { 6 | exclude = { 7 | "blink-cmp-menu", 8 | 9 | -- Default 10 | "notify", 11 | "cmp_menu", 12 | "noice", 13 | "flash_prompt", 14 | function(win) 15 | -- exclude non-focusable windows 16 | return not vim.api.nvim_win_get_config(win).focusable 17 | end, 18 | }, 19 | }, 20 | modes = { 21 | search = { 22 | enabled = true, 23 | highlight = { 24 | backdrop = true, 25 | }, 26 | }, 27 | char = { 28 | enabled = false, 29 | }, 30 | treesitter = { 31 | highlight = { 32 | backdrop = true, 33 | }, 34 | }, 35 | }, 36 | }, 37 | event = "VeryLazy", 38 | keys = { 39 | { 40 | "s", 41 | mode = { "n" }, 42 | function() 43 | require("flash").treesitter() 44 | end, 45 | desc = "Select Treesitter Node", 46 | }, 47 | { 48 | "S", 49 | mode = { "n" }, 50 | function() 51 | require("flash").treesitter_search() 52 | end, 53 | desc = "Search Treesitter Node", 54 | }, 55 | }, 56 | } 57 | -------------------------------------------------------------------------------- /lua/plugins/efficiency/flatten.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "willothy/flatten.nvim", 4 | opts = function() 5 | local flatten = require "flatten" 6 | 7 | ---@type Flatten.PartialConfig 8 | return { 9 | window = { 10 | open = "alternate", 11 | }, 12 | hooks = { 13 | should_nest = function(host) 14 | return flatten.hooks.should_nest(host) or vim.env.HEADLESS_OSV 15 | end, 16 | }, 17 | } 18 | end, 19 | } 20 | -------------------------------------------------------------------------------- /lua/plugins/efficiency/gx.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "chrishrb/gx.nvim", 4 | keys = { 5 | { 6 | "gx", 7 | function() 8 | vim.cmd.Browse() 9 | end, 10 | }, 11 | }, 12 | cmd = { 13 | "Browse", 14 | }, 15 | opts = {}, 16 | } 17 | -------------------------------------------------------------------------------- /lua/plugins/efficiency/ibus-sw.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "kevinhwang91/vim-ibus-sw", 4 | event = "VeryLazy", 5 | } 6 | -------------------------------------------------------------------------------- /lua/plugins/efficiency/img-clip.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "HakonHarnes/img-clip.nvim", 4 | cmd = { 5 | "PasteImage", 6 | }, 7 | opts = {}, 8 | } 9 | -------------------------------------------------------------------------------- /lua/plugins/efficiency/next.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "ghostbuster91/nvim-next", 4 | enabled = false, 5 | opts = function() 6 | local builtins = require "nvim-next.builtins" 7 | 8 | return { 9 | default_mappings = { 10 | repeat_style = "original", 11 | }, 12 | items = { 13 | builtins.f, 14 | builtins.t, 15 | }, 16 | } 17 | end, 18 | keys = function() 19 | local integrations = require "nvim-next.integrations" 20 | local diag = integrations.diagnostic() 21 | local qf = integrations.quickfix() 22 | 23 | return { 24 | -- Diagnostic 25 | { "[d", diag.goto_prev(), desc = "Previous diagnostic" }, 26 | { "]d", diag.goto_next(), desc = "Next diagnostic" }, 27 | 28 | -- Quickfix 29 | { "[q", qf.cprevious, desc = "Previous quickfix item" }, 30 | { "]q", qf.cnext, desc = "Next quickfix item" }, 31 | } 32 | end, 33 | } 34 | -------------------------------------------------------------------------------- /lua/plugins/efficiency/project.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "ofseed/project.nvim", -- maintained fork 4 | event = "VeryLazy", 5 | main = "project_nvim", 6 | opts = { 7 | ignore_lsp = { "jsonls", "yamlls", "taplo" }, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /lua/plugins/efficiency/session-manager.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "Shatur/neovim-session-manager", 4 | event = "VeryLazy", 5 | dependencies = { 6 | "nvim-lua/plenary.nvim", 7 | }, 8 | opts = function() 9 | local config = require "session_manager.config" 10 | 11 | return { 12 | autoload_mode = config.AutoloadMode.Disabled, 13 | } 14 | end, 15 | config = function(_, opts) 16 | local manager = require "session_manager" 17 | 18 | manager.setup(opts) 19 | 20 | -- Convert the cwd to a simple file name 21 | local function get_cwd_as_name() 22 | local dir = vim.fn.getcwd(0) 23 | return dir:gsub("[^A-Za-z0-9]", "_") 24 | end 25 | 26 | do -- Custom logic to save and load overseer tasks 27 | vim.api.nvim_create_autocmd("User", { 28 | pattern = "SessionSavePre", 29 | desc = "Save overseer tasks", 30 | callback = function() 31 | local overseer = require "overseer" 32 | local task_name = get_cwd_as_name() 33 | 34 | -- Remove the task if it exists 35 | if vim.tbl_contains(overseer.list_task_bundles(), task_name) then 36 | overseer.delete_task_bundle(task_name) 37 | end 38 | 39 | overseer.save_task_bundle( 40 | get_cwd_as_name(), 41 | overseer.list_tasks { 42 | status = "RUNNING", 43 | }, 44 | { on_conflict = "overwrite" } 45 | ) 46 | end, 47 | }) 48 | vim.api.nvim_create_autocmd("User", { 49 | pattern = "SessionLoadPost", 50 | desc = "Load overseer tasks", 51 | callback = function() 52 | local overseer = require "overseer" 53 | local gitsigns = require "gitsigns" 54 | 55 | overseer.load_task_bundle( 56 | get_cwd_as_name(), 57 | { ignore_missing = true } 58 | ) 59 | gitsigns.refresh() 60 | end, 61 | }) 62 | end 63 | end, 64 | keys = { 65 | { 66 | "ss", 67 | "SessionManager load_session", 68 | desc = "Load selected", 69 | }, 70 | { 71 | "sl", 72 | "SessionManager load_last_session", 73 | desc = "Load last", 74 | }, 75 | { "sd", "SessionManager delete_session", desc = "Delete" }, 76 | -- { "scs", "SessionManager save_current_session", desc = "Save" }, 77 | -- { "scl", "SessionManager load_current_dir_session", desc = "Load" }, 78 | { 79 | "sc", 80 | "SessionManager load_current_dir_session", 81 | desc = "Load Current", 82 | }, 83 | }, 84 | } 85 | -------------------------------------------------------------------------------- /lua/plugins/efficiency/sleuth.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "tpope/vim-sleuth", 4 | event = "VeryLazy", 5 | } 6 | -------------------------------------------------------------------------------- /lua/plugins/efficiency/startuptime.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "dstein64/vim-startuptime", 4 | cmd = { "StartupTime" }, 5 | } 6 | -------------------------------------------------------------------------------- /lua/plugins/efficiency/winshift.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "sindrets/winshift.nvim", 4 | enabled = false, 5 | } 6 | -------------------------------------------------------------------------------- /lua/plugins/filetype/crates.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "Saecki/crates.nvim", 4 | event = { "BufRead Cargo.toml" }, 5 | dependencies = { "nvim-lua/plenary.nvim" }, 6 | opts = {}, 7 | } 8 | -------------------------------------------------------------------------------- /lua/plugins/filetype/csv.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "chrisbra/csv.vim", 4 | ft = "csv", 5 | } 6 | -------------------------------------------------------------------------------- /lua/plugins/filetype/gopher.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "olexsmir/gopher.nvim", 4 | ft = { "go" }, 5 | opts = {}, 6 | } 7 | -------------------------------------------------------------------------------- /lua/plugins/filetype/hex.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "RaafatTurki/hex.nvim", 4 | event = { 5 | "BufReadPre", 6 | }, 7 | opts = {}, 8 | } 9 | -------------------------------------------------------------------------------- /lua/plugins/filetype/kitty.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "fladson/vim-kitty", 4 | event = { "BufReadPre kitty.conf" }, 5 | } 6 | -------------------------------------------------------------------------------- /lua/plugins/filetype/lilypond-suite.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "martineausimon/nvim-lilypond-suite", 6 | ft = { "lilypond" }, 7 | opts = { 8 | options = { 9 | border_style = custom.border, 10 | }, 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /lua/plugins/filetype/package-info.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "vuki656/package-info.nvim", 4 | event = { 5 | "BufRead package.json", 6 | "BufRead package-lock.json", 7 | }, 8 | init = function() 9 | vim.api.nvim_create_autocmd("BufRead", { 10 | pattern = { "package.json", "package-lock.json" }, 11 | callback = function(args) 12 | local bufnr = args.buf 13 | 14 | vim.keymap.set("n", "s", function() 15 | require("package-info").show() 16 | end, { desc = "Show package versions", buffer = bufnr }) 17 | vim.keymap.set("n", "c", function() 18 | require("package-info").hide() 19 | end, { desc = "Hide package versions", buffer = bufnr }) 20 | vim.keymap.set("n", "u", function() 21 | require("package-info").update() 22 | end, { desc = "Update package on line", buffer = bufnr }) 23 | vim.keymap.set("n", "d", function() 24 | require("package-info").delete() 25 | end, { desc = "Delete package on line", buffer = bufnr }) 26 | vim.keymap.set("n", "i", function() 27 | require("package-info").install() 28 | end, { desc = "Install a new package", buffer = bufnr }) 29 | vim.keymap.set("n", "p", function() 30 | require("package-info").change_version() 31 | end, { 32 | desc = "Install a different package version", 33 | buffer = bufnr, 34 | }) 35 | end, 36 | }) 37 | end, 38 | dependencies = "MunifTanjim/nui.nvim", 39 | opts = { 40 | package_manager = "pnpm", 41 | }, 42 | } 43 | -------------------------------------------------------------------------------- /lua/plugins/filetype/rest.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "rest-nvim/rest.nvim", 4 | ft = { "http" }, 5 | init = function() 6 | vim.api.nvim_create_autocmd("FileType", { 7 | pattern = "http", 8 | callback = function(args) 9 | local bufnr = args.buf 10 | require "rest-nvim" 11 | 12 | vim.keymap.set("n", "r", "Rest run", { 13 | buffer = bufnr, 14 | silent = true, 15 | desc = "Run request under the cursor", 16 | }) 17 | vim.keymap.set( 18 | "n", 19 | "l", 20 | "Rest run last", 21 | { buffer = bufnr, silent = true, desc = "Re-run latest request" } 22 | ) 23 | end, 24 | }) 25 | end, 26 | main = "rest-nvim", 27 | opts = {}, 28 | } 29 | -------------------------------------------------------------------------------- /lua/plugins/filetype/tailwind-tools.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "luckasRanarison/tailwind-tools.nvim", 6 | lazy = true, 7 | init = function() 8 | vim.api.nvim_create_autocmd("LspAttach", { 9 | callback = function(args) 10 | local client = vim.lsp.get_client_by_id(args.data.client_id) 11 | if client and client.name == "tailwindcss" then 12 | require "tailwind-tools" 13 | return true 14 | end 15 | end, 16 | }) 17 | end, 18 | opts = { 19 | conceal = { 20 | symbol = "…", 21 | }, 22 | }, 23 | config = function(_, opts) 24 | require("tailwind-tools").setup(opts) 25 | custom.cmp_format.before = require("tailwind-tools.cmp").lspkind_format 26 | end, 27 | } 28 | -------------------------------------------------------------------------------- /lua/plugins/filetype/tex.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "lervag/vimtex", 4 | ft = { "tex" }, 5 | config = function() 6 | vim.g.tex_flavor = "latex" 7 | 8 | vim.g.vimtex_mappings_prefix = "" 9 | vim.g.vimtex_quickfix_mode = 0 10 | vim.g.vimtex_compiler_latexmk_engines = { _ = "-xelatex" } 11 | vim.g.vimtex_compiler_latexrun_engines = { _ = "xelatex" } 12 | vim.g.vimtex_compiler_progname = "nvr" 13 | vim.g.vimtex_toc_config = { 14 | name = "TOC", 15 | layers = { "content", "todo", "include" }, 16 | split_width = 25, 17 | todo_sorted = 0, 18 | show_help = 1, 19 | show_numbers = 1, 20 | } 21 | end, 22 | } 23 | -------------------------------------------------------------------------------- /lua/plugins/git/diffview.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "sindrets/diffview.nvim", 4 | cmd = { 5 | "DiffviewOpen", 6 | "DiffviewFileHistory", 7 | }, 8 | keys = { 9 | { "gdo", "DiffviewOpen", desc = "Open" }, 10 | { "gdc", "DiffviewClose", desc = "Close" }, 11 | { "gdh", "DiffviewFileHistory", desc = "Open History" }, 12 | { 13 | "gdf", 14 | "DiffviewFileHistory %", 15 | desc = "Current History", 16 | }, 17 | }, 18 | opts = function() 19 | local actions = require "diffview.actions" 20 | 21 | return { 22 | enhanced_diff_hl = true, 23 | show_help_hints = false, 24 | file_panel = { 25 | win_config = { 26 | width = math.floor(vim.go.columns * 0.2) > 25 and math.floor( 27 | vim.go.columns * 0.2 28 | ) or 25, 29 | }, 30 | }, 31 | hooks = { 32 | diff_buf_win_enter = function(_, winid) 33 | vim.wo[winid].wrap = false 34 | end, 35 | }, 36 | keymaps = { 37 | view = { 38 | { "n", "q", actions.close, { desc = "Close diffview" } }, 39 | { "n", "", actions.close, { desc = "Close diffview" } }, 40 | }, 41 | file_panel = { 42 | { "n", "q", actions.close, { desc = "Close diffview" } }, 43 | { "n", "", actions.close, { desc = "Close diffview" } }, 44 | }, 45 | file_history_panel = { 46 | { "n", "q", actions.close, { desc = "Close diffview" } }, 47 | { "n", "", actions.close, { desc = "Close diffview" } }, 48 | }, 49 | }, 50 | } 51 | end, 52 | } 53 | -------------------------------------------------------------------------------- /lua/plugins/git/flog.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "rbong/vim-flog", 4 | init = function() 5 | vim.g.flog_enable_extended_chars = 1 6 | end, 7 | dependencies = { 8 | "tpope/vim-fugitive", 9 | }, 10 | cmd = "Flog", 11 | } 12 | -------------------------------------------------------------------------------- /lua/plugins/git/fugitive.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "tpope/vim-fugitive", 4 | cmd = { 5 | "G", 6 | "Git", 7 | }, 8 | } 9 | -------------------------------------------------------------------------------- /lua/plugins/git/gist.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "Rawnly/gist.nvim", 4 | cmd = { 5 | "GistCreate", 6 | "GistCreateFromFile", 7 | "GistsList", 8 | }, 9 | opts = {}, 10 | } 11 | -------------------------------------------------------------------------------- /lua/plugins/git/git-conflict.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "akinsho/git-conflict.nvim", 4 | event = "VeryLazy", 5 | opts = { 6 | default_mappings = { 7 | ours = "co", 8 | theirs = "ct", 9 | none = "c0", 10 | both = "cb", 11 | next = "]x", 12 | prev = "[x", 13 | }, 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /lua/plugins/git/gitlinker.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "ruifm/gitlinker.nvim", 4 | dependencies = "nvim-lua/plenary.nvim", 5 | opts = { 6 | mappings = nil, 7 | }, 8 | keys = { 9 | { 10 | "gy", 11 | function() 12 | require("gitlinker").get_buf_range_url "n" 13 | end, 14 | desc = "Create link", 15 | }, 16 | { 17 | "gy", 18 | function() 19 | require("gitlinker").get_buf_range_url "v" 20 | end, 21 | mode = "v", 22 | desc = "Create link", 23 | }, 24 | }, 25 | } 26 | -------------------------------------------------------------------------------- /lua/plugins/git/gitsigns.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | local utils = require "utils" 3 | 4 | ---@type LazyPluginSpec 5 | return { 6 | "lewis6991/gitsigns.nvim", 7 | event = "VeryLazy", 8 | dependencies = "nvim-lua/plenary.nvim", 9 | keys = { 10 | { 11 | "gB", 12 | function() 13 | require("gitsigns").blame() 14 | end, 15 | desc = "Blame", 16 | }, 17 | }, 18 | opts = { 19 | word_diff = true, 20 | attach_to_untracked = true, 21 | preview_config = { 22 | border = custom.border, 23 | }, 24 | on_attach = function(bufnr) 25 | local gitsigns = require "gitsigns" 26 | local next_hunk, prev_hunk = utils.make_repeatable_move_pair(function() 27 | gitsigns.nav_hunk "next" 28 | end, function() 29 | gitsigns.nav_hunk "prev" 30 | end) 31 | 32 | -- Navigation 33 | vim.keymap.set("n", "]h", function() 34 | if vim.wo.diff then 35 | vim.cmd.normal { "]h", bang = true } 36 | else 37 | next_hunk() 38 | end 39 | end, { buffer = bufnr, desc = "Next hunk" }) 40 | 41 | vim.keymap.set("n", "[h", function() 42 | if vim.wo.diff then 43 | vim.cmd.normal { "[h", bang = true } 44 | else 45 | prev_hunk() 46 | end 47 | end, { buffer = bufnr, desc = "Previous hunk" }) 48 | 49 | -- Actions 50 | vim.keymap.set( 51 | "n", 52 | "gs", 53 | gitsigns.stage_hunk, 54 | { buffer = bufnr, desc = "Stage hunk" } 55 | ) 56 | vim.keymap.set("v", "gs", function() 57 | gitsigns.stage_hunk { vim.fn.line ".", vim.fn.line "v" } 58 | end, { buffer = bufnr, desc = "Stage hunk" }) 59 | vim.keymap.set( 60 | "n", 61 | "gr", 62 | gitsigns.reset_hunk, 63 | { buffer = bufnr, desc = "Reset hunk" } 64 | ) 65 | vim.keymap.set("v", "gr", function() 66 | gitsigns.reset_hunk { vim.fn.line ".", vim.fn.line "v" } 67 | end, { buffer = bufnr, desc = "Reset hunk" }) 68 | vim.keymap.set( 69 | "n", 70 | "gu", 71 | gitsigns.undo_stage_hunk, 72 | { buffer = bufnr, desc = "Undo stage hunk" } 73 | ) 74 | vim.keymap.set( 75 | "n", 76 | "gS", 77 | gitsigns.stage_buffer, 78 | { buffer = bufnr, desc = "Stage buffer" } 79 | ) 80 | vim.keymap.set( 81 | "n", 82 | "gR", 83 | gitsigns.reset_buffer, 84 | { buffer = bufnr, desc = "Reset buffer" } 85 | ) 86 | vim.keymap.set( 87 | "n", 88 | "gp", 89 | gitsigns.preview_hunk, 90 | { buffer = bufnr, desc = "Preview hunk" } 91 | ) 92 | vim.keymap.set("n", "gb", function() 93 | gitsigns.blame_line { 94 | full = true, 95 | ignore_whitespace = true, 96 | } 97 | end, { buffer = bufnr, desc = "Blame line" }) 98 | 99 | vim.keymap.set( 100 | "n", 101 | "tD", 102 | gitsigns.toggle_deleted, 103 | { buffer = bufnr, desc = "GIt deleted" } 104 | ) 105 | vim.keymap.set( 106 | "n", 107 | "tb", 108 | gitsigns.toggle_current_line_blame, 109 | { buffer = bufnr, desc = "Line blame" } 110 | ) 111 | 112 | -- Text object 113 | vim.keymap.set( 114 | { "o", "x" }, 115 | "ih", 116 | ":Gitsigns select_hunk", 117 | { desc = "a git hunk" } 118 | ) 119 | vim.keymap.set( 120 | { "o", "x" }, 121 | "ah", 122 | ":Gitsigns select_hunk", 123 | { desc = "a git hunk" } 124 | ) 125 | end, 126 | }, 127 | config = function(_, opts) 128 | require("gitsigns").setup(opts) 129 | 130 | local function set_hl() 131 | vim.api.nvim_set_hl(0, "GitSignsChangeLn", { link = "DiffText" }) 132 | vim.api.nvim_set_hl(0, "GitSignsDeleteLn", { link = "DiffDelete" }) 133 | 134 | vim.api.nvim_set_hl(0, "GitSignsAddInline", { link = "GitSignsAddLn" }) 135 | vim.api.nvim_set_hl( 136 | 0, 137 | "GitSignsDeleteInline", 138 | { link = "GitSignsDeleteLn" } 139 | ) 140 | vim.api.nvim_set_hl( 141 | 0, 142 | "GitSignsChangeInline", 143 | { link = "GitSignsChangeLn" } 144 | ) 145 | end 146 | set_hl() 147 | vim.api.nvim_create_autocmd("ColorScheme", { 148 | desc = "Set gitsigns highlights", 149 | callback = set_hl, 150 | }) 151 | end, 152 | } 153 | -------------------------------------------------------------------------------- /lua/plugins/git/neogit.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "NeogitOrg/neogit", 4 | dependencies = { 5 | "nvim-lua/plenary.nvim", 6 | "sindrets/diffview.nvim", 7 | }, 8 | cmd = { 9 | "Neogit", 10 | }, 11 | keys = { 12 | { "gg", "Neogit", desc = "Open Neogit" }, 13 | }, 14 | opts = { 15 | disable_hint = true, 16 | graph_style = "kitty", 17 | integrations = { 18 | diffview = true, 19 | }, 20 | sections = { 21 | stashes = { 22 | folded = false, 23 | }, 24 | recent = { 25 | folded = false, 26 | }, 27 | }, 28 | }, 29 | } 30 | -------------------------------------------------------------------------------- /lua/plugins/git/octo.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "pwntester/octo.nvim", 4 | cmd = { "Octo" }, 5 | opts = { 6 | picker = "fzf-lua", 7 | picker_config = { 8 | use_emojis = true, 9 | }, 10 | }, 11 | } 12 | -------------------------------------------------------------------------------- /lua/plugins/init.lua: -------------------------------------------------------------------------------- 1 | ---@type LazySpecImport 2 | return { 3 | { import = "plugins.colorscheme" }, 4 | { import = "plugins.ui" }, 5 | { import = "plugins.dap" }, 6 | { import = "plugins.edit" }, 7 | { import = "plugins.efficiency" }, 8 | { import = "plugins.filetype" }, 9 | { import = "plugins.git" }, 10 | { import = "plugins.lib" }, 11 | { import = "plugins.lsp" }, 12 | { import = "plugins.treesitter" }, 13 | { import = "plugins.tool" }, 14 | } 15 | -------------------------------------------------------------------------------- /lua/plugins/lib/litee.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "ldelossa/litee.nvim", 4 | lazy = true, 5 | main = "litee.lib", 6 | opts = {}, 7 | } 8 | -------------------------------------------------------------------------------- /lua/plugins/lib/luvit.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "Bilal2453/luvit-meta", 4 | lazy = true, 5 | } 6 | -------------------------------------------------------------------------------- /lua/plugins/lib/mini.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "echasnovski/mini.nvim", 4 | enabled = false, 5 | } 6 | -------------------------------------------------------------------------------- /lua/plugins/lib/nio.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "nvim-neotest/nvim-nio", 4 | lazy = true, 5 | } 6 | -------------------------------------------------------------------------------- /lua/plugins/lib/plenary.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "nvim-lua/plenary.nvim", 4 | lazy = true, 5 | keys = { 6 | { 7 | "hpb", 8 | function() 9 | require("plenary.profile").start("profile.log", { flame = true }) 10 | end, 11 | desc = "Begin profiling", 12 | }, 13 | { 14 | "hpe", 15 | function() 16 | require("plenary.profile").stop() 17 | end, 18 | desc = "End profiling", 19 | }, 20 | }, 21 | } 22 | -------------------------------------------------------------------------------- /lua/plugins/lib/snacks.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "folke/snacks.nvim", 4 | ---@module "snacks" 5 | ---@type snacks.Config 6 | opts = { 7 | input = { 8 | icon = " ", 9 | }, 10 | styles = { 11 | input = { 12 | title_pos = "left", 13 | relative = "cursor", 14 | row = 1, 15 | col = 0, 16 | width = 30, 17 | }, 18 | }, 19 | }, 20 | } 21 | -------------------------------------------------------------------------------- /lua/plugins/lsp/clangd_extensions.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "p00f/clangd_extensions.nvim", 6 | ft = { 7 | "c", 8 | "cpp", 9 | }, 10 | opts = { 11 | memory_usage = { 12 | border = custom.border, 13 | }, 14 | symbol_info = { 15 | border = custom.border, 16 | }, 17 | }, 18 | config = function(_, opts) 19 | require("clangd_extensions").setup(opts) 20 | 21 | local group = vim.api.nvim_create_augroup("clangd_extesnion", { 22 | clear = true, 23 | }) 24 | 25 | local has_cmp, cmp = pcall(require, "cmp") 26 | if has_cmp then 27 | vim.api.nvim_create_autocmd("Filetype", { 28 | group = group, 29 | desc = "Setup clangd_extension scores for cmp", 30 | pattern = "c,cpp", 31 | callback = function() 32 | cmp.setup.buffer { 33 | sorting = { 34 | comparators = { 35 | cmp.config.compare.offset, 36 | cmp.config.compare.exact, 37 | cmp.config.compare.recently_used, 38 | require "clangd_extensions.cmp_scores", 39 | cmp.config.compare.kind, 40 | cmp.config.compare.sort_text, 41 | cmp.config.compare.length, 42 | cmp.config.compare.order, 43 | }, 44 | }, 45 | } 46 | end, 47 | }) 48 | end 49 | 50 | vim.api.nvim_create_autocmd("LspAttach", { 51 | group = group, 52 | desc = "Setup clangd_extesnion keymap for cmp", 53 | callback = function(args) 54 | local bufnr = args.buf 55 | local client = vim.lsp.get_client_by_id(args.data.client_id) 56 | if client == nil or client.name ~= "clangd" then 57 | return 58 | end 59 | vim.keymap.set( 60 | "n", 61 | "t", 62 | "ClangdAST", 63 | { buffer = bufnr, desc = "Show AST" } 64 | ) 65 | vim.keymap.set( 66 | "n", 67 | "", 68 | "ClangdSwitchSourceHeader", 69 | { buffer = bufnr, desc = "Switch between source and header" } 70 | ) 71 | vim.keymap.set( 72 | "n", 73 | "h", 74 | "ClangdTypeHierarchy", 75 | { buffer = bufnr, desc = "Show type hierarchy" } 76 | ) 77 | vim.keymap.set( 78 | "n", 79 | "m", 80 | "ClangdMemoryUsage", 81 | { buffer = bufnr, desc = "Clangd memory usage" } 82 | ) 83 | end, 84 | }) 85 | end, 86 | } 87 | -------------------------------------------------------------------------------- /lua/plugins/lsp/emmet.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "olrtg/nvim-emmet", 4 | lazy = true, 5 | init = function() 6 | vim.api.nvim_create_autocmd("LspAttach", { 7 | desc = "Setup nvim-emmet", 8 | callback = function(args) 9 | local bufnr = args.buf 10 | local client = vim.lsp.get_client_by_id(args.data.client_id) 11 | 12 | if client == nil or client.name ~= "emmet_language_server" then 13 | return 14 | end 15 | 16 | vim.keymap.set("n", "x", function() 17 | require("nvim-emmet").wrap_with_abbreviation() 18 | end, { buffer = bufnr, desc = "Wrap with abbreviation" }) 19 | end, 20 | }) 21 | end, 22 | } 23 | -------------------------------------------------------------------------------- /lua/plugins/lsp/flutter-tools.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "akinsho/flutter-tools.nvim", 6 | event = { 7 | "BufRead *.dart", 8 | "BufNewFile *.dart", 9 | }, 10 | dependencies = { 11 | "nvim-lua/plenary.nvim", 12 | }, 13 | opts = { 14 | ui = { 15 | border = custom.border, 16 | }, 17 | lsp = { 18 | on_attach = function(client, bufnr) 19 | vim.keymap.set( 20 | "n", 21 | "o", 22 | "FlutterOutlineOpen", 23 | { buffer = bufnr, desc = "Flutter Outline" } 24 | ) 25 | vim.keymap.set( 26 | "n", 27 | "r", 28 | "FlutterRun", 29 | { buffer = bufnr, desc = "Run" } 30 | ) 31 | vim.keymap.set( 32 | "n", 33 | "q", 34 | "FlutterQuit", 35 | { buffer = bufnr, desc = "Quit" } 36 | ) 37 | end, 38 | }, 39 | }, 40 | } 41 | -------------------------------------------------------------------------------- /lua/plugins/lsp/jdtls.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "mfussenegger/nvim-jdtls", 4 | event = { 5 | "BufRead *.java", 6 | "BufNewFile *.java", 7 | }, 8 | opts = function() 9 | return { 10 | cmd = { "jdtls" }, 11 | handlers = { 12 | ["language/status"] = function() end, 13 | }, 14 | settings = { 15 | java = { 16 | inlayHints = { 17 | parameterNames = { 18 | enabled = "all", 19 | }, 20 | }, 21 | }, 22 | }, 23 | } 24 | end, 25 | config = function(_, opts) 26 | local jdtls = require "jdtls" 27 | 28 | vim.api.nvim_create_autocmd("FileType", { 29 | pattern = "java", 30 | desc = "Attach jdtls", 31 | callback = function() 32 | jdtls.start_or_attach(opts, { dap = { hotcodereplace = "auto" } }) 33 | vim.bo.tabstop = 4 34 | end, 35 | }) 36 | end, 37 | } 38 | -------------------------------------------------------------------------------- /lua/plugins/lsp/lazydev.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "ofseed/lazydev.nvim", 4 | ft = "lua", 5 | opts = { 6 | library = { 7 | { 8 | path = "luvit-meta/library", 9 | words = { "vim%.uv" }, 10 | }, 11 | { 12 | path = "lazy.nvim", 13 | words = { "Lazy.*Spec" }, 14 | }, 15 | }, 16 | enabled = function(root_dir) 17 | if vim.g.lazydev_enabled == false then 18 | return false 19 | end 20 | 21 | -- Disable if .luarc.json exists and workspace.library is set 22 | local fd = vim.uv.fs_open(root_dir .. "/.luarc.json", "r", 438) 23 | if fd then 24 | local luarc = 25 | vim.json.decode(assert(vim.uv.fs_read(fd, vim.uv.fs_fstat(fd).size))) 26 | return not (luarc.workspace and luarc.workspace.library) 27 | end 28 | return true 29 | end, 30 | }, 31 | } 32 | -------------------------------------------------------------------------------- /lua/plugins/lsp/lspconfig.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "neovim/nvim-lspconfig", 6 | event = { 7 | "Filetype", 8 | }, 9 | dependencies = { 10 | "folke/neoconf.nvim", 11 | }, 12 | config = function() 13 | require("lspconfig.ui.windows").default_options.border = custom.border 14 | end, 15 | keys = { 16 | { 17 | "lR", 18 | function() 19 | vim.cmd.LspRestart() 20 | end, 21 | desc = "Reload", 22 | }, 23 | { 24 | "lI", 25 | function() 26 | vim.cmd.LspInfo() 27 | end, 28 | desc = "Info", 29 | }, 30 | }, 31 | } 32 | -------------------------------------------------------------------------------- /lua/plugins/lsp/rustacean.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "mrcjkb/rustaceanvim", 4 | ft = { "rust" }, 5 | opts = { 6 | dap = { 7 | adapter = { 8 | type = "server", 9 | port = "${port}", 10 | host = "127.0.0.1", 11 | executable = { 12 | command = "codelldb", 13 | args = { 14 | "--port", 15 | "${port}", 16 | "--settings", 17 | vim.json.encode { 18 | showDisassembly = "never", 19 | }, 20 | }, 21 | }, 22 | }, 23 | }, 24 | }, 25 | config = function(_, opts) 26 | ---@module "rustaceanvim" 27 | vim.g.rustaceanvim = opts 28 | end, 29 | } 30 | -------------------------------------------------------------------------------- /lua/plugins/lsp/schema-store.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "b0o/SchemaStore.nvim", 4 | ft = { "json", "yaml" }, 5 | config = function() 6 | vim.lsp.config("jsonls", { 7 | settings = { 8 | json = { 9 | schemas = require("schemastore").json.schemas(), 10 | validate = { enable = true }, 11 | }, 12 | }, 13 | on_attach = function(client) 14 | client.server_capabilities.documentFormattingProvider = false 15 | end, 16 | }) 17 | vim.lsp.config("yamlls", { 18 | settings = { 19 | yaml = { 20 | keyOrdering = false, 21 | schemaStore = { 22 | enable = false, 23 | url = "", 24 | }, 25 | schemas = require("schemastore").yaml.schemas { 26 | ignore = { 27 | -- Very easy to conflict with other `deploy.yaml` 28 | "Deployer Recipe", 29 | }, 30 | }, 31 | }, 32 | }, 33 | }) 34 | end, 35 | } 36 | -------------------------------------------------------------------------------- /lua/plugins/lsp/typescript-tools.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "pmizio/typescript-tools.nvim", 4 | enabled = false, 5 | event = { 6 | "BufRead *.js,*.jsx,*.mjs,*.cjs,*.ts,*.tsx,*.vue", 7 | "BufNewFile *.js,*.jsx,*.mjs,*.cjs,*.ts,*.tsx,*.vue", 8 | }, 9 | dependencies = { 10 | "nvim-lua/plenary.nvim", 11 | "neovim/nvim-lspconfig", 12 | }, 13 | opts = { 14 | filetypes = { 15 | "javascript", 16 | "javascriptreact", 17 | "typescript", 18 | "typescriptreact", 19 | "vue", 20 | }, 21 | on_attach = function(client, bufnr) 22 | client.server_capabilities.documentFormattingProvider = false 23 | client.server_capabilities.documentRangeFormattingProvider = false 24 | 25 | vim.keymap.set( 26 | "n", 27 | "gD", 28 | "TSToolsGoToSourceDefinition", 29 | { buffer = bufnr, desc = "Source Definition" } 30 | ) 31 | 32 | vim.keymap.set( 33 | "n", 34 | "i", 35 | "TSToolsAddMissingImports", 36 | { buffer = bufnr, desc = "Add missing imports" } 37 | ) 38 | vim.keymap.set( 39 | "n", 40 | "o", 41 | "TSToolsOrganizeImports", 42 | { buffer = bufnr, desc = "Organize imports" } 43 | ) 44 | vim.keymap.set( 45 | "n", 46 | "r", 47 | "TSToolsRemoveUnused", 48 | { buffer = bufnr, desc = "Remove unused variables" } 49 | ) 50 | vim.keymap.set( 51 | "n", 52 | "F", 53 | "TSToolsFixAll", 54 | { buffer = bufnr, desc = "Fix all" } 55 | ) 56 | 57 | vim.keymap.set( 58 | "n", 59 | "fr", 60 | "TSToolsFileReferences", 61 | { buffer = bufnr, desc = "File references" } 62 | ) 63 | vim.keymap.set( 64 | "n", 65 | "fn", 66 | "TSToolsRenameFile", 67 | { buffer = bufnr, desc = "File rename" } 68 | ) 69 | end, 70 | settings = { 71 | tsserver_file_preferences = { 72 | importModuleSpecifierPreference = "non-relative", 73 | 74 | includeInlayParameterNameHints = "all", 75 | includeInlayParameterNameHintsWhenArgumentMatchesName = false, 76 | includeInlayFunctionParameterTypeHints = true, 77 | includeInlayVariableTypeHints = true, 78 | includeInlayPropertyDeclarationTypeHints = true, 79 | includeInlayFunctionLikeReturnTypeHints = true, 80 | includeInlayEnumMemberValueHints = true, 81 | }, 82 | tsserver_plugins = { 83 | "@vue/typescript-plugin", 84 | }, 85 | }, 86 | code_lens = "all", 87 | }, 88 | } 89 | -------------------------------------------------------------------------------- /lua/plugins/lsp/vtsls.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "yioneko/nvim-vtsls", 4 | init = function() 5 | vim.api.nvim_create_autocmd("LspAttach", { 6 | callback = function(args) 7 | local bufnr = args.buf 8 | local client = vim.lsp.get_client_by_id(args.data.client_id) 9 | 10 | if client and client.name == "vtsls" then 11 | vim.keymap.set( 12 | "n", 13 | "d", 14 | "VtsExec go_to_source_definition", 15 | { buffer = bufnr, desc = "Source Definition" } 16 | ) 17 | vim.keymap.set( 18 | "n", 19 | "i", 20 | "VtsExec add_missing_imports", 21 | { buffer = bufnr, desc = "Add missing imports" } 22 | ) 23 | vim.keymap.set( 24 | "n", 25 | "o", 26 | "VtsExec organize_imports", 27 | { buffer = bufnr, desc = "Organize imports" } 28 | ) 29 | vim.keymap.set( 30 | "n", 31 | "r", 32 | "VtsExec remove_unused", 33 | { buffer = bufnr, desc = "Remove unused variables" } 34 | ) 35 | vim.keymap.set( 36 | "n", 37 | "F", 38 | "VtsExec fix_all", 39 | { buffer = bufnr, desc = "Fix all" } 40 | ) 41 | 42 | vim.keymap.set( 43 | "n", 44 | "fr", 45 | "VtsExec file_references", 46 | { buffer = bufnr, desc = "File references" } 47 | ) 48 | vim.keymap.set( 49 | "n", 50 | "fn", 51 | "VtsExec rename_file", 52 | { buffer = bufnr, desc = "File rename" } 53 | ) 54 | end 55 | end, 56 | }) 57 | end, 58 | opts = {}, 59 | config = function(_, opts) 60 | require("vtsls").config(opts) 61 | end, 62 | } 63 | -------------------------------------------------------------------------------- /lua/plugins/tool/2048.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "NStefan002/2048.nvim", 4 | cmd = "Play2048", 5 | opts = {}, 6 | } 7 | -------------------------------------------------------------------------------- /lua/plugins/tool/aerial.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "stevearc/aerial.nvim", 6 | enabled = false, 7 | opts = { 8 | backends = { "lsp", "treesitter", "markdown" }, 9 | float = { 10 | border = custom.border, 11 | }, 12 | }, 13 | keys = { 14 | { "a", "AerialToggle", desc = "Outline" }, 15 | }, 16 | } 17 | -------------------------------------------------------------------------------- /lua/plugins/tool/conform.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "stevearc/conform.nvim", 4 | opts = { 5 | formatters_by_ft = { 6 | lua = { "stylua" }, 7 | nix = { "nixfmt" }, 8 | python = { "isort", "black" }, 9 | go = { "gofumpt", "goimports" }, 10 | 11 | html = { "prettier" }, 12 | css = { "prettier" }, 13 | less = { "prettier" }, 14 | scss = { "prettier" }, 15 | javascript = { "prettier" }, 16 | typescript = { "prettier" }, 17 | javascriptreact = { "prettier" }, 18 | typescriptreact = { "prettier" }, 19 | vue = { "prettier" }, 20 | json = { "prettier" }, 21 | jsonc = { "prettier" }, 22 | yaml = { "prettier" }, 23 | }, 24 | }, 25 | keys = { 26 | { 27 | "F", 28 | function() 29 | require("conform").format { lsp_fallback = true, async = true } 30 | end, 31 | desc = "Format Document", 32 | mode = { "n", "v" }, 33 | }, 34 | }, 35 | } 36 | -------------------------------------------------------------------------------- /lua/plugins/tool/copilot-chat.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "CopilotC-Nvim/CopilotChat.nvim", 4 | branch = "canary", 5 | enabled = false, 6 | cmd = { 7 | "CopilotChat", 8 | "CopilotChatOpen", 9 | "CopilotChatClose", 10 | "CopilotChatToggle", 11 | "CopilotChatStop", 12 | "CopilotChatReset", 13 | "CopilotChatSave", 14 | "CopilotChatLoad", 15 | "CopilotChatDebugInfo", 16 | }, 17 | opts = {}, 18 | } 19 | -------------------------------------------------------------------------------- /lua/plugins/tool/dadbod-ui.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "kristijanhusak/vim-dadbod-ui", 3 | enabled = false, 4 | cmd = { "DBUIToggle" }, 5 | } 6 | -------------------------------------------------------------------------------- /lua/plugins/tool/dadbod.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "tpope/vim-dadbod", 4 | enabled = false, 5 | } 6 | -------------------------------------------------------------------------------- /lua/plugins/tool/direnv.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "direnv/direnv.vim", 4 | config = function() end, 5 | } 6 | -------------------------------------------------------------------------------- /lua/plugins/tool/fundo.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "kevinhwang91/nvim-fundo", 4 | event = { 5 | "BufReadPre", 6 | }, 7 | dependencies = "kevinhwang91/promise-async", 8 | build = function() 9 | require("fundo").install() 10 | end, 11 | opts = {}, 12 | } 13 | -------------------------------------------------------------------------------- /lua/plugins/tool/fzf.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "ibhagwan/fzf-lua", 6 | init = function() 7 | ---@diagnostic disable-next-line: duplicate-set-field 8 | vim.ui.select = function(...) 9 | require("fzf-lua").register_ui_select() 10 | vim.ui.select(...) 11 | end 12 | end, 13 | cmd = { "FzfLua" }, 14 | opts = { 15 | hls = { 16 | normal = "NormalFloat", 17 | border = "FloatBorder", 18 | title = "FloatTitle", 19 | preview_normal = "NormalFloat", 20 | preview_border = "FloatBorder", 21 | preview_title = "FloatTitle", 22 | }, 23 | fzf_colors = { 24 | ["fg"] = { "fg", "NormalFloat" }, 25 | ["bg"] = { "bg", "NormalFloat" }, 26 | ["hl"] = { "fg", "Statement" }, 27 | ["fg+"] = { "fg", "NormalFloat" }, 28 | ["bg+"] = { "bg", "CursorLine" }, 29 | ["hl+"] = { "fg", "Statement" }, 30 | ["info"] = { "fg", "PreProc" }, 31 | ["prompt"] = { "fg", "Conditional" }, 32 | ["pointer"] = { "fg", "Exception" }, 33 | ["marker"] = { "fg", "Keyword" }, 34 | ["spinner"] = { "fg", "Label" }, 35 | ["header"] = { "fg", "Comment" }, 36 | ["gutter"] = { "bg", "NormalFloat" }, 37 | }, 38 | files = { 39 | formatter = "path.filename_first", 40 | }, 41 | winopts = { 42 | border = custom.border, 43 | }, 44 | lsp = { 45 | symbols = { 46 | symbol_icons = custom.icons.kind, 47 | }, 48 | }, 49 | }, 50 | keys = { 51 | { 52 | "ff", 53 | function() 54 | require("fzf-lua").files() 55 | end, 56 | desc = "Files", 57 | }, 58 | { 59 | "fb", 60 | function() 61 | require("fzf-lua").buffers() 62 | end, 63 | desc = "Buffers", 64 | }, 65 | { 66 | "f?", 67 | function() 68 | require("fzf-lua").help_tags() 69 | end, 70 | desc = "Help tags", 71 | }, 72 | { 73 | "fh", 74 | function() 75 | require("fzf-lua").oldfiles() 76 | end, 77 | desc = "Old files", 78 | }, 79 | { 80 | "fm", 81 | function() 82 | require("fzf-lua").marks() 83 | end, 84 | desc = "Marks", 85 | }, 86 | { 87 | "fs", 88 | function() 89 | require("fzf-lua").lsp_document_symbols() 90 | end, 91 | desc = "Document Symbols", 92 | }, 93 | { 94 | "fS", 95 | function() 96 | require("fzf-lua").lsp_workspace_symbols() 97 | end, 98 | desc = "Workspace Symbols", 99 | }, 100 | { 101 | "fc", 102 | function() 103 | require("fzf-lua").colorschemes() 104 | end, 105 | desc = "Colorscheme", 106 | }, 107 | { 108 | "fH", 109 | function() 110 | require("fzf-lua").highlights() 111 | end, 112 | desc = "Highlights", 113 | }, 114 | { 115 | "fj", 116 | function() 117 | require("fzf-lua").jump() 118 | end, 119 | desc = "Jumplist", 120 | }, 121 | { 122 | "fw", 123 | function() 124 | require("fzf-lua").live_grep_native() 125 | end, 126 | desc = "Live grep", 127 | }, 128 | { 129 | "fr", 130 | function() 131 | require("fzf-lua").registers() 132 | end, 133 | desc = "Registers", 134 | }, 135 | { 136 | "fk", 137 | function() 138 | require("fzf-lua").keymaps() 139 | end, 140 | desc = "Keymaps", 141 | }, 142 | -- { 143 | -- "fn", 144 | -- function() 145 | -- -- To be implement 146 | -- end, 147 | -- desc = "Notify", 148 | -- }, 149 | 150 | -- git 151 | { 152 | "fgc", 153 | function() 154 | require("fzf-lua").git_commits() 155 | end, 156 | desc = "Commits", 157 | }, 158 | { 159 | "fgb", 160 | function() 161 | require("fzf-lua").git_branchs() 162 | end, 163 | desc = "Branchs", 164 | }, 165 | { 166 | "fgt", 167 | function() 168 | require("fzf-lua").git_tags() 169 | end, 170 | desc = "Tags", 171 | }, 172 | 173 | -- dap 174 | { 175 | "fde", 176 | function() 177 | require("fzf-lua").dap_commands() 178 | end, 179 | desc = "Commands", 180 | }, 181 | { 182 | "fdc", 183 | function() 184 | require("fzf-lua").dap_configurations() 185 | end, 186 | desc = "Configurations", 187 | }, 188 | { 189 | "fdb", 190 | function() 191 | require("fzf-lua").dap_breakpoints() 192 | end, 193 | desc = "Breakpoints", 194 | }, 195 | { 196 | "fdv", 197 | function() 198 | require("fzf-lua").dap_variables() 199 | end, 200 | desc = "Variables", 201 | }, 202 | { 203 | "fdf", 204 | function() 205 | require("fzf-lua").dap_frames() 206 | end, 207 | desc = "Frames", 208 | }, 209 | }, 210 | config = function(_, opts) 211 | local actions = require "fzf-lua.actions" 212 | 213 | -- https://github.com/tiagovla/scope.nvim/issues/35 214 | ---@diagnostic disable-next-line: duplicate-set-field 215 | actions.file_tabedit = function(selected, action_opts) 216 | local vimcmd = "tabedit | " 217 | actions.vimcmd_entry(vimcmd, selected, action_opts) 218 | end 219 | 220 | require("fzf-lua").setup(opts) 221 | end, 222 | } 223 | -------------------------------------------------------------------------------- /lua/plugins/tool/gp.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | ---@module "gp" 6 | "https://github.com/Robitx/gp.nvim", 7 | ---@type GpConfig 8 | opts = { 9 | providers = { 10 | openai = { 11 | endpoint = "https://models.inference.ai.azure.com/chat/completions", 12 | secret = vim.env.GITHUB_TOKEN, 13 | }, 14 | }, 15 | toggle_target = "split", 16 | chat_free_cursor = true, 17 | style_chat_finder_border = custom.border, 18 | style_popup_border = custom.border, 19 | }, 20 | cmd = { 21 | -- Chat 22 | "GpChatNew", 23 | "GpChatToggle", 24 | "GpChatFinder", 25 | }, 26 | keys = { 27 | -- Chat 28 | { 29 | "n", 30 | "GpChatNew split", 31 | mode = { "n", "i" }, 32 | desc = "New Chat", 33 | }, 34 | { 35 | "n", 36 | ":'<,'>GpChatNew split", 37 | mode = { "v" }, 38 | desc = "New Chat", 39 | }, 40 | { 41 | "t", 42 | "GpChatToggle split", 43 | mode = { "n", "i" }, 44 | desc = "Toggle Chat", 45 | }, 46 | { 47 | "t", 48 | ":'<,'>GpChatToggle split", 49 | mode = { "v" }, 50 | desc = "Toggle Chat", 51 | }, 52 | { 53 | "f", 54 | "GpChatFinder", 55 | mode = { "n", "i" }, 56 | desc = "Find Chat", 57 | }, 58 | { 59 | "p", 60 | ":'<,'>GpChatPaste", 61 | mode = { "v" }, 62 | desc = "Chat Paste", 63 | }, 64 | }, 65 | } 66 | -------------------------------------------------------------------------------- /lua/plugins/tool/image.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "3rd/image.nvim", 4 | enabled = vim.uv.os_uname().sysname ~= "Windows_NT", 5 | init = function() 6 | if vim.uv.os_uname().sysname == "Linux" then 7 | vim.uv.fs_stat("/etc/NIXOS", function(_, stat) 8 | if stat then 9 | ---@diagnostic disable-next-line: missing-parameter 10 | local home = vim.uv.os_getenv "HOME" 11 | package.path = table.concat({ 12 | home .. "/.nix-profile/share/lua/5.1/?/init.lua", 13 | home .. "/.nix-profile/share/lua/5.1/?.lua", 14 | package.path, 15 | }, ";") 16 | end 17 | end) 18 | end 19 | end, 20 | dependencies = { 21 | { "leafo/magick" }, 22 | }, 23 | ft = { "markdown", "org", "norg" }, 24 | event = function(plugin) 25 | return { 26 | { 27 | event = "BufRead", 28 | pattern = plugin.opts.hijack_file_patterns, 29 | }, 30 | } 31 | end, 32 | opts = { 33 | hijack_file_patterns = { "*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp" }, 34 | }, 35 | } 36 | -------------------------------------------------------------------------------- /lua/plugins/tool/kitty-scrollback.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "mikesmithgh/kitty-scrollback.nvim", 4 | cmd = { 5 | "KittyScrollbackGenerateKittens", 6 | "KittyScrollbackCheckHealth", 7 | }, 8 | event = { "User KittyScrollbackLaunch" }, 9 | opts = { 10 | { 11 | paste_window = { 12 | winopts_overrides = function(winopts) 13 | winopts.border = { 14 | "╭", 15 | "─", 16 | "╮", 17 | "│", 18 | "┤", 19 | "─", 20 | "├", 21 | "│", 22 | } 23 | return winopts 24 | end, 25 | footer_winopts_overrides = function(winopts) 26 | winopts.border = { 27 | "│", 28 | " ", 29 | "│", 30 | "│", 31 | "╯", 32 | "─", 33 | "╰", 34 | "│", 35 | } 36 | return winopts 37 | end, 38 | }, 39 | callbacks = { 40 | after_paste_window_ready = function(pastewin_data) 41 | local winid = pastewin_data.paste_window.winid 42 | vim.wo[winid].statuscolumn = "" 43 | end, 44 | }, 45 | }, 46 | }, 47 | } 48 | -------------------------------------------------------------------------------- /lua/plugins/tool/leetcode.lua: -------------------------------------------------------------------------------- 1 | local arg = "leetcode" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | ---@module "leetcode" 6 | "kawre/leetcode.nvim", 7 | lazy = vim.fn.argv()[1] ~= arg, 8 | ---@type lc.UserConfig 9 | opts = { 10 | arg = arg, 11 | cn = { 12 | enabled = true, 13 | }, 14 | injector = { 15 | ["cpp"] = { 16 | before = { 17 | "#include ", 18 | "using namespace std;", 19 | }, 20 | after = { 21 | "int main() {", 22 | " Solution solution;", 23 | " return 0;", 24 | "}", 25 | }, 26 | }, 27 | }, 28 | description = { 29 | position = "top", 30 | }, 31 | console = { 32 | dir = "col", 33 | }, 34 | hooks = { 35 | ["question_enter"] = { 36 | -- For question 37 | function(q) 38 | local bufnr = q.bufnr 39 | 40 | vim.b[bufnr].copilot_enabled = false 41 | 42 | vim.keymap.set( 43 | "n", 44 | "l", 45 | "Leet list", 46 | { buffer = bufnr, desc = "LeetCode list" } 47 | ) 48 | vim.keymap.set( 49 | "n", 50 | "r", 51 | "Leet run", 52 | { buffer = bufnr, desc = "LeetCode run" } 53 | ) 54 | vim.keymap.set( 55 | "n", 56 | "s", 57 | "Leet submit", 58 | { buffer = bufnr, desc = "LeetCode submit" } 59 | ) 60 | vim.keymap.set( 61 | "n", 62 | "i", 63 | "Leet info", 64 | { buffer = bufnr, desc = "LeetCode information" } 65 | ) 66 | vim.keymap.set( 67 | "n", 68 | "d", 69 | "Leet desc", 70 | { buffer = bufnr, desc = "LeetCode description" } 71 | ) 72 | end, 73 | -- For question description 74 | function(q) 75 | local winid = q.description.winid 76 | 77 | vim.wo[winid].wrap = true 78 | vim.wo[winid].showbreak = "NONE" 79 | vim.wo[winid].smoothscroll = true 80 | vim.wo[winid].foldcolumn = "0" 81 | end, 82 | }, 83 | }, 84 | image_support = true, 85 | }, 86 | } 87 | -------------------------------------------------------------------------------- /lua/plugins/tool/lint.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "mfussenegger/nvim-lint", 4 | enabled = false, 5 | opts = { 6 | python = { "pylint" }, 7 | }, 8 | config = function(_, opts) 9 | require("lint").linters_by_ft = opts 10 | 11 | vim.api.nvim_create_autocmd({ 12 | "BufReadPost", 13 | "BufWritePost", 14 | "InsertLeave", 15 | }, { 16 | desc = "Lint", 17 | callback = function() 18 | require("lint").try_lint() 19 | end, 20 | }) 21 | end, 22 | } 23 | -------------------------------------------------------------------------------- /lua/plugins/tool/mason.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "williamboman/mason.nvim", 6 | lazy = false, 7 | opts = { 8 | ui = { 9 | border = custom.border, 10 | }, 11 | }, 12 | keys = { 13 | { "mm", "Mason", desc = "Packages" }, 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /lua/plugins/tool/navbuddy.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "SmiteshP/nvim-navbuddy", 6 | dependencies = { 7 | "neovim/nvim-lspconfig", 8 | "SmiteshP/nvim-navic", 9 | "MunifTanjim/nui.nvim", 10 | }, 11 | opts = { 12 | window = { 13 | border = custom.border, 14 | size = { 15 | height = "60%", 16 | width = "80%", 17 | }, 18 | }, 19 | icons = custom.icons.kind_with_space, 20 | lsp = { 21 | auto_attach = true, 22 | }, 23 | }, 24 | keys = { 25 | { 26 | "n", 27 | function() 28 | require("nvim-navbuddy").open() 29 | end, 30 | desc = "Symbol Navigator", 31 | }, 32 | }, 33 | } 34 | -------------------------------------------------------------------------------- /lua/plugins/tool/neo-tree.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | local kinds = vim.iter(custom.icons.kind):fold({}, function(t, k, v) 3 | t[k] = { icon = v } 4 | return t 5 | end) 6 | 7 | ---@type LazyPluginSpec 8 | return { 9 | "nvim-neo-tree/neo-tree.nvim", 10 | branch = "main", 11 | dependencies = { 12 | "nvim-lua/plenary.nvim", 13 | "nvim-tree/nvim-web-devicons", -- not strictly required, but recommended 14 | "MunifTanjim/nui.nvim", 15 | "s1n7ax/nvim-window-picker", 16 | }, 17 | init = function() 18 | vim.api.nvim_create_autocmd("BufEnter", { 19 | group = vim.api.nvim_create_augroup("load_neo_tree", {}), 20 | desc = "Loads neo-tree when openning a directory", 21 | callback = function(args) 22 | local stats = vim.uv.fs_stat(args.file) 23 | 24 | if not stats or stats.type ~= "directory" then 25 | return 26 | end 27 | 28 | require "neo-tree" 29 | 30 | return true 31 | end, 32 | }) 33 | end, 34 | opts = { 35 | default_source = "last", 36 | popup_border_style = custom.border, 37 | event_handlers = { 38 | { 39 | event = "neo_tree_popup_input_ready", 40 | handler = function(args) 41 | vim.keymap.set( 42 | "i", 43 | "", 44 | vim.cmd.stopinsert, 45 | { noremap = true, buffer = args.bufnr } 46 | ) 47 | end, 48 | }, 49 | }, 50 | default_component_configs = { 51 | icon = { 52 | folder_closed = "", 53 | folder_open = "", 54 | folder_empty = "", 55 | }, 56 | symlink_target = { 57 | enabled = true, 58 | }, 59 | }, 60 | source_selector = { 61 | winbar = true, 62 | sources = { 63 | { 64 | source = "filesystem", 65 | display_name = "  Files", 66 | }, 67 | { 68 | source = "buffers", 69 | display_name = "  Bufs", 70 | }, 71 | { 72 | source = "git_status", 73 | display_name = "  Git", 74 | }, 75 | { 76 | source = "document_symbols", 77 | display_name = " Symbols", 78 | }, 79 | }, 80 | }, 81 | window = { 82 | width = custom.width, 83 | mappings = { 84 | [""] = "none", 85 | ["/"] = "none", 86 | 87 | ["gx"] = "system_open", 88 | 89 | ["h"] = "smart_h", 90 | ["l"] = "smart_l", 91 | 92 | -- Swap default split behavior 93 | ["S"] = "open_vsplit", 94 | ["s"] = "open_split", 95 | 96 | -- Modify default behavior of preview. 97 | -- Using floating window causes strange behavior, 98 | -- such as statuscolumn not being applied 99 | ["P"] = { 100 | "toggle_preview", 101 | config = { 102 | use_float = false, 103 | use_image_nvim = true, 104 | }, 105 | }, 106 | }, 107 | }, 108 | commands = { 109 | system_open = function(state) 110 | local node = state.tree:get_node() 111 | local path = node:get_id() 112 | vim.ui.open(path) 113 | end, 114 | 115 | smart_h = function(state) 116 | local node = state.tree:get_node() 117 | if node.type == "directory" and node:is_expanded() then 118 | if state.name == "filesystem" then 119 | require("neo-tree.sources.filesystem.commands").toggle_node(state) 120 | else 121 | require("neo-tree.sources.common.commands").toggle_node(state) 122 | end 123 | else 124 | require("neo-tree.ui.renderer").focus_node( 125 | state, 126 | node:get_parent_id() 127 | ) 128 | end 129 | end, 130 | 131 | smart_l = function(state) 132 | local node = state.tree:get_node() 133 | if node.type == "directory" then 134 | if not node:is_expanded() then 135 | if state.name == "filesystem" then 136 | require("neo-tree.sources.filesystem.commands").toggle_node(state) 137 | else 138 | require("neo-tree.sources.common.commands").toggle_node(state) 139 | end 140 | elseif node:has_children() then 141 | require("neo-tree.ui.renderer").focus_node( 142 | state, 143 | node:get_child_ids()[1] 144 | ) 145 | end 146 | elseif node.type == "file" then 147 | require("neo-tree.sources.common.commands").open(state) 148 | end 149 | end, 150 | }, 151 | filesystem = { 152 | group_empty_dirs = true, 153 | follow_current_file = { 154 | enabled = true, 155 | }, 156 | window = { 157 | mappings = { 158 | ["[g"] = "none", 159 | ["]g"] = "none", 160 | ["[h"] = "prev_git_modified", 161 | ["]h"] = "next_git_modified", 162 | }, 163 | }, 164 | }, 165 | document_symbols = { 166 | kinds = kinds, 167 | }, 168 | }, 169 | config = function(_, opts) 170 | local function on_move(data) 171 | require("snacks").rename.on_rename_file(data.source, data.destination) 172 | end 173 | local events = require "neo-tree.events" 174 | opts.event_handlers = opts.event_handlers or {} 175 | vim.list_extend(opts.event_handlers, { 176 | { event = events.FILE_MOVED, handler = on_move }, 177 | { event = events.FILE_RENAMED, handler = on_move }, 178 | }) 179 | require("neo-tree").setup(opts) 180 | vim.api.nvim_create_augroup("load_neo_tree", {}) 181 | end, 182 | keys = { 183 | { "e", "Neotree toggle", desc = "File Explorer" }, 184 | }, 185 | } 186 | -------------------------------------------------------------------------------- /lua/plugins/tool/neoconf.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "folke/neoconf.nvim", 4 | event = "BufReadPre", 5 | opts = {}, 6 | } 7 | -------------------------------------------------------------------------------- /lua/plugins/tool/neotest.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "rcarriga/neotest", 4 | dependencies = { 5 | "nvim-lua/plenary.nvim", 6 | "nvim-treesitter/nvim-treesitter", 7 | 8 | -- Adapters 9 | "nvim-neotest/neotest-jest", 10 | "nvim-neotest/neotest-go", 11 | }, 12 | opts = function() 13 | return { 14 | adapters = { 15 | require "neotest-jest", 16 | require "neotest-go", 17 | }, 18 | consumers = { 19 | overseer = require "neotest.consumers.overseer", 20 | }, 21 | } 22 | end, 23 | keys = { 24 | { 25 | "Tr", 26 | function() 27 | require("neotest").run.run() 28 | end, 29 | desc = "Run", 30 | }, 31 | { 32 | "Ts", 33 | function() 34 | require("neotest").run.stop() 35 | end, 36 | desc = "Stop", 37 | }, 38 | { 39 | "Ta", 40 | function() 41 | require("neotest").run.attach() 42 | end, 43 | desc = "Attach", 44 | }, 45 | 46 | { 47 | "Tm", 48 | function() 49 | require("neotest").summary.toggle() 50 | end, 51 | desc = "Summary", 52 | }, 53 | { 54 | "Tw", 55 | function() 56 | require("neotest").watch.toggle() 57 | end, 58 | desc = "Watch", 59 | }, 60 | { 61 | "To", 62 | function() 63 | require("neotest").output_panel.toggle() 64 | end, 65 | desc = "Output panel", 66 | }, 67 | }, 68 | } 69 | -------------------------------------------------------------------------------- /lua/plugins/tool/oil.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "stevearc/oil.nvim", 6 | enabled = false, 7 | lazy = false, 8 | keys = { 9 | { 10 | "-", 11 | function() 12 | require("oil").open() 13 | end, 14 | desc = "Open parent directory", 15 | }, 16 | }, 17 | opts = { 18 | skip_confirm_for_simple_edits = true, 19 | cleanup_delay_ms = false, 20 | float = { 21 | border = custom.border, 22 | }, 23 | preview = { 24 | border = custom.border, 25 | }, 26 | progress = { 27 | border = custom.border, 28 | }, 29 | keymaps = { 30 | [""] = "actions.select_split", 31 | [""] = "actions.select_vsplit", 32 | }, 33 | }, 34 | } 35 | -------------------------------------------------------------------------------- /lua/plugins/tool/outline.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "hedyhli/outline.nvim", 6 | keys = { 7 | { "a", "Outline", desc = "Outline" }, 8 | }, 9 | opts = { 10 | preview_window = { 11 | border = custom.border, 12 | live = true, 13 | }, 14 | symbols = { 15 | icon_source = "lspkind", 16 | }, 17 | }, 18 | } 19 | -------------------------------------------------------------------------------- /lua/plugins/tool/overseer.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "stevearc/overseer.nvim", 6 | opts = function() 7 | return { 8 | dap = false, 9 | form = { 10 | border = custom.border, 11 | }, 12 | confirm = { 13 | border = custom.border, 14 | }, 15 | task_win = { 16 | border = custom.border, 17 | }, 18 | component_aliases = { 19 | default = { 20 | { "display_duration", detail_level = 2 }, 21 | "on_output_summarize", 22 | "on_exit_set_status", 23 | "on_complete_notify", 24 | "on_complete_dispose", 25 | "unique", 26 | }, 27 | }, 28 | } 29 | end, 30 | config = function(_, opts) 31 | local overseer = require "overseer" 32 | 33 | overseer.setup(opts) 34 | 35 | do -- For lazy loading lualine component 36 | local success, lualine = pcall(require, "lualine") 37 | if not success then 38 | return 39 | end 40 | local lualine_cfg = lualine.get_config() 41 | for i, item in ipairs(lualine_cfg.sections.lualine_x) do 42 | if type(item) == "table" and item.name == "overseer-placeholder" then 43 | lualine_cfg.sections.lualine_x[i] = "overseer" 44 | end 45 | end 46 | lualine.setup(lualine_cfg) 47 | end 48 | 49 | local templates = { 50 | { 51 | name = "C++ build single file", 52 | builder = function() 53 | return { 54 | cmd = { "c++" }, 55 | args = { 56 | "-g", 57 | vim.fn.expand "%:p", 58 | "-o", 59 | vim.fn.expand "%:p:t:r", 60 | }, 61 | } 62 | end, 63 | condition = { 64 | filetype = { "cpp" }, 65 | }, 66 | }, 67 | { 68 | name = "zig build", 69 | builder = function() 70 | return { 71 | cmd = { "zig" }, 72 | args = { 73 | "build", 74 | }, 75 | } 76 | end, 77 | condition = { 78 | filetype = { "zig" }, 79 | }, 80 | }, 81 | } 82 | for _, template in ipairs(templates) do 83 | overseer.register_template(template) 84 | end 85 | end, 86 | keys = { 87 | { "rr", "OverseerRun", desc = "Run" }, 88 | { "rl", "OverseerToggle", desc = "List" }, 89 | { "rn", "OverseerBuild", desc = "New" }, 90 | { "ra", "OverseerTaskAction", desc = "Action" }, 91 | { "ri", "OverseerInfo", desc = "Info" }, 92 | { "rc", "OverseerClearCache", desc = "Clear cache" }, 93 | }, 94 | } 95 | -------------------------------------------------------------------------------- /lua/plugins/tool/screenkey.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "NStefan002/screenkey.nvim", 6 | cmd = "Screenkey", 7 | opts = { 8 | win_opts = { 9 | border = custom.border, 10 | }, 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /lua/plugins/tool/tmux.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "aserowy/tmux.nvim", 4 | cond = vim.env.TMUX ~= nil, 5 | opts = {}, 6 | event = "VeryLazy", 7 | } 8 | -------------------------------------------------------------------------------- /lua/plugins/tool/toggleterm.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "akinsho/toggleterm.nvim", 6 | version = "*", 7 | opts = { 8 | size = function(term) 9 | if term.direction == "horizontal" then 10 | return 15 11 | elseif term.direction == "vertical" then 12 | return vim.o.columns * 0.4 13 | end 14 | end, 15 | open_mapping = [[]], 16 | shell = vim.uv.os_uname().sysname == "Windows_NT" and "pwsh" or "fish", 17 | float_opts = { 18 | border = custom.border, 19 | }, 20 | winbar = { 21 | enabled = true, 22 | }, 23 | }, 24 | keys = function() 25 | local float_opts = { 26 | border = custom.border, 27 | } 28 | local on_create = function(t) 29 | local bufnr = t.bufnr 30 | vim.keymap.set("t", "", "", { buffer = bufnr }) 31 | end 32 | 33 | local lazygit 34 | local lazydocker 35 | local gh_dash 36 | local lf 37 | 38 | return { 39 | { "" }, 40 | { 41 | "tt", 42 | "ToggleTermToggleAll", 43 | mode = "n", 44 | desc = "All Terminal", 45 | }, 46 | 47 | -- External programs 48 | { 49 | "gl", 50 | function() 51 | if not lazygit then 52 | lazygit = require("toggleterm.terminal").Terminal:new { 53 | cmd = "lazygit", 54 | hidden = true, 55 | direction = "float", 56 | float_opts = float_opts, 57 | on_create = on_create, 58 | } 59 | end 60 | lazygit:toggle() 61 | end, 62 | desc = "LazyGit", 63 | }, 64 | { 65 | "pd", 66 | function() 67 | if not lazydocker then 68 | lazydocker = require("toggleterm.terminal").Terminal:new { 69 | cmd = "lazydocker", 70 | hidden = true, 71 | direction = "float", 72 | float_opts = float_opts, 73 | on_create = on_create, 74 | } 75 | end 76 | lazydocker:toggle() 77 | end, 78 | desc = "Lazy Docker", 79 | }, 80 | { 81 | "pg", 82 | function() 83 | if not gh_dash then 84 | gh_dash = require("toggleterm.terminal").Terminal:new { 85 | -- https://github.com/dlvhdr/gh-dash/issues/316 86 | env = { LANG = "en_US.UTF-8" }, 87 | cmd = "gh-dash", 88 | hidden = true, 89 | direction = "float", 90 | float_opts = float_opts, 91 | on_create = on_create, 92 | } 93 | end 94 | gh_dash:toggle() 95 | end, 96 | desc = "GitHub Dash", 97 | }, 98 | { 99 | "N", 100 | function() 101 | if not lf then 102 | lf = require("toggleterm.terminal").Terminal:new { 103 | cmd = "lf", 104 | hidden = true, 105 | direction = "float", 106 | float_opts = float_opts, 107 | on_create = on_create, 108 | } 109 | end 110 | lf:toggle() 111 | end, 112 | desc = "File Navigator", 113 | }, 114 | } 115 | end, 116 | } 117 | -------------------------------------------------------------------------------- /lua/plugins/tool/tree.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "nvim-tree/nvim-tree.lua", 6 | enabled = false, 7 | dependencies = { "nvim-tree/nvim-web-devicons" }, 8 | opts = { 9 | view = { 10 | width = custom.width, 11 | float = { 12 | open_win_config = { 13 | border = custom.border, 14 | }, 15 | }, 16 | }, 17 | }, 18 | keys = { 19 | { "e", "NvimTreeToggle", desc = "File Explorer" }, 20 | }, 21 | } 22 | -------------------------------------------------------------------------------- /lua/plugins/tool/undotree.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "mbbill/undotree", 4 | config = function() 5 | local custom = require "custom" 6 | local width = custom.width() 7 | 8 | vim.g.undotree_SplitWidth = width 9 | vim.g.undotree_WindowLayout = 2 10 | vim.g.undotree_DiffAutoOpen = 0 11 | vim.g.undotree_SetFocusWhenToggle = 1 12 | vim.g.undotree_ShortIndicators = 1 13 | vim.g.undotree_HelpLine = 0 14 | end, 15 | keys = { 16 | { "u", "UndotreeToggle", desc = "Undo Tree" }, 17 | }, 18 | } 19 | -------------------------------------------------------------------------------- /lua/plugins/tool/which-key.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | ---@module "which-key" 6 | "folke/which-key.nvim", 7 | event = "VeryLazy", 8 | ---@type wk.Opts 9 | opts = { 10 | preset = "modern", 11 | win = { 12 | no_overlap = false, 13 | border = custom.border, 14 | }, 15 | icons = { 16 | breadcrumb = "", 17 | separator = "", 18 | ---@type wk.IconRule[] 19 | rules = { 20 | -- Verbs 21 | { pattern = "insert", icon = " ", color = "cyan" }, 22 | { pattern = "create", icon = " ", color = "purple" }, 23 | { pattern = "new", icon = " ", color = "purple" }, 24 | { pattern = "run", icon = " ", color = "green" }, 25 | { pattern = "launch", icon = " ", color = "green" }, 26 | { pattern = "close", icon = " ", color = "red" }, 27 | { pattern = "stop", icon = " ", color = "red" }, 28 | { pattern = "reset", icon = " ", color = "grey" }, 29 | { pattern = "restore", icon = " ", color = "grey" }, 30 | { pattern = "reload", icon = " ", color = "grey" }, 31 | { pattern = "open", icon = " ", color = "green" }, 32 | { pattern = "delete", icon = " ", color = "blue" }, 33 | { pattern = "top", icon = " ", color = "grey" }, 34 | { pattern = "up", icon = " ", color = "grey" }, 35 | { pattern = "bottom", icon = " ", color = "grey" }, 36 | { pattern = "down", icon = " ", color = "grey" }, 37 | { pattern = "left", icon = " ", color = "grey" }, 38 | { pattern = "right", icon = " ", color = "grey" }, 39 | { pattern = "switch", icon = " ", color = "grey" }, 40 | { pattern = "move", icon = " ", color = "grey" }, 41 | -- Nouns 42 | { pattern = "fold", icon = " ", color = "azure" }, 43 | { pattern = "color", icon = " ", color = "red" }, 44 | { pattern = "highlight", icon = " ", color = "red" }, 45 | { pattern = "tree", icon = " ", color = "green" }, 46 | { pattern = "mark", icon = " ", color = "yellow" }, 47 | { pattern = "task", icon = " ", color = "green" }, 48 | { pattern = "help", icon = " ", color = "cyan" }, 49 | { pattern = "info", icon = " ", color = "cyan" }, 50 | { pattern = "blame", icon = " ", color = "cyan" }, 51 | { pattern = "program", icon = " ", color = "azure" }, 52 | { pattern = "plugin", icon = " ", color = "azure" }, 53 | { pattern = "package", icon = " ", color = "yellow" }, 54 | { pattern = "lsp", icon = " ", color = "red" }, 55 | { pattern = "test", icon = " ", color = "yellow" }, 56 | { pattern = "manage", icon = " ", color = "orange" }, 57 | { pattern = "outline", icon = " ", color = "purple" }, 58 | { pattern = "symbol", icon = " ", color = "orange" }, 59 | { pattern = "annotation", icon = " ", color = "grey" }, 60 | { pattern = "comment", icon = " ", color = "grey" }, 61 | { pattern = "term", icon = " ", color = "cyan" }, 62 | { pattern = "grep", icon = " ", color = "orange" }, 63 | { pattern = "quickfix", icon = " ", color = "yellow" }, 64 | { pattern = "list", icon = " ", color = "yellow" }, 65 | { pattern = "workspace", icon = " ", color = "yellow" }, 66 | { pattern = "regex", icon = " ", color = "yellow" }, 67 | -- Override default 68 | { plugin = "nvim-spectre", icon = " ", color = "blue" }, 69 | { pattern = "file", icon = " ", color = "cyan" }, 70 | { pattern = "debug", icon = " ", color = "red" }, 71 | { pattern = "find", icon = " ", color = "green" }, 72 | { pattern = "search", icon = " ", color = "green" }, 73 | { pattern = "session", icon = " ", color = "azure" }, 74 | { pattern = "format", icon = " ", color = "cyan" }, 75 | { pattern = "tab", icon = " ", color = "purple" }, 76 | { pattern = "buffer", icon = " ", color = "purple" }, 77 | { pattern = "window", icon = " ", color = "purple" }, 78 | }, 79 | }, 80 | 81 | spec = { 82 | { "i", group = "insert" }, 83 | { "m", group = "manage" }, 84 | { "r", group = "tasks" }, 85 | { "d", group = "debug" }, 86 | { "t", group = "toggle" }, 87 | { "T", group = "test" }, 88 | { "o", group = "org" }, 89 | 90 | { "p", group = "programs" }, 91 | 92 | { "f", group = "find" }, 93 | { "fg", group = "git" }, 94 | { "fd", group = "debug" }, 95 | 96 | { "g", group = "git" }, 97 | { "gd", group = "diffview" }, 98 | 99 | { "s", group = "session" }, 100 | { "sc", group = "current" }, 101 | 102 | { "b", group = "tab" }, 103 | { "bs", group = "sort" }, 104 | { "l", group = "lsp" }, 105 | { "lw", group = "workspace" }, 106 | 107 | { "h", group = "helper" }, 108 | { "hp", group = "profile" }, 109 | }, 110 | }, 111 | } 112 | -------------------------------------------------------------------------------- /lua/plugins/tool/window-picker.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "s1n7ax/nvim-window-picker", 4 | version = "*", 5 | opts = { 6 | show_prompt = false, 7 | filter_func = function(window_ids) 8 | return vim.tbl_filter(function(window_id) 9 | if window_id == vim.api.nvim_get_current_win() then 10 | return false 11 | end 12 | 13 | if vim.api.nvim_win_get_config(window_id).relative ~= "" then 14 | return false 15 | end 16 | 17 | return true 18 | end, window_ids) 19 | end, 20 | }, 21 | keys = { 22 | { 23 | "w", 24 | function() 25 | local window_id = require("window-picker").pick_window() 26 | or vim.api.nvim_get_current_win() 27 | vim.api.nvim_set_current_win(window_id) 28 | end, 29 | desc = "Pick a window", 30 | }, 31 | { 32 | "", 33 | function() 34 | local window_id = require("window-picker").pick_window() 35 | or vim.api.nvim_get_current_win() 36 | vim.api.nvim_set_current_win(window_id) 37 | end, 38 | desc = "Pick a window", 39 | }, 40 | }, 41 | } 42 | -------------------------------------------------------------------------------- /lua/plugins/treesitter/autotag.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "windwp/nvim-ts-autotag", 4 | ft = { 5 | "html", 6 | "javascriptreact", 7 | "typescriptreact", 8 | "vue", 9 | "svelte", 10 | }, 11 | opts = {}, 12 | } 13 | -------------------------------------------------------------------------------- /lua/plugins/treesitter/commentstring.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "JoosepAlviste/nvim-ts-context-commentstring", 4 | lazy = true, 5 | opts = {}, 6 | } 7 | -------------------------------------------------------------------------------- /lua/plugins/treesitter/context.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "nvim-treesitter/nvim-treesitter-context", 4 | event = "VeryLazy", 5 | opts = { 6 | max_lines = 5, 7 | mode = "topline", 8 | }, 9 | keys = { 10 | { "tc", "TSContextToggle", desc = "Treesitter Context" }, 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /lua/plugins/treesitter/textobjects.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "nvim-treesitter/nvim-treesitter-textobjects", 4 | branch = "main", 5 | dependencies = { 6 | { "ghostbuster91/nvim-next" }, 7 | }, 8 | opts = { 9 | select = { 10 | lookahead = true, 11 | include_surrounding_whitespace = true, 12 | }, 13 | move = { 14 | set_jumps = true, 15 | }, 16 | }, 17 | keys = function() 18 | local ts = vim._defer_require("nvim-treesitter-textobjects", { 19 | repeatable_move = {}, ---@module "nvim-treesitter-textobjects.repeatable_move" 20 | select = {}, ---@module "nvim-treesitter-textobjects.select" 21 | move = {}, ---@module "nvim-treesitter-textobjects.move" 22 | }) 23 | 24 | return { 25 | --- 26 | --- Repeatable 27 | --- 28 | { 29 | ";", 30 | function() 31 | return ts.repeatable_move.repeat_last_move() 32 | end, 33 | expr = true; 34 | mode = { "n", "x", "o" }, 35 | desc = "Next last move", 36 | }, 37 | { 38 | ",", 39 | function() 40 | return ts.repeatable_move.repeat_last_move_opposite() 41 | end, 42 | expr = true; 43 | mode = { "n", "x", "o" }, 44 | desc = "Prev last move", 45 | }, 46 | { 47 | "f", 48 | function() 49 | return ts.repeatable_move.builtin_f_expr() 50 | end, 51 | expr = true, 52 | mode = { "n", "x", "o" }, 53 | desc = "Move to next char", 54 | }, 55 | { 56 | "F", 57 | function() 58 | return ts.repeatable_move.builtin_F_expr() 59 | end, 60 | expr = true, 61 | mode = { "n", "x", "o" }, 62 | desc = "Move to prev char", 63 | }, 64 | { 65 | "t", 66 | function() 67 | return ts.repeatable_move.builtin_t_expr() 68 | end, 69 | expr = true, 70 | mode = { "n", "x", "o" }, 71 | desc = "Move before next char", 72 | }, 73 | { 74 | "T", 75 | function() 76 | return ts.repeatable_move.builtin_T_expr() 77 | end, 78 | expr = true, 79 | mode = { "n", "x", "o" }, 80 | desc = "Move before prev char", 81 | }, 82 | -- 83 | -- Select 84 | -- 85 | { 86 | "aa", 87 | function() 88 | ts.select.select_textobject "@parameter.outer" 89 | end, 90 | mode = { "x", "o" }, 91 | desc = "a argument", 92 | }, 93 | { 94 | "ia", 95 | function() 96 | ts.select.select_textobject "@parameter.inner" 97 | end, 98 | mode = { "x", "o" }, 99 | desc = "inner part of a argument", 100 | }, 101 | { 102 | "af", 103 | function() 104 | ts.select.select_textobject "@function.outer" 105 | end, 106 | mode = { "x", "o" }, 107 | desc = "a function region", 108 | }, 109 | { 110 | "if", 111 | function() 112 | ts.select.select_textobject "@function.inner" 113 | end, 114 | mode = { "x", "o" }, 115 | desc = "inner part of a function region", 116 | }, 117 | { 118 | "ac", 119 | function() 120 | ts.select.select_textobject "@class.outer" 121 | end, 122 | mode = { "x", "o" }, 123 | desc = "a of a class", 124 | }, 125 | { 126 | "ic", 127 | function() 128 | ts.select.select_textobject "@class.inner" 129 | end, 130 | mode = { "x", "o" }, 131 | desc = "inner part of a class region", 132 | }, 133 | { 134 | "aj", 135 | function() 136 | ts.select.select_textobject "@conditional.outer" 137 | end, 138 | mode = { "x", "o" }, 139 | desc = "a judge", 140 | }, 141 | { 142 | "ij", 143 | function() 144 | ts.select.select_textobject "@conditional.inner" 145 | end, 146 | mode = { "x", "o" }, 147 | desc = "inner part of a judge region", 148 | }, 149 | { 150 | "al", 151 | function() 152 | ts.select.select_textobject "@loop.outer" 153 | end, 154 | mode = { "x", "o" }, 155 | desc = "a loop", 156 | }, 157 | { 158 | "il", 159 | function() 160 | ts.select.select_textobject "@loop.inner" 161 | end, 162 | mode = { "x", "o" }, 163 | desc = "inner part of a loop", 164 | }, 165 | { 166 | "an", 167 | function() 168 | ts.select.select_textobject "@number.outer" 169 | end, 170 | mode = { "x", "o" }, 171 | desc = "a loop", 172 | }, 173 | { 174 | "in", 175 | function() 176 | ts.select.select_textobject "@number.inner" 177 | end, 178 | mode = { "x", "o" }, 179 | desc = "inner part of a number", 180 | }, 181 | -- 182 | -- Move 183 | -- 184 | { 185 | "]a", 186 | function() 187 | ts.move.goto_next_start "@parameter.outer" 188 | end, 189 | mode = { "n", "x", "o" }, 190 | desc = "Next argument start", 191 | }, 192 | { 193 | "]A", 194 | function() 195 | ts.move.goto_next_end "@parameter.outer" 196 | end, 197 | mode = { "n", "x", "o" }, 198 | desc = "Next argument end", 199 | }, 200 | { 201 | "[a", 202 | function() 203 | ts.move.goto_previous_start "@parameter.outer" 204 | end, 205 | mode = { "n", "x", "o" }, 206 | desc = "Previous argument start", 207 | }, 208 | { 209 | "[A", 210 | function() 211 | ts.move.goto_previous_end "@parameter.outer" 212 | end, 213 | mode = { "n", "x", "o" }, 214 | desc = "Previous argument end", 215 | }, 216 | { 217 | "]f", 218 | function() 219 | ts.move.goto_next_start "@function.outer" 220 | end, 221 | mode = { "n", "x", "o" }, 222 | desc = "Next function start", 223 | }, 224 | { 225 | "]F", 226 | function() 227 | ts.move.goto_next_end "@function.outer" 228 | end, 229 | mode = { "n", "x", "o" }, 230 | desc = "Next function end", 231 | }, 232 | { 233 | "[f", 234 | function() 235 | ts.move.goto_previous_start "@function.outer" 236 | end, 237 | mode = { "n", "x", "o" }, 238 | desc = "Previous function start", 239 | }, 240 | { 241 | "[F", 242 | function() 243 | ts.move.goto_previous_end "@function.outer" 244 | end, 245 | mode = { "n", "x", "o" }, 246 | desc = "Previous function end", 247 | }, 248 | { 249 | "]c", 250 | function() 251 | ts.move.goto_next_start "@class.outer" 252 | end, 253 | mode = { "n", "x", "o" }, 254 | desc = "Next class start", 255 | }, 256 | { 257 | "]C", 258 | function() 259 | ts.move.goto_next_end "@class.outer" 260 | end, 261 | mode = { "n", "x", "o" }, 262 | desc = "Next class end", 263 | }, 264 | { 265 | "[c", 266 | function() 267 | ts.move.goto_previous_start "@class.outer" 268 | end, 269 | mode = { "n", "x", "o" }, 270 | desc = "Previous class start", 271 | }, 272 | { 273 | "[C", 274 | function() 275 | ts.move.goto_previous_end "@class.outer" 276 | end, 277 | mode = { "n", "x", "o" }, 278 | desc = "Previous class end", 279 | }, 280 | { 281 | "]j", 282 | function() 283 | ts.move.goto_next_start "@conditional.outer" 284 | end, 285 | mode = { "n", "x", "o" }, 286 | desc = "Next judge start", 287 | }, 288 | { 289 | "]J", 290 | function() 291 | ts.move.goto_next_end "@conditional.outer" 292 | end, 293 | mode = { "n", "x", "o" }, 294 | desc = "Next judge end", 295 | }, 296 | { 297 | "[j", 298 | function() 299 | ts.move.goto_previous_start "@conditional.outer" 300 | end, 301 | mode = { "n", "x", "o" }, 302 | desc = "Previous judge start", 303 | }, 304 | { 305 | "[J", 306 | function() 307 | ts.move.goto_previous_end "@conditional.outer" 308 | end, 309 | mode = { "n", "x", "o" }, 310 | desc = "Previous judge end", 311 | }, 312 | { 313 | "]l", 314 | function() 315 | ts.move.goto_next_start "@loop.outer" 316 | end, 317 | mode = { "n", "x", "o" }, 318 | desc = "Next loop start", 319 | }, 320 | { 321 | "]L", 322 | function() 323 | ts.move.goto_next_end "@loop.outer" 324 | end, 325 | mode = { "n", "x", "o" }, 326 | desc = "Next loop end", 327 | }, 328 | { 329 | "[l", 330 | function() 331 | ts.move.goto_previous_start "@loop.outer" 332 | end, 333 | mode = { "n", "x", "o" }, 334 | desc = "Previous loop start", 335 | }, 336 | { 337 | "[L", 338 | function() 339 | ts.move.goto_previous_end "@loop.outer" 340 | end, 341 | mode = { "n", "x", "o" }, 342 | desc = "Previous loop end", 343 | }, 344 | { 345 | "[n", 346 | function() 347 | ts.move.goto_previous_start "@number.inner" 348 | end, 349 | mode = { "n", "x", "o" }, 350 | desc = "Previous number", 351 | }, 352 | { 353 | "]n", 354 | function() 355 | ts.move.goto_next_start "@number.inner" 356 | end, 357 | mode = { "n", "x", "o" }, 358 | desc = "Next number", 359 | }, 360 | { 361 | "[N", 362 | function() 363 | ts.move.goto_previous_end "@number.inner" 364 | end, 365 | mode = { "n", "x", "o" }, 366 | desc = "Previous number", 367 | }, 368 | { 369 | "]N", 370 | function() 371 | ts.move.goto_next_end "@number.inner" 372 | end, 373 | mode = { "n", "x", "o" }, 374 | desc = "Next number", 375 | }, 376 | } 377 | end, 378 | } 379 | -------------------------------------------------------------------------------- /lua/plugins/treesitter/treesitter.lua: -------------------------------------------------------------------------------- 1 | local locals = require "locals" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "nvim-treesitter/nvim-treesitter", 6 | branch = locals.treesitter_dev and "main" or "master", 7 | event = "VeryLazy", 8 | build = ":TSUpdate", 9 | opts = { 10 | ---@diagnostic disable-next-line: param-type-mismatch 11 | parser_install_dir = vim.fs.joinpath(vim.fn.stdpath "data", "site"), 12 | ensure_installed = "all", 13 | highlight = { 14 | enable = true, 15 | -- Should be controlled by vimtex 16 | disable = { "latex" }, 17 | }, 18 | indent = { 19 | enable = true, 20 | }, 21 | }, 22 | config = function(_, opts) 23 | -- if vim.uv.os_uname().sysname == "Windows_NT" then 24 | -- require("nvim-treesitter.install").prefer_git = false 25 | -- end 26 | 27 | if locals.treesitter_dev then 28 | return 29 | end 30 | 31 | require("nvim-treesitter.configs").setup(opts) 32 | end, 33 | } 34 | -------------------------------------------------------------------------------- /lua/plugins/treesitter/treesj.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "Wansmer/treesj", 4 | keys = { 5 | { 6 | "gJ", 7 | function() 8 | require("treesj").join() 9 | end, 10 | desc = "Join lines", 11 | }, 12 | { 13 | "gS", 14 | function() 15 | require("treesj").split() 16 | end, 17 | desc = "Split lines", 18 | }, 19 | }, 20 | opts = { 21 | use_default_keymaps = false, 22 | }, 23 | } 24 | -------------------------------------------------------------------------------- /lua/plugins/ui/actions-preview.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "aznhe21/actions-preview.nvim", 4 | -- Could be replaced by fzf-lua 5 | enabled = false, 6 | lazy = true, 7 | init = function() 8 | vim.api.nvim_create_autocmd("LspAttach", { 9 | desc = "Setup code action preview", 10 | callback = function(args) 11 | local bufnr = args.buf 12 | 13 | vim.keymap.set({ "n", "v" }, "la", function() 14 | require("actions-preview").code_actions() 15 | end, { buffer = bufnr, desc = "LSP: Code action" }) 16 | end, 17 | }) 18 | end, 19 | opts = {}, 20 | } 21 | -------------------------------------------------------------------------------- /lua/plugins/ui/alpha.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "goolord/alpha-nvim", 4 | opts = function() 5 | local dashboard = require "alpha.themes.dashboard" 6 | local theta = require "alpha.themes.theta" 7 | 8 | theta.header.val = { 9 | [[ ]], 10 | [[ ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ]], 11 | [[ ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ]], 12 | [[ ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ]], 13 | [[ ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ]], 14 | [[ ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ]], 15 | [[ ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ]], 16 | [[ ]], 17 | } 18 | 19 | theta.buttons.val = { 20 | { 21 | type = "text", 22 | val = "Quick links", 23 | opts = { hl = "SpecialComment", position = "center" }, 24 | }, 25 | { type = "padding", val = 1 }, 26 | dashboard.button("e", "󰈔 New file", "ene"), 27 | dashboard.button("SPC f f", "󰈞 Find file"), 28 | dashboard.button("SPC f w", "󰊄 Live grep"), 29 | dashboard.button( 30 | "c", 31 | " Configuration", 32 | "edit ~/.config/nvim" 33 | ), 34 | dashboard.button("u", " Update plugins", "Lazy sync"), 35 | dashboard.button("q", "󰅚 Quit", "qa"), 36 | } 37 | 38 | return theta.config 39 | end, 40 | } 41 | -------------------------------------------------------------------------------- /lua/plugins/ui/bqf.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "kevinhwang91/nvim-bqf", 6 | ft = "qf", 7 | dependencies = { 8 | { 9 | "junegunn/fzf", 10 | }, 11 | }, 12 | opts = { 13 | auto_resize_height = true, 14 | preview = { 15 | border = custom.border, 16 | show_scroll_bar = false, 17 | }, 18 | }, 19 | } 20 | -------------------------------------------------------------------------------- /lua/plugins/ui/bufferline.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "akinsho/bufferline.nvim", 4 | event = "VeryLazy", 5 | dependencies = { "nvim-tree/nvim-web-devicons" }, 6 | init = function() 7 | vim.o.showtabline = 2 8 | vim.o.tabline = " " 9 | end, 10 | opts = { 11 | options = { 12 | mode = "tabs", 13 | show_close_icon = false, 14 | buffer_close_icon = "🗙", 15 | }, 16 | }, 17 | keys = { 18 | { 19 | "1", 20 | "BufferLineGoToBuffer 1", 21 | desc = "Go to tab 1", 22 | }, 23 | { 24 | "2", 25 | "BufferLineGoToBuffer 2", 26 | desc = "Go to tab 2", 27 | }, 28 | { 29 | "3", 30 | "BufferLineGoToBuffer 3", 31 | desc = "Go to tab 3", 32 | }, 33 | { 34 | "4", 35 | "BufferLineGoToBuffer 4", 36 | desc = "Go to tab 4", 37 | }, 38 | { 39 | "5", 40 | "BufferLineGoToBuffer 5", 41 | desc = "Go to tab 5", 42 | }, 43 | { 44 | "6", 45 | "BufferLineGoToBuffer 6", 46 | desc = "Go to tab 6", 47 | }, 48 | { 49 | "7", 50 | "BufferLineGoToBuffer 7", 51 | desc = "Go to tab 7", 52 | }, 53 | { 54 | "8", 55 | "BufferLineGoToBuffer 8", 56 | desc = "Go to tab 8", 57 | }, 58 | { 59 | "9", 60 | "BufferLineGoToBuffer 9", 61 | desc = "Go to tab 9", 62 | }, 63 | 64 | { "", "+tabmove", desc = "Move tab to next" }, 65 | { "", "-tabmove", desc = "Move tab to previous" }, 66 | 67 | { "bc", "BufferLinePickClose", desc = "Close" }, 68 | { 69 | "bse", 70 | "BufferLineSortByExtension", 71 | desc = "By extension", 72 | }, 73 | { 74 | "bsd", 75 | "BufferLineSortByDirectory", 76 | desc = "By directory", 77 | }, 78 | { "bst", "BufferLineSortByTabs", desc = "By tabs" }, 79 | }, 80 | } 81 | -------------------------------------------------------------------------------- /lua/plugins/ui/ccc.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "uga-rosa/ccc.nvim", 4 | enabled = false, 5 | opts = true, 6 | } 7 | -------------------------------------------------------------------------------- /lua/plugins/ui/colorizer.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "NvChad/nvim-colorizer.lua", 4 | event = "VeryLazy", 5 | opts = { 6 | user_default_options = { 7 | names = false, 8 | }, 9 | }, 10 | } 11 | -------------------------------------------------------------------------------- /lua/plugins/ui/dropbar.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "Bekaboo/dropbar.nvim", 6 | event = { 7 | "BufRead", 8 | "BufNewFile", 9 | }, 10 | opts = { 11 | icons = { 12 | kinds = { 13 | symbols = vim.tbl_extend( 14 | "keep", 15 | { Folder = " " }, 16 | custom.icons.kind_with_space 17 | ), 18 | }, 19 | }, 20 | sources = { 21 | path = { 22 | modified = function(sym) 23 | return sym:merge { 24 | name = sym.name .. " [+]", 25 | name_hl = "DiffAdded", 26 | } 27 | end, 28 | }, 29 | }, 30 | }, 31 | } 32 | -------------------------------------------------------------------------------- /lua/plugins/ui/fidget.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "j-hui/fidget.nvim", 4 | event = "LspAttach", 5 | opts = {}, 6 | } 7 | -------------------------------------------------------------------------------- /lua/plugins/ui/illuminate.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "RRethy/vim-illuminate", 4 | cond = vim.lsp.document_highlight == nil, 5 | event = "VeryLazy", 6 | opts = function() 7 | return { 8 | filetypes_denylist = { 9 | "xxd", 10 | "floggraph", 11 | }, 12 | large_file_cutoff = 10000, 13 | should_enable = function(bufnr) 14 | local win = vim.fn.bufwinid(bufnr) 15 | -- Very bad performance in diff-mode 16 | if vim.api.nvim_win_is_valid(win) and vim.wo[win].diff then 17 | return false 18 | end 19 | return true 20 | end, 21 | } 22 | end, 23 | config = function(_, opts) 24 | local illuminate = require "illuminate" 25 | illuminate.configure(opts) 26 | 27 | -- Highlight on yank 28 | -- conflict with vim-illuminate 29 | vim.api.nvim_create_autocmd("TextYankPost", { 30 | group = vim.api.nvim_create_augroup("highlight_on_yank", {}), 31 | desc = "Briefly highlight yanked text", 32 | callback = function() 33 | illuminate.pause() 34 | vim.highlight.on_yank() 35 | illuminate.resume() 36 | end, 37 | }) 38 | end, 39 | keys = { 40 | { 41 | "]r", 42 | function() 43 | require("illuminate").goto_next_reference() 44 | end, 45 | desc = "Next reference", 46 | }, 47 | { 48 | "[r", 49 | function() 50 | require("illuminate").goto_prev_reference() 51 | end, 52 | desc = "Prev reference", 53 | }, 54 | { 55 | "ti", 56 | function() 57 | require("illuminate").toggle_freeze_buf() 58 | end, 59 | desc = "Toggle Freeze reference", 60 | }, 61 | }, 62 | } 63 | -------------------------------------------------------------------------------- /lua/plugins/ui/inc-rename.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "smjonas/inc-rename.nvim", 4 | opts = {}, 5 | cmd = { 6 | "IncRename", 7 | }, 8 | } 9 | -------------------------------------------------------------------------------- /lua/plugins/ui/indent-blankline.lua: -------------------------------------------------------------------------------- 1 | local utils = require "utils" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "lukas-reineke/indent-blankline.nvim", 6 | event = "VeryLazy", 7 | opts = { 8 | indent = { 9 | char = "▏", -- Thiner, not suitable when enable scope 10 | tab_char = "▏", 11 | }, 12 | }, 13 | config = function(_, opts) 14 | local ibl = require "ibl" 15 | local hooks = require "ibl.hooks" 16 | 17 | ibl.setup(opts) 18 | 19 | -- Hide first level indent, using `foldsep` to show it 20 | hooks.register(hooks.type.VIRTUAL_TEXT, function(_, bufnr, row, virt_text) 21 | local win = vim.fn.bufwinid(bufnr) 22 | local lnum = row + 1 23 | local foldinfo = utils.fold_info(win, lnum) 24 | 25 | if 26 | virt_text[1] 27 | and virt_text[1][1] == opts.indent.char 28 | and foldinfo 29 | and foldinfo.start == lnum 30 | then 31 | virt_text[1] = { " ", { "@ibl.whitespace.char.1" } } 32 | end 33 | 34 | return virt_text 35 | end) 36 | end, 37 | } 38 | -------------------------------------------------------------------------------- /lua/plugins/ui/lspkind.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "onsails/lspkind.nvim", 6 | lazy = true, 7 | opts = { 8 | symbol_map = custom.icons.kind, 9 | }, 10 | } 11 | -------------------------------------------------------------------------------- /lua/plugins/ui/lualine.lua: -------------------------------------------------------------------------------- 1 | local lazy_status = require "lazy.status" 2 | 3 | local function indent() 4 | if vim.o.expandtab then 5 | return "SW:" .. vim.o.shiftwidth 6 | else 7 | return "TS:" .. vim.o.tabstop 8 | end 9 | end 10 | 11 | local function lsp() 12 | local clients = vim.lsp.get_clients() 13 | local buf = vim.api.nvim_get_current_buf() 14 | clients = vim 15 | .iter(clients) 16 | :filter(function(client) 17 | return client.attached_buffers[buf] 18 | end) 19 | :filter(function(client) 20 | return client.name ~= "GitHub Copilot" 21 | end) 22 | :map(function(client) 23 | return " " .. client.name 24 | end) 25 | :totable() 26 | local info = table.concat(clients, " ") 27 | if info == "" then 28 | return "No attached LSP server" 29 | else 30 | return info 31 | end 32 | end 33 | 34 | local function dap() 35 | ---@diagnostic disable-next-line: redefined-local 36 | local dap = package.loaded["dap"] 37 | if dap then 38 | return dap.status() 39 | end 40 | return "" 41 | end 42 | 43 | local function osv() 44 | ---@diagnostic disable-next-line: redefined-local 45 | local osv = package.loaded["osv"] 46 | if osv and osv.is_running() then 47 | return "Running as debuggee" 48 | end 49 | return "" 50 | end 51 | 52 | local function dap_or_lsp() 53 | if osv() ~= "" then 54 | return osv() 55 | elseif dap() ~= "" then 56 | return dap() 57 | else 58 | return lsp() 59 | end 60 | end 61 | 62 | ---@type LazyPluginSpec 63 | return { 64 | "nvim-lualine/lualine.nvim", 65 | init = function() 66 | vim.o.laststatus = 0 67 | end, 68 | event = "VeryLazy", 69 | dependencies = { 70 | { "nvim-tree/nvim-web-devicons" }, 71 | { "ofseed/copilot-status.nvim", enabled = false }, 72 | }, 73 | opts = { 74 | sections = { 75 | lualine_a = { 76 | { 77 | "mode", 78 | icon = "", 79 | }, 80 | }, 81 | lualine_b = { 82 | { 83 | "branch", 84 | icon = "", 85 | }, 86 | { 87 | "diff", 88 | symbols = { 89 | added = " ", 90 | modified = " ", 91 | removed = " ", 92 | }, 93 | source = function() 94 | return vim.b.gitsigns_status_dict 95 | end, 96 | }, 97 | }, 98 | lualine_c = { 99 | dap_or_lsp, 100 | }, 101 | lualine_x = { 102 | { 103 | lazy_status.updates, 104 | cond = lazy_status.has_updates, 105 | color = { fg = "#ff9e64" }, 106 | }, 107 | { 108 | name = "overseer-placeholder", 109 | function() 110 | return "" 111 | end, 112 | }, 113 | "copilot", 114 | indent, 115 | { 116 | "encoding", 117 | show_bomb = true, 118 | }, 119 | "fileformat", 120 | }, 121 | lualine_y = { 122 | "diagnostics", 123 | { 124 | "progress", 125 | icon = "", 126 | }, 127 | }, 128 | lualine_z = { 129 | { 130 | "location", 131 | icon = "", 132 | }, 133 | }, 134 | }, 135 | options = { 136 | icons_enabled = true, 137 | theme = "auto", 138 | disabled_filetypes = { 139 | statusline = { 140 | "alpha", 141 | }, 142 | }, 143 | always_divide_middle = true, 144 | globalstatus = false, 145 | section_separators = { left = "", right = "" }, 146 | component_separators = { left = "", right = "" }, 147 | }, 148 | extensions = { 149 | "man", 150 | "quickfix", 151 | "nvim-tree", 152 | "neo-tree", 153 | "toggleterm", 154 | "symbols-outline", 155 | "aerial", 156 | "fugitive", 157 | "nvim-dap-ui", 158 | "mundo", 159 | "lazy", 160 | }, 161 | }, 162 | } 163 | -------------------------------------------------------------------------------- /lua/plugins/ui/marks.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "chentoast/marks.nvim", 4 | event = "VeryLazy", 5 | opts = { 6 | sign_priority = { lower = 10, upper = 15, builtin = 5, bookmark = 20 }, 7 | excluded_buftypes = { "nofile" }, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /lua/plugins/ui/nabla.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "jbyuki/nabla.nvim", 4 | ft = { "tex", "markdown" }, 5 | init = function() 6 | vim.api.nvim_create_autocmd("FileType", { 7 | pattern = { "tex", "markdown" }, 8 | callback = function(args) 9 | local bufnr = args.buf 10 | vim.keymap.set("n", "p", function() 11 | require("nabla").toggle_virt() 12 | end, { 13 | buffer = bufnr, 14 | desc = "Toggle nabla virt text", 15 | }) 16 | end, 17 | }) 18 | end, 19 | } 20 | -------------------------------------------------------------------------------- /lua/plugins/ui/noice.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "folke/noice.nvim", 6 | event = "VeryLazy", 7 | init = function() 8 | vim.o.cmdheight = 0 9 | 10 | -- Make sure to load noice when notify is called 11 | ---@diagnostic disable-next-line: duplicate-set-field 12 | vim.notify = function(...) 13 | require("noice").notify(...) 14 | end 15 | end, 16 | dependencies = { 17 | -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries 18 | "MunifTanjim/nui.nvim", 19 | -- OPTIONAL: 20 | -- `nvim-notify` is only needed, if you want to use the notification view. 21 | -- If not available, we use `mini` as the fallback 22 | "rcarriga/nvim-notify", 23 | }, 24 | opts = { 25 | routes = { 26 | { 27 | filter = { event = "msg_show", min_height = 20 }, 28 | view = "cmdline_output", 29 | }, 30 | }, 31 | cmdline = { 32 | format = { 33 | search_down = { 34 | view = "cmdline", 35 | }, 36 | search_up = { 37 | view = "cmdline", 38 | }, 39 | substitute = { 40 | pattern = { 41 | "^:%s*%%s?n?o?m?/", 42 | "^:'<,'>%s*s?n?m?/", 43 | "^:%d+,%d+%s*s?n?m?/", 44 | }, 45 | icon = " /", 46 | view = "cmdline", 47 | lang = "regex", 48 | }, 49 | }, 50 | }, 51 | markdown = { 52 | hover = { 53 | ["%[.-%]%((%S-)%)"] = function(...) 54 | vim.ui.open(...) 55 | end, 56 | }, 57 | }, 58 | lsp = { 59 | override = { 60 | ["vim.lsp.util.convert_input_to_markdown_lines"] = true, 61 | ["vim.lsp.util.stylize_markdown"] = true, 62 | ["cmp.entry.get_documentation"] = true, 63 | }, 64 | progress = { 65 | enabled = false, 66 | }, 67 | message = { 68 | enabled = false, 69 | }, 70 | hover = { 71 | enabled = false, 72 | }, 73 | signature = { 74 | enabled = false, 75 | }, 76 | }, 77 | views = { 78 | cmdline_popup = { 79 | border = { 80 | style = custom.border, 81 | }, 82 | }, 83 | hover = { 84 | size = { 85 | max_width = 80, 86 | }, 87 | border = { 88 | style = custom.border, 89 | padding = { 0, custom.border == "none" and 2 or 0 }, 90 | }, 91 | position = { 92 | row = custom.border == "none" and 1 or 2, 93 | }, 94 | }, 95 | }, 96 | }, 97 | keys = { 98 | { 99 | "fn", 100 | "Noice fzf", 101 | desc = "Noitification", 102 | }, 103 | { 104 | "", 105 | function() 106 | if not require("noice.lsp").scroll(4) then 107 | return "" 108 | end 109 | end, 110 | mode = { "n", "i", "s" }, 111 | silent = true, 112 | expr = true, 113 | }, 114 | { 115 | "", 116 | function() 117 | if not require("noice.lsp").scroll(-4) then 118 | return "" 119 | end 120 | end, 121 | mode = { "n", "i", "s" }, 122 | silent = true, 123 | expr = true, 124 | }, 125 | }, 126 | } 127 | -------------------------------------------------------------------------------- /lua/plugins/ui/notify.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "rcarriga/nvim-notify", 4 | event = "VeryLazy", 5 | opts = function() 6 | local stages_util = require "notify.stages.util" 7 | local direction = stages_util.DIRECTION.BOTTOM_UP 8 | 9 | return { 10 | render = "minimal", 11 | 12 | -- Modified from "static" 13 | stages = { 14 | function(state) 15 | local next_height = state.message.height + 2 16 | local next_row = stages_util.available_slot( 17 | state.open_windows, 18 | next_height, 19 | direction 20 | ) 21 | if not next_row then 22 | return nil 23 | end 24 | 25 | -- Avoid overlapping with the statusline 26 | if vim.tbl_isempty(state.open_windows) then 27 | next_row = next_row - 1 28 | end 29 | 30 | return { 31 | relative = "editor", 32 | anchor = "NE", 33 | width = state.message.width, 34 | height = state.message.height, 35 | col = vim.opt.columns:get(), 36 | row = next_row, 37 | border = "rounded", 38 | style = "minimal", 39 | } 40 | end, 41 | function() 42 | return { 43 | col = vim.opt.columns:get(), 44 | time = true, 45 | } 46 | end, 47 | }, 48 | } 49 | end, 50 | } 51 | -------------------------------------------------------------------------------- /lua/plugins/ui/quicker.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "stevearc/quicker.nvim", 4 | ft = "qf", 5 | ---@module "quicker" 6 | ---@type quicker.SetupOptions 7 | opts = { 8 | keys = { 9 | { 10 | "zo", 11 | function() 12 | require("quicker").expand { 13 | before = 2, 14 | after = 2, 15 | add_to_existing = true, 16 | } 17 | end, 18 | desc = "Expand quickfix context", 19 | }, 20 | { 21 | "zc", 22 | function() 23 | require("quicker").collapse() 24 | end, 25 | desc = "Collapse quickfix context", 26 | }, 27 | }, 28 | opts = { 29 | number = true, 30 | }, 31 | highlight = { 32 | lsp = false, 33 | }, 34 | max_filename_width = function() 35 | return math.floor(math.min(60, vim.o.columns / 4)) 36 | end, 37 | }, 38 | } 39 | -------------------------------------------------------------------------------- /lua/plugins/ui/rainbow-delimiters.lua: -------------------------------------------------------------------------------- 1 | local highlight = { 2 | "RainbowDelimiterRed", 3 | "RainbowDelimiterYellow", 4 | "RainbowDelimiterBlue", 5 | "RainbowDelimiterOrange", 6 | "RainbowDelimiterGreen", 7 | "RainbowDelimiterViolet", 8 | "RainbowDelimiterCyan", 9 | } 10 | 11 | ---@type LazyPluginSpec 12 | return { 13 | "HiPhish/rainbow-delimiters.nvim", 14 | event = "VeryLazy", 15 | opts = { 16 | query = { 17 | [""] = "rainbow-delimiters", 18 | latex = "rainbow-blocks", 19 | lua = "rainbow-blocks", 20 | query = "rainbow-blocks", 21 | verilog = "rainbow-blocks", 22 | }, 23 | highlight = highlight, 24 | }, 25 | config = function(_, opts) 26 | -- Integration with indent-blankline 27 | local _, ibl = pcall(require, "ibl") 28 | if ibl then 29 | local hooks = require "ibl.hooks" 30 | ibl.update { 31 | scope = { 32 | highlight = highlight, 33 | }, 34 | } 35 | hooks.register( 36 | hooks.type.SCOPE_HIGHLIGHT, 37 | hooks.builtin.scope_highlight_from_extmark 38 | ) 39 | end 40 | 41 | vim.g.rainbow_delimiters = opts 42 | end, 43 | } 44 | -------------------------------------------------------------------------------- /lua/plugins/ui/regexplainer.lua: -------------------------------------------------------------------------------- 1 | local custom = require "custom" 2 | 3 | ---@type LazyPluginSpec 4 | return { 5 | "bennypowers/nvim-regexplainer", 6 | -- Not very useful now 7 | dependencies = { 8 | "nvim-lua/plenary.nvim", 9 | "MunifTanjim/nui.nvim", 10 | }, 11 | keys = { "gR", desc = "Toggle Regexplainer" }, 12 | opts = { 13 | popup = { 14 | border = { 15 | style = custom.border, 16 | }, 17 | }, 18 | }, 19 | } 20 | -------------------------------------------------------------------------------- /lua/plugins/ui/scrollview.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "dstein64/nvim-scrollview", 4 | event = "VeryLazy", 5 | opts = { 6 | winblend = 50, 7 | winblend_gui = 50, 8 | floating_windows = true, 9 | consider_border = true, 10 | excluded_filetypes = { 11 | "dropbar_menu", 12 | "cmp_docs", 13 | "cmp_menu", 14 | 'blink-cmp-menu', 15 | 'blink-cmp-documentation', 16 | 'blink-cmp-signature', 17 | "noice", 18 | }, 19 | signs_on_startup = { 20 | "conflicts", 21 | -- "cursor", 22 | "diagnostics", 23 | "folds", 24 | "loclist", 25 | "marks", 26 | "quickfix", 27 | "search", 28 | "spell", 29 | -- "textwidth", 30 | -- "trail", 31 | }, 32 | }, 33 | config = function(_, opts) 34 | local scrollview = require "scrollview" 35 | local scrollview_gitsigns = require "scrollview.contrib.gitsigns" 36 | 37 | scrollview.setup(opts) 38 | scrollview_gitsigns.setup { 39 | add_priority = 100, 40 | change_priority = 100, 41 | delete_priority = 100, 42 | } 43 | 44 | vim.api.nvim_set_hl(0, "ScrollView", { link = "PmenuThumb" }) 45 | vim.api.nvim_set_hl(0, "ScrollViewHover", { link = "PmenuSbar" }) 46 | end, 47 | } 48 | -------------------------------------------------------------------------------- /lua/plugins/ui/sentiment.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "utilyre/sentiment.nvim", 4 | event = "VeryLazy", 5 | opts = {}, 6 | } 7 | -------------------------------------------------------------------------------- /lua/plugins/ui/statuscol.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "luukvbaal/statuscol.nvim", 4 | opts = function() 5 | local builtin = require "statuscol.builtin" 6 | 7 | return { 8 | bt_ignore = { "nofile", "terminal" }, 9 | ft_ignore = { "NeogitStatus" }, 10 | segments = { 11 | -- Simulate the sign column while not showing the gitsigns 12 | { 13 | sign = { 14 | name = { ".*" }, 15 | text = { ".*" }, 16 | }, 17 | click = "v:lua.ScSa", 18 | }, 19 | -- Simulate the line number column without the right padding 20 | { 21 | text = { builtin.lnumfunc }, 22 | click = "v:lua.ScLa", 23 | }, 24 | -- Show gitsigns at the position of line numbers' right padding 25 | { 26 | sign = { 27 | namespace = { "gitsigns" }, 28 | colwidth = 1, 29 | wrap = true, 30 | foldclosed = true, 31 | }, 32 | condition = { 33 | function(args) 34 | return vim.wo[args.win].number or vim.b[args.buf].gitsigns_status 35 | end, 36 | }, 37 | click = "v:lua.ScSa", 38 | }, 39 | -- Show the fold column with custom icons 40 | { 41 | text = { 42 | function(args) 43 | args.fold.close = "" 44 | args.fold.open = "" 45 | args.fold.sep = " " 46 | return builtin.foldfunc(args) 47 | end, 48 | }, 49 | click = "v:lua.ScFa", 50 | }, 51 | }, 52 | } 53 | end, 54 | } 55 | -------------------------------------------------------------------------------- /lua/plugins/ui/tabline.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "mg979/tabline.nvim", 4 | enabled = false, 5 | init = function() 6 | vim.o.showtabline = 2 7 | end, 8 | opts = {}, 9 | config = function(_, opts) 10 | local tabline = require "tabline.setup" 11 | 12 | tabline.setup(opts) 13 | tabline.mappings(true) 14 | end, 15 | } 16 | -------------------------------------------------------------------------------- /lua/plugins/ui/tint.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | -- When switching between colorschemes, 4 | -- this plugin cause many highlight groups can not be applied. 5 | "levouh/tint.nvim", 6 | enabled = false, 7 | event = "VeryLazy", 8 | opts = { 9 | highlight_ignore_patterns = { 10 | "WinSeparator", 11 | "EndOfBuffer", 12 | "LineNr", 13 | "IblWhitespace", 14 | }, 15 | window_ignore_function = function(win) 16 | local buf = vim.api.nvim_win_get_buf(win) 17 | return vim.bo[buf].modifiable ~= true 18 | end, 19 | }, 20 | config = function(_, opts) 21 | require("tint").setup(opts) 22 | 23 | vim.api.nvim_create_autocmd("ColorScheme", { 24 | desc = "Refresh tint", 25 | callback = function() 26 | -- Timeout is needed for wait all colorscheme highlights applied 27 | vim.defer_fn(function() 28 | require("tint").refresh() 29 | end, 100) 30 | end, 31 | }) 32 | end, 33 | } 34 | -------------------------------------------------------------------------------- /lua/plugins/ui/todo-comments.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "folke/todo-comments.nvim", 4 | enabled = false, 5 | event = "VeryLazy", 6 | opts = {}, 7 | } 8 | -------------------------------------------------------------------------------- /lua/plugins/ui/ufo.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "kevinhwang91/nvim-ufo", 4 | cond = function() 5 | if vim.lsp._folding_range then 6 | vim.o.foldmethod = "expr" 7 | vim.o.foldexpr = "v:lua.vim.lsp.foldexpr()" 8 | vim.o.foldtext = "v:lua.vim.lsp.foldtext()" 9 | vim.o.foldcolumn = "1" 10 | vim.o.foldlevel = 99 11 | 12 | vim.api.nvim_create_autocmd("LspNotify", { 13 | callback = function(args) 14 | if args.data.method == "textDocument/didOpen" then 15 | vim.lsp.foldclose("imports", vim.fn.bufwinid(args.buf)) 16 | end 17 | end, 18 | }) 19 | return false 20 | end 21 | return true 22 | end, 23 | event = "VeryLazy", 24 | dependencies = "kevinhwang91/promise-async", 25 | init = function() 26 | local set_foldcolumn_for_file = 27 | vim.api.nvim_create_augroup("set_foldcolumn_for_file", { 28 | clear = true, 29 | }) 30 | vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { 31 | group = set_foldcolumn_for_file, 32 | callback = function() 33 | if vim.bo.buftype == "" then 34 | vim.wo.foldcolumn = "1" 35 | else 36 | vim.wo.foldcolumn = "0" 37 | end 38 | end, 39 | }) 40 | vim.api.nvim_create_autocmd("OptionSet", { 41 | group = set_foldcolumn_for_file, 42 | pattern = "buftype", 43 | callback = function() 44 | if vim.bo.buftype == "" then 45 | vim.wo.foldcolumn = "1" 46 | else 47 | vim.wo.foldcolumn = "0" 48 | end 49 | end, 50 | }) 51 | vim.o.foldlevel = 99 52 | vim.o.foldlevelstart = 99 53 | vim.o.foldenable = true 54 | end, 55 | opts = { 56 | close_fold_kinds_for_ft = { 57 | default = { "imports" }, 58 | }, 59 | }, 60 | config = function(_, opts) 61 | local ufo = require "ufo" 62 | ufo.setup(opts) 63 | 64 | vim.api.nvim_create_autocmd("LspAttach", { 65 | desc = "Setup Ufo `K` with LSP hover", 66 | callback = function(args) 67 | local bufnr = args.buf 68 | 69 | vim.keymap.set("n", "K", function() 70 | local winid = ufo.peekFoldedLinesUnderCursor() 71 | if not winid then 72 | vim.lsp.buf.hover() 73 | end 74 | end, { buffer = bufnr, desc = "LSP: Signature help" }) 75 | end, 76 | }) 77 | end, 78 | } 79 | -------------------------------------------------------------------------------- /lua/plugins/ui/virt-column.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "lukas-reineke/virt-column.nvim", 4 | opts = { 5 | char = "▏", 6 | }, 7 | } 8 | -------------------------------------------------------------------------------- /lua/plugins/ui/wezterm.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "willothy/wezterm.nvim", 4 | cond = vim.env.TERM == "wezterm", 5 | cmds = { 6 | "WeztermSpawn", 7 | }, 8 | opts = {}, 9 | } 10 | -------------------------------------------------------------------------------- /lua/plugins/ui/zen-mode.lua: -------------------------------------------------------------------------------- 1 | ---@type LazyPluginSpec 2 | return { 3 | "folke/zen-mode.nvim", 4 | opts = {}, 5 | keys = { 6 | { "tz", "ZenMode", desc = "Zen Mode" }, 7 | }, 8 | } 9 | -------------------------------------------------------------------------------- /lua/utils.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | --- Wrapper for tree-sitter repeatable move, 4 | --- avoid error when the module is not loaded 5 | ---@param forward_move_fn function 6 | ---@param backward_move_fn function 7 | function M.make_repeatable_move_pair(forward_move_fn, backward_move_fn) 8 | local function move_fn(opts) 9 | if opts.forward then 10 | return forward_move_fn() 11 | else 12 | return backward_move_fn() 13 | end 14 | end 15 | 16 | local loaded_ts, ts_repeatable 17 | return function() 18 | if not loaded_ts then 19 | loaded_ts, ts_repeatable = 20 | pcall(require, "nvim-treesitter-textobjects.repeatable_move") 21 | if loaded_ts then 22 | move_fn = ts_repeatable.make_repeatable_move(move_fn) 23 | end 24 | end 25 | return move_fn { forward = true } 26 | end, function() 27 | if not loaded_ts then 28 | loaded_ts, ts_repeatable = 29 | pcall(require, "nvim-treesitter-textobjects.repeatable_move") 30 | if loaded_ts then 31 | move_fn = ts_repeatable.make_repeatable_move(move_fn) 32 | end 33 | end 34 | return move_fn { forward = false } 35 | end 36 | end 37 | 38 | --- Turn the first letter of a string to uppercase 39 | ---@param str string 40 | ---@return string uppercased 41 | function M.firstToUpper(str) 42 | return (str:gsub("^%l", string.upper)) 43 | end 44 | 45 | -- FFI 46 | local ffi = require "ffidef" 47 | local error = ffi.new "Error" 48 | 49 | ---@param winid number 50 | ---@param lnum number 51 | ---@return foldinfo_T | nil 52 | function M.fold_info(winid, lnum) 53 | local win_T_ptr = ffi.C.find_window_by_handle(winid, error) 54 | if win_T_ptr == nil then 55 | return 56 | end 57 | return ffi.C.fold_info(win_T_ptr, lnum) 58 | end 59 | 60 | return M 61 | -------------------------------------------------------------------------------- /queries/typescript/highlights.scm: -------------------------------------------------------------------------------- 1 | ; extends 2 | 3 | ; Workaround for https://github.com/tree-sitter/tree-sitter-typescript/issues/282 4 | (call_expression 5 | function: (await_expression 6 | (identifier) @function.call)) 7 | -------------------------------------------------------------------------------- /stylua.toml: -------------------------------------------------------------------------------- 1 | column_width = 80 2 | indent_type = "Spaces" 3 | indent_width = 2 4 | no_call_parentheses = true 5 | --------------------------------------------------------------------------------