├── .gitignore ├── .stylua.toml ├── README.md ├── ftplugin ├── dart.lua ├── gleam.lua ├── java.lua ├── javascript.lua ├── kdl.lua └── typescript.lua ├── init.lua ├── lazy-lock.json ├── logo.sh ├── lua ├── gmr │ ├── configs │ │ ├── base46.lua │ │ ├── formatter │ │ │ ├── biome.lua │ │ │ ├── prettier.lua │ │ │ └── web.lua │ │ ├── kitty.lua │ │ ├── lsp │ │ │ ├── handlers.lua │ │ │ ├── init.lua │ │ │ ├── navic.lua │ │ │ ├── servers.lua │ │ │ ├── settings │ │ │ │ ├── clangd.lua │ │ │ │ ├── denols.lua │ │ │ │ ├── elixirls.lua │ │ │ │ ├── gopls.lua │ │ │ │ ├── html.lua │ │ │ │ ├── jsonls.lua │ │ │ │ ├── lua_ls.lua │ │ │ │ ├── omnisharp.lua │ │ │ │ ├── pyright.lua │ │ │ │ ├── taplo.lua │ │ │ │ ├── ts_ls.lua │ │ │ │ └── yamlls.lua │ │ │ └── ts_ls.lua │ │ ├── mason │ │ │ └── packages.lua │ │ ├── snippets │ │ │ ├── c.lua │ │ │ ├── csharp.lua │ │ │ ├── dart.lua │ │ │ ├── go.lua │ │ │ ├── init.lua │ │ │ ├── java.lua │ │ │ ├── javascript.lua │ │ │ ├── kotlin.lua │ │ │ ├── lua.lua │ │ │ ├── ocaml.lua │ │ │ ├── python.lua │ │ │ ├── rust.lua │ │ │ ├── sql.lua │ │ │ └── typescript.lua │ │ └── treesitter │ │ │ └── parsers.lua │ ├── core │ │ ├── autocmds.lua │ │ ├── indentlines.lua │ │ ├── keymaps │ │ │ ├── colorizer.lua │ │ │ ├── dap.lua │ │ │ ├── editor.lua │ │ │ ├── fzf.lua │ │ │ ├── grapple.lua │ │ │ ├── init.lua │ │ │ ├── neotest.lua │ │ │ ├── nvim-tree.lua │ │ │ ├── snacks.lua │ │ │ └── telescope.lua │ │ ├── options.lua │ │ ├── statusline.lua │ │ ├── terminalcolors.lua │ │ ├── utils.lua │ │ └── winbar.lua │ ├── lazy.lua │ └── plugins │ │ ├── autopairs.lua │ │ ├── autotag.lua │ │ ├── base46.lua │ │ ├── blink-cmp.lua │ │ ├── cloak.lua │ │ ├── cmp.lua │ │ ├── colorizer.lua │ │ ├── colorschemes │ │ ├── black_white.lua │ │ ├── cold.lua │ │ ├── github.lua │ │ ├── rose-pine.lua │ │ └── vscode_modern_theme.lua │ │ ├── formatter.lua │ │ ├── fzf.lua │ │ ├── gitsigns.lua │ │ ├── grapple.lua │ │ ├── guess-indent.lua │ │ ├── jdtls.lua │ │ ├── lazydev.lua │ │ ├── lsp.lua │ │ ├── luvit-meta.lua │ │ ├── mason.lua │ │ ├── mini-indentscope.lua │ │ ├── mini-surround.lua │ │ ├── navic.lua │ │ ├── null-ls.lua │ │ ├── nvim-tree.lua │ │ ├── scriptease.lua │ │ ├── snacks.lua │ │ ├── telescope.lua │ │ ├── treesitter-context.lua │ │ ├── treesitter.lua │ │ ├── ts-comments.lua │ │ ├── twilight.lua │ │ ├── undotree.lua │ │ ├── vim-surround.lua │ │ ├── web-devicons.lua │ │ └── zen-mode.lua └── nvconfig.lua └── queries ├── go └── injections.scm ├── javascript └── injections.scm ├── kotlin └── injections.scm ├── python └── injections.scm └── typescript └── injections.scm /.gitignore: -------------------------------------------------------------------------------- 1 | plugin 2 | !*after/plugin 3 | .luarc.json 4 | -------------------------------------------------------------------------------- /.stylua.toml: -------------------------------------------------------------------------------- 1 | column_width = 80 2 | line_endings = "Unix" 3 | indent_type = "Spaces" 4 | indent_width = 4 5 | quote_style = "ForceSingle" 6 | call_parentheses = "None" 7 | syntax = "LuaJIT" 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Neovim config 2 | -------------------------------------------------------------------------------- /ftplugin/dart.lua: -------------------------------------------------------------------------------- 1 | vim.bo.commentstring = '//%s' 2 | -------------------------------------------------------------------------------- /ftplugin/gleam.lua: -------------------------------------------------------------------------------- 1 | vim.opt.shiftwidth = 2 2 | vim.opt.tabstop = 2 3 | -------------------------------------------------------------------------------- /ftplugin/java.lua: -------------------------------------------------------------------------------- 1 | local jdtls_path = vim.fn.expand '$MASON/packages/jdtls' 2 | local java_debug_path = vim.fn.expand '$MASON/packages/java-debug-adapter' 3 | local java_test_path = vim.fn.expand '$MASON/packages/java-test' 4 | 5 | local equinox_launcher_path = 6 | vim.fn.glob(jdtls_path .. '/plugins/org.eclipse.equinox.launcher_*.jar') 7 | 8 | local system = 'linux' 9 | if vim.fn.has 'win32' then 10 | system = 'win' 11 | elseif vim.fn.has 'mac' then 12 | system = 'mac' 13 | end 14 | local config_path = vim.fn.glob(jdtls_path .. '/config_' .. system) 15 | 16 | local lombok_path = jdtls_path .. '/lombok.jar' 17 | 18 | local jdtls = require 'jdtls' 19 | 20 | local lspconfiguser = require 'gmr.configs.lsp' 21 | lspconfiguser.setup_diagnostic_config() 22 | 23 | local config = { 24 | cmd = { 25 | -- vim.fn.expand '~/.sdkman/candidates/java/21.*-tem/bin/java', -- or '/path/to/java17_or_newer/bin/java' 26 | 'java', -- or '/path/to/java17_or_newer/bin/java' 27 | 28 | '-Declipse.application=org.eclipse.jdt.ls.core.id1', 29 | '-Dosgi.bundles.defaultStartLevel=4', 30 | '-Declipse.product=org.eclipse.jdt.ls.core.product', 31 | '-Dlog.protocol=true', 32 | '-Dlog.level=ALL', 33 | '-Xmx1g', 34 | '--add-modules=ALL-SYSTEM', 35 | '--add-opens', 36 | 'java.base/java.util=ALL-UNNAMED', 37 | '--add-opens', 38 | 'java.base/java.lang=ALL-UNNAMED', 39 | 40 | '-javaagent:' .. lombok_path, 41 | 42 | '-jar', 43 | equinox_launcher_path, 44 | 45 | '-configuration', 46 | config_path, 47 | 48 | '-data', 49 | vim.fn.stdpath 'cache' 50 | .. '/jdtls/' 51 | .. vim.fn.fnamemodify(vim.fn.getcwd(), ':t'), 52 | }, 53 | 54 | root_dir = vim.fs.root(0, { 'mvnw', 'gradlew' }), 55 | 56 | on_attach = lspconfiguser.on_attach, 57 | 58 | -- Here you can configure eclipse.jdt.ls specific settings 59 | -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request 60 | -- for a list of options 61 | settings = { 62 | java = { 63 | server = { launchMode = 'Hybrid' }, 64 | eclipse = { 65 | downloadSources = true, 66 | }, 67 | maven = { 68 | downloadSources = true, 69 | }, 70 | -- configuration = { 71 | -- runtimes = { 72 | -- { 73 | -- name = 'JavaSE-1.8', 74 | -- path = vim.fn.expand '~/.sdkman/candidates/java/8.*-tem', 75 | -- }, 76 | -- { 77 | -- name = 'JavaSE-11', 78 | -- path = vim.fn.expand '~/.sdkman/candidates/java/11.*-tem', 79 | -- }, 80 | -- { 81 | -- name = 'JavaSE-17', 82 | -- path = vim.fn.expand '~/.sdkman/candidates/java/17.*-tem', 83 | -- }, 84 | -- { 85 | -- name = 'JavaSE-21', 86 | -- path = vim.fn.expand '~/.sdkman/candidates/java/21.*-tem', 87 | -- }, 88 | -- }, 89 | -- }, 90 | references = { 91 | includeDecompiledSources = true, 92 | }, 93 | implementationsCodeLens = { 94 | enabled = false, 95 | }, 96 | referenceCodeLens = { 97 | enabled = false, 98 | }, 99 | inlayHints = { 100 | parameterNames = { 101 | enabled = 'none', 102 | }, 103 | }, 104 | signatureHelp = { 105 | enabled = true, 106 | description = { 107 | enabled = true, 108 | }, 109 | }, 110 | sources = { 111 | organizeImports = { 112 | starThreshold = 9999, 113 | staticStarThreshold = 9999, 114 | }, 115 | }, 116 | }, 117 | redhat = { telemetry = { enabled = false } }, 118 | }, 119 | } 120 | 121 | local bundles = { 122 | vim.fn.glob( 123 | java_debug_path 124 | .. '/extension/server/com.microsoft.java.debug.plugin-*.jar' 125 | ), 126 | } 127 | 128 | vim.list_extend( 129 | bundles, 130 | vim.split(vim.fn.glob(java_test_path .. '/extension/server/*.jar'), '\n') 131 | ) 132 | 133 | config['init_options'] = { 134 | bundles = bundles, 135 | } 136 | 137 | jdtls.start_or_attach(config) 138 | -------------------------------------------------------------------------------- /ftplugin/javascript.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_create_autocmd('LspAttach', { 2 | group = vim.api.nvim_create_augroup( 3 | 'gmr_go_to_source_definition_js', 4 | { clear = true } 5 | ), 6 | callback = function() 7 | vim.keymap.set( 8 | 'n', 9 | 'gD', 10 | require('gmr.configs.lsp.ts_ls').go_to_source_definition 11 | ) 12 | end, 13 | }) 14 | -------------------------------------------------------------------------------- /ftplugin/kdl.lua: -------------------------------------------------------------------------------- 1 | vim.bo.commentstring = '//%s' 2 | -------------------------------------------------------------------------------- /ftplugin/typescript.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_create_autocmd('LspAttach', { 2 | group = vim.api.nvim_create_augroup( 3 | 'gmr_go_to_source_definition_ts', 4 | { clear = true } 5 | ), 6 | callback = function() 7 | vim.keymap.set( 8 | 'n', 9 | 'gD', 10 | require('gmr.configs.lsp.ts_ls').go_to_source_definition 11 | ) 12 | end, 13 | }) 14 | -------------------------------------------------------------------------------- /init.lua: -------------------------------------------------------------------------------- 1 | require 'gmr.core.options' 2 | require 'gmr.core.keymaps' 3 | require 'gmr.core.autocmds' 4 | require 'gmr.core.statusline' 5 | require 'gmr.core.winbar' 6 | require 'gmr.core.terminalcolors' 7 | require 'gmr.lazy' 8 | -- require 'gmr.configs.base46' 9 | -------------------------------------------------------------------------------- /lazy-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "SchemaStore.nvim": { "branch": "main", "commit": "0098dde21296a454ae1426f9ac47340dd38c27ce" }, 3 | "blink.cmp": { "branch": "main", "commit": "022521a8910a5543b0251b21c9e1a1e989745796" }, 4 | "cold.nvim": { "branch": "master", "commit": "ec6d33ca4059f8672d7b4f28ac1c98d37715edbf" }, 5 | "formatter.nvim": { "branch": "master", "commit": "eb89a1f3e079f1b9680bc7293b75fffccb5e1598" }, 6 | "gitsigns.nvim": { "branch": "main", "commit": "8b729e489f1475615dc6c9737da917b3bc163605" }, 7 | "grapple.nvim": { "branch": "main", "commit": "b41ddfc1c39f87f3d1799b99c2f0f1daa524c5f7" }, 8 | "guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" }, 9 | "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, 10 | "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, 11 | "luvit-meta": { "branch": "main", "commit": "1df30b60b1b4aecfebc785aa98943db6c6989716" }, 12 | "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, 13 | "mini.indentscope": { "branch": "main", "commit": "8af2569a7d7fd37300dfa760e44e71efbbf322fd" }, 14 | "mini.surround": { "branch": "main", "commit": "5aab42fcdcf31fa010f012771eda5631c077840a" }, 15 | "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, 16 | "nvim-colorizer.lua": { "branch": "master", "commit": "517df88cf2afb36652830df2c655df2da416a0ae" }, 17 | "nvim-jdtls": { "branch": "master", "commit": "c23f200fee469a415c77265ca55b496feb646992" }, 18 | "nvim-lspconfig": { "branch": "master", "commit": "562487bc108bf73c2493f9e701b9334b48163216" }, 19 | "nvim-tree.lua": { "branch": "master", "commit": "cbc3165e08893bb499da035c6f6f9d1512b57664" }, 20 | "nvim-treesitter": { "branch": "main", "commit": "354c30d2a2f0996b56886928cb3d36e9c6664a06" }, 21 | "nvim-treesitter-context": { "branch": "master", "commit": "4976d8b90401cba9b85f6861e4e5a6edef2f2086" }, 22 | "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, 23 | "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, 24 | "snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }, 25 | "ts-comments.nvim": { "branch": "main", "commit": "1bd9d0ba1d8b336c3db50692ffd0955fe1bb9f0c" }, 26 | "twilight.nvim": { "branch": "main", "commit": "1584c0b0a979b71fd86b18d302ba84e9aba85b1b" }, 27 | "undotree": { "branch": "master", "commit": "b951b87b46c34356d44aa71886aecf9dd7f5788a" }, 28 | "vim-scriptease": { "branch": "master", "commit": "cdb5981d47ac98221a408ae2e7cae66524d9e872" }, 29 | "zen-mode.nvim": { "branch": "main", "commit": "863f150ca321b3dd8aa1a2b69b5f411a220e144f" } 30 | } 31 | -------------------------------------------------------------------------------- /logo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cat << x0 4 |       >j_             (>       5 |     itUXu{.           xX/!     6 |   ifYYXcxvt:          fczz/!   7 | ;]\vzczcxrnx<         fcvvcc\i 8 | 1|1{fzcvrrrru[.       tvvvuvvv 9 | }111{|vvjjjjjn\,      /unuuunx 10 | }1111{1jxjjjjfrj>     \nnnnnnx 11 | [{{{{{1--xjfffffx].   |xxxxxxr 12 | [{}}}}1- !tjtffftr(,  (rjrrrrj 13 | ]}[[[[{_  ^1jtttt/fti 1jjjjjjj 14 | ?[[[[[}_    _ft/tt/tj-1fffffff 15 | ?[]]]][+     l\t\////trftttttt 16 | -]]]]]]+      ^{f\\\\\jxf///// 17 | -]????]~        +/\\\\jrrf\\\\ 18 | ,<??--?~         I(/||fjjjf\}l 19 |   "<---<          ^[/(tfff)!   20 |     ^i-<            ~|tt{l     21 |       "l             l{l       22 | x0 23 | -------------------------------------------------------------------------------- /lua/gmr/configs/base46.lua: -------------------------------------------------------------------------------- 1 | if vim.fn.isdirectory(vim.g.base46_cache) == 0 then 2 | require('base46').load_all_highlights() 3 | end 4 | 5 | dofile(vim.g.base46_cache .. 'colors') 6 | dofile(vim.g.base46_cache .. 'defaults') 7 | dofile(vim.g.base46_cache .. 'devicons') 8 | dofile(vim.g.base46_cache .. 'git') 9 | dofile(vim.g.base46_cache .. 'lsp') 10 | dofile(vim.g.base46_cache .. 'mason') 11 | dofile(vim.g.base46_cache .. 'nvimtree') 12 | dofile(vim.g.base46_cache .. 'syntax') 13 | dofile(vim.g.base46_cache .. 'telescope') 14 | dofile(vim.g.base46_cache .. 'treesitter') 15 | 16 | vim.api.nvim_create_user_command('Base46', function() 17 | require('base46').load_all_highlights() 18 | end, {}) 19 | -------------------------------------------------------------------------------- /lua/gmr/configs/formatter/biome.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | if not vim.uv.fs_stat 'biome.json' then 3 | return { 4 | exe = 'biome', 5 | args = { 6 | 'format', 7 | '--indent-width', 8 | vim.bo.tabstop, 9 | '--stdin-file-path', 10 | vim.fn.shellescape(vim.api.nvim_buf_get_name(0)), 11 | }, 12 | stdin = true, 13 | } 14 | end 15 | 16 | return { 17 | exe = 'biome', 18 | args = { 19 | 'format', 20 | '--stdin-file-path', 21 | vim.fn.shellescape(vim.api.nvim_buf_get_name(0)), 22 | }, 23 | stdin = true, 24 | } 25 | end 26 | -------------------------------------------------------------------------------- /lua/gmr/configs/formatter/prettier.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local prettier_config_files = { 3 | '.prettierrc', 4 | '.prettierrc.json', 5 | '.prettierrc.yml', 6 | '.prettierrc.yaml', 7 | '.prettierrc.json5', 8 | '.prettierrc.js', 9 | 'prettier.config.js', 10 | '.prettierrc.mjs', 11 | 'prettier.config.mjs', 12 | '.prettierrc.cjs', 13 | 'prettier.config.cjs', 14 | '.prettierrc.toml', 15 | } 16 | 17 | local config_file_exists = false 18 | 19 | for _, config_file in pairs(prettier_config_files) do 20 | if vim.uv.fs_stat(config_file) then 21 | config_file_exists = true 22 | break 23 | end 24 | end 25 | 26 | if not config_file_exists then 27 | return { 28 | exe = 'prettier', 29 | args = { 30 | '--tab-width', 31 | vim.bo.tabstop, 32 | '--stdin-filepath', 33 | vim.fn.shellescape(vim.api.nvim_buf_get_name(0)), 34 | }, 35 | stdin = true, 36 | } 37 | end 38 | 39 | return { 40 | exe = 'prettier', 41 | args = { 42 | '--stdin-filepath', 43 | vim.fn.shellescape(vim.api.nvim_buf_get_name(0)), 44 | }, 45 | stdin = true, 46 | } 47 | end 48 | -------------------------------------------------------------------------------- /lua/gmr/configs/formatter/web.lua: -------------------------------------------------------------------------------- 1 | return function() 2 | local prettier_config_files = { 3 | '.prettierrc', 4 | '.prettierrc.json', 5 | '.prettierrc.yml', 6 | '.prettierrc.yaml', 7 | '.prettierrc.json5', 8 | '.prettierrc.js', 9 | 'prettier.config.js', 10 | '.prettierrc.mjs', 11 | 'prettier.config.mjs', 12 | '.prettierrc.cjs', 13 | 'prettier.config.cjs', 14 | '.prettierrc.toml', 15 | } 16 | 17 | local prettier_config_file_exists = false 18 | 19 | for _, config_file in pairs(prettier_config_files) do 20 | if vim.uv.fs_stat(config_file) then 21 | prettier_config_file_exists = true 22 | break 23 | end 24 | end 25 | 26 | if prettier_config_file_exists then 27 | return { 28 | exe = 'prettier', 29 | args = { 30 | '--stdin-filepath', 31 | vim.fn.shellescape(vim.api.nvim_buf_get_name(0)), 32 | }, 33 | stdin = true, 34 | } 35 | end 36 | 37 | if not vim.uv.fs_stat 'biome.json' then 38 | return { 39 | exe = 'biome', 40 | args = { 41 | 'format', 42 | '--indent-width', 43 | vim.bo.tabstop, 44 | '--indent-style', 45 | vim.o.expandtab and 'space' or 'tab', 46 | '--stdin-file-path', 47 | vim.fn.shellescape(vim.api.nvim_buf_get_name(0)), 48 | }, 49 | stdin = true, 50 | } 51 | end 52 | 53 | return { 54 | exe = 'biome', 55 | args = { 56 | 'format', 57 | '--stdin-file-path', 58 | vim.fn.shellescape(vim.api.nvim_buf_get_name(0)), 59 | }, 60 | stdin = true, 61 | } 62 | end 63 | -------------------------------------------------------------------------------- /lua/gmr/configs/kitty.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | local direction = { 4 | ['h'] = 'left', 5 | ['j'] = 'bottom', 6 | ['k'] = 'top', 7 | ['l'] = 'right', 8 | } 9 | 10 | --- @param hjkl 'h'|'j'|'k'|'l' 11 | function M.nav(hjkl) 12 | local current_winnr = vim.fn.winnr() 13 | vim.api.nvim_command('wincmd ' .. hjkl) 14 | local new_winnr = vim.fn.winnr() 15 | 16 | if current_winnr == new_winnr then 17 | local cmd = 'kitten @ focus-window --match neighbor:' .. direction[hjkl] 18 | vim.fn.system(cmd) 19 | end 20 | end 21 | 22 | return M 23 | -------------------------------------------------------------------------------- /lua/gmr/configs/lsp/handlers.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | --- @param err? lsp.ResponseError 4 | --- @param result any|lsp.Location[]|lsp.LocationLink[] 5 | --- @param context lsp.HandlerContext 6 | --- @param config? table 7 | function M.go_to_definition(err, result, context, config) 8 | local split_cmd = 'vsplit' 9 | local running_linux = vim.uv.os_uname().sysname == 'Linux' 10 | local desktop_session = os.getenv 'DESKTOP_SESSION' 11 | local running_hyprland = desktop_session == 'hyprland' 12 | or desktop_session == 'hyprland-uwsm' 13 | 14 | if running_linux and running_hyprland then 15 | local output_hyprctl = vim.fn.system 'hyprctl -j activewindow' 16 | --- @class HyprlandWindow 17 | --- @field size number[] 18 | local json = vim.json.decode(output_hyprctl) 19 | 20 | local size_x, size_y = json.size[1], json.size[2] 21 | 22 | if size_y > size_x then 23 | split_cmd = 'split' 24 | end 25 | end 26 | 27 | if result == nil or vim.tbl_isempty(result) then 28 | vim.lsp.log.info(context.method, 'No location found') 29 | return nil 30 | end 31 | 32 | local first_visible_line = vim.fn.line 'w0' 33 | local last_visible_line = vim.fn.line 'w$' 34 | 35 | local definition = result[1] 36 | 37 | local buf = vim.api.nvim_get_current_buf() 38 | local filename = vim.api.nvim_buf_get_name(buf) 39 | 40 | local uri = definition.uri or definition.targetUri 41 | 42 | if 'file://' .. filename ~= uri then 43 | vim.cmd(split_cmd) 44 | else 45 | local range = definition.range or definition.targetSelectionRange 46 | local line_definition = range.start.line 47 | 48 | if line_definition == 0 then 49 | line_definition = 1 50 | end 51 | 52 | if 53 | line_definition < first_visible_line 54 | or line_definition > last_visible_line 55 | then 56 | vim.cmd(split_cmd) 57 | end 58 | end 59 | 60 | if vim.islist(result) then 61 | vim.lsp.util.show_document( 62 | result[1], 63 | 'utf-8', 64 | { focus = true, reuse_win = false } 65 | ) 66 | 67 | if #result > 1 then 68 | vim.fn.setqflist(vim.lsp.util.locations_to_items(result, 'utf-8')) 69 | vim.api.nvim_command 'copen' 70 | vim.api.nvim_command 'wincmd p' 71 | end 72 | else 73 | vim.lsp.util.show_document( 74 | result, 75 | 'utf-8', 76 | { focus = true, reuse_win = false } 77 | ) 78 | end 79 | end 80 | 81 | return M 82 | -------------------------------------------------------------------------------- /lua/gmr/configs/lsp/init.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | -- local navic_attach = require('gmr.configs.lsp.navic').attach 4 | 5 | -- local running_windows = vim.fn.has 'win32' == 1 6 | 7 | --- @param client vim.lsp.Client 8 | --- @param bufnr integer 9 | function M.on_attach(client, bufnr) 10 | local methods = vim.lsp.protocol.Methods 11 | local req = client.request 12 | 13 | client.request = function(self, method, params, handler, bufnr_req) 14 | if method == methods.textDocument_definition then 15 | return req( 16 | self, 17 | method, 18 | params, 19 | require('gmr.configs.lsp.handlers').go_to_definition, 20 | bufnr_req 21 | ) 22 | else 23 | return req(self, method, params, handler, bufnr_req) 24 | end 25 | end 26 | 27 | vim.api.nvim_set_option_value( 28 | 'omnifunc', 29 | 'v:lua.vim.lsp.omnifunc', 30 | { buf = bufnr } 31 | ) 32 | 33 | --- @param lhs string 34 | --- @param rhs string|function 35 | --- @param mode? string|string[] 36 | local function keymap(lhs, rhs, mode) 37 | mode = mode or 'n' 38 | vim.keymap.set( 39 | mode, 40 | lhs, 41 | rhs, 42 | { noremap = true, silent = true, buffer = bufnr } 43 | ) 44 | end 45 | 46 | -- local fzf_opts = { 47 | -- winopts = { 48 | -- fullscreen = true, 49 | -- }, 50 | -- } 51 | 52 | keymap('e', vim.diagnostic.open_float) 53 | keymap('[d', function() 54 | vim.diagnostic.jump { count = -1, float = true } 55 | end) 56 | keymap(']d', function() 57 | vim.diagnostic.jump { count = 1, float = true } 58 | end) 59 | keymap('q', vim.diagnostic.setloclist) 60 | keymap('gd', vim.lsp.buf.definition) 61 | keymap('J', vim.lsp.buf.hover) 62 | keymap( 63 | 'gi', 64 | ':SnacksPickerLspImplementations' 65 | -- running_windows and ':Telescope lsp_implementations' 66 | -- or function() 67 | -- require('fzf-lua').lsp_implementations(fzf_opts) 68 | -- end 69 | ) 70 | keymap('K', vim.lsp.buf.signature_help) 71 | keymap('wa', vim.lsp.buf.add_workspace_folder) 72 | keymap('wr', vim.lsp.buf.remove_workspace_folder) 73 | keymap('wl', function() 74 | print(vim.inspect(vim.lsp.buf.list_workspace_folders())) 75 | end) 76 | keymap('D', vim.lsp.buf.type_definition) 77 | keymap('rn', vim.lsp.buf.rename) 78 | keymap( 79 | 'gr', 80 | ':SnacksPickerLspReferences' 81 | -- running_windows and ':Telescope lsp_references' 82 | -- or function() 83 | -- require('fzf-lua').lsp_references(fzf_opts) 84 | -- end 85 | ) 86 | keymap( 87 | 'sds', 88 | ':SnacksPickerLspDocumentSymbols' 89 | -- running_windows and ':Telescope lsp_document_symbols' 90 | -- or function() 91 | -- require('fzf-lua').lsp_document_symbols(fzf_opts) 92 | -- end 93 | ) 94 | keymap( 95 | 'sws', 96 | ':SnacksPickerLspWorkspaceSymbols' 97 | -- running_windows and ':Telescope lsp_dynamic_workspace_symbols' 98 | -- or function() 99 | -- require('fzf-lua').lsp_live_workspace_symbols(fzf_opts) 100 | -- end 101 | ) 102 | 103 | if client:supports_method(methods.textDocument_codeAction) then 104 | keymap( 105 | 'ca', 106 | vim.lsp.buf.code_action 107 | -- running_windows and vim.lsp.buf.code_action 108 | -- or function() 109 | -- require('fzf-lua').lsp_code_actions(fzf_opts) 110 | -- end 111 | ) 112 | keymap('oi', function() 113 | vim.lsp.buf.code_action { 114 | apply = true, 115 | context = { 116 | only = { 'source.organizeImports' }, 117 | diagnostics = {}, 118 | }, 119 | } 120 | end) 121 | end 122 | 123 | -- if client:supports_method(methods.textDocument_completion) then 124 | -- vim.lsp.completion.enable( 125 | -- true, 126 | -- client.id, 127 | -- bufnr, 128 | -- { autotrigger = false } 129 | -- ) 130 | -- end 131 | 132 | if client:supports_method(methods.textDocument_declaration) then 133 | keymap('gD', vim.lsp.buf.declaration) 134 | end 135 | 136 | if client:supports_method(methods.textDocument_documentHighlight) then 137 | local augroup = vim.api.nvim_create_augroup( 138 | 'gmr_lsp_document_highlight', 139 | { clear = false } 140 | ) 141 | 142 | vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { 143 | group = augroup, 144 | desc = 'Highlight references under the cursor', 145 | buffer = bufnr, 146 | callback = vim.lsp.buf.document_highlight, 147 | }) 148 | 149 | vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { 150 | group = augroup, 151 | desc = 'Clear highlight references after move cursor', 152 | buffer = bufnr, 153 | callback = vim.lsp.buf.clear_references, 154 | }) 155 | end 156 | 157 | if client:supports_method(methods.textDocument_formatting) then 158 | keymap('fo', function() 159 | vim.lsp.buf.format { 160 | async = true, 161 | filter = function(c) 162 | return c.name ~= 'eslint' 163 | end, 164 | } 165 | end, { 'n', 'v' }) 166 | end 167 | 168 | if client:supports_method(methods.textDocument_inlayHint) then 169 | keymap('ih', function() 170 | vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) 171 | end) 172 | end 173 | 174 | -- navic_attach(client, bufnr) 175 | end 176 | 177 | function M.setup_diagnostic_config() 178 | local severity_strings = { 179 | [1] = 'error', 180 | [2] = 'warn', 181 | [3] = 'info', 182 | [4] = 'hint', 183 | } 184 | 185 | vim.diagnostic.config { 186 | underline = true, 187 | virtual_text = { 188 | source = false, 189 | spacing = 1, 190 | suffix = '', 191 | format = function(diagnostic) 192 | return string.format( 193 | '%s: %s: %s ', 194 | severity_strings[diagnostic.severity], 195 | diagnostic.source, 196 | diagnostic.message 197 | ) 198 | end, 199 | }, 200 | signs = false, 201 | float = { source = true }, 202 | update_in_insert = false, 203 | severity_sort = true, 204 | } 205 | end 206 | 207 | return M 208 | -------------------------------------------------------------------------------- /lua/gmr/configs/lsp/navic.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | --- @param client vim.lsp.Client 4 | --- @param bufnr integer 5 | function M.attach(client, bufnr) 6 | local method = vim.lsp.protocol.Methods.textDocument_documentSymbol 7 | 8 | if client:supports_method(method) then 9 | local filetype = vim.bo.filetype 10 | 11 | if 12 | client.name == 'html' 13 | and (filetype == 'javascriptreact' or filetype == 'typescriptreact') 14 | then 15 | return 16 | end 17 | 18 | local ok_navic, navic = pcall(require, 'nvim-navic') 19 | if not ok_navic then 20 | vim.notify 'nvim-navic could not be loaded' 21 | return 22 | end 23 | 24 | navic.attach(client, bufnr) 25 | end 26 | end 27 | 28 | return M 29 | -------------------------------------------------------------------------------- /lua/gmr/configs/lsp/servers.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | M.to_setup = { 4 | 'angularls', 5 | 'astro', 6 | 'bashls', 7 | 'biome', 8 | 'buf_ls', 9 | 'clangd', 10 | 'cssls', 11 | 'denols', 12 | 'dockerls', 13 | 'elixirls', 14 | 'eslint', 15 | 'gleam', 16 | 'gopls', 17 | 'html', 18 | 'intelephense', 19 | -- 'jdtls', 20 | 'jsonls', 21 | -- 'kotlin_language_server', 22 | 'nim_langserver', 23 | 'nushell', 24 | 'ocamllsp', 25 | 'omnisharp', 26 | 'postgres_lsp', 27 | -- 'pylance', 28 | -- 'pylyzer', 29 | -- 'phpactor', 30 | 'pyright', 31 | 'ruff', 32 | 'rust_analyzer', 33 | 'templ', 34 | -- "solargraph", 35 | 'svelte', 36 | 'lua_ls', 37 | 'tailwindcss', 38 | 'taplo', 39 | 'ts_ls', 40 | 'vimls', 41 | -- 'vtsls', 42 | 'yamlls', 43 | -- 'zls', 44 | } 45 | 46 | return M 47 | -------------------------------------------------------------------------------- /lua/gmr/configs/lsp/settings/clangd.lua: -------------------------------------------------------------------------------- 1 | --- @class vim.lsp.Config 2 | local config = { 3 | filetypes = { 4 | 'c', 5 | 'cpp', 6 | 'objc', 7 | 'objcpp', 8 | 'cuda', 9 | }, 10 | } 11 | 12 | return config 13 | -------------------------------------------------------------------------------- /lua/gmr/configs/lsp/settings/denols.lua: -------------------------------------------------------------------------------- 1 | -- https://github.com/denoland/vscode_deno/blob/main/README.md 2 | 3 | --- @class vim.lsp.Config 4 | local config = { 5 | root_markers = { 'deno.json', 'deno.jsonc' }, 6 | workspace_required = true, 7 | settings = { 8 | deno = { 9 | inlayHints = { 10 | enumMemberValues = { enabled = true }, 11 | functionLikeReturnTypes = { enabled = true }, 12 | parameterNames = { 13 | enabled = 'all', 14 | suppressWhenArgumentMatchesName = true, 15 | }, 16 | parameterTypes = { enabled = true }, 17 | propertyDeclarationTypes = { enabled = true }, 18 | variableTypes = { 19 | enabled = true, 20 | suppressWhenTypeMatchesName = true, 21 | }, 22 | }, 23 | }, 24 | }, 25 | } 26 | 27 | return config 28 | -------------------------------------------------------------------------------- /lua/gmr/configs/lsp/settings/elixirls.lua: -------------------------------------------------------------------------------- 1 | --- @class vim.lsp.Config 2 | local config = { 3 | cmd = { 'elixir-ls' }, 4 | } 5 | 6 | return config 7 | -------------------------------------------------------------------------------- /lua/gmr/configs/lsp/settings/gopls.lua: -------------------------------------------------------------------------------- 1 | -- https://github.com/golang/tools/blob/master/gopls/doc/settings.md 2 | 3 | --- @class vim.lsp.Config 4 | local config = { 5 | settings = { 6 | gopls = { 7 | gofumpt = true, 8 | usePlaceholders = false, 9 | semanticTokens = false, 10 | ['ui.inlayhint.hints'] = { 11 | assignVariableTypes = true, 12 | compositeLiteralFields = true, 13 | compositeLiteralTypes = false, 14 | constantValues = true, 15 | functionTypeParameters = true, 16 | parameterNames = true, 17 | rangeVariableTypes = true, 18 | }, 19 | }, 20 | }, 21 | } 22 | 23 | return config 24 | -------------------------------------------------------------------------------- /lua/gmr/configs/lsp/settings/html.lua: -------------------------------------------------------------------------------- 1 | --- @class vim.lsp.Config 2 | local config = { 3 | filetypes = { 4 | 'django-html', 5 | 'ejs', 6 | 'handlebars', 7 | 'hbs', 8 | 'html', 9 | 'htmldjango', 10 | 'pug', 11 | 'templ', 12 | 'template', 13 | }, 14 | } 15 | 16 | return config 17 | -------------------------------------------------------------------------------- /lua/gmr/configs/lsp/settings/jsonls.lua: -------------------------------------------------------------------------------- 1 | local ok, schemastore = pcall(require, 'schemastore') 2 | if not ok then 3 | vim.notify 'schemastore could not be loaded' 4 | return 5 | end 6 | 7 | --- @class vim.lsp.Config 8 | local config = { 9 | settings = { 10 | json = { 11 | schemas = schemastore.json.schemas(), 12 | validate = { enable = true }, 13 | }, 14 | }, 15 | } 16 | 17 | return config 18 | -------------------------------------------------------------------------------- /lua/gmr/configs/lsp/settings/lua_ls.lua: -------------------------------------------------------------------------------- 1 | -- https://luals.github.io/wiki/settings/ 2 | 3 | --- @class vim.lsp.Config 4 | local config = { 5 | settings = { 6 | Lua = { 7 | completion = { 8 | callSnippet = 'Replace', 9 | keywordSnippet = 'Replace', 10 | }, 11 | hint = { enable = true }, 12 | telemetry = { enable = false }, 13 | workspace = { checkThirdParty = false }, 14 | }, 15 | }, 16 | } 17 | 18 | return config 19 | -------------------------------------------------------------------------------- /lua/gmr/configs/lsp/settings/omnisharp.lua: -------------------------------------------------------------------------------- 1 | local path = vim.fn.exepath 'omnisharp' 2 | 3 | --- @class vim.lsp.Config 4 | local config = { 5 | cmd = { 6 | 'dotnet', 7 | path .. '/libexec/OmniSharp.dll', 8 | }, 9 | } 10 | 11 | return config 12 | -------------------------------------------------------------------------------- /lua/gmr/configs/lsp/settings/pyright.lua: -------------------------------------------------------------------------------- 1 | --- @class vim.lsp.Config 2 | local config = { 3 | settings = { 4 | pyright = { 5 | disableLanguageServices = false, 6 | disableOrganizeImports = false, 7 | }, 8 | python = { 9 | analysis = { 10 | autoImportCompletions = true, 11 | autoSearchPaths = true, 12 | diagnosticMode = 'workspace', -- openFilesOnly, workspace 13 | typeCheckingMode = 'basic', -- off, basic, strict 14 | useLibraryCodeForTypes = true, 15 | }, 16 | }, 17 | }, 18 | single_file_support = true, 19 | } 20 | 21 | return config 22 | -------------------------------------------------------------------------------- /lua/gmr/configs/lsp/settings/taplo.lua: -------------------------------------------------------------------------------- 1 | local ok, schemastore = pcall(require, 'schemastore') 2 | if not ok then 3 | vim.notify 'schemastore could not be loaded' 4 | return 5 | end 6 | 7 | --- @class vim.lsp.Config 8 | local config = { 9 | settings = { 10 | toml = { 11 | schemas = schemastore.json.schemas(), 12 | validate = { enable = true }, 13 | }, 14 | }, 15 | } 16 | 17 | return config 18 | -------------------------------------------------------------------------------- /lua/gmr/configs/lsp/settings/ts_ls.lua: -------------------------------------------------------------------------------- 1 | -- https://github.com/typescript-language-server/typescript-language-server/blob/master/docs/configuration.md 2 | 3 | --- @class vim.lsp.Config 4 | local config = { 5 | root_markers = { 'tsconfig.json', 'jsconfig.json', 'package.json' }, 6 | workspace_required = true, 7 | settings = { 8 | diagnostics = { 9 | ignoredCodes = { 80001 }, 10 | }, 11 | -- javascript = { 12 | -- inlayHints = { 13 | -- includeInlayEnumMemberValueHints = true, 14 | -- includeInlayFunctionLikeReturnTypeHints = true, 15 | -- includeInlayFunctionParameterTypeHints = true, 16 | -- --- @type 'none' | 'literals' | 'all' 17 | -- includeInlayParameterNameHints = 'all', 18 | -- includeInlayParameterNameHintsWhenArgumentMatchesName = true, 19 | -- includeInlayPropertyDeclarationTypeHints = true, 20 | -- includeInlayVariableTypeHints = true, 21 | -- includeInlayVariableTypeHintsWhenTypeMatchesName = true, 22 | -- }, 23 | -- }, 24 | -- typescript = { 25 | -- inlayHints = { 26 | -- includeInlayEnumMemberValueHints = true, 27 | -- includeInlayFunctionLikeReturnTypeHints = true, 28 | -- includeInlayFunctionParameterTypeHints = true, 29 | -- --- @type 'none' | 'literals' | 'all' 30 | -- includeInlayParameterNameHints = 'all', 31 | -- includeInlayParameterNameHintsWhenArgumentMatchesName = true, 32 | -- includeInlayPropertyDeclarationTypeHints = true, 33 | -- includeInlayVariableTypeHints = true, 34 | -- includeInlayVariableTypeHintsWhenTypeMatchesName = true, 35 | -- }, 36 | -- }, 37 | }, 38 | handlers = { 39 | --- @param err? lsp.ResponseError 40 | --- @param result? lsp.Location[]|lsp.LocationLink[] 41 | --- @param context lsp.HandlerContext 42 | --- @param config? table 43 | ['workspace/executeCommand'] = function(err, result, context, config) 44 | if context.params.command == '_typescript.goToSourceDefinition' then 45 | require('gmr.configs.lsp.handlers').go_to_definition( 46 | err, 47 | result, 48 | context, 49 | config 50 | ) 51 | end 52 | end, 53 | }, 54 | } 55 | 56 | return config 57 | -------------------------------------------------------------------------------- /lua/gmr/configs/lsp/settings/yamlls.lua: -------------------------------------------------------------------------------- 1 | local ok, schemastore = pcall(require, 'schemastore') 2 | if not ok then 3 | vim.notify 'schemastore could not be loaded' 4 | return 5 | end 6 | 7 | --- @class vim.lsp.Config 8 | local config = { 9 | settings = { 10 | redhat = { 11 | telemetry = { 12 | enabled = false, 13 | }, 14 | }, 15 | yaml = { 16 | schemas = schemastore.json.schemas(), 17 | validate = { enable = true }, 18 | }, 19 | }, 20 | } 21 | 22 | return config 23 | -------------------------------------------------------------------------------- /lua/gmr/configs/lsp/ts_ls.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | M.go_to_source_definition = function() 4 | local params = vim.lsp.util.make_position_params(nil, 'utf-8') 5 | 6 | vim.lsp.buf_request(0, 'workspace/executeCommand', { 7 | command = '_typescript.goToSourceDefinition', 8 | arguments = { params.textDocument.uri, params.position }, 9 | }, nil) 10 | end 11 | 12 | return M 13 | -------------------------------------------------------------------------------- /lua/gmr/configs/mason/packages.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'angular-language-server', 3 | 'astro-language-server', 4 | 'bash-language-server', 5 | 'biome', 6 | 'clangd', 7 | 'css-lsp', 8 | 'deno', 9 | 'docker-compose-language-service', 10 | 'dockerfile-language-server', 11 | 'elixir-ls', 12 | 'emmet-ls', 13 | 'eslint-lsp', 14 | 'eslint_d', 15 | 'glow', 16 | 'gofumpt', 17 | 'golangci-lint', 18 | 'google-java-format', 19 | 'gopls', 20 | 'html-lsp', 21 | 'htmx-lsp', 22 | 'impl', 23 | 'jdtls', 24 | 'json-lsp', 25 | 'lua-language-server', 26 | 'ocaml-lsp', 27 | 'ocamlformat', 28 | 'omnisharp', 29 | 'prettier', 30 | 'prettierd', 31 | 'pyright', 32 | 'ruff', 33 | 'rust-analyzer', 34 | 'sqlls', 35 | 'stylua', 36 | 'svelte-language-server', 37 | 'tailwindcss-language-server', 38 | 'taplo', 39 | 'templ', 40 | 'typescript-language-server', 41 | 'vetur-vls', 42 | 'yaml-language-server', 43 | } 44 | -------------------------------------------------------------------------------- /lua/gmr/configs/snippets/c.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gmr458/nvim/d601a726905ad41b7548072f6fee62d8a1d8751f/lua/gmr/configs/snippets/c.lua -------------------------------------------------------------------------------- /lua/gmr/configs/snippets/dart.lua: -------------------------------------------------------------------------------- 1 | local luasnip = require 'luasnip' 2 | local fmta = require('luasnip.extras.fmt').fmta 3 | local rep = require('luasnip.extras').rep 4 | local filetype = 'dart' 5 | 6 | luasnip.add_snippets(filetype, { 7 | luasnip.snippet( 8 | 'if', 9 | fmta( 10 | [[ 11 | if () { 12 | 13 | } 14 | ]], 15 | { 16 | condition = luasnip.insert_node(1), 17 | body = luasnip.insert_node(2), 18 | finish = luasnip.insert_node(0), 19 | } 20 | ) 21 | ), 22 | }) 23 | 24 | luasnip.add_snippets(filetype, { 25 | luasnip.snippet( 26 | 'elseif', 27 | fmta( 28 | [[ 29 | else if () { 30 | 31 | } 32 | ]], 33 | { 34 | condition = luasnip.insert_node(1), 35 | body = luasnip.insert_node(2), 36 | finish = luasnip.insert_node(0), 37 | } 38 | ) 39 | ), 40 | }) 41 | 42 | luasnip.add_snippets(filetype, { 43 | luasnip.snippet( 44 | 'else', 45 | fmta( 46 | [[ 47 | else { 48 | 49 | } 50 | ]], 51 | { 52 | body = luasnip.insert_node(1), 53 | finish = luasnip.insert_node(0), 54 | } 55 | ) 56 | ), 57 | }) 58 | 59 | luasnip.add_snippets(filetype, { 60 | luasnip.snippet( 61 | 'switch', 62 | fmta( 63 | [[ 64 | switch () { 65 | 66 | } 67 | ]], 68 | { 69 | expression = luasnip.insert_node(1), 70 | finish = luasnip.insert_node(0), 71 | } 72 | ) 73 | ), 74 | }) 75 | 76 | luasnip.add_snippets(filetype, { 77 | luasnip.snippet( 78 | 'case', 79 | fmta( 80 | [[ 81 | case : 82 | 83 | ]], 84 | { 85 | case = luasnip.insert_node(1), 86 | body_case = luasnip.insert_node(0), 87 | } 88 | ) 89 | ), 90 | }) 91 | 92 | luasnip.add_snippets(filetype, { 93 | luasnip.snippet( 94 | 'default', 95 | fmta( 96 | [[ 97 | default: 98 | 99 | ]], 100 | { 101 | body_case = luasnip.insert_node(0), 102 | } 103 | ) 104 | ), 105 | }) 106 | 107 | luasnip.add_snippets(filetype, { 108 | luasnip.snippet( 109 | 'for', 110 | fmta( 111 | [[ 112 | for () { 113 | 114 | } 115 | ]], 116 | { 117 | condition = luasnip.insert_node(1), 118 | body = luasnip.insert_node(0), 119 | } 120 | ) 121 | ), 122 | }) 123 | 124 | luasnip.add_snippets(filetype, { 125 | luasnip.snippet( 126 | 'fori', 127 | fmta( 128 | [[ 129 | for (int = 0; ; ++) { 130 | 131 | } 132 | ]], 133 | { 134 | init_stmt = luasnip.insert_node(1), 135 | condition = luasnip.insert_node(2), 136 | post_stmt = rep(1), 137 | body = luasnip.insert_node(0), 138 | } 139 | ) 140 | ), 141 | }) 142 | 143 | luasnip.add_snippets(filetype, { 144 | luasnip.snippet( 145 | 'forin', 146 | fmta( 147 | [[ 148 | for (final in ) { 149 | 150 | } 151 | ]], 152 | { 153 | property = luasnip.insert_node(1), 154 | object = luasnip.insert_node(2), 155 | statement = luasnip.insert_node(3), 156 | finish = luasnip.insert_node(0), 157 | } 158 | ) 159 | ), 160 | }) 161 | 162 | luasnip.add_snippets(filetype, { 163 | luasnip.snippet( 164 | 'while', 165 | fmta( 166 | [[ 167 | while () { 168 | 169 | } 170 | ]], 171 | { 172 | condition = luasnip.insert_node(1), 173 | statement = luasnip.insert_node(2), 174 | finish = luasnip.insert_node(0), 175 | } 176 | ) 177 | ), 178 | }) 179 | 180 | luasnip.add_snippets(filetype, { 181 | luasnip.snippet( 182 | 'function', 183 | fmta( 184 | [[ 185 | () { 186 | 187 | } 188 | ]], 189 | { 190 | return_type = luasnip.insert_node(1), 191 | method_name = luasnip.insert_node(2), 192 | parameter_list = luasnip.insert_node(3), 193 | body = luasnip.insert_node(4), 194 | finish = luasnip.insert_node(0), 195 | } 196 | ) 197 | ), 198 | }) 199 | 200 | luasnip.add_snippets(filetype, { 201 | luasnip.snippet( 202 | 'import', 203 | fmta( 204 | [[ 205 | import ''; 206 | ]], 207 | { 208 | package = luasnip.insert_node(0), 209 | } 210 | ) 211 | ), 212 | }) 213 | 214 | luasnip.add_snippets(filetype, { 215 | luasnip.snippet( 216 | 'extends', 217 | fmta( 218 | [[ 219 | extends 220 | ]], 221 | { 222 | other_class = luasnip.insert_node(0), 223 | } 224 | ) 225 | ), 226 | }) 227 | 228 | luasnip.add_snippets(filetype, { 229 | luasnip.snippet( 230 | 'with', 231 | fmta( 232 | [[ 233 | with 234 | ]], 235 | { 236 | mixin = luasnip.insert_node(0), 237 | } 238 | ) 239 | ), 240 | }) 241 | 242 | luasnip.add_snippets(filetype, { 243 | luasnip.snippet( 244 | 'implements', 245 | fmta( 246 | [[ 247 | implements 248 | ]], 249 | { 250 | interface = luasnip.insert_node(0), 251 | } 252 | ) 253 | ), 254 | }) 255 | 256 | luasnip.add_snippets(filetype, { 257 | luasnip.snippet( 258 | 'class', 259 | fmta( 260 | [[ 261 | class { 262 | 263 | } 264 | ]], 265 | { 266 | identifier = luasnip.insert_node(1), 267 | field = luasnip.insert_node(2), 268 | finish = luasnip.insert_node(0), 269 | } 270 | ) 271 | ), 272 | }) 273 | 274 | luasnip.add_snippets(filetype, { 275 | luasnip.snippet( 276 | 'absclass', 277 | fmta( 278 | [[ 279 | abstract class { 280 | 281 | } 282 | ]], 283 | { 284 | identifier = luasnip.insert_node(1), 285 | field = luasnip.insert_node(2), 286 | finish = luasnip.insert_node(0), 287 | } 288 | ) 289 | ), 290 | }) 291 | 292 | luasnip.add_snippets(filetype, { 293 | luasnip.snippet( 294 | 'classe', 295 | fmta( 296 | [[ 297 | class extends { 298 | 299 | } 300 | ]], 301 | { 302 | identifier = luasnip.insert_node(1), 303 | class = luasnip.insert_node(2), 304 | field = luasnip.insert_node(3), 305 | finish = luasnip.insert_node(0), 306 | } 307 | ) 308 | ), 309 | }) 310 | 311 | luasnip.add_snippets(filetype, { 312 | luasnip.snippet( 313 | 'classim', 314 | fmta( 315 | [[ 316 | class implements { 317 | 318 | } 319 | ]], 320 | { 321 | identifier = luasnip.insert_node(1), 322 | class = luasnip.insert_node(2), 323 | field = luasnip.insert_node(3), 324 | finish = luasnip.insert_node(0), 325 | } 326 | ) 327 | ), 328 | }) 329 | 330 | luasnip.add_snippets(filetype, { 331 | luasnip.snippet( 332 | 'enum', 333 | fmta( 334 | [[ 335 | enum { 336 | 337 | } 338 | ]], 339 | { 340 | identifier = luasnip.insert_node(1), 341 | field = luasnip.insert_node(2), 342 | finish = luasnip.insert_node(0), 343 | } 344 | ) 345 | ), 346 | }) 347 | 348 | luasnip.add_snippets(filetype, { 349 | luasnip.snippet( 350 | 'mixin', 351 | fmta( 352 | [[ 353 | mixin { 354 | 355 | } 356 | ]], 357 | { 358 | identifier = luasnip.insert_node(1), 359 | field = luasnip.insert_node(2), 360 | finish = luasnip.insert_node(0), 361 | } 362 | ) 363 | ), 364 | }) 365 | -------------------------------------------------------------------------------- /lua/gmr/configs/snippets/go.lua: -------------------------------------------------------------------------------- 1 | local luasnip = require 'luasnip' 2 | local fmta = require('luasnip.extras.fmt').fmta 3 | local rep = require('luasnip.extras').rep 4 | local filetype = 'go' 5 | 6 | luasnip.add_snippets(filetype, { 7 | luasnip.snippet( 8 | 'if', 9 | fmta( 10 | [[ 11 | if { 12 | 13 | } 14 | ]], 15 | { 16 | condition = luasnip.insert_node(1), 17 | body = luasnip.insert_node(2), 18 | finish = luasnip.insert_node(0), 19 | } 20 | ) 21 | ), 22 | }) 23 | 24 | luasnip.add_snippets(filetype, { 25 | luasnip.snippet( 26 | 'elseif', 27 | fmta( 28 | [[ 29 | else if { 30 | 31 | } 32 | ]], 33 | { 34 | condition = luasnip.insert_node(1), 35 | body = luasnip.insert_node(2), 36 | finish = luasnip.insert_node(0), 37 | } 38 | ) 39 | ), 40 | }) 41 | 42 | luasnip.add_snippets(filetype, { 43 | luasnip.snippet( 44 | 'else', 45 | fmta( 46 | [[ 47 | else { 48 | 49 | } 50 | ]], 51 | { 52 | body = luasnip.insert_node(1), 53 | finish = luasnip.insert_node(0), 54 | } 55 | ) 56 | ), 57 | }) 58 | 59 | luasnip.add_snippets(filetype, { 60 | luasnip.snippet( 61 | 'switch', 62 | fmta( 63 | [[ 64 | switch { 65 | 66 | } 67 | ]], 68 | { 69 | expression = luasnip.insert_node(1), 70 | finish = luasnip.insert_node(0), 71 | } 72 | ) 73 | ), 74 | }) 75 | 76 | luasnip.add_snippets(filetype, { 77 | luasnip.snippet( 78 | 'switcht', 79 | fmta( 80 | [[ 81 | switch { 82 | 83 | } 84 | ]], 85 | { 86 | finish = luasnip.insert_node(0), 87 | } 88 | ) 89 | ), 90 | }) 91 | 92 | luasnip.add_snippets(filetype, { 93 | luasnip.snippet( 94 | 'select', 95 | fmta( 96 | [[ 97 | select { 98 | 99 | } 100 | ]], 101 | { 102 | finish = luasnip.insert_node(0), 103 | } 104 | ) 105 | ), 106 | }) 107 | 108 | luasnip.add_snippets(filetype, { 109 | luasnip.snippet( 110 | 'case', 111 | fmta( 112 | [[ 113 | case : 114 | 115 | ]], 116 | { 117 | case = luasnip.insert_node(1), 118 | body_case = luasnip.insert_node(0), 119 | } 120 | ) 121 | ), 122 | }) 123 | 124 | luasnip.add_snippets(filetype, { 125 | luasnip.snippet( 126 | 'casei', 127 | fmta( 128 | [[ 129 | case : 130 | ]], 131 | { 132 | case = luasnip.insert_node(1), 133 | body_case = luasnip.insert_node(0), 134 | } 135 | ) 136 | ), 137 | }) 138 | 139 | luasnip.add_snippets(filetype, { 140 | luasnip.snippet( 141 | 'default', 142 | fmta( 143 | [[ 144 | default: 145 | 146 | ]], 147 | { 148 | body_case = luasnip.insert_node(0), 149 | } 150 | ) 151 | ), 152 | }) 153 | 154 | luasnip.add_snippets(filetype, { 155 | luasnip.snippet( 156 | 'defaulti', 157 | fmta( 158 | [[ 159 | default: 160 | ]], 161 | { 162 | body_case = luasnip.insert_node(0), 163 | } 164 | ) 165 | ), 166 | }) 167 | 168 | luasnip.add_snippets(filetype, { 169 | luasnip.snippet( 170 | 'for', 171 | fmta( 172 | [[ 173 | for { 174 | 175 | } 176 | ]], 177 | { 178 | condition = luasnip.insert_node(1), 179 | body = luasnip.insert_node(0), 180 | } 181 | ) 182 | ), 183 | }) 184 | 185 | luasnip.add_snippets(filetype, { 186 | luasnip.snippet( 187 | 'fori', 188 | fmta( 189 | [[ 190 | for := 0; ; ++ { 191 | 192 | } 193 | ]], 194 | { 195 | init_stmt = luasnip.insert_node(1), 196 | condition = luasnip.insert_node(2), 197 | post_stmt = rep(1), 198 | body = luasnip.insert_node(0), 199 | } 200 | ) 201 | ), 202 | }) 203 | 204 | luasnip.add_snippets(filetype, { 205 | luasnip.snippet( 206 | 'forr', 207 | fmta( 208 | [[ 209 | for , := range { 210 | 211 | } 212 | ]], 213 | { 214 | key = luasnip.insert_node(1), 215 | value = luasnip.insert_node(2), 216 | range_expression = luasnip.insert_node(3), 217 | body = luasnip.insert_node(0), 218 | } 219 | ) 220 | ), 221 | }) 222 | 223 | luasnip.add_snippets(filetype, { 224 | luasnip.snippet( 225 | 'tys', 226 | fmta( 227 | [[ 228 | type struct { 229 | 230 | } 231 | ]], 232 | { 233 | identifier = luasnip.insert_node(1), 234 | field = luasnip.insert_node(0), 235 | } 236 | ) 237 | ), 238 | }) 239 | 240 | luasnip.add_snippets(filetype, { 241 | luasnip.snippet( 242 | 'tyf', 243 | fmta( 244 | [[ 245 | type func() 246 | ]], 247 | { 248 | identifier = luasnip.insert_node(1), 249 | parameters = luasnip.insert_node(2), 250 | return_type = luasnip.insert_node(0), 251 | } 252 | ) 253 | ), 254 | }) 255 | 256 | luasnip.add_snippets(filetype, { 257 | luasnip.snippet( 258 | 'tyi', 259 | fmta( 260 | [[ 261 | type interface { 262 | 263 | } 264 | ]], 265 | { 266 | identifier = luasnip.insert_node(1), 267 | field = luasnip.insert_node(0), 268 | } 269 | ) 270 | ), 271 | }) 272 | 273 | luasnip.add_snippets(filetype, { 274 | luasnip.snippet( 275 | 'func', 276 | fmta( 277 | [[ 278 | func () { 279 | 280 | } 281 | ]], 282 | { 283 | func_name = luasnip.insert_node(1), 284 | parameters = luasnip.insert_node(2), 285 | return_type = luasnip.insert_node(3), 286 | body = luasnip.insert_node(0), 287 | } 288 | ) 289 | ), 290 | }) 291 | 292 | luasnip.add_snippets(filetype, { 293 | luasnip.snippet( 294 | 'funcm', 295 | fmta( 296 | [[ 297 | func ( ) () { 298 | 299 | } 300 | ]], 301 | { 302 | receiver_name = luasnip.insert_node(1), 303 | receiver_type = luasnip.insert_node(2), 304 | func_name = luasnip.insert_node(3), 305 | parameters = luasnip.insert_node(4), 306 | return_type = luasnip.insert_node(5), 307 | body = luasnip.insert_node(0), 308 | } 309 | ) 310 | ), 311 | }) 312 | 313 | luasnip.add_snippets(filetype, { 314 | luasnip.snippet( 315 | 'typeb', 316 | fmta( 317 | [[ 318 | type ( 319 | 320 | ) 321 | ]], 322 | { 323 | finish = luasnip.insert_node(0), 324 | } 325 | ) 326 | ), 327 | }) 328 | 329 | luasnip.add_snippets(filetype, { 330 | luasnip.snippet( 331 | 'varb', 332 | fmta( 333 | [[ 334 | var ( 335 | 336 | ) 337 | ]], 338 | { 339 | finish = luasnip.insert_node(0), 340 | } 341 | ) 342 | ), 343 | }) 344 | 345 | luasnip.add_snippets(filetype, { 346 | luasnip.snippet( 347 | 'constb', 348 | fmta( 349 | [[ 350 | const ( 351 | 352 | ) 353 | ]], 354 | { 355 | finish = luasnip.insert_node(0), 356 | } 357 | ) 358 | ), 359 | }) 360 | 361 | luasnip.add_snippets(filetype, { 362 | luasnip.snippet( 363 | 'importb', 364 | fmta( 365 | [[ 366 | import ( 367 | "" 368 | ) 369 | ]], 370 | { 371 | package = luasnip.insert_node(0), 372 | } 373 | ) 374 | ), 375 | }) 376 | 377 | luasnip.add_snippets(filetype, { 378 | luasnip.snippet( 379 | 'json', 380 | fmta( 381 | [[ 382 | `json:""` 383 | ]], 384 | { 385 | finish = luasnip.insert_node(0), 386 | } 387 | ) 388 | ), 389 | }) 390 | 391 | luasnip.add_snippets(filetype, { 392 | luasnip.snippet( 393 | 'form', 394 | fmta( 395 | [[ 396 | `form:""` 397 | ]], 398 | { 399 | finish = luasnip.insert_node(0), 400 | } 401 | ) 402 | ), 403 | }) 404 | -------------------------------------------------------------------------------- /lua/gmr/configs/snippets/init.lua: -------------------------------------------------------------------------------- 1 | require 'gmr.configs.snippets.c' 2 | require 'gmr.configs.snippets.csharp' 3 | require 'gmr.configs.snippets.dart' 4 | require 'gmr.configs.snippets.go' 5 | require 'gmr.configs.snippets.java' 6 | require 'gmr.configs.snippets.javascript' 7 | require 'gmr.configs.snippets.kotlin' 8 | require 'gmr.configs.snippets.lua' 9 | require 'gmr.configs.snippets.ocaml' 10 | require 'gmr.configs.snippets.python' 11 | require 'gmr.configs.snippets.rust' 12 | require 'gmr.configs.snippets.sql' 13 | require 'gmr.configs.snippets.typescript' 14 | -------------------------------------------------------------------------------- /lua/gmr/configs/snippets/javascript.lua: -------------------------------------------------------------------------------- 1 | local luasnip = require 'luasnip' 2 | local fmt = require('luasnip.extras.fmt').fmt 3 | local fmta = require('luasnip.extras.fmt').fmta 4 | local filetype = 'javascript' 5 | 6 | luasnip.add_snippets(filetype, { 7 | luasnip.snippet( 8 | 'if', 9 | fmta( 10 | [[ 11 | if () { 12 | 13 | } 14 | ]], 15 | { 16 | condition = luasnip.insert_node(1), 17 | body = luasnip.insert_node(2), 18 | finish = luasnip.insert_node(0), 19 | } 20 | ) 21 | ), 22 | }) 23 | 24 | luasnip.add_snippets(filetype, { 25 | luasnip.snippet( 26 | 'elseif', 27 | fmta( 28 | [[ 29 | else if () { 30 | 31 | } 32 | ]], 33 | { 34 | condition = luasnip.insert_node(1), 35 | body = luasnip.insert_node(2), 36 | finish = luasnip.insert_node(0), 37 | } 38 | ) 39 | ), 40 | }) 41 | 42 | luasnip.add_snippets(filetype, { 43 | luasnip.snippet( 44 | 'else', 45 | fmta( 46 | [[ 47 | else { 48 | 49 | } 50 | ]], 51 | { 52 | body = luasnip.insert_node(1), 53 | finish = luasnip.insert_node(0), 54 | } 55 | ) 56 | ), 57 | }) 58 | 59 | luasnip.add_snippets(filetype, { 60 | luasnip.snippet( 61 | 'switch', 62 | fmta( 63 | [[ 64 | switch () { 65 | 66 | } 67 | ]], 68 | { 69 | expression = luasnip.insert_node(1), 70 | case = luasnip.insert_node(2), 71 | finish = luasnip.insert_node(0), 72 | } 73 | ) 74 | ), 75 | }) 76 | 77 | luasnip.add_snippets(filetype, { 78 | luasnip.snippet( 79 | 'switcht', 80 | fmta( 81 | [[ 82 | switch (true) { 83 | 84 | } 85 | ]], 86 | { 87 | case = luasnip.insert_node(1), 88 | finish = luasnip.insert_node(0), 89 | } 90 | ) 91 | ), 92 | }) 93 | 94 | luasnip.add_snippets(filetype, { 95 | luasnip.snippet( 96 | 'case', 97 | fmta( 98 | [[ 99 | case : 100 | 101 | break; 102 | ]], 103 | { 104 | case = luasnip.insert_node(1), 105 | body_case = luasnip.insert_node(2), 106 | finish = luasnip.insert_node(0), 107 | } 108 | ) 109 | ), 110 | }) 111 | 112 | luasnip.add_snippets(filetype, { 113 | luasnip.snippet( 114 | 'casei', 115 | fmta( 116 | [[ 117 | case : 118 | ]], 119 | { 120 | case = luasnip.insert_node(1), 121 | body_case = luasnip.insert_node(0), 122 | } 123 | ) 124 | ), 125 | }) 126 | 127 | luasnip.add_snippets(filetype, { 128 | luasnip.snippet( 129 | 'default', 130 | fmta( 131 | [[ 132 | default: 133 | 134 | ]], 135 | { 136 | body_case = luasnip.insert_node(0), 137 | } 138 | ) 139 | ), 140 | }) 141 | 142 | luasnip.add_snippets(filetype, { 143 | luasnip.snippet( 144 | 'defaulti', 145 | fmta( 146 | [[ 147 | default: 148 | ]], 149 | { 150 | body_case = luasnip.insert_node(0), 151 | } 152 | ) 153 | ), 154 | }) 155 | 156 | luasnip.add_snippets(filetype, { 157 | luasnip.snippet( 158 | 'trycatch', 159 | fmta( 160 | [[ 161 | try { 162 | 163 | } catch (err) { 164 | if (err instanceof Error) { 165 | console.error(err.message); 166 | } 167 | } 168 | ]], 169 | { 170 | try_statements = luasnip.insert_node(1), 171 | finish = luasnip.insert_node(0), 172 | } 173 | ) 174 | ), 175 | }) 176 | 177 | luasnip.add_snippets(filetype, { 178 | luasnip.snippet( 179 | 'trycatchfin', 180 | fmta( 181 | [[ 182 | try { 183 | 184 | } catch (err) { 185 | if (err instanceof Error) { 186 | console.error(err.message); 187 | } 188 | } finally { 189 | 190 | } 191 | ]], 192 | { 193 | try_statements = luasnip.insert_node(1), 194 | finally_statements = luasnip.insert_node(2), 195 | finish = luasnip.insert_node(0), 196 | } 197 | ) 198 | ), 199 | }) 200 | 201 | luasnip.add_snippets(filetype, { 202 | luasnip.snippet( 203 | 'function', 204 | fmta( 205 | [[ 206 | function () { 207 | 208 | } 209 | ]], 210 | { 211 | func_name = luasnip.insert_node(1), 212 | parameters = luasnip.insert_node(2), 213 | body = luasnip.insert_node(3), 214 | finish = luasnip.insert_node(0), 215 | } 216 | ) 217 | ), 218 | }) 219 | 220 | luasnip.add_snippets(filetype, { 221 | luasnip.snippet( 222 | 'functiong', 223 | fmt( 224 | [[ 225 | function* {func_name}({parameters}) {{ 226 | {body} 227 | }}{finish} 228 | ]], 229 | { 230 | func_name = luasnip.insert_node(1), 231 | parameters = luasnip.insert_node(2), 232 | body = luasnip.insert_node(3), 233 | finish = luasnip.insert_node(0), 234 | } 235 | ) 236 | ), 237 | }) 238 | 239 | luasnip.add_snippets(filetype, { 240 | luasnip.snippet( 241 | 'class', 242 | fmta( 243 | [[ 244 | class { 245 | 246 | } 247 | ]], 248 | { 249 | identifier = luasnip.insert_node(1), 250 | field = luasnip.insert_node(2), 251 | finish = luasnip.insert_node(0), 252 | } 253 | ) 254 | ), 255 | }) 256 | 257 | luasnip.add_snippets(filetype, { 258 | luasnip.snippet( 259 | 'classe', 260 | fmta( 261 | [[ 262 | class extends { 263 | 264 | } 265 | ]], 266 | { 267 | identifier = luasnip.insert_node(1), 268 | class = luasnip.insert_node(2), 269 | field = luasnip.insert_node(3), 270 | finish = luasnip.insert_node(0), 271 | } 272 | ) 273 | ), 274 | }) 275 | 276 | luasnip.add_snippets(filetype, { 277 | luasnip.snippet( 278 | 'constructor', 279 | fmta( 280 | [[ 281 | constructor() { 282 | 283 | } 284 | ]], 285 | { 286 | parameters = luasnip.insert_node(1), 287 | block = luasnip.insert_node(2), 288 | finish = luasnip.insert_node(0), 289 | } 290 | ) 291 | ), 292 | }) 293 | 294 | luasnip.add_snippets(filetype, { 295 | luasnip.snippet( 296 | 'dowhile', 297 | fmta( 298 | [[ 299 | do { 300 | 301 | } while (); 302 | ]], 303 | { 304 | statement = luasnip.insert_node(1), 305 | block = luasnip.insert_node(0), 306 | } 307 | ) 308 | ), 309 | }) 310 | 311 | luasnip.add_snippets(filetype, { 312 | luasnip.snippet( 313 | 'for', 314 | fmta( 315 | [[ 316 | for (; ; ) { 317 | 318 | } 319 | ]], 320 | { 321 | initialization = luasnip.insert_node(1), 322 | condition = luasnip.insert_node(2), 323 | afterthought = luasnip.insert_node(3), 324 | statement = luasnip.insert_node(4), 325 | finish = luasnip.insert_node(0), 326 | } 327 | ) 328 | ), 329 | }) 330 | 331 | luasnip.add_snippets(filetype, { 332 | luasnip.snippet( 333 | 'forin', 334 | fmta( 335 | [[ 336 | for (const in ) { 337 | 338 | } 339 | ]], 340 | { 341 | property = luasnip.insert_node(1), 342 | object = luasnip.insert_node(2), 343 | statement = luasnip.insert_node(3), 344 | finish = luasnip.insert_node(0), 345 | } 346 | ) 347 | ), 348 | }) 349 | 350 | luasnip.add_snippets(filetype, { 351 | luasnip.snippet( 352 | 'forof', 353 | fmta( 354 | [[ 355 | for (const of ) { 356 | 357 | } 358 | ]], 359 | { 360 | element = luasnip.insert_node(1), 361 | iterable = luasnip.insert_node(2), 362 | statement = luasnip.insert_node(3), 363 | finish = luasnip.insert_node(0), 364 | } 365 | ) 366 | ), 367 | }) 368 | 369 | luasnip.add_snippets(filetype, { 370 | luasnip.snippet( 371 | 'forofaw', 372 | fmta( 373 | [[ 374 | for await (const of ) { 375 | 376 | } 377 | ]], 378 | { 379 | element = luasnip.insert_node(1), 380 | iterable = luasnip.insert_node(2), 381 | statement = luasnip.insert_node(3), 382 | finish = luasnip.insert_node(0), 383 | } 384 | ) 385 | ), 386 | }) 387 | 388 | luasnip.add_snippets(filetype, { 389 | luasnip.snippet( 390 | 'while', 391 | fmta( 392 | [[ 393 | while () { 394 | 395 | } 396 | ]], 397 | { 398 | condition = luasnip.insert_node(1), 399 | statement = luasnip.insert_node(2), 400 | finish = luasnip.insert_node(0), 401 | } 402 | ) 403 | ), 404 | }) 405 | 406 | luasnip.add_snippets(filetype, { 407 | luasnip.snippet( 408 | 'import', 409 | fmta( 410 | [[ 411 | import { } from ""; 412 | ]], 413 | { 414 | exported = luasnip.insert_node(2), 415 | module = luasnip.insert_node(1), 416 | finish = luasnip.insert_node(0), 417 | } 418 | ) 419 | ), 420 | }) 421 | 422 | luasnip.add_snippets(filetype, { 423 | luasnip.snippet( 424 | 'importd', 425 | fmta( 426 | [[ 427 | import from ""; 428 | ]], 429 | { 430 | default_export = luasnip.insert_node(2), 431 | module = luasnip.insert_node(1), 432 | finish = luasnip.insert_node(0), 433 | } 434 | ) 435 | ), 436 | }) 437 | 438 | luasnip.add_snippets(filetype, { 439 | luasnip.snippet( 440 | 'require', 441 | fmta( 442 | [[ 443 | const { } = require(""); 444 | ]], 445 | { 446 | exported = luasnip.insert_node(2), 447 | module = luasnip.insert_node(1), 448 | finish = luasnip.insert_node(0), 449 | } 450 | ) 451 | ), 452 | }) 453 | 454 | luasnip.add_snippets(filetype, { 455 | luasnip.snippet( 456 | 'required', 457 | fmta( 458 | [[ 459 | const = require(""); 460 | ]], 461 | { 462 | default_export = luasnip.insert_node(2), 463 | module = luasnip.insert_node(1), 464 | finish = luasnip.insert_node(0), 465 | } 466 | ) 467 | ), 468 | }) 469 | -------------------------------------------------------------------------------- /lua/gmr/configs/snippets/kotlin.lua: -------------------------------------------------------------------------------- 1 | local luasnip = require 'luasnip' 2 | local fmt = require('luasnip.extras.fmt').fmt 3 | local fmta = require('luasnip.extras.fmt').fmta 4 | local rep = require('luasnip.extras').rep 5 | local filetype = 'kotlin' 6 | 7 | luasnip.add_snippets(filetype, { 8 | luasnip.snippet( 9 | 'if', 10 | fmta( 11 | [[ 12 | if () { 13 | 14 | } 15 | ]], 16 | { 17 | condition = luasnip.insert_node(1), 18 | body = luasnip.insert_node(2), 19 | finish = luasnip.insert_node(0), 20 | } 21 | ) 22 | ), 23 | }) 24 | 25 | luasnip.add_snippets(filetype, { 26 | luasnip.snippet( 27 | 'ifinl', 28 | fmta( 29 | [[ 30 | if () 31 | ]], 32 | { 33 | condition = luasnip.insert_node(1), 34 | statement = luasnip.insert_node(0), 35 | } 36 | ) 37 | ), 38 | }) 39 | 40 | luasnip.add_snippets(filetype, { 41 | luasnip.snippet( 42 | 'elseif', 43 | fmta( 44 | [[ 45 | else if () { 46 | 47 | } 48 | ]], 49 | { 50 | condition = luasnip.insert_node(1), 51 | body = luasnip.insert_node(2), 52 | finish = luasnip.insert_node(0), 53 | } 54 | ) 55 | ), 56 | }) 57 | 58 | luasnip.add_snippets(filetype, { 59 | luasnip.snippet( 60 | 'else', 61 | fmta( 62 | [[ 63 | else { 64 | 65 | } 66 | ]], 67 | { 68 | body = luasnip.insert_node(1), 69 | finish = luasnip.insert_node(0), 70 | } 71 | ) 72 | ), 73 | }) 74 | 75 | luasnip.add_snippets(filetype, { 76 | luasnip.snippet( 77 | 'when', 78 | fmta( 79 | [[ 80 | when () { 81 | 82 | } 83 | ]], 84 | { 85 | expression = luasnip.insert_node(1), 86 | case = luasnip.insert_node(2), 87 | finish = luasnip.insert_node(0), 88 | } 89 | ) 90 | ), 91 | }) 92 | 93 | luasnip.add_snippets(filetype, { 94 | luasnip.snippet( 95 | 'trycatch', 96 | fmta( 97 | [[ 98 | try { 99 | 100 | } catch (: ) { 101 | println(.message); 102 | } 103 | ]], 104 | { 105 | try_statements = luasnip.insert_node(3), 106 | type_exception = luasnip.insert_node(2), 107 | var_exception = luasnip.insert_node(1), 108 | exception = rep(1), 109 | finish = luasnip.insert_node(0), 110 | } 111 | ) 112 | ), 113 | }) 114 | 115 | luasnip.add_snippets(filetype, { 116 | luasnip.snippet( 117 | 'catch', 118 | fmta( 119 | [[ 120 | catch (: ) { 121 | 122 | println(.message); 123 | } 124 | ]], 125 | { 126 | var_exception = luasnip.insert_node(1), 127 | type_exception = luasnip.insert_node(2), 128 | exception = rep(1), 129 | block = luasnip.insert_node(3), 130 | finish = luasnip.insert_node(0), 131 | } 132 | ) 133 | ), 134 | }) 135 | 136 | luasnip.add_snippets(filetype, { 137 | luasnip.snippet( 138 | 'finally', 139 | fmta( 140 | [[ 141 | finally { 142 | 143 | } 144 | ]], 145 | { 146 | block = luasnip.insert_node(1), 147 | finish = luasnip.insert_node(0), 148 | } 149 | ) 150 | ), 151 | }) 152 | 153 | luasnip.add_snippets(filetype, { 154 | luasnip.snippet( 155 | 'trycatchfin', 156 | fmta( 157 | [[ 158 | try { 159 | 160 | } catch (: ) { 161 | 162 | println(.message); 163 | } finally { 164 | 165 | } 166 | ]], 167 | { 168 | var_exception = luasnip.insert_node(1), 169 | type_exception = luasnip.insert_node(2), 170 | exception = rep(1), 171 | try_statements = luasnip.insert_node(3), 172 | catch_statements = luasnip.insert_node(4), 173 | finally_statements = luasnip.insert_node(5), 174 | finish = luasnip.insert_node(0), 175 | } 176 | ) 177 | ), 178 | }) 179 | 180 | luasnip.add_snippets(filetype, { 181 | luasnip.snippet( 182 | 'fun', 183 | fmta( 184 | [[ 185 | fun (): { 186 | 187 | } 188 | ]], 189 | { 190 | func_name = luasnip.insert_node(1), 191 | parameters = luasnip.insert_node(2), 192 | return_type = luasnip.insert_node(3), 193 | body = luasnip.insert_node(4), 194 | finish = luasnip.insert_node(0), 195 | } 196 | ) 197 | ), 198 | }) 199 | 200 | luasnip.add_snippets(filetype, { 201 | luasnip.snippet( 202 | 'funinl', 203 | fmta( 204 | [[ 205 | fun (): = 206 | ]], 207 | { 208 | func_name = luasnip.insert_node(1), 209 | parameters = luasnip.insert_node(2), 210 | return_type = luasnip.insert_node(3), 211 | body = luasnip.insert_node(0), 212 | } 213 | ) 214 | ), 215 | }) 216 | 217 | luasnip.add_snippets(filetype, { 218 | luasnip.snippet( 219 | 'lambda', 220 | fmt( 221 | [[ 222 | val {lambda_name} = {{ {parameters} -> {body} }} 223 | ]], 224 | { 225 | lambda_name = luasnip.insert_node(1), 226 | parameters = luasnip.insert_node(2), 227 | body = luasnip.insert_node(0), 228 | } 229 | ) 230 | ), 231 | }) 232 | 233 | luasnip.add_snippets(filetype, { 234 | luasnip.snippet( 235 | 'fungn', 236 | fmt( 237 | [[ 238 | fun <{generic_parameters}> {func_name}({parameters}): {return_type} {{ 239 | {body} 240 | }}{finish} 241 | ]], 242 | { 243 | generic_parameters = luasnip.insert_node(1), 244 | func_name = luasnip.insert_node(2), 245 | parameters = luasnip.insert_node(3), 246 | return_type = luasnip.insert_node(4), 247 | body = luasnip.insert_node(5), 248 | finish = luasnip.insert_node(0), 249 | } 250 | ) 251 | ), 252 | }) 253 | 254 | luasnip.add_snippets(filetype, { 255 | luasnip.snippet( 256 | 'fungnwh', 257 | fmt( 258 | [[ 259 | fun <{generic_parameters}> {func_name}({parameters}): {return_type} 260 | where {where_clause}, 261 | {{ 262 | {body} 263 | }}{finish} 264 | ]], 265 | { 266 | generic_parameters = luasnip.insert_node(1), 267 | func_name = luasnip.insert_node(2), 268 | parameters = luasnip.insert_node(3), 269 | return_type = luasnip.insert_node(4), 270 | where_clause = luasnip.insert_node(5), 271 | body = luasnip.insert_node(6), 272 | finish = luasnip.insert_node(0), 273 | } 274 | ) 275 | ), 276 | }) 277 | 278 | luasnip.add_snippets(filetype, { 279 | luasnip.snippet( 280 | 'class', 281 | fmta( 282 | [[ 283 | class { 284 | 285 | } 286 | ]], 287 | { 288 | identifier = luasnip.insert_node(1), 289 | field = luasnip.insert_node(2), 290 | finish = luasnip.insert_node(0), 291 | } 292 | ) 293 | ), 294 | }) 295 | 296 | luasnip.add_snippets(filetype, { 297 | luasnip.snippet( 298 | 'classgn', 299 | fmt( 300 | [[ 301 | class {identifier}<{generic_parameters}> {{ 302 | {field} 303 | }}{finish} 304 | ]], 305 | { 306 | identifier = luasnip.insert_node(1), 307 | generic_parameters = luasnip.insert_node(2), 308 | field = luasnip.insert_node(3), 309 | finish = luasnip.insert_node(0), 310 | } 311 | ) 312 | ), 313 | }) 314 | 315 | luasnip.add_snippets(filetype, { 316 | luasnip.snippet( 317 | 'classei', 318 | fmta( 319 | [[ 320 | class : { 321 | 322 | } 323 | ]], 324 | { 325 | identifier = luasnip.insert_node(1), 326 | class = luasnip.insert_node(2), 327 | field = luasnip.insert_node(3), 328 | finish = luasnip.insert_node(0), 329 | } 330 | ) 331 | ), 332 | }) 333 | 334 | luasnip.add_snippets(filetype, { 335 | luasnip.snippet( 336 | 'interface', 337 | fmta( 338 | [[ 339 | interface 340 | { 341 | 342 | } 343 | ]], 344 | { 345 | identifier = luasnip.insert_node(1), 346 | field = luasnip.insert_node(2), 347 | finish = luasnip.insert_node(0), 348 | } 349 | ) 350 | ), 351 | }) 352 | 353 | luasnip.add_snippets(filetype, { 354 | luasnip.snippet( 355 | 'interface', 356 | fmt( 357 | [[ 358 | interface {identifier}<{generic_parameters}> {{ 359 | {field} 360 | }}{finish} 361 | ]], 362 | { 363 | identifier = luasnip.insert_node(1), 364 | generic_parameters = luasnip.insert_node(2), 365 | field = luasnip.insert_node(3), 366 | finish = luasnip.insert_node(0), 367 | } 368 | ) 369 | ), 370 | }) 371 | 372 | luasnip.add_snippets(filetype, { 373 | luasnip.snippet( 374 | 'enum', 375 | fmta( 376 | [[ 377 | enum class { 378 | 379 | } 380 | ]], 381 | { 382 | identifier = luasnip.insert_node(1), 383 | field = luasnip.insert_node(2), 384 | finish = luasnip.insert_node(0), 385 | } 386 | ) 387 | ), 388 | }) 389 | 390 | luasnip.add_snippets(filetype, { 391 | luasnip.snippet( 392 | 'dowhile', 393 | fmta( 394 | [[ 395 | do { 396 | 397 | } while (); 398 | ]], 399 | { 400 | statement = luasnip.insert_node(1), 401 | block = luasnip.insert_node(0), 402 | } 403 | ) 404 | ), 405 | }) 406 | 407 | luasnip.add_snippets(filetype, { 408 | luasnip.snippet( 409 | 'for', 410 | fmta( 411 | [[ 412 | for ( in ) { 413 | 414 | } 415 | ]], 416 | { 417 | item = luasnip.insert_node(1), 418 | collection = luasnip.insert_node(2), 419 | statement = luasnip.insert_node(3), 420 | finish = luasnip.insert_node(0), 421 | } 422 | ) 423 | ), 424 | }) 425 | 426 | luasnip.add_snippets(filetype, { 427 | luasnip.snippet( 428 | 'while', 429 | fmta( 430 | [[ 431 | while () { 432 | 433 | } 434 | ]], 435 | { 436 | condition = luasnip.insert_node(1), 437 | statement = luasnip.insert_node(2), 438 | finish = luasnip.insert_node(0), 439 | } 440 | ) 441 | ), 442 | }) 443 | -------------------------------------------------------------------------------- /lua/gmr/configs/snippets/lua.lua: -------------------------------------------------------------------------------- 1 | local luasnip = require 'luasnip' 2 | local fmta = require('luasnip.extras.fmt').fmta 3 | local filetype = 'lua' 4 | 5 | luasnip.add_snippets(filetype, { 6 | luasnip.snippet( 7 | 'if', 8 | fmta( 9 | [[ 10 | if then 11 | 12 | end 13 | ]], 14 | { 15 | exp = luasnip.insert_node(1), 16 | block = luasnip.insert_node(2), 17 | finish = luasnip.insert_node(0), 18 | } 19 | ) 20 | ), 21 | }) 22 | 23 | luasnip.add_snippets(filetype, { 24 | luasnip.snippet( 25 | 'elseif', 26 | fmta( 27 | [[ 28 | elseif then 29 | 30 | ]], 31 | { 32 | exp = luasnip.insert_node(1), 33 | block = luasnip.insert_node(0), 34 | } 35 | ) 36 | ), 37 | }) 38 | 39 | luasnip.add_snippets(filetype, { 40 | luasnip.snippet( 41 | 'else', 42 | fmta( 43 | [[ 44 | else 45 | 46 | ]], 47 | { 48 | block = luasnip.insert_node(0), 49 | } 50 | ) 51 | ), 52 | }) 53 | 54 | luasnip.add_snippets(filetype, { 55 | luasnip.snippet( 56 | 'repeat', 57 | fmta( 58 | [[ 59 | repeat 60 | 61 | until 62 | ]], 63 | { 64 | block = luasnip.insert_node(0), 65 | exp = luasnip.insert_node(1), 66 | } 67 | ) 68 | ), 69 | }) 70 | 71 | luasnip.add_snippets(filetype, { 72 | luasnip.snippet( 73 | 'while', 74 | fmta( 75 | [[ 76 | while do 77 | 78 | end 79 | ]], 80 | { 81 | exp = luasnip.insert_node(1), 82 | block = luasnip.insert_node(2), 83 | finish = luasnip.insert_node(0), 84 | } 85 | ) 86 | ), 87 | }) 88 | 89 | luasnip.add_snippets(filetype, { 90 | luasnip.snippet( 91 | 'forr', 92 | fmta( 93 | [[ 94 | for = , do 95 | 96 | end 97 | ]], 98 | { 99 | var = luasnip.insert_node(1), 100 | val = luasnip.insert_node(2), 101 | limit = luasnip.insert_node(3), 102 | block = luasnip.insert_node(4), 103 | finish = luasnip.insert_node(0), 104 | } 105 | ) 106 | ), 107 | }) 108 | 109 | luasnip.add_snippets(filetype, { 110 | luasnip.snippet( 111 | 'forrinc', 112 | fmta( 113 | [[ 114 | for = , , do 115 | 116 | end 117 | ]], 118 | { 119 | var = luasnip.insert_node(1), 120 | val = luasnip.insert_node(2), 121 | limit = luasnip.insert_node(3), 122 | step = luasnip.insert_node(4), 123 | block = luasnip.insert_node(5), 124 | finish = luasnip.insert_node(0), 125 | } 126 | ) 127 | ), 128 | }) 129 | 130 | luasnip.add_snippets(filetype, { 131 | luasnip.snippet( 132 | 'forpairs', 133 | fmta( 134 | [[ 135 | for , in pairs() do 136 | 137 | end 138 | ]], 139 | { 140 | key = luasnip.insert_node(1), 141 | value = luasnip.insert_node(2), 142 | table = luasnip.insert_node(3), 143 | block = luasnip.insert_node(4), 144 | finish = luasnip.insert_node(0), 145 | } 146 | ) 147 | ), 148 | }) 149 | 150 | luasnip.add_snippets(filetype, { 151 | luasnip.snippet( 152 | 'foripairs', 153 | fmta( 154 | [[ 155 | for , in ipairs(
) do 156 | 157 | end 158 | ]], 159 | { 160 | index = luasnip.insert_node(1), 161 | value = luasnip.insert_node(2), 162 | table = luasnip.insert_node(3), 163 | block = luasnip.insert_node(4), 164 | finish = luasnip.insert_node(0), 165 | } 166 | ) 167 | ), 168 | }) 169 | 170 | luasnip.add_snippets(filetype, { 171 | luasnip.snippet( 172 | 'function', 173 | fmta( 174 | [[ 175 | function () 176 | 177 | end 178 | ]], 179 | { 180 | func_name = luasnip.insert_node(1), 181 | parameters = luasnip.insert_node(2), 182 | body = luasnip.insert_node(3), 183 | finish = luasnip.insert_node(0), 184 | } 185 | ) 186 | ), 187 | }) 188 | 189 | luasnip.add_snippets(filetype, { 190 | luasnip.snippet( 191 | 'require', 192 | fmta( 193 | [[ 194 | require("") 195 | ]], 196 | { 197 | module = luasnip.insert_node(1), 198 | finish = luasnip.insert_node(0), 199 | } 200 | ) 201 | ), 202 | }) 203 | 204 | luasnip.add_snippets(filetype, { 205 | luasnip.snippet( 206 | 'print', 207 | fmta( 208 | [[ 209 | print("") 210 | ]], 211 | { 212 | str = luasnip.insert_node(1), 213 | finish = luasnip.insert_node(0), 214 | } 215 | ) 216 | ), 217 | }) 218 | -------------------------------------------------------------------------------- /lua/gmr/configs/snippets/ocaml.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gmr458/nvim/d601a726905ad41b7548072f6fee62d8a1d8751f/lua/gmr/configs/snippets/ocaml.lua -------------------------------------------------------------------------------- /lua/gmr/configs/snippets/python.lua: -------------------------------------------------------------------------------- 1 | local luasnip = require 'luasnip' 2 | local fmta = require('luasnip.extras.fmt').fmta 3 | local filetype = 'python' 4 | 5 | luasnip.add_snippets(filetype, { 6 | luasnip.snippet( 7 | 'if', 8 | fmta( 9 | [[ 10 | if : 11 | 12 | ]], 13 | { 14 | condition = luasnip.insert_node(1), 15 | body = luasnip.insert_node(2), 16 | } 17 | ) 18 | ), 19 | }) 20 | 21 | luasnip.add_snippets(filetype, { 22 | luasnip.snippet( 23 | 'ifmain', 24 | fmta( 25 | [[ 26 | if __name__ == "__main__": 27 | 28 | ]], 29 | { 30 | body = luasnip.insert_node(0), 31 | } 32 | ) 33 | ), 34 | }) 35 | 36 | luasnip.add_snippets(filetype, { 37 | luasnip.snippet( 38 | 'elif', 39 | fmta( 40 | [[ 41 | elif : 42 | 43 | ]], 44 | { 45 | condition = luasnip.insert_node(1), 46 | body = luasnip.insert_node(2), 47 | } 48 | ) 49 | ), 50 | }) 51 | 52 | luasnip.add_snippets(filetype, { 53 | luasnip.snippet( 54 | 'else', 55 | fmta( 56 | [[ 57 | else: 58 | 59 | ]], 60 | { 61 | body = luasnip.insert_node(1), 62 | } 63 | ) 64 | ), 65 | }) 66 | 67 | luasnip.add_snippets(filetype, { 68 | luasnip.snippet( 69 | 'for', 70 | fmta( 71 | [[ 72 | for in : 73 | 74 | ]], 75 | { 76 | range = luasnip.insert_node(2), 77 | condition = luasnip.insert_node(1), 78 | body = luasnip.insert_node(0), 79 | } 80 | ) 81 | ), 82 | }) 83 | 84 | luasnip.add_snippets(filetype, { 85 | luasnip.snippet( 86 | 'def', 87 | fmta( 88 | [[ 89 | def () : 90 | 91 | ]], 92 | { 93 | func_name = luasnip.insert_node(1), 94 | parameters = luasnip.insert_node(2), 95 | return_type = luasnip.insert_node(3), 96 | body = luasnip.insert_node(0), 97 | } 98 | ) 99 | ), 100 | }) 101 | 102 | luasnip.add_snippets(filetype, { 103 | luasnip.snippet( 104 | 'import', 105 | fmta( 106 | [[ 107 | import 108 | ]], 109 | { 110 | package = luasnip.insert_node(0), 111 | } 112 | ) 113 | ), 114 | }) 115 | 116 | luasnip.add_snippets(filetype, { 117 | luasnip.snippet( 118 | 'from', 119 | fmta( 120 | [[ 121 | from import 122 | ]], 123 | { 124 | exported = luasnip.insert_node(0), 125 | module = luasnip.insert_node(1), 126 | } 127 | ) 128 | ), 129 | }) 130 | 131 | luasnip.add_snippets(filetype, { 132 | luasnip.snippet( 133 | 'class', 134 | fmta( 135 | [[ 136 | class : 137 | 138 | ]], 139 | { 140 | identifier = luasnip.insert_node(1), 141 | field = luasnip.insert_node(2), 142 | } 143 | ) 144 | ), 145 | }) 146 | 147 | luasnip.add_snippets(filetype, { 148 | luasnip.snippet( 149 | 'with', 150 | fmta( 151 | [[ 152 | with as 153 | ]], 154 | { 155 | renamed = luasnip.insert_node(0), 156 | resource = luasnip.insert_node(1), 157 | } 158 | ) 159 | ), 160 | }) 161 | 162 | luasnip.add_snippets(filetype, { 163 | luasnip.snippet( 164 | 'tryexcept', 165 | fmta( 166 | [[ 167 | try: 168 | 169 | except Exception as err: 170 | print(f"Error {err}, Type: {type(err)}") 171 | ]], 172 | { 173 | try_statements = luasnip.insert_node(1), 174 | } 175 | ) 176 | ), 177 | }) 178 | -------------------------------------------------------------------------------- /lua/gmr/configs/snippets/sql.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gmr458/nvim/d601a726905ad41b7548072f6fee62d8a1d8751f/lua/gmr/configs/snippets/sql.lua -------------------------------------------------------------------------------- /lua/gmr/configs/treesitter/parsers.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | function M.install_automatically() 4 | local utils = require 'gmr.core.utils' 5 | 6 | if 7 | vim.uv.os_uname().sysname == 'Windows_NT' 8 | or utils.running_wsl() 9 | or utils.running_android() 10 | then 11 | return {} 12 | end 13 | 14 | return { 15 | 'astro', 16 | 'c', 17 | 'c_sharp', 18 | 'css', 19 | 'diff', 20 | 'dockerfile', 21 | 'git_config', 22 | 'git_rebase', 23 | 'gitattributes', 24 | 'gitcommit', 25 | 'gitignore', 26 | 'go', 27 | 'gomod', 28 | 'gosum', 29 | 'gowork', 30 | 'html', 31 | 'htmldjango', 32 | 'hyprlang', 33 | 'java', 34 | 'javascript', 35 | 'jsdoc', 36 | 'json', 37 | 'jsonc', 38 | 'kdl', 39 | 'lua', 40 | 'luadoc', 41 | 'luap', 42 | 'luau', 43 | 'markdown', 44 | 'markdown_inline', 45 | 'nu', 46 | 'ocaml', 47 | 'ocaml_interface', 48 | 'ocamllex', 49 | 'python', 50 | 'query', 51 | 'regex', 52 | 'requirements', 53 | 'rust', 54 | 'scheme', 55 | 'sql', 56 | 'svelte', 57 | 'toml', 58 | 'tsx', 59 | 'typescript', 60 | 'vim', 61 | 'vimdoc', 62 | 'vue', 63 | 'xml', 64 | 'yaml', 65 | } 66 | end 67 | 68 | return M 69 | -------------------------------------------------------------------------------- /lua/gmr/core/autocmds.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_create_autocmd('BufReadPost', { 2 | group = vim.api.nvim_create_augroup( 3 | 'gmr_jump_to_the_last_known_cursor_position', 4 | { clear = true } 5 | ), 6 | pattern = { '*' }, 7 | desc = 'When editing a file, always jump to the last known cursor position', 8 | callback = function() 9 | local line = vim.fn.line '\'"' 10 | if 11 | line >= 1 12 | and line <= vim.fn.line '$' 13 | and vim.bo.filetype ~= 'commit' 14 | and vim.fn.index({ 'xxd', 'gitrebase' }, vim.bo.filetype) == -1 15 | then 16 | vim.cmd 'normal! g`"' 17 | end 18 | end, 19 | }) 20 | 21 | vim.api.nvim_create_autocmd('VimLeave', { 22 | group = vim.api.nvim_create_augroup( 23 | 'gmr_restore_cursor_shape_on_exit', 24 | { clear = true } 25 | ), 26 | pattern = { '*' }, 27 | desc = 'Restores vertical shape cursor for Alacritty on exit', 28 | callback = function() 29 | vim.opt.guicursor = 'a:ver1' 30 | end, 31 | }) 32 | 33 | vim.api.nvim_create_autocmd('TermOpen', { 34 | group = vim.api.nvim_create_augroup( 35 | 'gmr_clean_term_mode', 36 | { clear = true } 37 | ), 38 | pattern = { '*' }, 39 | desc = '', 40 | callback = function() 41 | vim.opt_local.number = false 42 | vim.opt_local.relativenumber = false 43 | vim.opt_local.signcolumn = 'no' 44 | end, 45 | }) 46 | 47 | vim.api.nvim_create_autocmd('FileType', { 48 | group = vim.api.nvim_create_augroup( 49 | 'gmr_json_conceal_level_0', 50 | { clear = true } 51 | ), 52 | desc = 'Disable conceallevel and spell for JSON and JSONC', 53 | pattern = { 'json', 'jsonc' }, 54 | callback = function() 55 | vim.opt_local.spell = false 56 | vim.opt_local.conceallevel = 0 57 | end, 58 | }) 59 | 60 | vim.api.nvim_create_autocmd('FileType', { 61 | group = vim.api.nvim_create_augroup('gmr_close_with_q', { clear = true }), 62 | desc = 'Close with ', 63 | pattern = { 64 | 'help', 65 | 'man', 66 | 'qf', 67 | 'query', 68 | 'scratch', 69 | 'spectre_panel', 70 | }, 71 | callback = function(args) 72 | vim.keymap.set('n', 'q', 'quit', { buffer = args.buf }) 73 | end, 74 | }) 75 | 76 | vim.api.nvim_create_autocmd('TextYankPost', { 77 | group = vim.api.nvim_create_augroup( 78 | 'gmr_highlight_on_yank', 79 | { clear = true } 80 | ), 81 | desc = 'Highlight on yank', 82 | callback = function() 83 | vim.highlight.on_yank { higroup = 'Search' } 84 | end, 85 | }) 86 | 87 | -- vim.api.nvim_create_autocmd('LspAttach', { 88 | -- group = vim.api.nvim_create_augroup( 89 | -- 'gmr_lsp_attach_conflicts', 90 | -- { clear = true } 91 | -- ), 92 | -- desc = 'Prevent tsserver and volar conflict', 93 | -- callback = function(args) 94 | -- if not (args.data and args.data.client_id) then 95 | -- return 96 | -- end 97 | -- 98 | -- local active_clients = vim.lsp.get_clients() 99 | -- local client = vim.lsp.get_client_by_id(args.data.client_id) 100 | -- 101 | -- if client ~= nil and client.name == 'volar' then 102 | -- for _, c in ipairs(active_clients) do 103 | -- if c.name == 'tsserver' then 104 | -- c.stop() 105 | -- end 106 | -- end 107 | -- end 108 | -- end, 109 | -- }) 110 | 111 | vim.api.nvim_create_autocmd('BufWinEnter', { 112 | group = vim.api.nvim_create_augroup( 113 | 'gmr_avoid_comment_new_line', 114 | { clear = true } 115 | ), 116 | desc = 'Avoid comment on new line', 117 | command = 'set formatoptions-=cro', 118 | }) 119 | 120 | vim.api.nvim_create_autocmd('VimResized', { 121 | group = vim.api.nvim_create_augroup( 122 | 'gmr_consistent_size_buffers', 123 | { clear = true } 124 | ), 125 | desc = 'Keep consistent size for buffers', 126 | command = 'tabdo wincmd =', 127 | }) 128 | 129 | vim.api.nvim_create_autocmd('FileType', { 130 | group = vim.api.nvim_create_augroup( 131 | 'gmr_config_for_markdown', 132 | { clear = true } 133 | ), 134 | pattern = { 'markdown' }, 135 | desc = 'Config for Git Markdown ', 136 | callback = function() 137 | vim.opt_local.conceallevel = 0 138 | end, 139 | }) 140 | 141 | vim.api.nvim_create_autocmd('CmdlineEnter', { 142 | group = vim.api.nvim_create_augroup( 143 | 'gmr_cmdheight_1_on_cmdlineenter', 144 | { clear = true } 145 | ), 146 | desc = 'Don\'t hide the status line when typing a command', 147 | command = ':set cmdheight=1', 148 | }) 149 | 150 | vim.api.nvim_create_autocmd('CmdlineLeave', { 151 | group = vim.api.nvim_create_augroup( 152 | 'gmr_cmdheight_0_on_cmdlineleave', 153 | { clear = true } 154 | ), 155 | desc = 'Hide cmdline when not typing a command', 156 | command = ':set cmdheight=0', 157 | }) 158 | 159 | vim.api.nvim_create_autocmd('BufWritePost', { 160 | group = vim.api.nvim_create_augroup( 161 | 'gmr_hide_message_after_write', 162 | { clear = true } 163 | ), 164 | desc = 'Get rid of message after writing a file', 165 | pattern = { '*' }, 166 | command = 'redrawstatus', 167 | }) 168 | 169 | vim.api.nvim_create_autocmd('FileType', { 170 | group = vim.api.nvim_create_augroup( 171 | 'gmr_disable_indentscope_filetypes', 172 | { clear = true } 173 | ), 174 | desc = 'Disable mini.indentscope in specific filetypes', 175 | pattern = { 176 | 'lspinfo', 177 | 'lazy', 178 | 'checkhealth', 179 | 'help', 180 | 'man', 181 | 'gitcommit', 182 | 'NvimTree', 183 | 'fzf', 184 | 'mason', 185 | 'undotree', 186 | '', 187 | }, 188 | callback = function() 189 | vim.b.miniindentscope_disable = true 190 | end, 191 | }) 192 | 193 | vim.api.nvim_create_autocmd('FileType', { 194 | group = vim.api.nvim_create_augroup('gmr_nowrap', { clear = true }), 195 | desc = 'No wrap in these filetypes', 196 | pattern = { 'checkhealth' }, 197 | command = ':set nowrap', 198 | }) 199 | -------------------------------------------------------------------------------- /lua/gmr/core/indentlines.lua: -------------------------------------------------------------------------------- 1 | local function set_leadmultispace() 2 | local lead = '│' 3 | 4 | if vim.o.shiftwidth == 2 then 5 | lead = lead .. ' ' 6 | end 7 | 8 | if vim.o.shiftwidth == 4 then 9 | lead = lead .. ' ' 10 | end 11 | 12 | vim.opt_local.listchars:append { leadmultispace = lead } 13 | end 14 | 15 | vim.api.nvim_create_autocmd({ 'BufRead', 'BufWritePost' }, { 16 | pattern = { '*' }, 17 | callback = function() 18 | local ok, _ = pcall(require, 'guess-indent') 19 | if ok then 20 | vim.cmd ':silent GuessIndent' 21 | end 22 | set_leadmultispace() 23 | end, 24 | }) 25 | 26 | set_leadmultispace() 27 | -------------------------------------------------------------------------------- /lua/gmr/core/keymaps/colorizer.lua: -------------------------------------------------------------------------------- 1 | vim.keymap.set( 2 | 'n', 3 | 'ct', 4 | 'ColorizerToggle', 5 | { desc = 'Toggle nvim-colorizer.lua ' } 6 | ) 7 | -------------------------------------------------------------------------------- /lua/gmr/core/keymaps/dap.lua: -------------------------------------------------------------------------------- 1 | vim.keymap.set( 2 | 'n', 3 | 'bk', 4 | ':DapToggleBreakpoint', 5 | { silent = true, desc = 'Toggle a debug break point in the current line' } 6 | ) 7 | -------------------------------------------------------------------------------- /lua/gmr/core/keymaps/editor.lua: -------------------------------------------------------------------------------- 1 | local running_kitty = os.getenv 'TERM' == 'xterm-kitty' 2 | 3 | local kitty = require 'gmr.configs.kitty' 4 | 5 | -- move cursor between windows 6 | vim.keymap.set('n', '', running_kitty and function() 7 | kitty.nav 'h' 8 | end or 'h', { desc = 'Move the cursor to the window on the left' }) 9 | vim.keymap.set('n', '', running_kitty and function() 10 | kitty.nav 'j' 11 | end or 'j', { desc = 'Move the cursor to the window below' }) 12 | vim.keymap.set('n', '', running_kitty and function() 13 | kitty.nav 'k' 14 | end or 'k', { desc = 'Move the cursor to the window above' }) 15 | vim.keymap.set('n', '', running_kitty and function() 16 | kitty.nav 'l' 17 | end or 'l', { desc = 'Move the cursor to the window on the right' }) 18 | 19 | -- resize 20 | vim.keymap.set( 21 | 'n', 22 | '', 23 | ':resize -2', 24 | { silent = true, desc = 'Resize window vertically' } 25 | ) 26 | vim.keymap.set( 27 | 'n', 28 | '', 29 | ':resize +2', 30 | { silent = true, desc = 'Resize window vertically' } 31 | ) 32 | vim.keymap.set( 33 | 'n', 34 | '', 35 | ':vertical resize -2', 36 | { silent = true, desc = 'Resize window horizontally' } 37 | ) 38 | vim.keymap.set( 39 | 'n', 40 | '', 41 | ':vertical resize +2', 42 | { silent = true, desc = 'Resize window horizontally' } 43 | ) 44 | 45 | -- buffers 46 | vim.keymap.set( 47 | 'n', 48 | 'bd', 49 | ':bd!', 50 | { silent = true, desc = 'Delete current buffer' } 51 | ) 52 | 53 | -- diagnostics 54 | vim.keymap.set('n', 'dd', function() 55 | vim.diagnostic.setloclist() 56 | end, { desc = 'Show buffer diagnostics' }) 57 | 58 | vim.keymap.set('n', 'wd', function() 59 | vim.diagnostic.setqflist() 60 | end, { desc = 'Show workspace diagnostics' }) 61 | 62 | -- search 63 | vim.keymap.set( 64 | 'n', 65 | 'nh', 66 | ':nohlsearch', 67 | { silent = true, desc = 'Don\'t highlight the current search' } 68 | ) 69 | 70 | -- insert and remove quotes 71 | -- vim.keymap.set( 72 | -- 'n', 73 | -- 'sq', 74 | -- 'ciw\'"\'', 75 | -- { silent = true, noremap = true, desc = 'Insert single quotes' } 76 | -- ) 77 | -- vim.keymap.set( 78 | -- 'n', 79 | -- 'usq', 80 | -- 'di\'hPl2x', 81 | -- { silent = true, noremap = true, desc = 'Remove single quotes' } 82 | -- ) 83 | -- vim.keymap.set( 84 | -- 'n', 85 | -- 'dq', 86 | -- 'ciw"""', 87 | -- { silent = true, noremap = true, desc = 'Insert double quotes' } 88 | -- ) 89 | -- vim.keymap.set( 90 | -- 'n', 91 | -- 'udq', 92 | -- 'di"hPl2x', 93 | -- { silent = true, noremap = true, desc = 'Remove double quotes' } 94 | -- ) 95 | -- vim.keymap.set('v', 'sq', 'xi\'pA\'', { 96 | -- silent = true, 97 | -- noremap = true, 98 | -- desc = 'Insert single quotes in visual mode', 99 | -- }) 100 | -- vim.keymap.set('v', 'dq', 'xi"pA"', { 101 | -- silent = true, 102 | -- noremap = true, 103 | -- desc = 'Insert double quotes in visual mode', 104 | -- }) 105 | 106 | -- simulate ci{ ci( ci' ci" with _ - and . 107 | vim.keymap.set( 108 | 'n', 109 | 'ci_', 110 | 'F_lvf_hc', 111 | { silent = true, noremap = true, desc = 'Delete word between underscores' } 112 | ) 113 | 114 | vim.keymap.set( 115 | 'n', 116 | 'ci-', 117 | 'F-lvf-hc', 118 | { silent = true, noremap = true, desc = 'Delete word between hyphens' } 119 | ) 120 | 121 | vim.keymap.set( 122 | 'n', 123 | 'ci.', 124 | 'F.lvf.hc', 125 | { silent = true, noremap = true, desc = 'Delete word between dots' } 126 | ) 127 | 128 | vim.keymap.set( 129 | 'n', 130 | 'ci<', 131 | 'F>lvfy', 139 | [["+y]], 140 | { desc = 'Yank to clipboard' } 141 | ) 142 | vim.keymap.set('n', 'Y', [["+Y]], { desc = 'Yank to clipboard' }) 143 | 144 | -- switch 145 | vim.keymap.set('n', 'sb', function() 146 | vim.opt.background = vim.o.background == 'dark' and 'light' or 'dark' 147 | if running_kitty and vim.g.neovide == nil then 148 | local cmd = 'kitten themes --cache-age=-1 ' 149 | .. 'cold_' 150 | .. vim.o.background 151 | vim.fn.system(cmd) 152 | end 153 | end, { desc = 'Switch background' }) 154 | 155 | vim.keymap.set('n', 'sw', function() 156 | if vim.o.wrap then 157 | vim.cmd 'set nowrap' 158 | else 159 | vim.cmd 'set wrap' 160 | end 161 | end, { desc = 'Switch wrap' }) 162 | 163 | vim.keymap.set('n', 'ch', function() 164 | vim.opt.cmdheight = vim.o.cmdheight == 0 and 1 or 0 165 | end, { silent = true, desc = 'Switch cmdheight between 1 and 0' }) 166 | 167 | -- terminal 168 | vim.keymap.set( 169 | 'n', 170 | 'vt', 171 | [[vsplit | termA]], 172 | { desc = 'Open terminal in vertical split' } 173 | ) 174 | vim.keymap.set( 175 | 'n', 176 | 'ht', 177 | [[split | termA]], 178 | { desc = 'Open terminal in horizontal split' } 179 | ) 180 | vim.keymap.set( 181 | 't', 182 | 'jk', 183 | '', 184 | { desc = 'Use jk to enter in terminal normal mode' } 185 | ) 186 | 187 | -- better space 188 | vim.keymap.set('i', 'jk', '', { desc = 'Use jk to enter in normal mode' }) 189 | 190 | -- useful stuff 191 | vim.keymap.set('n', 'x', '"_x', { desc = 'Dot not yank with x' }) 192 | 193 | vim.keymap.set('n', '', 'ggG', { desc = 'Select all' }) 194 | 195 | vim.keymap.set('n', 'fc', 'foldclose') 196 | 197 | vim.keymap.set('v', '<', '', '>gv', { desc = 'Stay in indent mode' }) 199 | 200 | vim.keymap.set('v', 'p', '"_dP', { 201 | noremap = true, 202 | silent = true, 203 | desc = 'Remember copied elements when pasted in visual mode', 204 | }) 205 | 206 | local terminal_buf = nil 207 | local terminal_win_id = nil 208 | 209 | local function open_terminal() 210 | if vim.fn.bufexists(terminal_buf) ~= 1 then 211 | vim.cmd 'split | term' 212 | terminal_win_id = vim.fn.win_getid() 213 | terminal_buf = vim.fn.bufnr '%' 214 | elseif vim.fn.win_gotoid(terminal_win_id) ~= 1 then 215 | vim.cmd('sb ' .. terminal_buf) 216 | terminal_win_id = vim.fn.win_getid() 217 | end 218 | 219 | vim.cmd 'startinsert' 220 | end 221 | 222 | local function hide_terminal() 223 | if vim.fn.win_gotoid(terminal_win_id) == 1 then 224 | vim.cmd 'hide' 225 | end 226 | end 227 | 228 | local function toggle_terminal() 229 | if vim.fn.win_gotoid(terminal_win_id) == 1 then 230 | hide_terminal() 231 | else 232 | open_terminal() 233 | end 234 | end 235 | 236 | vim.keymap.set({ 'n', 't' }, '', toggle_terminal, { 237 | desc = 'toggle terminal', 238 | }) 239 | 240 | vim.keymap.set('n', 'dd', function() 241 | if vim.fn.getline('.'):match '^%s*$' then 242 | return '"_dd' 243 | end 244 | return 'dd' 245 | end, { expr = true, desc = 'Yank the line on `dd` only if it is non-empty' }) 246 | 247 | vim.keymap.set( 248 | 'x', 249 | '/', 250 | '/\\%V', 251 | { desc = 'Search within visual selection' } 252 | ) 253 | -------------------------------------------------------------------------------- /lua/gmr/core/keymaps/fzf.lua: -------------------------------------------------------------------------------- 1 | --- @param height number|nil 2 | --- @param width number|nil 3 | local function get_fzf_opts(height, width) 4 | height = height or 0.85 5 | width = width or 0.80 6 | 7 | return { 8 | winopts = { 9 | height = height, 10 | width = width, 11 | preview = { 12 | hidden = 'hidden', 13 | }, 14 | }, 15 | fzf_opts = { 16 | ['--highlight-line'] = true, 17 | }, 18 | } 19 | end 20 | 21 | vim.keymap.set('n', 'ff', function() 22 | require('fzf-lua').files(get_fzf_opts(0.7, 0.5)) 23 | end, { 24 | silent = true, 25 | desc = 'FzfLua Find Files', 26 | }) 27 | 28 | vim.keymap.set('n', 'gs', function() 29 | require('fzf-lua').git_status { 30 | winopts = { 31 | fullscreen = true, 32 | }, 33 | } 34 | end, { 35 | silent = true, 36 | desc = 'FzfLua Git Status', 37 | }) 38 | 39 | vim.keymap.set('n', 'lg', function() 40 | require('fzf-lua').live_grep { 41 | winopts = { 42 | fullscreen = true, 43 | }, 44 | } 45 | end, { 46 | silent = true, 47 | desc = 'FzfLua Live Grep', 48 | }) 49 | 50 | vim.keymap.set('n', 'hh', function() 51 | require('fzf-lua').help_tags { 52 | winopts = { 53 | preview = { 54 | layout = 'horizontal', 55 | }, 56 | fullscreen = true, 57 | }, 58 | resume = true, 59 | } 60 | end, { 61 | silent = true, 62 | desc = 'FzfLua Help Tags', 63 | }) 64 | 65 | vim.keymap.set('n', 'of', function() 66 | require('fzf-lua').oldfiles(get_fzf_opts()) 67 | end, { 68 | silent = true, 69 | desc = 'FzfLua History Files', 70 | }) 71 | 72 | vim.keymap.set('n', 'bf', function() 73 | require('fzf-lua').buffers(get_fzf_opts(0.7, 0.5)) 74 | end, { 75 | silent = true, 76 | desc = 'Fzf Buffer Opened', 77 | }) 78 | -------------------------------------------------------------------------------- /lua/gmr/core/keymaps/grapple.lua: -------------------------------------------------------------------------------- 1 | vim.keymap.set( 2 | 'n', 3 | 'm', 4 | 'Grapple toggle', 5 | { desc = 'Tag the curent buffer with grapple.nvim' } 6 | ) 7 | 8 | vim.keymap.set( 9 | 'n', 10 | 'gr', 11 | 'Grapple open_tags', 12 | { desc = 'Open grapple.nvim window to see buffers tagged' } 13 | ) 14 | 15 | local indexes = { 1, 2, 3, 4, 5, 6, 7, 8, 9 } 16 | 17 | for _, idx in pairs(indexes) do 18 | vim.keymap.set( 19 | 'n', 20 | string.format('%s', idx), 21 | string.format('Grapple select index=%s', idx), 22 | { desc = 'Select tagged buffer with grapple.nvim by index' } 23 | ) 24 | end 25 | -------------------------------------------------------------------------------- /lua/gmr/core/keymaps/init.lua: -------------------------------------------------------------------------------- 1 | vim.g.mapleader = ' ' 2 | 3 | require 'gmr.core.keymaps.colorizer' 4 | require 'gmr.core.keymaps.editor' 5 | require 'gmr.core.keymaps.grapple' 6 | require 'gmr.core.keymaps.nvim-tree' 7 | require 'gmr.core.keymaps.snacks' 8 | -------------------------------------------------------------------------------- /lua/gmr/core/keymaps/neotest.lua: -------------------------------------------------------------------------------- 1 | vim.keymap.set( 2 | 'n', 3 | 'ts', 4 | ':Neotest summary', 5 | { silent = true, desc = 'Show side buffer with summary of tests' } 6 | ) 7 | 8 | vim.keymap.set( 9 | 'n', 10 | 'tn', 11 | ':NeotestNearest', 12 | { silent = true, desc = 'Execute the nearest test' } 13 | ) 14 | 15 | vim.keymap.set( 16 | 'n', 17 | 'tc', 18 | ':NeotestCurrentFile', 19 | { silent = true, desc = 'Execute all tests in current file' } 20 | ) 21 | 22 | vim.keymap.set( 23 | 'n', 24 | 'ta', 25 | ':NeotestAll', 26 | { silent = true, desc = 'Execute all tests in the project' } 27 | ) 28 | -------------------------------------------------------------------------------- /lua/gmr/core/keymaps/nvim-tree.lua: -------------------------------------------------------------------------------- 1 | vim.keymap.set( 2 | 'n', 3 | '', 4 | ':NvimTreeFindFileToggle', 5 | { silent = true, desc = 'Tooggle NvimTree' } 6 | ) 7 | 8 | vim.keymap.set( 9 | 'n', 10 | 'r', 11 | ':NvimTreeRefresh', 12 | { silent = true, desc = 'Refresh NvimTree' } 13 | ) 14 | -------------------------------------------------------------------------------- /lua/gmr/core/keymaps/snacks.lua: -------------------------------------------------------------------------------- 1 | vim.keymap.set('n', 'ff', ':SnacksPickerFiles', { 2 | silent = true, 3 | desc = 'Snacks Picker Files', 4 | }) 5 | 6 | vim.keymap.set('n', 'gs', ':SnacksPickerGitStatus', { 7 | silent = true, 8 | desc = 'Snacks Picker Git Status', 9 | }) 10 | 11 | vim.keymap.set('n', 'lg', ':SnacksPickerGrep', { 12 | silent = true, 13 | desc = 'Snacks Picker Grep', 14 | }) 15 | 16 | vim.keymap.set('n', 'hh', ':SnacksPickerHelp', { 17 | silent = true, 18 | desc = 'Snacks Picker Help', 19 | }) 20 | 21 | vim.keymap.set('n', 'bf', ':SnacksPickerBuffers', { 22 | silent = true, 23 | desc = 'Snacks Picker Buffers', 24 | }) 25 | -------------------------------------------------------------------------------- /lua/gmr/core/keymaps/telescope.lua: -------------------------------------------------------------------------------- 1 | vim.keymap.set('n', 'ff', ':Telescope find_files', { 2 | silent = true, 3 | desc = 'Telescope Find Files', 4 | }) 5 | 6 | vim.keymap.set('n', 'gs', ':Telescope git_status', { 7 | silent = true, 8 | desc = 'Telescope Git Status', 9 | }) 10 | 11 | vim.keymap.set('n', 'lg', ':Telescope live_grep', { 12 | silent = true, 13 | desc = 'Telescope Live Grep', 14 | }) 15 | 16 | vim.keymap.set('n', 'hh', ':Telescope help_tags', { 17 | silent = true, 18 | desc = 'Telescope Help Tags', 19 | }) 20 | 21 | vim.keymap.set('n', 'of', ':Telescope oldfiles', { 22 | silent = true, 23 | desc = 'Telescope History Files', 24 | }) 25 | 26 | vim.keymap.set('n', 'bf', ':Telescope buffers', { 27 | silent = true, 28 | desc = 'Telescope Buffers Opened', 29 | }) 30 | -------------------------------------------------------------------------------- /lua/gmr/core/options.lua: -------------------------------------------------------------------------------- 1 | vim.g.editorconfig = false 2 | vim.g.loaded_gzip = 1 3 | vim.g.loaded_tarPlugin = 1 4 | vim.g.loaded_tar = 1 5 | vim.g.loaded_zipPlugin = 1 6 | vim.g.loaded_zip = 1 7 | vim.g.loaded_getscript = 1 8 | vim.g.loaded_getscriptPlugin = 1 9 | vim.g.loaded_vimball = 1 10 | vim.g.loaded_vimballPlugin = 1 11 | vim.g.loaded_matchit = 1 12 | -- vim.g.loaded_matchparen = 1 13 | vim.g.loaded_2html_plugin = 1 14 | vim.g.loaded_logiPat = 1 15 | vim.g.loaded_rrhelper = 1 16 | vim.g.loaded_netrw = 1 17 | vim.g.loaded_netrwPlugin = 1 18 | vim.g.loaded_netrwSettings = 1 19 | vim.g.loaded_netrwFileHandlers = 1 20 | vim.g.loaded_python3_provider = 0 21 | vim.g.loaded_ruby_provider = 0 22 | vim.g.loaded_node_provider = 0 23 | vim.g.loaded_perl_provider = 0 24 | vim.g.loaded_typecorr = 1 25 | vim.g.loaded_spellfile_plugin = 1 26 | 27 | local opt = vim.opt 28 | 29 | -- opt.background = 'dark' 30 | opt.backup = false 31 | opt.cmdheight = 0 32 | opt.completeitemalign = 'abbr,menu,kind' 33 | opt.completeopt = { 'menu', 'menuone', 'noselect' } 34 | opt.conceallevel = 3 35 | opt.confirm = true 36 | opt.cursorline = true 37 | opt.expandtab = true 38 | opt.fillchars:append { 39 | eob = ' ', 40 | fold = ' ', 41 | foldopen = '', 42 | foldsep = ' ', 43 | foldclose = '', 44 | } 45 | opt.foldcolumn = '0' 46 | opt.foldenable = true 47 | -- opt.foldexpr = 'v:lua.vim.treesitter.foldexpr()' 48 | opt.foldlevel = 99 49 | opt.foldlevelstart = 99 50 | opt.foldmethod = 'expr' 51 | opt.foldtext = '' 52 | opt.grepprg = 'rg --vimgrep' 53 | -- opt.guifont = 'BlexMono Nerd Font Mono:h13' 54 | opt.ignorecase = true 55 | -- opt.inccommand = 'split' 56 | opt.laststatus = 3 57 | -- opt.list = true 58 | -- opt.listchars:append { 59 | -- eol = '↲', 60 | -- tab = '│ ', 61 | -- trail = ' ', 62 | -- } 63 | opt.mouse = 'a' 64 | opt.number = true 65 | opt.numberwidth = 1 66 | opt.pumheight = 10 67 | opt.relativenumber = true 68 | opt.scrolloff = 8 69 | -- opt.shell = 'nu' 70 | opt.shiftwidth = 4 71 | opt.showcmd = true 72 | opt.showcmdloc = 'statusline' 73 | opt.showmode = false 74 | opt.showtabline = 1 75 | opt.sidescroll = 3 76 | opt.sidescrolloff = 3 77 | opt.signcolumn = 'yes' 78 | opt.smartcase = false 79 | opt.smartindent = true 80 | opt.spell = false 81 | opt.spelllang = 'en_us' 82 | opt.spelloptions = 'camel' 83 | opt.splitbelow = true 84 | opt.splitkeep = 'screen' 85 | opt.splitright = true 86 | opt.swapfile = false 87 | opt.tabstop = 4 88 | opt.timeoutlen = 800 89 | opt.undofile = true 90 | opt.undolevels = 10000 91 | opt.updatetime = 200 92 | opt.virtualedit = 'block' 93 | -- opt.wildoptions = '' 94 | opt.winborder = 'single' 95 | opt.wrap = false 96 | 97 | vim.g.base46_cache = vim.fn.stdpath 'data' .. '/base46_cache/' 98 | 99 | if vim.g.neovide then 100 | opt.linespace = -1 101 | 102 | -- emulate alacritty font rendering 103 | vim.g.neovide_text_gamma = 0.8 104 | vim.g.neovide_text_contrast = 0.1 105 | 106 | -- padding 107 | vim.g.neovide_padding_top = 5 108 | vim.g.neovide_padding_left = 4 109 | 110 | -- disable blur 111 | vim.g.neovide_window_blurred = false 112 | vim.g.neovide_floating_shadow = false 113 | 114 | -- other options 115 | vim.g.neovide_hide_mouse_when_typing = true 116 | 117 | vim.g.neovide_cursor_animation_length = 0.1 118 | vim.g.neovide_cursor_trail_size = 0.1 119 | 120 | vim.cmd [[ 121 | " system clipboard 122 | nmap "+y 123 | vmap "+y 124 | nmap "+p 125 | inoremap + 126 | cnoremap + 127 | " use to insert original character without triggering things like auto-pairs 128 | inoremap 129 | ]] 130 | 131 | -- fzf looks weird without this 132 | -- vim.fn.setcellwidths { { 0x2002, 0x2002, 2 } } 133 | end 134 | -------------------------------------------------------------------------------- /lua/gmr/core/statusline.lua: -------------------------------------------------------------------------------- 1 | local statusline_augroup = 2 | vim.api.nvim_create_augroup('gmr_statusline', { clear = true }) 3 | 4 | --- @param severity integer 5 | --- @return integer 6 | local function get_lsp_diagnostics_count(severity) 7 | if not rawget(vim, 'lsp') then 8 | return 0 9 | end 10 | 11 | local count = vim.diagnostic.count(0, { serverity = severity })[severity] 12 | if count == nil then 13 | return 0 14 | end 15 | 16 | return count 17 | end 18 | 19 | --- @param type string 20 | --- @return integer 21 | local function get_git_diff(type) 22 | local gsd = vim.b.gitsigns_status_dict 23 | if gsd and gsd[type] then 24 | return gsd[type] 25 | end 26 | 27 | return 0 28 | end 29 | 30 | --- @return string 31 | local function mode() 32 | return string.format( 33 | '%%#StatusLineMode# %s %%*', 34 | vim.api.nvim_get_mode().mode 35 | ) 36 | end 37 | 38 | --- @return string 39 | local function python_env() 40 | local virtual_env = os.getenv 'VIRTUAL_ENV_PROMPT' 41 | if virtual_env == nil then 42 | return '' 43 | end 44 | 45 | virtual_env = virtual_env:gsub('%s+', '') -- delete spaces 46 | return string.format('%%#StatusLineMedium# %s%%*', virtual_env) 47 | end 48 | 49 | --- @return string 50 | local function lsp_active() 51 | if not rawget(vim, 'lsp') then 52 | return '' 53 | end 54 | 55 | local current_buf = vim.api.nvim_get_current_buf() 56 | local clients = vim.lsp.get_clients { bufnr = current_buf } 57 | 58 | local space = '%#StatusLineMedium# %*' 59 | 60 | if #clients > 0 then 61 | return space .. '%#StatusLineMedium#LSP%*' 62 | end 63 | 64 | return '' 65 | end 66 | 67 | --- @return string 68 | local function diagnostics_error() 69 | local count = get_lsp_diagnostics_count(vim.diagnostic.severity.ERROR) 70 | if count > 0 then 71 | return string.format('%%#StatusLineLspError# %se%%*', count) 72 | end 73 | 74 | return '' 75 | end 76 | 77 | --- @return string 78 | local function diagnostics_warns() 79 | local count = get_lsp_diagnostics_count(vim.diagnostic.severity.WARN) 80 | if count > 0 then 81 | return string.format('%%#StatusLineLspWarn# %sw%%*', count) 82 | end 83 | 84 | return '' 85 | end 86 | 87 | --- @return string 88 | local function diagnostics_hint() 89 | local count = get_lsp_diagnostics_count(vim.diagnostic.severity.HINT) 90 | if count > 0 then 91 | return string.format('%%#StatusLineLspHint# %sh%%*', count) 92 | end 93 | 94 | return '' 95 | end 96 | 97 | --- @return string 98 | local function diagnostics_info() 99 | local count = get_lsp_diagnostics_count(vim.diagnostic.severity.INFO) 100 | if count > 0 then 101 | return string.format('%%#StatusLineLspInfo# %si%%*', count) 102 | end 103 | 104 | return '' 105 | end 106 | 107 | --- @class LspProgress 108 | --- @field client vim.lsp.Client? 109 | --- @field kind string? 110 | --- @field title string? 111 | --- @field percentage integer? 112 | --- @field message string? 113 | local lsp_progress = { 114 | client = nil, 115 | kind = nil, 116 | title = nil, 117 | percentage = nil, 118 | message = nil, 119 | } 120 | 121 | vim.api.nvim_create_autocmd('LspProgress', { 122 | group = statusline_augroup, 123 | desc = 'Update LSP progress in statusline', 124 | pattern = { 'begin', 'report', 'end' }, 125 | callback = function(args) 126 | if not (args.data and args.data.client_id) then 127 | return 128 | end 129 | 130 | lsp_progress = { 131 | client = vim.lsp.get_client_by_id(args.data.client_id), 132 | kind = args.data.params.value.kind, 133 | message = args.data.params.value.message, 134 | percentage = args.data.params.value.percentage, 135 | title = args.data.params.value.title, 136 | } 137 | 138 | if lsp_progress.kind == 'end' then 139 | lsp_progress.title = nil 140 | vim.defer_fn(function() 141 | vim.cmd.redrawstatus() 142 | end, 500) 143 | else 144 | vim.cmd.redrawstatus() 145 | end 146 | end, 147 | }) 148 | 149 | --- @return string 150 | local function lsp_status() 151 | if not rawget(vim, 'lsp') then 152 | return '' 153 | end 154 | 155 | if vim.o.columns < 120 then 156 | return '' 157 | end 158 | 159 | if not lsp_progress.client or not lsp_progress.title then 160 | return '' 161 | end 162 | 163 | local title = lsp_progress.title or '' 164 | local percentage = ( 165 | lsp_progress.percentage and (lsp_progress.percentage .. '%%') 166 | ) or '' 167 | local message = lsp_progress.message or '' 168 | 169 | local lsp_message = string.format('%s', title) 170 | 171 | if message ~= '' then 172 | lsp_message = string.format('%s %s', lsp_message, message) 173 | end 174 | 175 | if percentage ~= '' then 176 | lsp_message = string.format('%s %s', lsp_message, percentage) 177 | end 178 | 179 | return string.format('%%#StatusLineLspMessages#%s%%* ', lsp_message) 180 | end 181 | 182 | --- @return string 183 | local function git_diff_added() 184 | local added = get_git_diff 'added' 185 | if added > 0 then 186 | return string.format('%%#StatusLineGitDiffAdded#+%s%%*', added) 187 | end 188 | 189 | return '' 190 | end 191 | 192 | --- @return string 193 | local function git_diff_changed() 194 | local changed = get_git_diff 'changed' 195 | if changed > 0 then 196 | return string.format('%%#StatusLineGitDiffChanged#~%s%%*', changed) 197 | end 198 | 199 | return '' 200 | end 201 | 202 | --- @return string 203 | local function git_diff_removed() 204 | local removed = get_git_diff 'removed' 205 | if removed > 0 then 206 | return string.format('%%#StatusLineGitDiffRemoved#-%s%%*', removed) 207 | end 208 | 209 | return '' 210 | end 211 | 212 | --- @return string 213 | local function git_branch_icon() 214 | return '%#StatusLineGitBranchIcon#%*' 215 | end 216 | 217 | --- @return string 218 | local function git_branch() 219 | local branch = vim.b.gitsigns_head 220 | 221 | if branch == '' or branch == nil then 222 | return '' 223 | end 224 | 225 | return string.format('%%#StatusLineMedium#%s%%*', branch) 226 | end 227 | 228 | --- @return string 229 | local function full_git() 230 | local full = '' 231 | local space = '%#StatusLineMedium# %*' 232 | 233 | local branch = git_branch() 234 | if branch ~= '' then 235 | local icon = git_branch_icon() 236 | full = full .. space .. icon .. space .. branch .. space 237 | end 238 | 239 | local added = git_diff_added() 240 | if added ~= '' then 241 | full = full .. added .. space 242 | end 243 | 244 | local changed = git_diff_changed() 245 | if changed ~= '' then 246 | full = full .. changed .. space 247 | end 248 | 249 | local removed = git_diff_removed() 250 | if removed ~= '' then 251 | full = full .. removed .. space 252 | end 253 | 254 | return full 255 | end 256 | 257 | --- @return string 258 | local function file_percentage() 259 | local current_line = vim.api.nvim_win_get_cursor(0)[1] 260 | local lines = vim.api.nvim_buf_line_count(0) 261 | 262 | return string.format( 263 | '%%#StatusLineMedium#  %d%%%% %%*', 264 | math.ceil(current_line / lines * 100) 265 | ) 266 | end 267 | 268 | --- @return string 269 | local function total_lines() 270 | local lines = vim.fn.line '$' 271 | return string.format('%%#StatusLineMedium#of %s %%*', lines) 272 | end 273 | 274 | --- @param hlgroup string 275 | local function formatted_filetype(hlgroup) 276 | local filetype = vim.bo.filetype or vim.fn.expand('%:e', false) 277 | return string.format('%%#%s# %s %%*', hlgroup, filetype) 278 | end 279 | 280 | StatusLine = {} 281 | 282 | StatusLine.inactive = function() 283 | return table.concat { 284 | formatted_filetype 'StatusLineMode', 285 | } 286 | end 287 | 288 | local redeable_filetypes = { 289 | ['qf'] = true, 290 | ['help'] = true, 291 | ['tsplayground'] = true, 292 | } 293 | 294 | StatusLine.active = function() 295 | local mode_str = vim.api.nvim_get_mode().mode 296 | if mode_str == 't' or mode_str == 'nt' then 297 | return table.concat { 298 | mode(), 299 | '%=', 300 | '%=', 301 | file_percentage(), 302 | total_lines(), 303 | } 304 | end 305 | 306 | if redeable_filetypes[vim.bo.filetype] or vim.o.modifiable == false then 307 | return table.concat { 308 | formatted_filetype 'StatusLineMode', 309 | '%=', 310 | '%=', 311 | file_percentage(), 312 | total_lines(), 313 | } 314 | end 315 | 316 | local statusline = { 317 | mode(), 318 | full_git(), 319 | '%=', 320 | '%=', 321 | '%S ', 322 | lsp_status(), 323 | diagnostics_error(), 324 | diagnostics_warns(), 325 | diagnostics_hint(), 326 | diagnostics_info(), 327 | lsp_active(), 328 | python_env(), 329 | file_percentage(), 330 | total_lines(), 331 | } 332 | 333 | return table.concat(statusline) 334 | end 335 | 336 | vim.opt.statusline = '%!v:lua.StatusLine.active()' 337 | 338 | vim.api.nvim_create_autocmd({ 'WinEnter', 'BufEnter', 'FileType' }, { 339 | group = statusline_augroup, 340 | pattern = { 341 | 'NvimTree_1', 342 | 'NvimTree', 343 | 'TelescopePrompt', 344 | 'fzf', 345 | 'lspinfo', 346 | 'lazy', 347 | 'netrw', 348 | 'mason', 349 | 'noice', 350 | 'qf', 351 | }, 352 | callback = function() 353 | vim.opt_local.statusline = '%!v:lua.StatusLine.inactive()' 354 | end, 355 | }) 356 | -------------------------------------------------------------------------------- /lua/gmr/core/terminalcolors.lua: -------------------------------------------------------------------------------- 1 | vim.g.terminal_color_0 = '#181818' 2 | vim.g.terminal_color_8 = '#6B6B6B' 3 | 4 | vim.g.terminal_color_1 = '#AC4242' 5 | vim.g.terminal_color_9 = '#C55555' 6 | 7 | vim.g.terminal_color_2 = '#90A959' 8 | vim.g.terminal_color_10 = '#AAC474' 9 | 10 | vim.g.terminal_color_3 = '#F4BF75' 11 | vim.g.terminal_color_11 = '#FECA88' 12 | 13 | vim.g.terminal_color_4 = '#6A9FB5' 14 | vim.g.terminal_color_12 = '#82B8C8' 15 | 16 | vim.g.terminal_color_5 = '#AA759F' 17 | vim.g.terminal_color_13 = '#C28CB8' 18 | 19 | vim.g.terminal_color_6 = '#75B5AA' 20 | vim.g.terminal_color_14 = '#93D3C3' 21 | 22 | vim.g.terminal_color_7 = '#D8D8D8' 23 | vim.g.terminal_color_15 = '#F8F8F8' 24 | -------------------------------------------------------------------------------- /lua/gmr/core/utils.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | --- @param filename string 4 | --- @param text string 5 | function M.write_file(filename, text) 6 | local file = io.open(filename, 'w+') 7 | if file == nil or io.type(file) ~= 'file' then 8 | print('Failed to open output file', filename) 9 | return 10 | end 11 | file:setvbuf 'full' 12 | 13 | file:write(text) 14 | file:flush() 15 | file:close() 16 | end 17 | 18 | --- @return boolean 19 | function M.running_wsl() 20 | local release = vim.uv.os_uname().release 21 | return string.find(release, 'WSL', 1, true) ~= nil 22 | end 23 | 24 | --- @return boolean 25 | function M.running_android() 26 | local machine = vim.uv.os_uname().machine 27 | return string.find(machine, 'arm', 1, true) ~= nil 28 | end 29 | 30 | --- @return boolean 31 | function M.is_nil_or_empty_string(s) 32 | return s == nil or s == '' 33 | end 34 | 35 | --- @return boolean 36 | function M.is_unsaved() 37 | return vim.api.nvim_get_option_value('mod', { buf = 0 }) 38 | end 39 | 40 | --- @return string 41 | function M.trim(str) 42 | str = str:gsub('^%s+', '') 43 | str = str:gsub('%s+$', '') 44 | return str 45 | end 46 | 47 | --- @return boolean 48 | function M.pumvisible() 49 | return tonumber(vim.fn.pumvisible()) ~= 0 50 | end 51 | 52 | return M 53 | -------------------------------------------------------------------------------- /lua/gmr/core/winbar.lua: -------------------------------------------------------------------------------- 1 | local enable_navic = true 2 | 3 | local winbar_filetype_exclude = { 4 | 'help', 5 | 'startify', 6 | 'dashboard', 7 | 'packer', 8 | 'neogitstatus', 9 | 'NvimTree', 10 | 'Trouble', 11 | 'trouble', 12 | 'alpha', 13 | 'lir', 14 | 'Outline', 15 | 'spectre_panel', 16 | 'toggleterm', 17 | 'DressingSelect', 18 | 'Jaq', 19 | 'harpoon', 20 | 'lab', 21 | 'Markdown', 22 | 'fzf', 23 | 'dap-float', 24 | 'dap-repl', 25 | '', 26 | } 27 | 28 | local function get_filename() 29 | local filename = vim.fn.expand '%:.' 30 | local extension = vim.fn.expand '%:e' 31 | local utils = require 'gmr.core.utils' 32 | 33 | if not utils.is_nil_or_empty_string(filename) then 34 | local ok, web_devicons = pcall(require, 'nvim-web-devicons') 35 | if not ok then 36 | vim.notify 'nvim-web-devicons could not be loaded' 37 | return 38 | end 39 | 40 | local file_icon, file_icon_color = 41 | web_devicons.get_icon_color(filename, extension, { default = true }) 42 | 43 | local hl_group = 'WinBarFileIcon' .. extension 44 | vim.api.nvim_set_hl(0, hl_group, { fg = file_icon_color }) 45 | 46 | local readonly = '' 47 | if vim.bo.readonly then 48 | readonly = ' ' 49 | end 50 | 51 | local tagged = '' 52 | if require('grapple').exists() then 53 | tagged = ' 󰓹' 54 | end 55 | 56 | return string.format( 57 | ' %%#%s#%s%%*%%#WarningMsg#%s%s%%* %%#WinBar#%s%%*', 58 | hl_group, 59 | file_icon, 60 | readonly, 61 | tagged, 62 | filename 63 | ) 64 | end 65 | end 66 | 67 | local get_navic = function() 68 | if not rawget(vim, 'lsp') then 69 | return '' 70 | end 71 | 72 | local ok, navic = pcall(require, 'nvim-navic') 73 | if not ok then 74 | return '' 75 | end 76 | 77 | local navic_location_loaded, navic_location = pcall(navic.get_location, {}) 78 | 79 | if not navic_location_loaded then 80 | return '' 81 | end 82 | 83 | if not navic.is_available() or navic_location == 'error' then 84 | return '' 85 | end 86 | 87 | if not require('gmr.core.utils').is_nil_or_empty_string(navic_location) then 88 | return '' .. ' ' .. navic_location 89 | end 90 | 91 | return '' 92 | end 93 | 94 | local function excludes() 95 | if vim.tbl_contains(winbar_filetype_exclude, vim.bo.filetype) then 96 | vim.opt_local.winbar = nil 97 | return true 98 | end 99 | 100 | return false 101 | end 102 | 103 | local function get_winbar() 104 | if excludes() then 105 | return 106 | end 107 | 108 | local utils = require 'gmr.core.utils' 109 | local value = get_filename() 110 | 111 | if not utils.is_nil_or_empty_string(value) and utils.is_unsaved() then 112 | local mod = '%#WarningMsg#*%*' 113 | value = value .. mod 114 | end 115 | 116 | if enable_navic and not utils.is_nil_or_empty_string(value) then 117 | local navic_value = get_navic() 118 | value = value .. ' ' .. navic_value 119 | end 120 | 121 | local num_tabs = #vim.api.nvim_list_tabpages() 122 | 123 | if num_tabs > 1 and not utils.is_nil_or_empty_string(value) then 124 | local tabpage_number = tostring(vim.api.nvim_tabpage_get_number(0)) 125 | value = value .. '%=' .. tabpage_number .. '/' .. tostring(num_tabs) 126 | end 127 | 128 | local status_ok, _ = pcall( 129 | vim.api.nvim_set_option_value, 130 | 'winbar', 131 | value, 132 | { scope = 'local' } 133 | ) 134 | 135 | if not status_ok then 136 | return 137 | end 138 | end 139 | 140 | vim.api.nvim_create_autocmd({ 141 | 'CursorMoved', 142 | 'CursorHold', 143 | 'BufWinEnter', 144 | 'BufFilePost', 145 | 'InsertEnter', 146 | 'BufWritePost', 147 | 'TabClosed', 148 | }, { 149 | group = vim.api.nvim_create_augroup('gmr_winbar', { clear = true }), 150 | callback = function() 151 | local status_ok, _ = 152 | pcall(vim.api.nvim_buf_get_var, 0, 'lsp_floating_window') 153 | if not status_ok then 154 | get_winbar() 155 | end 156 | end, 157 | }) 158 | -------------------------------------------------------------------------------- /lua/gmr/lazy.lua: -------------------------------------------------------------------------------- 1 | local plugin_specs = {} --- @type LazySpecImport[] 2 | 3 | --- @param plugin string 4 | local function add(plugin) 5 | local spec = { import = plugin } --- @type LazySpecImport 6 | table.insert(plugin_specs, spec) 7 | end 8 | 9 | add 'gmr.plugins.autopairs' 10 | add 'gmr.plugins.autotag' 11 | -- add 'gmr.plugins.base46' 12 | add 'gmr.plugins.blink-cmp' 13 | -- add 'gmr.plugins.cloak' 14 | add 'gmr.plugins.colorizer' 15 | add 'gmr.plugins.colorschemes.cold' 16 | add 'gmr.plugins.formatter' 17 | add 'gmr.plugins.grapple' 18 | add 'gmr.plugins.gitsigns' 19 | add 'gmr.plugins.guess-indent' 20 | add 'gmr.plugins.jdtls' 21 | add 'gmr.plugins.lsp' 22 | add 'gmr.plugins.mason' 23 | add 'gmr.plugins.mini-indentscope' 24 | add 'gmr.plugins.mini-surround' 25 | add 'gmr.plugins.nvim-tree' 26 | add 'gmr.plugins.scriptease' 27 | add 'gmr.plugins.snacks' 28 | add 'gmr.plugins.treesitter' 29 | add 'gmr.plugins.treesitter-context' 30 | add 'gmr.plugins.ts-comments' 31 | add 'gmr.plugins.twilight' 32 | add 'gmr.plugins.undotree' 33 | add 'gmr.plugins.web-devicons' 34 | add 'gmr.plugins.zen-mode' 35 | 36 | -- if vim.fn.has 'win32' == 1 then 37 | -- add 'gmr.plugins.telescope' 38 | -- else 39 | -- add 'gmr.plugins.fzf' 40 | -- end 41 | 42 | local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' 43 | 44 | if not vim.uv.fs_stat(lazypath) then 45 | vim.fn.system { 46 | 'git', 47 | 'clone', 48 | '--filter=blob:none', 49 | 'https://github.com/folke/lazy.nvim.git', 50 | '--branch=stable', 51 | lazypath, 52 | } 53 | end 54 | 55 | vim.opt.rtp:prepend(lazypath) 56 | 57 | require('lazy').setup(plugin_specs, { 58 | ui = { 59 | border = 'single', 60 | backdrop = 100, 61 | }, 62 | change_detection = { 63 | enabled = false, 64 | notify = false, 65 | }, 66 | performance = { 67 | rtp = { 68 | disabled_plugins = { 69 | 'gzip', 70 | 'matchit', 71 | -- 'matchparen', 72 | 'netrwPlugin', 73 | 'tarPlugin', 74 | 'tohtml', 75 | 'tutor', 76 | 'zipPlugin', 77 | }, 78 | }, 79 | }, 80 | }) 81 | -------------------------------------------------------------------------------- /lua/gmr/plugins/autopairs.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'windwp/nvim-autopairs', 3 | event = 'InsertEnter', 4 | config = function() 5 | require('nvim-autopairs').setup { 6 | map_cr = true, 7 | } 8 | end, 9 | } 10 | -------------------------------------------------------------------------------- /lua/gmr/plugins/autotag.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'windwp/nvim-ts-autotag', 3 | ft = { 4 | 'astro', 5 | 'glimmer', 6 | 'handlebars', 7 | 'hbs', 8 | 'html', 9 | 'javascript', 10 | 'javascriptreact', 11 | 'jsx', 12 | 'markdown', 13 | 'php', 14 | 'rescript', 15 | 'svelte', 16 | 'tsx', 17 | 'twig', 18 | 'typescript', 19 | 'typescriptreact', 20 | 'vue', 21 | 'xml', 22 | }, 23 | config = function() 24 | require('nvim-ts-autotag').setup() 25 | end, 26 | } 27 | -------------------------------------------------------------------------------- /lua/gmr/plugins/base46.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'NvChad/base46', 3 | lazy = true, 4 | build = ':lua require(\'base46\').load_all_highlights()', 5 | dependencies = { 'nvim-lua/plenary.nvim' }, 6 | } 7 | -------------------------------------------------------------------------------- /lua/gmr/plugins/blink-cmp.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'Saghen/blink.cmp', 3 | event = 'InsertEnter', 4 | version = '*', 5 | config = function() 6 | require('blink-cmp').setup { 7 | keymap = { 8 | [''] = { 9 | 'show', 10 | 'show_documentation', 11 | 'hide_documentation', 12 | }, 13 | [''] = { 'hide' }, 14 | [''] = { 'accept', 'fallback' }, 15 | 16 | [''] = { 'select_next', 'fallback' }, 17 | [''] = { 'select_prev', 'fallback' }, 18 | }, 19 | completion = { 20 | accept = { 21 | resolve_timeout_ms = 10000, 22 | auto_brackets = { 23 | enabled = false, 24 | }, 25 | }, 26 | list = { 27 | selection = { 28 | auto_insert = true, 29 | }, 30 | }, 31 | menu = { 32 | auto_show = false, 33 | draw = { 34 | columns = { 35 | { 36 | 'label', 37 | gap = 1, 38 | }, 39 | { 'kind' }, 40 | }, 41 | }, 42 | }, 43 | documentation = { 44 | auto_show = true, 45 | auto_show_delay_ms = 0, 46 | }, 47 | }, 48 | signature = { 49 | trigger = { 50 | enabled = false, 51 | }, 52 | }, 53 | appearance = { 54 | use_nvim_cmp_as_default = false, 55 | }, 56 | sources = { 57 | default = { 'lsp', 'path', 'buffer' }, 58 | providers = { 59 | lsp = { 60 | timeout_ms = 10000, 61 | }, 62 | }, 63 | }, 64 | cmdline = { 65 | enabled = false, 66 | }, 67 | } 68 | end, 69 | } 70 | -------------------------------------------------------------------------------- /lua/gmr/plugins/cloak.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'laytan/cloak.nvim', 3 | config = function() 4 | require('cloak').setup() 5 | end, 6 | } 7 | -------------------------------------------------------------------------------- /lua/gmr/plugins/cmp.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'hrsh7th/nvim-cmp', 3 | event = 'InsertEnter', 4 | dependencies = { 5 | { 'hrsh7th/cmp-nvim-lsp' }, 6 | { 'hrsh7th/cmp-path' }, 7 | { 8 | 'L3MON4D3/LuaSnip', 9 | version = 'v2.*', 10 | build = 'make install_jsregexp', 11 | }, 12 | { 'saadparwaiz1/cmp_luasnip' }, 13 | }, 14 | config = function() 15 | local luasnip = require 'luasnip' 16 | local cmp = require 'cmp' 17 | 18 | local cmp_kinds = { 19 | Text = ' ', 20 | Method = ' ', 21 | Function = ' ', 22 | Constructor = ' ', 23 | Field = ' ', 24 | Variable = ' ', 25 | Class = ' ', 26 | Interface = ' ', 27 | Module = ' ', 28 | Property = ' ', 29 | Unit = ' ', 30 | Value = ' ', 31 | Enum = ' ', 32 | Keyword = ' ', 33 | Snippet = ' ', 34 | Color = ' ', 35 | File = ' ', 36 | Reference = ' ', 37 | Folder = ' ', 38 | EnumMember = ' ', 39 | Constant = ' ', 40 | Struct = ' ', 41 | Event = ' ', 42 | Operator = ' ', 43 | TypeParameter = ' ', 44 | } 45 | 46 | cmp.setup { 47 | preselect = cmp.PreselectMode.None, 48 | completion = { 49 | completeopt = 'menu,menuone,noinsert', 50 | }, 51 | snippet = { 52 | expand = function(args) 53 | luasnip.lsp_expand(args.body) 54 | end, 55 | }, 56 | window = { 57 | completion = cmp.config.window.bordered { 58 | border = 'single', 59 | winhighlight = 'Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:Visual,Search:None', 60 | }, 61 | documentation = cmp.config.window.bordered { 62 | border = 'single', 63 | winhighlight = 'Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:Visual,Search:None', 64 | }, 65 | }, 66 | mapping = cmp.mapping.preset.insert { 67 | [''] = cmp.mapping.scroll_docs(-4), 68 | [''] = cmp.mapping.scroll_docs(4), 69 | [''] = cmp.mapping.abort(), 70 | [''] = cmp.mapping.confirm { select = true }, 71 | [''] = cmp.mapping.complete(), 72 | [''] = cmp.mapping(function(fallback) 73 | if cmp.visible() then 74 | cmp.select_next_item() 75 | elseif luasnip.jumpable(1) then 76 | luasnip.jump(1) 77 | else 78 | fallback() 79 | end 80 | end), 81 | [''] = cmp.mapping(function(fallback) 82 | if cmp.visible() then 83 | cmp.select_prev_item() 84 | elseif luasnip.jumpable(-1) then 85 | luasnip.jump(-1) 86 | else 87 | fallback() 88 | end 89 | end, { 'i', 's' }), 90 | }, 91 | formatting = { 92 | fields = { 'kind', 'abbr' }, 93 | format = function(_, vim_item) 94 | vim_item.kind = cmp_kinds[vim_item.kind] or '' 95 | vim_item.menu = '' 96 | return vim_item 97 | end, 98 | }, 99 | sources = cmp.config.sources({ 100 | { name = 'nvim_lsp' }, 101 | { name = 'path' }, 102 | { name = 'luasnip' }, 103 | }, {}), 104 | } 105 | 106 | require 'gmr.configs.snippets' 107 | 108 | luasnip.filetype_extend('javascriptreact', { 'javascript' }) 109 | luasnip.filetype_extend('typescriptreact', { 'typescript' }) 110 | 111 | vim.api.nvim_create_autocmd('CursorHold', { 112 | group = vim.api.nvim_create_augroup( 113 | 'gmr_cancel_snippet', 114 | { clear = true } 115 | ), 116 | desc = 'Cancel snippet and avoid cursor jumping to the first line of the file', 117 | callback = function() 118 | local ok, luasnip = pcall(require, 'luasnip') 119 | if not ok then 120 | return 121 | end 122 | 123 | if luasnip.expand_or_jumpable() then 124 | vim.cmd 'silent! lua require("luasnip").unlink_current()' 125 | end 126 | end, 127 | }) 128 | end, 129 | } 130 | -------------------------------------------------------------------------------- /lua/gmr/plugins/colorizer.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'catgoose/nvim-colorizer.lua', 3 | cmd = 'ColorizerToggle', 4 | config = function() 5 | require('colorizer').setup { 6 | filetypes = { 7 | 'conf', 8 | 'css', 9 | 'html', 10 | 'javascript', 11 | 'typescript', 12 | 'json', 13 | 'jsonc', 14 | 'lua', 15 | 'yaml', 16 | }, 17 | user_default_options = { 18 | RGB = true, 19 | RRGGBB = true, 20 | names = false, 21 | RRGGBBAA = true, 22 | AARRGGBB = true, 23 | rgb_fn = true, 24 | hsl_fn = true, 25 | css = true, 26 | css_fn = true, 27 | mode = 'virtualtext', 28 | tailwind = true, 29 | virtualtext = ' ██', 30 | }, 31 | } 32 | end, 33 | } 34 | -------------------------------------------------------------------------------- /lua/gmr/plugins/colorschemes/black_white.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'gmr458/black_white.nvim', 3 | lazy = false, 4 | priority = 1000, 5 | build = ':BlackWhiteCompile', 6 | config = function() 7 | require('black_white').setup { 8 | transparent_background = false, 9 | cursorline = false, 10 | treesitter_context_underline = true, 11 | } 12 | vim.cmd.colorscheme 'black_white' 13 | end, 14 | } 15 | -------------------------------------------------------------------------------- /lua/gmr/plugins/colorschemes/cold.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'gmr458/cold.nvim', 3 | lazy = false, 4 | priority = 1000, 5 | build = ':ColdCompile', 6 | config = function() 7 | require('cold').setup { 8 | transparent_background = false, 9 | cursorline = false, 10 | treesitter_context_bg = false, 11 | float_borderless = false, 12 | } 13 | vim.cmd.colorscheme 'cold' 14 | end, 15 | } 16 | -------------------------------------------------------------------------------- /lua/gmr/plugins/colorschemes/github.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'projekt0n/github-nvim-theme', 3 | lazy = false, 4 | priority = 1000, 5 | config = function() 6 | require('github-theme').setup { 7 | styles = { 8 | comments = 'NONE', 9 | functions = 'NONE', 10 | keywords = 'NONE', 11 | variables = 'NONE', 12 | conditionals = 'NONE', 13 | constants = 'NONE', 14 | numbers = 'NONE', 15 | operators = 'NONE', 16 | strings = 'NONE', 17 | types = 'NONE', 18 | }, 19 | groups = { 20 | all = { 21 | SnacksPickerInput = { bg = 'bg0' }, 22 | SnacksPickerInputBorder = { bg = 'bg0' }, 23 | SnacksPickerList = { bg = 'bg3' }, 24 | SnacksPickerListBorder = { bg = 'bg3' }, 25 | SnacksPickerPreviewBorder = { bg = 'bg0' }, 26 | SnacksPickerDir = { link = 'Comment' }, 27 | SnacksPickerRow = { link = 'Comment' }, 28 | NvimTreeWinSeparator = { bg = 'bg1', fg = 'bg1' }, 29 | TreesitterContextLineNumber = { 30 | bg = 'palette.accent.subtle', 31 | }, 32 | 33 | StatusLine = { bg = 'bg0', fg = 'palette.fg.muted' }, 34 | StatusLineMode = { bg = 'palette.black.bright', fg = 'fg' }, 35 | StatusLineMedium = { bg = 'bg2', fg = 'palette.fg.muted' }, 36 | StatusLineGitBranchIcon = { bg = 'bg2', fg = 'orange' }, 37 | StatusLineGitDiffAdded = { 38 | bg = 'bg2', 39 | fg = 'palette.green.base', 40 | }, 41 | StatusLineGitDiffChanged = { 42 | bg = 'bg2', 43 | fg = 'palette.attention.fg', 44 | }, 45 | StatusLineGitDiffRemoved = { 46 | bg = 'bg2', 47 | fg = 'palette.danger.fg', 48 | }, 49 | StatusLineLspError = { 50 | bg = 'bg2', 51 | fg = 'palette.danger.fg', 52 | }, 53 | StatusLineLspWarn = { 54 | bg = 'bg2', 55 | fg = 'palette.attention.fg', 56 | }, 57 | StatusLineLspHint = { bg = 'bg2', fg = 'palette.fg.muted' }, 58 | StatusLineLspInfo = { bg = 'bg2', fg = 'palette.accent.fg' }, 59 | StatusLineLspMessages = { 60 | bg = 'bg0', 61 | }, 62 | }, 63 | }, 64 | } 65 | 66 | vim.cmd.colorscheme 'github_dark_dimmed' 67 | end, 68 | } 69 | -------------------------------------------------------------------------------- /lua/gmr/plugins/colorschemes/rose-pine.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'rose-pine/neovim', 3 | name = 'rose-pine', 4 | lazy = false, 5 | priority = 1000, 6 | config = function() 7 | require('rose-pine').setup { 8 | highlight_groups = { 9 | TelescopeBorder = { fg = 'overlay', bg = 'overlay' }, 10 | TelescopeNormal = { fg = 'subtle', bg = 'overlay' }, 11 | TelescopeSelection = { fg = 'text', bg = 'highlight_med' }, 12 | TelescopeSelectionCaret = { fg = 'love', bg = 'highlight_med' }, 13 | TelescopeMultiSelection = { fg = 'text', bg = 'highlight_high' }, 14 | 15 | TelescopeTitle = { fg = 'base', bg = 'love' }, 16 | TelescopePromptTitle = { fg = 'base', bg = 'pine' }, 17 | TelescopePreviewTitle = { fg = 'base', bg = 'iris' }, 18 | 19 | TelescopePromptNormal = { fg = 'text', bg = 'surface' }, 20 | TelescopePromptBorder = { fg = 'surface', bg = 'surface' }, 21 | 22 | TelescopePreviewNormal = { link = 'Normal' }, 23 | TelescopePreviewBorder = { bg = 'base', fg = 'base' }, 24 | 25 | NvimTreeNormal = { bg = 'highlight_low' }, 26 | NvimTreeWinSeparator = { 27 | bg = 'highlight_low', 28 | fg = 'highlight_low', 29 | }, 30 | 31 | WinBar = { bg = 'base', fg = 'subtle' }, 32 | 33 | StatusLine = { bg = 'surface', fg = 'subtle' }, 34 | StatusLineNC = { link = 'StatusLine' }, 35 | StatusLineTerm = { link = 'StatusLine' }, 36 | StatusLineTermNC = { link = 'StatusLine' }, 37 | StatusLineMode = { bg = 'iris', fg = 'base' }, 38 | StatusLineMedium = { bg = 'overlay' }, 39 | StatusLineGitBranchIcon = { bg = 'overlay' }, 40 | StatusLineGitDiffAdded = { bg = 'overlay', fg = 'foam' }, 41 | StatusLineGitDiffChanged = { bg = 'overlay', fg = 'rose' }, 42 | StatusLineGitDiffRemoved = { bg = 'overlay', fg = 'love' }, 43 | 44 | StatusLineLspError = { bg = 'overlay', fg = 'love' }, 45 | StatusLineLspHint = { bg = 'overlay', fg = 'iris' }, 46 | StatusLineLspWarn = { bg = 'overlay', fg = 'gold' }, 47 | 48 | GrappleNormal = { link = 'NormalFloat' }, 49 | GrappleBorder = { fg = 'surface', bg = 'surface' }, 50 | }, 51 | } 52 | vim.cmd.colorscheme 'rose-pine' 53 | end, 54 | } 55 | -------------------------------------------------------------------------------- /lua/gmr/plugins/colorschemes/vscode_modern_theme.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'gmr458/vscode_modern_theme.nvim', 3 | lazy = false, 4 | priority = 1000, 5 | config = function() 6 | local vscode_modern = require 'vscode_modern' 7 | 8 | vscode_modern.setup { 9 | cursorline = true, 10 | transparent_background = false, 11 | nvim_tree_darker = true, 12 | italic_keyword = false, 13 | custom_dark_background = '#111111', 14 | custom_statusline_dark_background = '#080808', 15 | } 16 | 17 | vim.cmd.colorscheme 'vscode_modern' 18 | end, 19 | } 20 | -------------------------------------------------------------------------------- /lua/gmr/plugins/formatter.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'mhartington/formatter.nvim', 3 | cmd = 'Format', 4 | config = function() 5 | local util = require 'formatter.util' 6 | 7 | local prettier = require 'gmr.configs.formatter.prettier' 8 | local web = require 'gmr.configs.formatter.web' 9 | 10 | require('formatter').setup { 11 | logging = true, 12 | filetype = { 13 | astro = { prettier }, 14 | cs = { require('formatter.filetypes.cs').csharpier }, 15 | css = { prettier }, 16 | dart = { require('formatter.filetypes.dart').dartformat }, 17 | gleam = { 18 | function() 19 | return { 20 | exe = 'gleam', 21 | args = { 'format' }, 22 | } 23 | end, 24 | }, 25 | go = { require('formatter.filetypes.go').gofumpt }, 26 | html = { prettier }, 27 | htmldjango = { 28 | function() 29 | return { 30 | exe = 'djlint', 31 | args = { 32 | '--reformat', 33 | '--preserve-leading-space', 34 | '--preserve-blank-lines', 35 | '--indent', 36 | vim.bo.tabstop, 37 | }, 38 | } 39 | end, 40 | }, 41 | java = { 42 | function() 43 | return { 44 | exe = 'google-java-format', 45 | args = { 46 | '--aosp', 47 | util.escape_path( 48 | util.get_current_buffer_file_path() 49 | ), 50 | '--replace', 51 | '--skip-removing-unused-imports', 52 | }, 53 | stdin = true, 54 | } 55 | end, 56 | }, 57 | javascript = { web }, 58 | javascriptreact = { web }, 59 | json = { web }, 60 | jsonc = { web }, 61 | kotlin = { 62 | function() 63 | return { 64 | exe = 'ktfmt', 65 | args = { 66 | '--kotlinlang-style', 67 | vim.fn.shellescape( 68 | vim.api.nvim_buf_get_name(0) 69 | ), 70 | }, 71 | stdin = true, 72 | } 73 | end, 74 | }, 75 | lua = require('formatter.filetypes.lua').stylua, 76 | ocaml = { 77 | function() 78 | return { 79 | exe = 'ocamlformat', 80 | args = { 81 | '--enable-outside-detected-project', 82 | '--break-cases=toplevel', 83 | '--if-then-else=fit-or-vertical', 84 | vim.fn.shellescape( 85 | vim.api.nvim_buf_get_name(0) 86 | ), 87 | }, 88 | stdin = true, 89 | } 90 | end, 91 | }, 92 | php = require('formatter.filetypes.php').pint, 93 | proto = require('formatter.filetypes.proto').buf_format, 94 | python = require('formatter.filetypes.python').ruff, 95 | rust = require('formatter.filetypes.rust').rustfmt, 96 | scss = { prettier }, 97 | svelte = { prettier }, 98 | template = { 99 | function() 100 | return { 101 | exe = 'djlint', 102 | args = { 103 | '--reformat', 104 | '--quiet', 105 | vim.fn.shellescape( 106 | vim.api.nvim_buf_get_name(0) 107 | ), 108 | }, 109 | stdin = false, 110 | } 111 | end, 112 | }, 113 | toml = require('formatter.filetypes.toml').taplo, 114 | typescript = { web }, 115 | typescriptreact = { web }, 116 | yaml = require('formatter.filetypes.yaml').yamlfmt, 117 | zig = require('formatter.filetypes.zig').zigfmt, 118 | }, 119 | } 120 | end, 121 | } 122 | -------------------------------------------------------------------------------- /lua/gmr/plugins/fzf.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'ibhagwan/fzf-lua', 3 | cmd = 'FzfLua', 4 | config = function() 5 | local delta_syntax_theme = { 6 | ['dark'] = 'Dracula', 7 | ['light'] = 'GitHub', 8 | } 9 | 10 | local preview_pager = table.concat({ 11 | 'delta', 12 | '--syntax-theme', 13 | delta_syntax_theme[vim.o.background], 14 | '--line-numbers', 15 | -- '--side-by-side', 16 | '--hunk-header-style=\'omit\'', 17 | '--file-style=\'omit\'', 18 | }, ' ') 19 | 20 | local actions = require 'fzf-lua.actions' 21 | 22 | require('fzf-lua').setup { 23 | winopts = { 24 | border = 'single', 25 | row = 0.40, 26 | col = 0.49, 27 | backdrop = 100, 28 | preview = { 29 | vertical = 'down:75%', 30 | horizontal = 'right:60%', 31 | layout = 'vertical', 32 | }, 33 | on_create = function() 34 | vim.keymap.set( 35 | 't', 36 | '', 37 | '', 38 | { silent = true, buffer = true } 39 | ) 40 | vim.keymap.set( 41 | 't', 42 | '', 43 | '', 44 | { silent = true, buffer = true } 45 | ) 46 | end, 47 | }, 48 | keymap = { 49 | builtin = { 50 | [''] = 'toggle-preview', 51 | [''] = 'preview-page-down', 52 | [''] = 'preview-page-up', 53 | }, 54 | fzf = { 55 | ['tab'] = 'toggle-down', 56 | ['shift-tab'] = 'toggle-up', 57 | ['ctrl-d'] = 'preview-page-down', 58 | ['ctrl-u'] = 'preview-page-up', 59 | ['ctrl-q'] = 'select-all+accept', 60 | }, 61 | }, 62 | actions = { 63 | files = { 64 | ['enter'] = actions.file_edit_or_qf, 65 | ['alt-q'] = actions.file_sel_to_qf, 66 | ['ctrl-x'] = actions.file_split, 67 | ['ctrl-v'] = actions.file_vsplit, 68 | }, 69 | }, 70 | fzf_opts = { 71 | ['--pointer'] = '▌', 72 | ['--highlight-line'] = true, 73 | ['--color'] = 'gutter:-1', 74 | ['--scrollbar'] = '█', 75 | ['--info'] = 'hidden', 76 | ['--no-bold'] = '', 77 | }, 78 | files = { 79 | git_icons = false, 80 | cwd_prompt = false, 81 | formatter = 'path.filename_first', 82 | no_header = true, 83 | }, 84 | buffers = { 85 | no_header = true, 86 | }, 87 | git = { 88 | status = { 89 | preview_pager = preview_pager, 90 | no_header = true, 91 | }, 92 | }, 93 | grep = { 94 | no_header = true, 95 | git_icons = false, 96 | }, 97 | lsp = { 98 | no_header = true, 99 | symbols = { 100 | symbol_icons = { 101 | File = ' ', 102 | Module = ' ', 103 | Namespace = ' ', 104 | Package = ' ', 105 | Class = ' ', 106 | Method = ' ', 107 | Property = ' ', 108 | Field = ' ', 109 | Constructor = ' ', 110 | Enum = ' ', 111 | Interface = ' ', 112 | Function = ' ', 113 | Variable = ' ', 114 | Constant = ' ', 115 | String = ' ', 116 | Number = ' ', 117 | Boolean = ' ', 118 | Array = ' ', 119 | Object = ' ', 120 | Key = ' ', 121 | Null = 'null ', 122 | EnumMember = ' ', 123 | Struct = ' ', 124 | Event = ' ', 125 | Operator = ' ', 126 | TypeParameter = ' ', 127 | }, 128 | }, 129 | code_actions = { 130 | previewer = 'codeaction_native', 131 | preview_pager = preview_pager, 132 | }, 133 | }, 134 | } 135 | end, 136 | } 137 | -------------------------------------------------------------------------------- /lua/gmr/plugins/gitsigns.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'lewis6991/gitsigns.nvim', 3 | event = 'BufReadPost', 4 | config = function() 5 | require('gitsigns').setup { 6 | on_attach = function(bufnr) 7 | local gitsigns = require 'gitsigns' 8 | 9 | local function map(mode, l, r, opts) 10 | opts = opts or {} 11 | opts.buffer = bufnr 12 | vim.keymap.set(mode, l, r, opts) 13 | end 14 | 15 | -- Navigation 16 | map('n', ']c', function() 17 | if vim.wo.diff then 18 | vim.cmd.normal { ']c', bang = true } 19 | else 20 | gitsigns.nav_hunk 'next' 21 | end 22 | end) 23 | 24 | map('n', '[c', function() 25 | if vim.wo.diff then 26 | vim.cmd.normal { '[c', bang = true } 27 | else 28 | gitsigns.nav_hunk 'prev' 29 | end 30 | end) 31 | 32 | -- Actions 33 | map('n', 'sh', gitsigns.stage_hunk) 34 | map('n', 'rh', gitsigns.reset_hunk) 35 | map('v', 'sh', function() 36 | gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } 37 | end) 38 | map('v', 'rh', function() 39 | gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } 40 | end) 41 | map('n', 'ush', gitsigns.undo_stage_hunk) 42 | map('n', 'ph', gitsigns.preview_hunk) 43 | map('n', 'td', gitsigns.toggle_deleted) 44 | end, 45 | } 46 | end, 47 | } 48 | -------------------------------------------------------------------------------- /lua/gmr/plugins/grapple.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'cbochs/grapple.nvim', 3 | cmd = 'Grapple', 4 | config = function() 5 | require('grapple').setup { 6 | tag_title = function(scope) 7 | return vim.fn.fnamemodify(scope.id, ':t') 8 | end, 9 | styles = { 10 | custom = function(entity, _) 11 | local Path = require 'grapple.path' 12 | 13 | local parent_mark = { 14 | virt_text = { 15 | { 16 | Path.parent(Path.fs_short(entity.tag.path)), 17 | 'GrappleHint', 18 | }, 19 | }, 20 | virt_text_pos = 'eol', 21 | } 22 | 23 | local line = { 24 | display = Path.base(entity.tag.path), 25 | marks = { parent_mark }, 26 | } 27 | 28 | return line 29 | end, 30 | }, 31 | style = 'custom', 32 | win_opts = { 33 | width = 50, 34 | height = 12, 35 | row = 0.3, 36 | }, 37 | } 38 | end, 39 | } 40 | -------------------------------------------------------------------------------- /lua/gmr/plugins/guess-indent.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'NMAC427/guess-indent.nvim', 3 | event = 'BufReadPost', 4 | config = function() 5 | require('guess-indent').setup() 6 | end, 7 | } 8 | -------------------------------------------------------------------------------- /lua/gmr/plugins/jdtls.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'mfussenegger/nvim-jdtls', 3 | ft = 'java', 4 | dependencies = { 'neovim/nvim-lspconfig' }, 5 | } 6 | -------------------------------------------------------------------------------- /lua/gmr/plugins/lazydev.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'folke/lazydev.nvim', 3 | ft = 'lua', 4 | config = function() 5 | require('lazydev').setup { 6 | library = { 7 | { path = 'luvit-meta/library', words = { 'vim%.uv' } }, 8 | }, 9 | } 10 | end, 11 | } 12 | -------------------------------------------------------------------------------- /lua/gmr/plugins/lsp.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'neovim/nvim-lspconfig', 3 | cmd = { 'Start' }, 4 | dependencies = { 5 | require 'gmr.plugins.lazydev', 6 | require 'gmr.plugins.luvit-meta', 7 | { 'b0o/SchemaStore.nvim' }, 8 | }, 9 | config = function() 10 | vim.api.nvim_create_user_command('Start', function() 11 | local lspconfiguser = require 'gmr.configs.lsp' 12 | lspconfiguser.setup_diagnostic_config() 13 | 14 | local servers = require('gmr.configs.lsp.servers').to_setup 15 | for _, server in pairs(servers) do 16 | local server_opts = { 17 | on_attach = lspconfiguser.on_attach, 18 | } 19 | 20 | local has_custom_opts, server_custom_opts = 21 | pcall(require, 'gmr.configs.lsp.settings.' .. server) 22 | if has_custom_opts then 23 | server_opts = vim.tbl_deep_extend( 24 | 'force', 25 | server_opts, 26 | server_custom_opts 27 | ) 28 | end 29 | 30 | local has_custom_commands, server_custom_commands = 31 | pcall(require, 'gmr.configs.lsp.commands.' .. server) 32 | if has_custom_commands then 33 | server_opts.commands = server_custom_commands 34 | end 35 | 36 | vim.lsp.config(server, server_opts) 37 | vim.lsp.enable(server) 38 | end 39 | end, {}) 40 | 41 | vim.api.nvim_create_user_command('LspCheckhealth', function() 42 | vim.cmd ':silent :vertical checkhealth vim.lsp' 43 | end, {}) 44 | end, 45 | } 46 | -------------------------------------------------------------------------------- /lua/gmr/plugins/luvit-meta.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'Bilal2453/luvit-meta', 3 | lazy = true, 4 | } 5 | -------------------------------------------------------------------------------- /lua/gmr/plugins/mason.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'williamboman/mason.nvim', 3 | event = 'BufReadPost', 4 | config = function() 5 | require('mason').setup { 6 | ui = { 7 | border = 'single', 8 | backdrop = 100, 9 | width = 0.8, 10 | height = 0.7, 11 | icons = { 12 | package_installed = '󰸞', 13 | package_pending = '', 14 | package_uninstalled = '', 15 | }, 16 | }, 17 | } 18 | 19 | vim.api.nvim_create_user_command('MasonInstallAll', function() 20 | local packages = require 'gmr.configs.mason.packages' 21 | vim.cmd('MasonInstall ' .. table.concat(packages, ' ')) 22 | end, {}) 23 | end, 24 | } 25 | -------------------------------------------------------------------------------- /lua/gmr/plugins/mini-indentscope.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'echasnovski/mini.indentscope', 3 | version = false, 4 | event = 'BufReadPost', 5 | config = function() 6 | local indentscope = require 'mini.indentscope' 7 | 8 | indentscope.setup { 9 | draw = { 10 | delay = 0, 11 | animation = indentscope.gen_animation.none(), 12 | }, 13 | mappings = { 14 | object_scope = '', 15 | object_scope_with_border = '', 16 | goto_top = '', 17 | goto_bottom = '', 18 | }, 19 | symbol = '│', 20 | } 21 | end, 22 | } 23 | -------------------------------------------------------------------------------- /lua/gmr/plugins/mini-surround.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'echasnovski/mini.surround', 3 | version = false, 4 | config = function() 5 | require('mini.surround').setup {} 6 | end, 7 | } 8 | -------------------------------------------------------------------------------- /lua/gmr/plugins/navic.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'SmiteshP/nvim-navic', 3 | config = function() 4 | local icons = { 5 | disable = { 6 | File = 'file ', 7 | Module = 'module ', 8 | Namespace = 'namespace ', 9 | Package = 'package ', 10 | Class = 'class ', 11 | Method = 'method ', 12 | Property = 'property ', 13 | Field = 'field ', 14 | Constructor = 'constructor ', 15 | Enum = 'enum ', 16 | Interface = 'interface ', 17 | Function = 'function ', 18 | Variable = 'variable ', 19 | Constant = 'constant ', 20 | String = 'string ', 21 | Number = 'number ', 22 | Boolean = 'boolean ', 23 | Array = 'array ', 24 | Object = 'object ', 25 | Key = 'key ', 26 | Null = 'null ', 27 | EnumMember = 'enum member ', 28 | Struct = 'struct ', 29 | Event = 'event ', 30 | Operator = 'operator ', 31 | TypeParameter = 'type parameter ', 32 | }, 33 | enable = { 34 | File = ' ', 35 | Module = ' ', 36 | Namespace = ' ', 37 | Package = ' ', 38 | Class = ' ', 39 | Method = ' ', 40 | Property = ' ', 41 | Field = ' ', 42 | Constructor = ' ', 43 | Enum = ' ', 44 | Interface = ' ', 45 | Function = ' ', 46 | Variable = ' ', 47 | Constant = ' ', 48 | String = ' ', 49 | Number = ' ', 50 | Boolean = ' ', 51 | Array = ' ', 52 | Object = ' ', 53 | Key = ' ', 54 | Null = 'null ', 55 | EnumMember = ' ', 56 | Struct = ' ', 57 | Event = ' ', 58 | Operator = ' ', 59 | TypeParameter = ' ', 60 | }, 61 | } 62 | 63 | require('nvim-navic').setup { 64 | icons = icons.enable, 65 | highlight = true, 66 | separator = '  ', 67 | depth_limit = 0, 68 | depth_limit_indicator = '..', 69 | safe_output = true, 70 | } 71 | end, 72 | } 73 | -------------------------------------------------------------------------------- /lua/gmr/plugins/null-ls.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'nvimtools/none-ls.nvim', 3 | dependencies = { 'nvim-lua/plenary.nvim' }, 4 | config = function() 5 | local null_ls = require 'null-ls' 6 | 7 | null_ls.setup { 8 | sources = { 9 | null_ls.builtins.diagnostics.golangci_lint, 10 | }, 11 | } 12 | end, 13 | } 14 | -------------------------------------------------------------------------------- /lua/gmr/plugins/nvim-tree.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'nvim-tree/nvim-tree.lua', 3 | cmd = 'NvimTreeFindFileToggle', 4 | config = function() 5 | require('nvim-tree').setup { 6 | hijack_cursor = true, 7 | disable_netrw = true, 8 | view = { width = {} }, 9 | -- view = { 10 | -- cursorline = true, 11 | -- width = function() 12 | -- return math.floor(vim.opt.columns:get() / 3) 13 | -- end, 14 | -- float = { 15 | -- enable = true, 16 | -- open_win_config = function() 17 | -- local lines = vim.o.lines - vim.o.cmdheight 18 | -- local columns = vim.o.columns 19 | -- 20 | -- return { 21 | -- border = 'single', 22 | -- relative = 'editor', 23 | -- row = math.floor(lines * 0.08), 24 | -- col = math.floor((columns / 2) / 2) - 1, 25 | -- width = math.floor(columns * 0.5), 26 | -- height = math.floor(lines * 0.8), 27 | -- } 28 | -- end, 29 | -- }, 30 | -- }, 31 | renderer = { 32 | root_folder_label = function(path) 33 | return vim.fn.fnamemodify(path, ':t') 34 | end, 35 | indent_width = 3, 36 | special_files = {}, 37 | highlight_git = false, 38 | highlight_diagnostics = false, 39 | highlight_opened_files = 'none', 40 | highlight_modified = 'none', 41 | indent_markers = { 42 | enable = false, 43 | inline_arrows = true, 44 | icons = { 45 | corner = '└', 46 | edge = '│', 47 | item = '│', 48 | bottom = '─', 49 | none = ' ', 50 | }, 51 | }, 52 | icons = { 53 | web_devicons = { 54 | file = { 55 | enable = true, 56 | color = true, 57 | }, 58 | folder = { 59 | enable = false, 60 | color = true, 61 | }, 62 | }, 63 | git_placement = 'after', 64 | modified_placement = 'before', 65 | padding = ' ', 66 | symlink_arrow = ' 󰁔 ', 67 | show = { 68 | file = true, 69 | folder = true, 70 | folder_arrow = true, 71 | git = true, 72 | modified = true, 73 | diagnostics = true, 74 | bookmarks = true, 75 | }, 76 | glyphs = { 77 | git = { 78 | unstaged = 'M', 79 | staged = 'A', 80 | unmerged = 'U', 81 | renamed = 'R', 82 | untracked = '??', 83 | deleted = 'D', 84 | ignored = '!', 85 | }, 86 | }, 87 | }, 88 | }, 89 | git = { 90 | enable = true, 91 | timeout = 1000, 92 | }, 93 | modified = { 94 | enable = true, 95 | }, 96 | filters = { 97 | git_ignored = false, 98 | dotfiles = false, 99 | git_clean = false, 100 | no_buffer = false, 101 | custom = { '^\\.git$', 'node_modules' }, 102 | exclude = {}, 103 | }, 104 | } 105 | end, 106 | } 107 | -------------------------------------------------------------------------------- /lua/gmr/plugins/scriptease.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'tpope/vim-scriptease', 3 | cmd = { 4 | 'PP', 5 | 'Runtime', 6 | 'Disarm', 7 | 'Scriptnames', 8 | 'Messages', 9 | 'Verbose', 10 | 'Time', 11 | 'Breakadd', 12 | 'Breakdel', 13 | 'Vedit', 14 | 'Vtabedit', 15 | }, 16 | } 17 | -------------------------------------------------------------------------------- /lua/gmr/plugins/snacks.lua: -------------------------------------------------------------------------------- 1 | local layout_normal = { 2 | layout = { 3 | preview = false, 4 | layout = { 5 | max_width = 70, 6 | height = 0.8, 7 | backdrop = false, 8 | box = 'vertical', 9 | { 10 | win = 'input', 11 | height = 1, 12 | border = 'solid', 13 | }, 14 | { 15 | win = 'list', 16 | border = 'solid', 17 | }, 18 | }, 19 | }, 20 | } 21 | 22 | local function get_layout_fullscreen_vertical(width_preview) 23 | return { 24 | layout = { 25 | fullscreen = true, 26 | layout = { 27 | backdrop = false, 28 | box = 'horizontal', 29 | { 30 | box = 'vertical', 31 | { 32 | win = 'input', 33 | height = 1, 34 | border = 'solid', 35 | }, 36 | { 37 | win = 'list', 38 | border = 'solid', 39 | }, 40 | }, 41 | { 42 | win = 'preview', 43 | width = width_preview, 44 | border = 'solid', 45 | }, 46 | }, 47 | }, 48 | } 49 | end 50 | 51 | local layout_fullscreen_horizontal = { 52 | layout = { 53 | fullscreen = true, 54 | layout = { 55 | backdrop = false, 56 | box = 'vertical', 57 | { 58 | win = 'input', 59 | height = 1, 60 | border = 'solid', 61 | }, 62 | { win = 'list', border = 'solid' }, 63 | { 64 | win = 'preview', 65 | height = 0.6, 66 | border = 'vpad', 67 | }, 68 | }, 69 | }, 70 | } 71 | 72 | local layout_fullscreen_vertical = { 73 | layout = { 74 | fullscreen = true, 75 | layout = { 76 | backdrop = false, 77 | box = 'horizontal', 78 | { 79 | box = 'vertical', 80 | { 81 | win = 'input', 82 | height = 1, 83 | border = 'solid', 84 | }, 85 | { 86 | win = 'list', 87 | border = 'solid', 88 | }, 89 | }, 90 | { 91 | win = 'preview', 92 | width = 0.6, 93 | border = 'solid', 94 | }, 95 | }, 96 | }, 97 | } 98 | 99 | return { 100 | 'folke/snacks.nvim', 101 | priority = 1000, 102 | lazy = false, 103 | cmd = { 104 | 'SnacksPickerFiles', 105 | 'SnacksPickerGitStatus', 106 | 'SnacksPickerGrep', 107 | 'SnacksPickerHelp', 108 | 'SnacksPickerBuffers', 109 | 'SnacksPickerLspReferences', 110 | 'SnacksPickerLspImplementations', 111 | 'SnacksPickerLspDocumentSymbols', 112 | 'SnacksPickerLspWorkspaceSymbols', 113 | }, 114 | config = function() 115 | require('snacks').setup { 116 | bigfile = { enabled = false }, 117 | dashboard = { enabled = false }, 118 | image = { enabled = false }, 119 | indent = { enabled = false }, 120 | input = { enabled = false }, 121 | notifier = { enabled = false }, 122 | picker = { 123 | prompt = ' ', 124 | ui_select = false, 125 | formatters = { 126 | file = { 127 | filename_first = true, 128 | }, 129 | }, 130 | previewers = { 131 | git = { 132 | native = true, 133 | }, 134 | }, 135 | win = { 136 | input = { 137 | keys = { 138 | [''] = { 'list_down', mode = { 'i', 'n' } }, 139 | [''] = { 'list_up', mode = { 'i', 'n' } }, 140 | [''] = { 'edit_split', mode = { 'i', 'n' } }, 141 | [''] = { 142 | 'preview_scroll_up', 143 | mode = { 'i', 'n' }, 144 | }, 145 | [''] = { 146 | 'preview_scroll_down', 147 | mode = { 'i', 'n' }, 148 | }, 149 | }, 150 | }, 151 | }, 152 | icons = { 153 | kinds = { 154 | Array = 'array', 155 | Boolean = 'boolean', 156 | Class = 'class', 157 | Color = 'color', 158 | Control = 'control', 159 | Collapsed = 'collapsed', 160 | Constant = 'constant', 161 | Constructor = 'constructor', 162 | Copilot = 'copilot', 163 | Enum = 'enum', 164 | EnumMember = 'enumMember', 165 | Event = 'event', 166 | Field = 'field', 167 | File = 'file', 168 | Folder = 'folder', 169 | Function = 'function', 170 | Interface = 'interface', 171 | Key = 'key', 172 | Keyword = 'keyword', 173 | Method = 'method', 174 | Module = 'module', 175 | Namespace = 'namespace', 176 | Null = 'null', 177 | Number = 'number', 178 | Object = 'object', 179 | Operator = 'operator', 180 | Package = 'package', 181 | Property = 'property', 182 | Reference = 'reference', 183 | Snippet = 'snippet', 184 | String = 'string', 185 | Struct = 'struct', 186 | Text = 'text', 187 | TypeParameter = 'typeParameter', 188 | Unit = 'unit', 189 | Unknown = 'unknown', 190 | Value = 'value', 191 | Variable = 'variable', 192 | }, 193 | }, 194 | }, 195 | scope = { enabled = false }, 196 | scroll = { enabled = false }, 197 | statuscolumn = { enabled = false }, 198 | words = { enabled = false }, 199 | } 200 | 201 | vim.api.nvim_create_user_command('SnacksPickerFiles', function() 202 | Snacks.picker.files(layout_normal) 203 | end, {}) 204 | 205 | vim.api.nvim_create_user_command('SnacksPickerGitBranches', function() 206 | Snacks.picker.git_branches(layout_fullscreen_vertical) 207 | end, {}) 208 | 209 | vim.api.nvim_create_user_command('SnacksPickerGitDiff', function() 210 | Snacks.picker.git_diff(layout_fullscreen_vertical) 211 | end, {}) 212 | 213 | vim.api.nvim_create_user_command('SnacksPickerGitFiles', function() 214 | Snacks.picker.git_diff(layout_fullscreen_vertical) 215 | end, {}) 216 | 217 | vim.api.nvim_create_user_command('SnacksPickerGitLog', function() 218 | Snacks.picker.git_log(layout_fullscreen_vertical) 219 | end, {}) 220 | 221 | vim.api.nvim_create_user_command('SnacksPickerGitLogFile', function() 222 | Snacks.picker.git_log_file(layout_fullscreen_vertical) 223 | end, {}) 224 | 225 | vim.api.nvim_create_user_command('SnacksPickerGitLogLine', function() 226 | Snacks.picker.git_log_line(layout_fullscreen_vertical) 227 | end, {}) 228 | 229 | vim.api.nvim_create_user_command('SnacksPickerGitStatus', function() 230 | local layout = get_layout_fullscreen_vertical(0.8) 231 | local config = vim.tbl_deep_extend('force', layout, { 232 | win = { 233 | input = { 234 | keys = { 235 | [''] = { 'list_down', mode = { 'i', 'n' } }, 236 | [''] = { 'list_up', mode = { 'i', 'n' } }, 237 | }, 238 | }, 239 | }, 240 | }) 241 | Snacks.picker.git_status(config) 242 | end, {}) 243 | 244 | vim.api.nvim_create_user_command('SnacksPickerGrep', function() 245 | Snacks.picker.grep(layout_fullscreen_horizontal) 246 | end, {}) 247 | 248 | vim.api.nvim_create_user_command('SnacksPickerHelp', function() 249 | Snacks.picker.help(layout_fullscreen_vertical) 250 | end, {}) 251 | 252 | vim.api.nvim_create_user_command('SnacksPickerBuffers', function() 253 | Snacks.picker.buffers(layout_normal) 254 | end, {}) 255 | 256 | vim.api.nvim_create_user_command('SnacksPickerLspReferences', function() 257 | Snacks.picker.lsp_references(layout_fullscreen_horizontal) 258 | end, {}) 259 | 260 | vim.api.nvim_create_user_command( 261 | 'SnacksPickerLspImplementations', 262 | function() 263 | Snacks.picker.lsp_implementations(layout_fullscreen_horizontal) 264 | end, 265 | {} 266 | ) 267 | 268 | vim.api.nvim_create_user_command( 269 | 'SnacksPickerLspDocumentSymbols', 270 | function() 271 | Snacks.picker.lsp_symbols(layout_fullscreen_vertical) 272 | end, 273 | {} 274 | ) 275 | 276 | vim.api.nvim_create_user_command( 277 | 'SnacksPickerLspWorkspaceSymbols', 278 | function() 279 | Snacks.picker.lsp_workspace_symbols(layout_fullscreen_vertical) 280 | end, 281 | {} 282 | ) 283 | end, 284 | } 285 | -------------------------------------------------------------------------------- /lua/gmr/plugins/telescope.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'nvim-telescope/telescope.nvim', 3 | dependencies = { 4 | { 'nvim-lua/plenary.nvim' }, 5 | { 6 | 'nvim-telescope/telescope-fzf-native.nvim', 7 | build = 'make', 8 | }, 9 | }, 10 | cmd = 'Telescope', 11 | config = function() 12 | local telescope = require 'telescope' 13 | local actions = require 'telescope.actions' 14 | local actions_layout = require 'telescope.actions.layout' 15 | local previewers = require 'telescope.previewers' 16 | 17 | local layout_fullscreen = { 18 | layout_strategy = 'vertical', 19 | layout_config = { 20 | prompt_position = 'top', 21 | width = { padding = 0 }, 22 | height = { padding = 0 }, 23 | preview_cutoff = 1, 24 | mirror = true, 25 | }, 26 | } 27 | 28 | telescope.setup { 29 | defaults = { 30 | path_display = { 'filename_first' }, 31 | mappings = { 32 | n = { 33 | [''] = actions_layout.toggle_preview, 34 | }, 35 | i = { 36 | [''] = actions.move_selection_worse, 37 | [''] = actions.move_selection_better, 38 | [''] = actions_layout.toggle_preview, 39 | }, 40 | }, 41 | prompt_prefix = '  ', 42 | selection_caret = ' ', 43 | multi_icon = '', 44 | sorting_strategy = 'ascending', 45 | layout_strategy = nil, 46 | layout_config = nil, 47 | borderchars = { 48 | '─', 49 | '│', 50 | '─', 51 | '│', 52 | '┌', 53 | '┐', 54 | '┘', 55 | '└', 56 | }, 57 | color_devicons = true, 58 | set_env = { 59 | ['COLORTERM'] = 'truecolor', 60 | LESS = '', 61 | DELTA_PAGER = 'less', 62 | }, 63 | extensions = { 64 | fzf = { 65 | fuzzy = true, 66 | override_generic_sorter = true, 67 | override_file_sorter = true, 68 | case_mode = 'smart_case', 69 | }, 70 | }, 71 | vimgrep_arguments = { 72 | 'rg', 73 | '--color=never', 74 | '--no-heading', 75 | '--with-filename', 76 | '--line-number', 77 | '--column', 78 | '--smart-case', 79 | '--hidden', 80 | }, 81 | }, 82 | pickers = { 83 | buffers = { 84 | previewer = false, 85 | layout_config = { 86 | width = 0.7, 87 | prompt_position = 'top', 88 | }, 89 | }, 90 | builtin = { 91 | previewer = false, 92 | layout_config = { 93 | width = 0.3, 94 | prompt_position = 'top', 95 | }, 96 | }, 97 | find_files = { 98 | previewer = false, 99 | layout_strategy = 'vertical', 100 | layout_config = { 101 | prompt_position = 'top', 102 | width = 0.5, 103 | height = 0.7, 104 | preview_cutoff = 1, 105 | mirror = false, 106 | }, 107 | }, 108 | git_status = vim.tbl_deep_extend('force', { 109 | mappings = { 110 | i = { 111 | [''] = actions.move_selection_worse, 112 | [''] = actions.move_selection_better, 113 | }, 114 | }, 115 | previewer = previewers.new_termopen_previewer { 116 | get_command = function(entry, _) 117 | local cmd = { 118 | 'git', 119 | '-c', 120 | 'core.pager=delta', 121 | '-c', 122 | 'delta.side-by-side=false', 123 | '-c', 124 | 'delta.line-numbers=true', 125 | '-c', 126 | 'delta.hunk-header-style=omit', 127 | '-c', 128 | 'delta.file-style=omit', 129 | 'diff', 130 | } 131 | 132 | if entry.status == 'A ' then 133 | table.insert(cmd, '--cached') 134 | end 135 | 136 | table.insert(cmd, entry.value) 137 | 138 | return cmd 139 | end, 140 | }, 141 | }, layout_fullscreen), 142 | help_tags = { 143 | layout_config = { 144 | prompt_position = 'top', 145 | scroll_speed = 4, 146 | width = { padding = 0 }, 147 | height = { padding = 0 }, 148 | preview_width = 0.6, 149 | }, 150 | }, 151 | live_grep = layout_fullscreen, 152 | lsp_document_symbols = layout_fullscreen, 153 | lsp_dynamic_workspace_symbols = layout_fullscreen, 154 | lsp_implementations = layout_fullscreen, 155 | lsp_references = layout_fullscreen, 156 | oldfiles = { 157 | previewer = false, 158 | layout_config = { 159 | prompt_position = 'top', 160 | width = 0.9, 161 | }, 162 | }, 163 | }, 164 | } 165 | 166 | if not require('gmr.core.utils').running_android() then 167 | telescope.load_extension 'fzf' 168 | end 169 | end, 170 | } 171 | -------------------------------------------------------------------------------- /lua/gmr/plugins/treesitter-context.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'nvim-treesitter/nvim-treesitter-context', 3 | event = { 'BufReadPost', 'BufNewFile' }, 4 | config = function() 5 | require('treesitter-context').setup() 6 | 7 | pcall(vim.treesitter.query.set, 'tsx', 'context', '') 8 | end, 9 | } 10 | -------------------------------------------------------------------------------- /lua/gmr/plugins/treesitter.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'nvim-treesitter/nvim-treesitter', 3 | lazy = false, 4 | branch = 'main', 5 | build = ':TSUpdate', 6 | config = function() 7 | local config_parsers = require 'gmr.configs.treesitter.parsers' 8 | local parsers = config_parsers.install_automatically() 9 | 10 | vim.api.nvim_create_user_command('TSInstallAll', function() 11 | require('nvim-treesitter').install(parsers, { max_jobs = 1 }) 12 | end, {}) 13 | 14 | table.insert(parsers, 'javascriptreact') 15 | table.insert(parsers, 'typescriptreact') 16 | table.insert(parsers, 'hyprlang') 17 | 18 | vim.api.nvim_create_autocmd('FileType', { 19 | pattern = parsers, 20 | callback = function() 21 | vim.treesitter.start() 22 | vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()' 23 | vim.bo.indentexpr = 24 | 'v:lua.require\'nvim-treesitter\'.indentexpr()' 25 | end, 26 | }) 27 | end, 28 | } 29 | -------------------------------------------------------------------------------- /lua/gmr/plugins/ts-comments.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'folke/ts-comments.nvim', 3 | event = 'BufReadPost', 4 | config = function() 5 | require('ts-comments').setup() 6 | end, 7 | } 8 | -------------------------------------------------------------------------------- /lua/gmr/plugins/twilight.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'folke/twilight.nvim', 3 | cmd = { 'Twilight', 'TwilightEnable' }, 4 | } 5 | -------------------------------------------------------------------------------- /lua/gmr/plugins/undotree.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'mbbill/undotree', 3 | cmd = 'UndotreeToggle', 4 | } 5 | -------------------------------------------------------------------------------- /lua/gmr/plugins/vim-surround.lua: -------------------------------------------------------------------------------- 1 | return { 2 | event = { 'BufReadPost', 'BufNewFile' }, 3 | 'tpope/vim-surround', 4 | } 5 | -------------------------------------------------------------------------------- /lua/gmr/plugins/web-devicons.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'nvim-tree/nvim-web-devicons', 3 | lazy = true, 4 | config = function() 5 | require('nvim-web-devicons').setup { 6 | override = { 7 | ts = { 8 | icon = '󰛦', 9 | color = '#519aba', 10 | cterm_color = '74', 11 | name = 'Ts', 12 | }, 13 | ['tsx'] = { 14 | icon = '', 15 | color = '#58C4DC', 16 | cterm_color = '26', 17 | name = 'Tsx', 18 | }, 19 | ['jsx'] = { 20 | icon = '', 21 | color = '#58C4DC', 22 | cterm_color = '31', 23 | name = 'Jsx', 24 | }, 25 | }, 26 | } 27 | end, 28 | } 29 | -------------------------------------------------------------------------------- /lua/gmr/plugins/zen-mode.lua: -------------------------------------------------------------------------------- 1 | return { 2 | 'folke/zen-mode.nvim', 3 | cmd = 'ZenMode', 4 | opts = { 5 | window = { 6 | width = 100, 7 | }, 8 | plugins = { 9 | twilight = { enabled = false }, 10 | options = { 11 | winborder = 'none', 12 | }, 13 | }, 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /lua/nvconfig.lua: -------------------------------------------------------------------------------- 1 | local options = { 2 | base46 = { 3 | --- @type 'aquarium' | 'ashes' | 'aylin' | 'ayu_dark' | 'ayu_light' | 'bearded-arc' | 'blossom_light' | 'carbonfox' | 'catppuccin' | 'chadracula' | 'chadracula-evondev' | 'chadtain' | 'chocolate' | 'darcula-dark' | 'dark_horizon' | 'decay' | 'default-dark' | 'default-light' | 'doomchad' | 'eldritch' | 'embark' | 'everblush' | 'everforest' | 'everforest_light' | 'falcon' | 'flex-light' | 'flexoki' | 'flexoki-light' | 'flouromachine' | 'gatekeeper' | 'github_dark' | 'github_light' | 'gruvbox' | 'gruvbox_light' | 'gruvchad' | 'hiberbee' | 'horizon' | 'jabuti' | 'jellybeans' | 'kanagawa' | 'kanagawa-dragon' | 'material-darker' | 'material-deep-ocean' | 'material-lighter' | 'melange' | 'mito-laser' | 'monekai' | 'monochrome' | 'mountain' | 'nano-light' | 'neofusion' | 'nightfox' | 'nightlamp' | 'nightowl' | 'nord' | 'obsidian-ember' | 'oceanic-light' | 'oceanic-next' | 'one_light' | 'onedark' | 'onenord' | 'onenord_light' | 'oxocarbon' | 'palenight' | 'pastelDark' | 'pastelbeans' | 'penumbra_dark' | 'penumbra_light' | 'poimandres' | 'radium' | 'rosepine' | 'rosepine-dawn' | 'rxyhn' | 'scaryforest' | 'seoul256_dark' | 'seoul256_light' | 'solarized_dark' | 'solarized_light' | 'solarized_osaka' | 'starlight' | 'sweetpastel' | 'tokyodark' | 'tokyonight' | 'tomorrow_night' | 'tundra' | 'vesper' | 'vscode_dark' | 'vscode_light' | 'wombat' | 'yoru' | 'zenburn' 4 | theme = 'kanagawa-dragon', 5 | hl_add = { 6 | StatusLine = { bg = 'statusline_bg', fg = 'base07' }, 7 | StatusLineMode = { bg = 'green', fg = 'darker_black' }, 8 | StatusLineMedium = { bg = 'one_bg', fg = '#B0B3B8' }, 9 | StatusLineGitBranchIcon = { bg = 'one_bg', fg = 'orange' }, 10 | StatusLineGitDiffAdded = { bg = 'one_bg', fg = 'green' }, 11 | StatusLineGitDiffChanged = { bg = 'one_bg', fg = 'yellow' }, 12 | StatusLineGitDiffRemoved = { bg = 'one_bg', fg = 'red' }, 13 | StatusLineLspError = { bg = 'one_bg', fg = 'red' }, 14 | StatusLineLspWarn = { bg = 'one_bg', fg = 'yellow' }, 15 | StatusLineLspHint = { bg = 'one_bg', fg = 'purple' }, 16 | StatusLineLspInfo = { bg = 'one_bg', fg = 'green' }, 17 | StatusLineLspMessages = { bg = 'statusline_bg', fg = 'light_grey' }, 18 | DiagnosticUnderlineError = { 19 | undercurl = true, 20 | special = '#f87070', 21 | }, 22 | DiagnosticUnderlineWarn = { 23 | undercurl = true, 24 | special = '#ffe59e', 25 | }, 26 | DiagnosticUnderlineHint = { 27 | undercurl = true, 28 | special = '#c397d8', 29 | }, 30 | DiagnosticUnderlineInfo = { 31 | undercurl = true, 32 | special = '#37d99e', 33 | }, 34 | GitSignsDeleteInline = { bg = '#701414' }, 35 | GitSignsDelete = { fg = '#ab4642' }, 36 | GitSignsChangeInline = { bg = '#4C5B2B' }, 37 | GitSignsAddInline = { bg = '#4C5B2B' }, 38 | GitSignsChange = { fg = '#f7ca88' }, 39 | GitSignsAdd = { fg = '#9EBC9F' }, 40 | FzfLuaNormal = { bg = 'darker_black' }, 41 | FzfLuaBorder = { 42 | bg = 'darker_black', 43 | fg = 'darker_black', 44 | }, 45 | FzfLuaTitle = { bg = 'green', fg = 'darker_black' }, 46 | FzfLuaPreviewBorder = { bg = 'black', fg = 'black' }, 47 | FzfLuaPreviewNormal = { bg = 'black' }, 48 | TelescopePreviewNormal = { link = 'Normal' }, 49 | TelescopePreviewBorder = { bg = 'black', fg = 'black' }, 50 | BlinkCmpMenu = { bg = 'black' }, 51 | BlinkCmpMenuBorder = { 52 | bg = 'black', 53 | fg = 'grey', 54 | }, 55 | BlinkCmpDoc = { bg = 'black' }, 56 | BlinkCmpDocSeparator = { 57 | bg = 'black', 58 | fg = 'grey', 59 | }, 60 | BlinkCmpDocBorder = { 61 | bg = 'black', 62 | fg = 'grey', 63 | }, 64 | BlinkCmpKind = { link = 'Comment' }, 65 | TreesitterContext = { 66 | bg = 'darker_black', 67 | }, 68 | TreesitterContextLineNumber = { 69 | bg = 'darker_black', 70 | fg = 'grey', 71 | }, 72 | CursorLineNr = { bg = 'black2', fg = 'white' }, 73 | WinBar = { fg = 'light_grey' }, 74 | SnacksPickerInput = { bg = 'darker_black' }, 75 | SnacksPickerInputBorder = { bg = 'darker_black' }, 76 | SnacksPickerList = { bg = 'black2' }, 77 | SnacksPickerListBorder = { bg = 'black2' }, 78 | SnacksPickerDir = { link = 'Comment' }, 79 | SnacksPickerRow = { link = 'Comment' }, 80 | }, 81 | hl_override = { 82 | NormalFloat = { bg = 'black' }, 83 | FloatBorder = { 84 | bg = 'black', 85 | fg = 'grey', 86 | }, 87 | DiffDelete = { bg = '#4C1919' }, 88 | DiffAdd = { bg = '#383E2A' }, 89 | DiffChange = { bg = '#7e4e08' }, 90 | DiffText = { bg = '#383E2A' }, 91 | }, 92 | integrations = {}, 93 | changed_themes = {}, 94 | transparency = false, 95 | theme_toggle = { 'radium', 'one_light' }, 96 | }, 97 | ui = { 98 | cmp = { 99 | icons = true, 100 | lspkind_text = true, 101 | style = 'default', -- default/flat_light/flat_dark/atom/atom_colored 102 | }, 103 | telescope = { style = 'borderless' }, -- borderless / bordered 104 | statusline = { 105 | theme = 'default', -- default/vscode/vscode_colored/minimal 106 | -- default/round/block/arrow separators work only for default statusline theme 107 | -- round and block will work for minimal theme only 108 | separator_style = 'default', 109 | order = nil, 110 | modules = nil, 111 | }, 112 | }, 113 | cheatsheet = { 114 | theme = 'grid', -- simple/grid 115 | excluded_groups = { 'terminal (t)', 'autopairs', 'Nvim', 'Opens' }, -- can add group name or with mode 116 | }, 117 | } 118 | 119 | local status, chadrc = pcall(require, 'chadrc') 120 | return vim.tbl_deep_extend('force', options, status and chadrc or {}) 121 | -------------------------------------------------------------------------------- /queries/go/injections.scm: -------------------------------------------------------------------------------- 1 | ; extends 2 | 3 | ( 4 | [ 5 | (raw_string_literal_content) 6 | (interpreted_string_literal_content) 7 | ] @injection.content 8 | (#match? @injection.content "(SELECT|INSERT|UPDATE|DELETE).+(FROM|INTO|VALUES|SET).*(WHERE|GROUP BY)?") 9 | (#set! injection.language "sql") 10 | ) 11 | 12 | ( 13 | [ 14 | (raw_string_literal_content) 15 | (interpreted_string_literal_content) 16 | ] @injection.content 17 | (#match? @injection.content "(CREATE|ALTER|DROP|TRUNCATE).+(TABLE)?") 18 | (#set! injection.language "sql") 19 | ) 20 | -------------------------------------------------------------------------------- /queries/javascript/injections.scm: -------------------------------------------------------------------------------- 1 | ; extends 2 | 3 | ( 4 | [ 5 | (string_fragment) 6 | ] @injection.content 7 | (#match? @injection.content "(SELECT|INSERT|UPDATE|DELETE|CREATE).+(FROM|INTO|VALUES|SET|TABLE).*(WHERE|GROUP BY)?") 8 | (#set! injection.language "sql") 9 | ) 10 | -------------------------------------------------------------------------------- /queries/kotlin/injections.scm: -------------------------------------------------------------------------------- 1 | ; extends 2 | 3 | ( 4 | [ 5 | (string_literal) 6 | ] @injection.content 7 | (#match? @injection.content "(SELECT|INSERT|UPDATE|DELETE).+(FROM|INTO|VALUES|SET).*(WHERE|GROUP BY)?") 8 | (#offset! @injection.content 0 1 0 -1) 9 | (#set! injection.language "sql") 10 | ) 11 | -------------------------------------------------------------------------------- /queries/python/injections.scm: -------------------------------------------------------------------------------- 1 | ; extends 2 | 3 | ( 4 | [ 5 | (string_content) 6 | ] @injection.content 7 | (#match? @injection.content "(SELECT|INSERT|UPDATE|DELETE).+(FROM|INTO|VALUES|SET).*(WHERE|GROUP BY)?") 8 | (#set! injection.language "sql") 9 | ) 10 | -------------------------------------------------------------------------------- /queries/typescript/injections.scm: -------------------------------------------------------------------------------- 1 | ; extends 2 | 3 | ( 4 | [ 5 | (string_fragment) 6 | ] @injection.content 7 | (#match? @injection.content "(SELECT|INSERT|UPDATE|DELETE).+(FROM|INTO|VALUES|SET).*(WHERE|GROUP BY)?") 8 | (#set! injection.language "sql") 9 | ) 10 | --------------------------------------------------------------------------------