diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..39dc07a --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,115 @@ +Checks: 'readability-*, + bsl-*, + cppcoreguidelines-*, + cppcoreguidelines-prefer-member-initializer, + clang-analyzer-core.*, + clang-analyzer-core.StackAddressEscape, + bugprone-assert-side-effect, + bugprone-assignment-in-if-condition, + bugprone-branch-clone, + bugprone-copy-constructor-init, + bugprone-exception-escape, + bugprone-forward-declaration-namespace, + bugprone-incorrect-roundings, + bugprone-infinite-loop, + bugprone-integer-division, + bugprone-macro-parentheses, + bugprone-multiple-statement-macro, + bugprone-parent-virtual-call, + bugprone-redundant-branch-condition, + bugprone-reserved-identifier, + bugprone-sizeof-container, + bugprone-sizeof-expression, + bugprone-string-constructor, + bugprone-string-integer-assignment, + bugprone-suspicious-enum-usage, + bugprone-suspicious-include, + bugprone-suspicious-missing-comma, + bugprone-suspicious-semicolon, + bugprone-swapped-arguments, + bugprone-terminating-continue, + bugprone-too-small-loop-variable, + bugprone-use-after-move, + misc-redundant-expression, + misc-unused-parameters, + misc-const-correctness, + misc-confusable-identifiers, + misc-definitions-in-headers, + misc-header-include-cycle, + misc-include-cleaner, + misc-misplaced-const, + misc-static-assert, + modernize-use-default-member-init, + modernize-loop-convert, + modernize-min-max-use-initializer-list, + modernize-pass-by-value, + modernize-return-braced-init-list, + modernize-use-default-member-init, + modernize-use-designated-initializers, + modernize-use-equals-default, + modernize-use-equals-delete, + modernize-use-nullptr, + modernize-use-override, + modernize-use-starts-ends-with, + modernize-use-using, + readability-identifier-naming, + readability-duplicate-include, + readability-braces-around-statements, + readability-implicit-bool-conversion, + readability-inconsistent-declaration-parameter-name, + readability-make-member-function-const, + readability-misleading-indentation, + readability-redundant-declaration, + readability-redundant-preprocessor, + readability-redundant-member-init, + readability-simplify-boolean-expr, + readability-static-accessed-through-instance, + readability-uppercase-literal-suffix, + readability-identifier-naming, + readability-duplicate-include, + readability-braces-around-statements, + readability-implicit-bool-conversion, + readability-inconsistent-declaration-parameter-name, + readability-make-member-function-const, + readability-const-return-type, + readability-non-const-parameter, + hicpp-signed-bitwise, + -readability-avoid-const-params-in-decls, + -readability-function-cognitive-complexity, + -readability-magic-numbers, + -readability-identifier-length, + -cppcoreguidelines-explicit-virtual-functions, + -cppcoreguidelines-init-variables, + -cppcoreguidelines-non-private-member-variables-in-classes, + -cppcoreguidelines-avoid-magic-numbers, + -cppcoreguidelines-owning-memory, + -cppcoreguidelines-pro-bounds-constant-array-index, + -cppcoreguidelines-special-member-functions, + -cppcoreguidelines-avoid-c-arrays, + -cppcoreguidelines-pro-type-reinterpret-cast, + -cppcoreguidelines-avoid-non-const-global-variables, + -cppcoreguidelines-pro-bounds-pointer-arithmetic' +CheckOptions: + - key: readability-identifier-naming.NamespaceCase + value: lower_case + - key: readability-identifier-naming.ClassCase + value: CamelCase + - key: readability-identifier-naming.PrivateMemberPrefix + value: m_ + - key: readability-identifier-naming.StructCase + value: CamelCase + - key: readability-identifier-naming.FunctionCase + value: camelBack + - key: readability-identifier-naming.VariableCase + value: camelBack + - key: readability-identifier-naming.GlobalConstantCase + value: UPPER_CASE + - key: readability-identifier-naming.EnumConstant + value: UPPER_CASE + - key: bugprone-argument-comment.StrictMode + value: 1 + - key: bugprone-exception-escape.FunctionsThatShouldNotThrow + value: WinMain,SDL_main + - key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic + value: 1 + diff --git a/.clangd b/.clangd new file mode 100644 index 0000000..e980b03 --- /dev/null +++ b/.clangd @@ -0,0 +1,71 @@ +Diagnostics: + UnusedIncludes: Strict + ClangTidy: + Add: + - cppcoreguidelines-* + - clang-analyzer-core.* + - bugprone-assert-side-effect + - bugprone-branch-clone + - bugprone-copy-constructor-init + - bugprone-exception-escape + - bugprone-forward-declaration-namespace + - bugprone-incorrect-roundings + - bugprone-infinite-loop + - bugprone-integer-division + - bugprone-macro-parentheses + - bugprone-multiple-statement-macro + - bugprone-parent-virtual-call + - bugprone-redundant-branch-condition + - bugprone-reserved-identifier + - bugprone-sizeof-container + - bugprone-sizeof-expression + - bugprone-string-constructor + - bugprone-string-integer-assignment + - bugprone-suspicious-enum-usage + - bugprone-suspicious-include + - bugprone-suspicious-missing-comma + - bugprone-suspicious-semicolon + - bugprone-swapped-arguments + - bugprone-terminating-continue + - bugprone-too-small-loop-variable + - llvm-namespace-comment + - misc-definitions-in-headers + - misc-redundant-expression + - misc-unused-parameters + - hicpp-signed-bitwise + - readability-identifier-naming + - readability-duplicate-include + - readability-braces-around-statements + - readability-implicit-bool-conversion + - readability-inconsistent-declaration-parameter-name + - readability-make-member-function-const + - readability-misleading-indentation + - readability-redundant-declaration + - readability-redundant-preprocessor + - readability-redundant-member-init + - readability-simplify-boolean-expr + - readability-static-accessed-through-instance + - readability-uppercase-literal-suffix + Remove: + - readability-avoid-const-params-in-decls + - readability-function-cognitive-complexity + - readability-magic-numbers + - readability-identifier-length + - cppcoreguidelines-explicit-virtual-functions + - cppcoreguidelines-init-variables + - cppcoreguidelines-non-private-member-variables-in-classes + - cppcoreguidelines-avoid-magic-numbers + - cppcoreguidelines-owning-memory + - cppcoreguidelines-pro-bounds-constant-array-index + - cppcoreguidelines-special-member-functions + - cppcoreguidelines-avoid-c-arrays + - cppcoreguidelines-pro-type-reinterpret-cast + CheckOptions: + readability-identifier-naming.FunctionCase: camelBack + readability-identifier-naming.NamespaceCase: lower_case + readability-identifier-naming.ClassCase: CamelCase + readability-identifier-naming.PrivateMemberPrefix: m_ + readability-identifier-naming.StructCase: CamelCase + readability-identifier-naming.VariableCase: camelBack + readability-identifier-naming.GlobalConstantCase: UPPER_CASE + readability-identifier-naming.EnumConstant: UPPER_CASE diff --git a/.gitignore b/.gitignore index d87f6b4..02e3f90 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,7 @@ vim.bundle plugged rplugin.vim plugin/packer_compiled.lua +venv_debugpy +.luarc.json +.luarc.json +Session.vim diff --git a/.luarc.json b/.luarc.json deleted file mode 100644 index 8f4a02f..0000000 --- a/.luarc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", - "Lua.diagnostics.disable": ["undefined-global"] -} - diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..c8af39a --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,5 @@ +repos: + - repo: https://github.com/JohnnyMorganz/stylua + rev: v2.0.2 + hooks: + - id: stylua-system diff --git a/after/lsp/basedpyright.lua b/after/lsp/basedpyright.lua new file mode 100644 index 0000000..5d369c0 --- /dev/null +++ b/after/lsp/basedpyright.lua @@ -0,0 +1,7 @@ +return { + settings = { + basedpyright = { + typeCheckingMode = 'standard', + }, + }, +} diff --git a/after/lsp/clangd.lua b/after/lsp/clangd.lua new file mode 100644 index 0000000..36c7b6e --- /dev/null +++ b/after/lsp/clangd.lua @@ -0,0 +1,21 @@ +return { + cmd = { + 'clangd', + '--compile-commands-dir=build_nvim', + '--query-driver', + '/opt/cortex-a78-2022.08-gcc12.1-linux5.15/bin/aarch64-linux-gnu-g*', + '--clang-tidy', + '--background-index', + '--use-dirty-headers', + '--completion-style=detailed', + }, + root_markers = { + '.clangd', + '.clang-tidy', + '.clang-format', + 'compile_flags.txt', + 'configure.ac', + '.git', + 'build_nvim', + }, +} diff --git a/after/lsp/lua_ls.lua b/after/lsp/lua_ls.lua new file mode 100644 index 0000000..1769114 --- /dev/null +++ b/after/lsp/lua_ls.lua @@ -0,0 +1,22 @@ +return { + settings = { + Lua = { + workspace = { + checkThirdParty = false, + }, + completion = { + callSnippet = 'Replace', + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { + enable = false, + }, + diagnostics = { + disable = { 'missing-fields' }, + }, + format = { + enable = false, + }, + }, + }, +} diff --git a/after/lsp/pyrefly.lua b/after/lsp/pyrefly.lua new file mode 100644 index 0000000..5a13663 --- /dev/null +++ b/after/lsp/pyrefly.lua @@ -0,0 +1,7 @@ +return { + settings = { + pyrefly = { + displayTypeErrors = 'force-on', + }, + }, +} diff --git a/after/lsp/ty.lua b/after/lsp/ty.lua new file mode 100644 index 0000000..e30de6e --- /dev/null +++ b/after/lsp/ty.lua @@ -0,0 +1,9 @@ +return { + settings = { + ty = { + experimental = { + rename = true, + }, + }, + }, +} diff --git a/after/lsp/yamlls.lua b/after/lsp/yamlls.lua new file mode 100644 index 0000000..46dd36b --- /dev/null +++ b/after/lsp/yamlls.lua @@ -0,0 +1,7 @@ +return { + settings = { + yaml = { + validate = true, + }, + }, +} diff --git a/after/syntax/norg.lua b/after/syntax/norg.lua new file mode 100644 index 0000000..46bb63d --- /dev/null +++ b/after/syntax/norg.lua @@ -0,0 +1 @@ +vim.opt_local.conceallevel = 3 diff --git a/ftplugin/markdown.lua b/ftplugin/markdown.lua new file mode 100644 index 0000000..4a91dd7 --- /dev/null +++ b/ftplugin/markdown.lua @@ -0,0 +1,4 @@ +local opts = { noremap = true, silent = false } +vim.keymap.set('n', '', vim.lsp.buf.definition, opts) + +vim.opt_local.conceallevel = 0 diff --git a/init.lua b/init.lua index 7ad4f77..3d931a8 100644 --- a/init.lua +++ b/init.lua @@ -1,135 +1,8 @@ -local cmd = vim.cmd -- to execute Vim commands e.g. cmd('pwd') -local fn = vim.fn -- to call Vim functions e.g. fn.bufnr() -local g = vim.g -- a table to access global variables -local opt = vim.opt -- to set options -local utils = require('utils') - --------------------- PACKER -------------------------------- --- Auto install packer.nvim if not exists -local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' -if fn.empty(fn.glob(install_path)) > 0 then - fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) - vim.cmd 'packadd packer.nvim' +vim.g.mapleader = ',' +vim.g.maplocalleader = ',' +if not vim.g.vscode then + require('config.lazy') + require('my_keymappings') + require('my_autocommands') + require('config.options') end -vim.cmd [[packadd packer.nvim]] --------------------- EXTERNAL ------------------------------ -require('my_plugins') -require('my_keymappings') -require('my_options') -require("my_autocommands") - --- plugins -require('my_telescope') -require('my_lspinstall') -require('my_cmp') --------------------- TREE-SITTER --------------------------- -require('nvim-treesitter.configs').setup({ - ensure_installed = 'maintained', - highlight = { - enable = true - } -}) --------------------- GITSIGNS ------------------------------ -require('gitsigns').setup() --------------------- NVIM-TREE ----------------------------- -require('nvim-tree').setup({ - auto_close = true, - update_cwd = true, - update_to_buf_dir = { - -- enable the feature - enable = true, - -- allow to open the tree if it was previously closed - auto_open = false, - }, - update_focused_file = { - enable = true, - update_cwd = false, - ignore_list = {} - }, - diagnostics = { - enable = true, - icons = { - hint = "", - info = "", - warning = "", - error = "", - } - }, -}) -utils.map('n', 'tt', 'NvimTreeToggle') -g.nvim_tree_highlight_opened_files = 1 -g.nvim_tree_respect_buf_cwd = 1 --------------------- COMMENTED ----------------------------- -require('Comment').setup({ - toggler = { - ---line-comment toggle - line = 'cc', - }, - opleader = { - ---line-comment opfunc mapping - line = 'c', - }, -}) --------------------- CMAKE --------------------------------- -require('telescope').load_extension('cmake') -require('cmake').setup({ - parameters_file = 'neovim.json', -- JSON file to store information about selected target, run arguments and build type. - build_dir = '{cwd}/build_nvim', -- Build directory. The expressions `{cwd}`, `{os}` and `{build_type}` will be expanded with the corresponding text values. -}) -utils.map('n', '', ':CMake build:copen') - --- msbuild errorformat -opt.errorformat:append("\\ %#%f(%l\\\\\\,%c):\\ %m") --- cl.exe errorformat --- o.errorformat:append('\ %#%f(%l) : %#%t%[A-z]%# %m') - --------------------- NEOCLIP ------------------------------- -require('neoclip').setup({ - default_register = '+', -}) -require('telescope').load_extension('neoclip') --------------------- LUALINE ------------------------------- -require('lualine').setup { - options = {theme = 'gruvbox'}, - sections = {lualine_c = {'getcwd', 'filename', 'nvim_treesitter#statusline'}, - } -} --------------------- PROJECT ------------------------------- -require("project_nvim").setup { - silent_chdir = true, -} -require('telescope').load_extension('projects') -utils.map('n', 'p', 'Telescope projects') --------------------- TS-RAINBOW ---------------------------- -require'nvim-treesitter.configs'.setup { - rainbow = { - enable = true, - extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean - max_file_lines = nil, -- Do not enable for files with more than n lines, int - -- colors = {}, -- table of hex strings - -- termcolors = {} -- table of colour name strings - } -} --------------------- LUASNIP ------------------------------- -require("luasnip.loaders.from_vscode").load() --------------------- AUTOPAIRS ----------------------------- -require('nvim-autopairs').setup{} --------------------- FZF NATIVE ---------------------------- -require('telescope').load_extension('fzf') --------------------- TERMINAL ------------------------------ -require('nvim-terminal').setup({ - toggle_keymap = 'z', -}) --------------------- INDENT-BLANKLINE ---------------------- -opt.listchars:append("eol:↴") --- opt.listchars:append("space: ") -opt.listchars:append("trail: ") -opt.listchars:append("tab:→ ") - -require("indent_blankline").setup { - show_end_of_line = true, - use_treesitter = true, - show_current_context = true, - context_patterns = {'class', 'function', 'method', 'block', '^if', '^for', '^while'}, -} - diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..c23c2e5 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,81 @@ +{ + "Comment.nvim": { "branch": "master", "commit": "e51f2b142d88bb666dcaa77d93a07f4b419aca70" }, + "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, + "LuaSnip": { "branch": "master", "commit": "b3104910bb5ebf40492aadffae18f2528fa757d9" }, + "astrotheme": { "branch": "main", "commit": "4a2af93815e4e6adfe69c836e46047a9451de858" }, + "avante.nvim": { "branch": "main", "commit": "adae032f5fbc611d59545792d3c5bb1c9ddc3fdb" }, + "bamboo.nvim": { "branch": "master", "commit": "97124a0b81f886abc0d666ebec512b92425d67b6" }, + "blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" }, + "cmake-tools.nvim": { "branch": "master", "commit": "88e07c6bff838a5bda2f461e9c1122b79ff0829f" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" }, + "cmp-cmdline-history": { "branch": "master", "commit": "003573b72d4635ce636234a826fa8c4ba2895ffe" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" }, + "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" }, + "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "codecompanion.nvim": { "branch": "main", "commit": "4d174f5b20af95805e9d710f845aca6db15b3309" }, + "conform.nvim": { "branch": "master", "commit": "b4aab989db276993ea5dcb78872be494ce546521" }, + "copilot-cmp": { "branch": "master", "commit": "15fc12af3d0109fa76b60b5cffa1373697e261d1" }, + "copilot.lua": { "branch": "master", "commit": "f7732213e41995439171f35bdd2bf1c809f8e8e7" }, + "dial.nvim": { "branch": "master", "commit": "f0404ec1f83a03f2c3457e60087c6331d1cbb83f" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, + "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, + "everforest-nvim": { "branch": "main", "commit": "d2936185a6d266def29fd7b523d296384580ef08" }, + "flash.nvim": { "branch": "main", "commit": "b68bda044d68e4026c4e1ec6df3c5afd7eb8e341" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "fyler.nvim": { "branch": "stable", "commit": "f54a4bcb26e0632c0d9663cf6c9ba64fedf462bb" }, + "gitsigns.nvim": { "branch": "main", "commit": "f780609807eca1f783a36a8a31c30a48fbe150c5" }, + "goose.nvim": { "branch": "main", "commit": "e5f7c8590c4d9873390149a14da7d468ddf6feec" }, + "grug-far.nvim": { "branch": "main", "commit": "50d9ee2b5a19634670441948e7e4afaa042f1059" }, + "gruvbox-baby": { "branch": "main", "commit": "bd52e62d8134647090108189e69c8b3cd18bdbbf" }, + "gruvbox-flat.nvim": { "branch": "master", "commit": "1dc35c81da30d297f82d438ff362cf1b01d36782" }, + "gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" }, + "incline.nvim": { "branch": "main", "commit": "0fd2d5a27504dba7fdc507a53275f22c081fe640" }, + "iron.nvim": { "branch": "master", "commit": "551a11b40d74fea1ca24d22e27d22692f5123f0c" }, + "kanagawa.nvim": { "branch": "master", "commit": "debe91547d7fb1eef34ce26a5106f277fbfdd109" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lazydev.nvim": { "branch": "main", "commit": "258d2a5ef4a3e3d6d9ba9da72c9725c53e9afcbd" }, + "lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, + "lualine-diagnostic-message": { "branch": "master", "commit": "e8244c4d1f088e21bb05021f164ed903093b168b" }, + "lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" }, + "luvit-meta": { "branch": "main", "commit": "1df30b60b1b4aecfebc785aa98943db6c6989716" }, + "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, + "mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" }, + "material.nvim": { "branch": "main", "commit": "c8ff153d2c2b22f8b2c9bcce0d741ab55c00cfed" }, + "mini.ai": { "branch": "main", "commit": "45a26d032d8703f280c69c2ed9fb4e1bfc8f24f9" }, + "mini.sessions": { "branch": "main", "commit": "dd7fe484dfcbf270a788e9291545df509cdb9691" }, + "mini.surround": { "branch": "main", "commit": "5aab42fcdcf31fa010f012771eda5631c077840a" }, + "minuet-ai.nvim": { "branch": "main", "commit": "2083b86ea01cb18dc9e7cb7a68f932ea06e999e8" }, + "monokai-pro.nvim": { "branch": "master", "commit": "1ac671f6da720cba967d28d25c2f16b8b4e18808" }, + "neogen": { "branch": "main", "commit": "d7f9461727751fb07f82011051338a9aba07581d" }, + "neogit": { "branch": "master", "commit": "ceaf88a9f9607b736d572781490872e28a112aed" }, + "neotest": { "branch": "master", "commit": "2cf3544fb55cdd428a9a1b7154aea9c9823426e8" }, + "neotest-python": { "branch": "master", "commit": "ed9b4d794b89044cc32e5476e637936331473c6e" }, + "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, + "nvim-dap": { "branch": "master", "commit": "7523676a4be17644587aa47e4d42f6f7646d4727" }, + "nvim-dap-python": { "branch": "master", "commit": "bfe572e4458e0ac876b9539a1e9f301c72db8ea0" }, + "nvim-dap-repl-highlights": { "branch": "master", "commit": "4f4cdb9ccd567512fd4f602e411b8f7ab5f69002" }, + "nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, + "nvim-highlight-colors": { "branch": "main", "commit": "e0c4a58ec8c3ca7c92d3ee4eb3bc1dd0f7be317e" }, + "nvim-lint": { "branch": "master", "commit": "0864f81c681e15d9bdc1156fe3a17bd07db5a3ed" }, + "nvim-lspconfig": { "branch": "master", "commit": "d9879110d0422a566fa01d732556f4d5515e1738" }, + "nvim-navic": { "branch": "master", "commit": "f887d794a0f4594882814d7780980a949200a238" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, + "nvim-rooter.lua": { "branch": "main", "commit": "7689d05e8ab95acb4b24785253d913c0aae18be9" }, + "nvim-treesitter": { "branch": "main", "commit": "1c760c1888f5e7474d1ae222f0638cb3b731629b" }, + "nvim-web-devicons": { "branch": "master", "commit": "6e51ca170563330e063720449c21f43e27ca0bc1" }, + "oil.nvim": { "branch": "master", "commit": "07f80ad645895af849a597d1cac897059d89b686" }, + "overseer.nvim": { "branch": "master", "commit": "fe7b2f9ba263e150ab36474dfc810217b8cf7400" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "687ef75fdbd497eabc9eea92b52e7b4d403b3319" }, + "render-markdown.nvim": { "branch": "main", "commit": "5f437a26a8a8b964eff683dd6f68bc2a0d38c5db" }, + "rustaceanvim": { "branch": "master", "commit": "370b85298e5afdfd8b5d3da0c60c04e3873499a4" }, + "snacks.nvim": { "branch": "main", "commit": "d67a47739dfc652cfcf66c59e929c704a854b37a" }, + "tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "f64efd33a51ea89bdb847fb3aaf716e96b83ba1a" }, + "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, + "toggleterm.nvim": { "branch": "main", "commit": "9a88eae817ef395952e08650b3283726786fb5fb" }, + "which-key.nvim": { "branch": "main", "commit": "fcbf4eea17cb299c02557d576f0d568878e354a4" }, + "yanky.nvim": { "branch": "main", "commit": "04775cc6e10ef038c397c407bc17f00a2f52b378" } +} diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..3f7c862 --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,27 @@ +local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + 'git', + 'clone', + '--filter=blob:none', + 'https://github.com/folke/lazy.nvim.git', + '--branch=stable', -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +require('lazy').setup({ + defaults = { + version = false, + }, + spec = { + { import = 'plugins' }, + { import = 'themes' }, + }, + change_detection = { + -- automatically check for config file changes and reload the ui + enabled = true, + notify = false, -- get a notification when changes are found + }, +}) diff --git a/lua/config/options.lua b/lua/config/options.lua new file mode 100644 index 0000000..78dcac5 --- /dev/null +++ b/lua/config/options.lua @@ -0,0 +1,155 @@ +vim.cmd('filetype plugin indent on') +vim.cmd('language en_US.utf-8') + +local opt = vim.opt +local indent = 2 +opt.termguicolors = true -- Enable colors in terminal +opt.hlsearch = true --Set highlight on search +opt.number = true --Make line numbers default +opt.listchars:append('eol:↴') +-- opt.listchars:append("space: ") +-- opt.listchars:append 'space:⋅' +opt.listchars:append('trail: ') +opt.listchars:append('tab:→ ') +opt.relativenumber = false --Make relative number default +opt.mouse = 'a' --Enable mouse mode +opt.breakindent = true --Enable break indent +opt.undofile = true --Save undo history +opt.ignorecase = true --Case insensitive searching unless /C or capital in search +opt.smartcase = true -- Smart case +opt.updatetime = 300 --Decrease update time +opt.signcolumn = 'yes' -- Always show sign column +opt.timeoutlen = 300 -- Time in milliseconds to wait for a mapped sequence to complete. +opt.ttimeoutlen = 10 +opt.showmode = false -- Do not need to show the mode. We use the statusline instead. +opt.scrolloff = 999 -- Lines of context +opt.joinspaces = false -- No double spaces with join after a dot +opt.showmatch = true -- Show matching braces +opt.wrap = true -- When on, lines longer than the width of the window will wrap and displaying continues on the next line +opt.list = true +opt.hidden = true +opt.winborder = 'none' +opt.scrolloff = 10 +opt.shiftround = true +opt.relativenumber = false +opt.splitbelow = true +opt.splitright = true +opt.wildmode = 'longest:full,full' +opt.pumheight = 15 +opt.splitbelow = true +opt.splitright = true +opt.shiftwidth = indent +opt.tabstop = indent +if vim.fn.has('wsl') == 1 then + vim.g.clipboard = { + name = 'WslClipboard', + copy = { + ['+'] = 'clip.exe', + ['*'] = 'clip.exe', + }, + paste = { + ['+'] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))', + ['*'] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))', + }, + cache_enabled = 0, + } + -- opt.guifont = 'Hack Nerd Font Mono:h10' + opt.guifont = 'RobotoMono Nerd Font:h10' +elseif vim.loop.os_uname().sysname == 'Linux' then + opt.guifont = 'Iosevka NFM:h11' + if vim.env.SSH_TTY or vim.env.SSH_CLIENT or vim.env.SSH_CONNECTION then + function no_paste(reg) + return function(lines) + -- Do nothing! We can't paste with OSC52 + end + end + + vim.g.clipboard = { + name = 'OSC 52', + copy = { + ['+'] = require('vim.ui.clipboard.osc52').copy('+'), + ['*'] = require('vim.ui.clipboard.osc52').copy('*'), + }, + paste = { + -- ['+'] = require('vim.ui.clipboard.osc52').paste('+'), + -- ['*'] = require('vim.ui.clipboard.osc52').paste('*'), + ['+'] = no_paste('+'), -- Pasting disabled + ['*'] = no_paste('*'), -- Pasting disabled + }, + } + end +else + -- opt.guifont = 'Hack Nerd Font:h10' + -- opt.guifont = 'JetBrainsMono Nerd Font:h10' + -- opt.guifont = 'FiraCode Nerd Font:h10' + -- opt.guifont = 'RobotoMono Nerd Font:h10' + opt.guifont = 'IosevkaTerm Nerd Font Mono:h11' + -- opt.guifont = 'Cousine Nerd Font Mono:h10' + -- opt.guifont = 'DroidSansM Nerd Font Propo:h10' + -- opt.guifont = 'AnonymicePro Nerd Font:h11' + -- opt.guifont = 'SauceCodePro Nerd Font:h10' + -- opt.guifont = 'Monoid Nerd Font Propo:h10' +end +opt.swapfile = false +opt.backup = false +opt.spelllang = 'en' +opt.completeopt = 'menu,menuone,noselect' +opt.expandtab = true +opt.smartindent = true +opt.title = true +opt.titlestring = '%(%{fnamemodify(getcwd(),":t")}%) Neovim' +opt.laststatus = 3 -- for lualine +opt.background = 'dark' + +-- go to previous/next line with h,l,left arrow and right arrow +-- when cursor reaches end/beginning of line +-- opt.whichwrap:append('<>[]hl') + +-- disable nvim intro +opt.shortmess:append('sI') + +-- Treesitter based folding +-- opt.foldlevel = 20 +-- opt.foldmethod = 'expr' +-- opt.foldexpr = 'nvim_treesitter#foldexpr()' +-- opt.foldexpr = 'nvim_treesitter#foldexpr()' + +if vim.fn.has('nvim-0.12') == 1 then + vim.o.diffopt = 'internal,filler,closeoff,inline:simple,linematch:40' +elseif vim.fn.has('nvim-0.11') == 1 then + vim.o.diffopt = 'internal,filler,closeoff,linematch:40' +end + +vim.diagnostic.config({ + signs = { + text = { + [vim.diagnostic.severity.ERROR] = '', -- Nerd Font Error Icon + [vim.diagnostic.severity.WARN] = '', -- Nerd Font Warning Icon + [vim.diagnostic.severity.INFO] = '', -- Nerd Font Info Icon + [vim.diagnostic.severity.HINT] = '', -- Nerd Font Hint Icon (example) + }, + -- Define the highlight group to use for the sign text for each severity + texthl = { + [vim.diagnostic.severity.ERROR] = 'DiagnosticSignError', + [vim.diagnostic.severity.WARN] = 'DiagnosticSignWarn', + [vim.diagnostic.severity.INFO] = 'DiagnosticSignInfo', + [vim.diagnostic.severity.HINT] = 'DiagnosticSignHint', + }, + -- Optional: Highlight the line number column + numhl = { + [vim.diagnostic.severity.ERROR] = 'DiagnosticLineNrError', + -- Add others for WARN, INFO, HINT if desired + }, + -- Optional: Highlight the whole line + linehl = { + -- Define highlight groups like 'DiagnosticLineError', 'DiagnosticLineWarn', etc. + [vim.diagnostic.severity.ERROR] = 'DiagnosticLineError', + }, + }, + -- Other diagnostic configurations (optional examples) + virtual_text = false, + virtual_lines = false, + underline = true, -- Enable underlining diagnostics + update_in_insert = false, -- Don't update diagnostics in insert mode + severity_sort = true, -- Sort diagnostics by severity +}) diff --git a/lua/my_autocommands.lua b/lua/my_autocommands.lua index 3fb7b3e..d83b92b 100644 --- a/lua/my_autocommands.lua +++ b/lua/my_autocommands.lua @@ -1,45 +1,69 @@ -function nvim_create_augroups(definitions) - for group_name, definition in pairs(definitions) do - vim.cmd('augroup ' .. group_name) - vim.cmd('autocmd!') - for _, def in ipairs(definition) do - local command = table.concat(vim.tbl_flatten{'autocmd', def}, ' ') - vim.cmd(command) +local api = vim.api + +-- Highlight on yank + +vim.filetype.add({ + extension = { + simvis = 'xml', + manifest = 'xml', + simcfg = 'xml', + simcon = 'xml', + simudex = 'xml', + rasi = 'rasi', + rofi = 'rasi', + wofi = 'rasi', + }, + filename = { + ['JenkinsFile'] = 'groovy', + ['SConstruct'] = 'python', + ['SConscript'] = 'python', + ['doskey'] = 'dosini', + ['.clangd'] = 'yaml', + ['.clang-tidy'] = 'yaml', + ['.yamlfmt'] = 'yaml', + ['.*/waybar/config'] = 'jsonc', + ['.*/mako/config'] = 'dosini', + ['.*/kitty/.+%.conf'] = 'kitty', + ['.*/hypr/.+%.conf'] = 'hyprlang', + ['%.env%.[%w_.-]+'] = 'sh', + }, +}) + +-- Read and write shada file +api.nvim_create_autocmd({ 'FocusLost' }, { command = [[wshada]] }) + +-- go to last loc when opening a buffer +-- api.nvim_create_autocmd( +-- 'BufReadPost', +-- { command = [[if line("'\"") > 1 && line("'\"") <= line("$") | execute "normal! g`\"" | endif]] } +-- ) + +-- When editing a file, always jump to the last known cursor position. +-- Don't do it when the position is invalid, when inside an event handler +-- (happens when dropping a file on gvim) and for a commit message (it's +-- likely a different one than last time). +local userGrp = api.nvim_create_augroup('UserGroup', { clear = true }) +vim.api.nvim_create_autocmd('BufReadPost', { + group = userGrp, + callback = function(args) + local valid_line = vim.fn.line([['"]]) >= 1 and vim.fn.line([['"]]) < vim.fn.line('$') + local not_commit = vim.b[args.buf].filetype ~= 'commit' + + if valid_line and not_commit then + vim.cmd([[normal! g`"]]) end - vim.cmd('augroup END') - end -end + end, +}) -local autocmds = { - packer = { - { 'BufWritePost', 'plugins.lua', 'PackerCompile' }; - }; - restore_cursor = { - { 'BufRead', '*', [[call setpos(".", getpos("'\""))]] }; - }; - save_shada = { - {'FocusGained,FocusLost', '*', 'rshada|wshada'}; - }; - resize_windows_proportionally = { - { 'VimResized', '*', ':wincmd =' }; - }; - lua_highlight = { - { 'TextYankPost', '*', [[silent! lua vim.highlight.on_yank() {higroup='IncSearch', timeout=400}]] }; - }; - file_type = { - {'BufRead,BufNewFile', '*.simvis', 'set filetype=xml'}; - {'BufRead,BufNewFile', '*.simcfg,*.simcon,*.simudex', 'set filetype=cfg'}; - {'BufRead,BufNewFile', 'Jenkinsfile*', 'set filetype=groovy'}; - {'BufRead,BufNewFile', '*.manifest', 'set filetype=xml'}; - {'BufRead,BufNewFile', 'SConstruct,SConscript', 'set filetype=python'}; - }; - file_changed = { - {'BufEnter,FocusGained', '*', 'checktime'}; - }; - no_auto_comment = { - {'BufEnter', '*', 'set fo-=c fo-=r fo-=o'} - } -} +-- Check if we need to reload the file when it changed +api.nvim_create_autocmd({ 'FocusGained', 'BufEnter' }, { command = [[if !bufexists("[Command Line]") | checktime | endif]] }) -nvim_create_augroups(autocmds) +-- windows to close with "q" +api.nvim_create_autocmd('FileType', { pattern = { 'help', 'startuptime', 'qf', 'lspinfo' }, command = [[nnoremap q :close]] }) +api.nvim_create_autocmd('FileType', { pattern = 'man', command = [[nnoremap q :quit]] }) +-- don't auto comment new line +api.nvim_create_autocmd('BufEnter', { command = [[set formatoptions-=cro]] }) + +-- Keep window ratio when resize +api.nvim_create_autocmd('VimResized', { command = [[wincmd =]] }) diff --git a/lua/my_cmp.lua b/lua/my_cmp.lua deleted file mode 100644 index 0e5c7c5..0000000 --- a/lua/my_cmp.lua +++ /dev/null @@ -1,118 +0,0 @@ -local cmp = require('cmp') -local luasnip = require("luasnip") - -local t = function(str) - return vim.api.nvim_replace_termcodes(str, true, true, true) -end - -local check_back_space = function() - local col = vim.fn.col(".") - 1 - return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") ~= nil -end - -cmp.setup { - - formatting = { - format = function(entry, vim_item) - -- fancy icons and a name of kind - vim_item.kind = require("lspkind").presets.default[vim_item.kind] .. - " " .. vim_item.kind - -- set a name for each source - vim_item.menu = ({ - buffer = "[Buffer]", - nvim_lsp = "[LSP]", - ultisnips = "[UltiSnips]", - nvim_lua = "[Lua]", - cmp_tabnine = "[TabNine]", - look = "[Look]", - path = "[Path]", - spell = "[Spell]", - calc = "[Calc]", - emoji = "[Emoji]" - })[entry.source.name] - return vim_item - end - }, - mapping = { - [''] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c', 's'}), - [''] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c', 's' }), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c', 's' }), - [''] = cmp.mapping(cmp.mapping.close(), { 'i', 'c', 's' }), - [''] = cmp.mapping({ - i = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true }), - c = cmp.mapping.confirm({ select = false }), - s = cmp.mapping.confirm({ select = false }), - }), - [""] = cmp.mapping(function(fallback) - if luasnip.expand_or_jumpable() then - vim.api.nvim_feedkeys(t("luasnip-expand-or-jump"), "", true) - else - fallback() - end - end, { - "i", - "s", - }), - [""] = cmp.mapping(function(fallback) - if luasnip.jumpable(-1) then - vim.api.nvim_feedkeys(t("luasnip-jump-prev"), "", true) - else - fallback() - end - end, { - "i", - "s", - }), - }, - snippet = { - expand = function(args) - require'luasnip'.lsp_expand(args.body) - end - }, - sources = { - {name = 'nvim_lsp'}, {name = 'buffer'}, {name = "luasnip"}, - {name = "nvim_lua"}, {name = "look"}, {name = "path"}, - {name = 'cmp_tabnine'}, {name = "calc"}, {name = "spell"}, - {name = "emoji"} - }, - completion = {completeopt = 'menu,menuone,noinsert, noselect'}, - -- experimental = { native_menu = true } -} - --- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline('/', { - sources = { - { name = 'buffer' } - }, - }) - --- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline(':', { - sources = cmp.config.sources({ - { name = 'path' } - }, { - { name = 'cmdline' } - }, { - { name = 'buffer' } - }), -}) - --- Autopairs ---require("nvim-autopairs.completion.cmp").setup({ --- map_cr = true, --- map_complete = true, --- auto_select = true ---}) -local cmp_autopairs = require('nvim-autopairs.completion.cmp') -cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } })) - --- TabNine ---local tabnine = require('cmp_tabnine.config') ---tabnine:setup({max_lines = 1000, max_num_results = 20, sort = true}) - --- Database completion -vim.api.nvim_exec([[ -autocmd FileType sql,mysql,plsql lua require('cmp').setup.buffer({ sources = {{ name = 'vim-dadbod-completion' }} }) -]], false) diff --git a/lua/my_keymappings.lua b/lua/my_keymappings.lua index e941744..fcfb498 100644 --- a/lua/my_keymappings.lua +++ b/lua/my_keymappings.lua @@ -1,90 +1,102 @@ -local utils = require('utils') -vim.g.mapleader = ',' --- Paste from clipboard -utils.map('n', 'p', '"+p') -utils.map('n', 'P', '"+P') -utils.map('v', 'p', '"+p') -utils.map('v', 'P', '"+P') - --- Yank to clipboard -utils.map('v', 'y', '"+y') -utils.map('n', 'Y', '"+yg_') -utils.map('n', 'y', '"+y') -utils.map('n', 'yy', '"+yy') +local opts = { noremap = true, silent = true } -- Tabs -utils.map('n', '', ':tabnew .', { noremap = true, silent = true }) -utils.map('i', '', ':tabnew .', { noremap = true, silent = true }) --- utils.map('n', '', ':BufferLineCycleNext') --- utils.map('n', '', ':BufferLineCyclePrev') -utils.map('n', '', ':tabnext', { noremap = true, silent = true }) -utils.map('n', '', ':tabprevious', { noremap = true, silent = true }) +vim.keymap.set('n', '', ':tabnext', opts) +vim.keymap.set('n', '', ':tabprevious', opts) +vim.keymap.set('n', '', ':tabnext', opts) +vim.keymap.set('n', '', ':tabprevious', opts) -- Split movement -utils.map('n', '', ':wincmd k', { noremap = true, silent = true }) -utils.map('n', '', ':wincmd j', { noremap = true, silent = true }) -utils.map('n', '', ':wincmd h', { noremap = true, silent = true }) -utils.map('n', '', ':wincmd l', { noremap = true, silent = true }) --- Open a new vertical split window with Ctrl - F2 -utils.map('n', '', ':vsplit .', { noremap = true, silent = true }) -utils.map('i', '', ':vsplit .', { noremap = true, silent = true }) --- Open a new horizontal split window with Shift - F2 -utils.map('n', '', ':split .', { noremap = true, silent = true }) -utils.map('i', '', ':split .', { noremap = true, silent = true }) +vim.keymap.set('n', '', ':wincmd k', opts) +vim.keymap.set('n', '', ':wincmd j', opts) +vim.keymap.set('n', '', ':wincmd h', opts) +vim.keymap.set('n', '', ':wincmd l', opts) +vim.keymap.set('n', '', ':wincmd k', opts) +vim.keymap.set('n', '', ':wincmd j', opts) +vim.keymap.set('n', '', ':wincmd h', opts) +vim.keymap.set('n', '', ':wincmd l', opts) -utils.map('n', '', ':wa') +vim.keymap.set('n', '', ':wa | wshada') -- Linewrap and jumping -utils.map('n', 'k', 'gk') -utils.map('n', 'j', 'gj') -utils.map('n', '0', 'g0') -utils.map('n', '$', 'g$') -utils.map('n', '', 'gk') -utils.map('n', '', 'gj') -utils.map('n', '', 'g') -utils.map('n', '', 'g') -utils.map('v', 'k', 'gk') -utils.map('v', 'j', 'gj') -utils.map('v', '0', 'g0') -utils.map('v', '$', 'g$') -utils.map('v', '', 'gk') -utils.map('v', '', 'gj') -utils.map('v', '', 'g') -utils.map('v', '', 'g') +vim.keymap.set({ 'n', 'x' }, 'k', 'gk', opts) +vim.keymap.set({ 'n', 'x' }, 'j', 'gj', opts) +vim.keymap.set({ 'n', 'x' }, '0', 'g0', opts) +vim.keymap.set({ 'n', 'x' }, '$', 'g$', opts) +vim.keymap.set({ 'n', 'x' }, '', 'gk', opts) +vim.keymap.set({ 'n', 'x' }, '', 'gj', opts) +vim.keymap.set({ 'n', 'x' }, '', 'g', opts) +vim.keymap.set({ 'n', 'x' }, '', 'g', opts) +vim.keymap.set({ 'i' }, '', 'gk', opts) +vim.keymap.set({ 'i' }, '', '', opts) +vim.keymap.set({ 'i' }, '', '', opts) +vim.keymap.set({ 'i' }, '', 'gj', opts) +-- vim.keymap.set({'n', 'x', 'i'}, '', '') +-- vim.keymap.set({'n', 'x', 'i'}, '', '') +-- vim.keymap.set({'n', 'x', 'i'}, '', '') +-- vim.keymap.set({'n', 'x', 'i'}, '', '') -utils.map('v', '<', '', '>gv') +vim.keymap.set('x', '<', '', '>gv') + +local function hlWord() + local current_word = vim.call('expand', '') + vim.fn.setreg('/', '\\<' .. current_word .. '\\>') + vim.opt.hlsearch = true +end -- Highlight word under cursor -utils.map('n', 'ü', ":let @/='\\<=expand(\"\")\\>':set hls", { noremap = true, silent = true }) -utils.map('v', 'ü', "y:let @/='=escape(@\",'/\\')':set hls") utils.map('v', 'ü', "y:let @/='=escape(@\",'/\\')':set hls", { noremap = true, silent = true }) +vim.keymap.set('n', "'", hlWord, { noremap = true, silent = true, desc = 'Higlight word under cursor' }) +vim.keymap.set('x', "'", function() + -- 1. Yank current visual selection into the 'v' register + vim.cmd('noau normal! "vy"') + local text = vim.fn.getreg('v') --- Close Buffer -utils.map('n', '', ':bd') + -- 2. Escape special characters (\ and /) for search + text = vim.fn.escape(text, '\\/') --- to navigate the completion menu -utils.map('i', '', 'pumvisible() ? "\\" : "\\"', {expr = true}) -utils.map('i', '', 'pumvisible() ? "\\" : "\\"', {expr = true}) + -- 3. Replace actual newlines with the string "\n" + text = string.gsub(text, '\n', '\\n') --- Telescope -utils.map('n', 'f', 'Telescope find_files') -utils.map('n', '', 'Telescope find_files') -utils.map('n', 'g', 'Telescope git_files') -utils.map('n', 'o', 'Telescope oldfiles') -utils.map('n', 'h', 'Telescope command_history') -utils.map('v', 'h', 'Telescope command_history') -utils.map('n', '', 'Telescope commands') -utils.map('n', 'b', 'Telescope buffers') -utils.map('n', 'q', 'Telescope quickfix') -utils.map('n', 'l', 'Telescope live_grep') -utils.map('n', 'r', 'Telescope lsp_references') -utils.map('n', '', 'Telescope lsp_document_symbols') -utils.map('n', '', 'Telescope lsp_document_symbols') -utils.map('n', 'v', 'Telescope diagnostics bufnr=0') -utils.map('n', '', 'Telescope neoclip') -utils.map('n', 'j', 'Telescope jumplist') + -- 4. Set the search register with \V (very nomagic) for literal search + vim.fn.setreg('/', '\\V' .. text) --- wildmode + -- 5. Turn on highlight search + vim.opt.hlsearch = true --- Symbols Outline -utils.map('n', 's', 'SymbolsOutline') + -- Optional: Print feedback +end, { desc = 'Search for selected text (multiline supported)' }) +-- Close Buffer +-- vim.keymap.set('n', '', ':bd', { desc = 'Close buffer' }) +vim.keymap.set('n', 'x', 'za', { desc = 'Toggle fold' }) + +vim.keymap.set({ 'n', 'x' }, 'y', '"+y', { desc = 'Copy from system clipboard' }) +vim.keymap.set({ 'n', 'x' }, 'Y', '"+yg_', { desc = 'Copy from system clipboard' }) +vim.keymap.set({ 'n', 'x' }, 'p', '"+p', { desc = 'Paste from system clipboard' }) +vim.keymap.set({ 'n', 'x' }, 'P', '"+P', { desc = 'Paste from system clipboard' }) + +vim.keymap.set('v', 'v', function() + local mode = vim.fn.mode() + if mode == 'v' then + vim.api.nvim_feedkeys('V', 'n', true) -- Switch to Visual Line mode + elseif mode == 'V' then + vim.api.nvim_feedkeys('v', 'n', true) -- Switch to regular Visual mode + end +end, { noremap = true, silent = true }) + +vim.keymap.set('x', '/', '/\\%V') --search within visual selection + +vim.api.nvim_create_user_command('WinFont', 'set guifont=JetBrainsMonoNL\\ NF:h9', {}) +vim.api.nvim_create_user_command('LinuxFont', 'set guifont=JetBrainsMono\\ Nerd\\ Font\\ Mono:h7', {}) + +if vim.g.neovide then + vim.g.neovide_scale_factor = 1.0 + local change_scale_factor = function(delta) + vim.g.neovide_scale_factor = vim.g.neovide_scale_factor * delta + print(string.format('scaling: %f', vim.g.neovide_scale_factor)) + end + vim.keymap.set('n', '', function() change_scale_factor(1.25) end) + vim.keymap.set('n', '', function() change_scale_factor(1 / 1.25) end) + vim.keymap.set('n', '', function() change_scale_factor(1.25) end) + vim.keymap.set('n', '', function() change_scale_factor(1 / 1.25) end) +end diff --git a/lua/my_lspinstall.lua b/lua/my_lspinstall.lua deleted file mode 100644 index 0647ab8..0000000 --- a/lua/my_lspinstall.lua +++ /dev/null @@ -1,108 +0,0 @@ -local utils = require('utils') - -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities.textDocument.completion.completionItem.documentationFormat = { 'markdown', 'plaintext' } -capabilities.textDocument.completion.completionItem.snippetSupport = true -capabilities.textDocument.completion.completionItem.preselectSupport = true -capabilities.textDocument.completion.completionItem.insertReplaceSupport = true -capabilities.textDocument.completion.completionItem.labelDetailsSupport = true -capabilities.textDocument.completion.completionItem.deprecatedSupport = true -capabilities.textDocument.completion.completionItem.commitCharactersSupport = true -capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } } -capabilities.textDocument.completion.completionItem.resolveSupport = { - properties = { - 'documentation', - 'detail', - 'additionalTextEdits', - }, -} - -local on_attach = function(client, bufnr) - local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end - local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end - - buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') - - -- Mappings. - local opts = { noremap=true, silent=true } - utils.map('n', ',', 'lua vim.lsp.diagnostic.goto_prev()', opts) - utils.map('n', ';', 'lua vim.lsp.diagnostic.goto_next()', opts) - utils.map('n', 'a', 'Telescope lsp_code_actions', opts) - utils.map('n', 'd', 'lua vim.lsp.buf.definition()', opts) - utils.map('n', 'e', 'lua vim.lsp.buf.declaration()', opts) - utils.map('n', 'h', 'lua vim.lsp.buf.hover()', opts) - utils.map('n', 'c', 'lua vim.lsp.buf.outgoing_calls()', opts) - utils.map('n', 'C', 'lua vim.lsp.buf.incoming_calls()', opts) - utils.map('n', 'm', 'lua vim.lsp.buf.rename()', opts) - -- utils.map('n', 'r', 'lua vim.lsp.buf.references()') - utils.map('n', 's', 'lua vim.lsp.buf.document_symbol()', opts) - utils.map('n', '', 'Telescope lsp_dynamic_workspace_symbols', opts) - utils.map('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) - utils.map('n', '', 'lua vim.lsp.buf.signature_help()', opts) - utils.map('n', 'r', 'Telescope lsp_references') - utils.map('n', '', 'Telescope lsp_document_symbols') - utils.map('n', '', 'Telescope lsp_document_symbols') - utils.map('n', 'v', 'Telescope diagnostics bufnr=0') - utils.map('n', '', ':ClangdSwitchSourceHeader', opts) - - -- Set some keybinds conditional on server capabilities - if client.resolved_capabilities.document_formatting then - utils.map('n', 'f', 'lua vim.lsp.buf.formatting()', opts) - end - if client.resolved_capabilities.document_range_formatting then - utils.map('v', 'f', 'lua vim.lsp.buf.range_formatting()', opts) - end - - -- Set autocommands conditional on server_capabilities - if client.resolved_capabilities.document_highlight then - vim.api.nvim_exec([[ - hi LspReferenceRead cterm=bold ctermbg=red guibg=DarkGreen - hi LspReferenceText cterm=bold ctermbg=Black guibg=DarkYellow guifg=Black - hi LspReferenceWrite cterm=bold ctermbg=red guibg=DarkRed - augroup lsp_document_highlight - autocmd! * - autocmd CursorHold lua vim.lsp.buf.document_highlight() - autocmd CursorHoldI lua vim.lsp.buf.document_highlight() - autocmd CursorMoved lua vim.lsp.buf.clear_references() - augroup END - ]], false) - end - require "lsp_signature".on_attach({ - bind = true, -- This is mandatory, otherwise border config won't get registered. - handler_opts = { - border = "single" - }, - hi_parameter = "IncSearch" - }, bufnr) -end - -local lsp_installer = require("nvim-lsp-installer") -lsp_installer.on_server_ready(function(server) - local opts = { - on_attach = on_attach, - capabilities = capabilities, - } - - -- (optional) Customize the options passed to the server - -- if server.name == "tsserver" then - -- opts.root_dir = function() ... end - -- end - - -- This setup() function is exactly the same as lspconfig's setup function (:help lspconfig-quickstart) - server:setup(opts) - vim.cmd [[ do User LspAttachBuffers ]] -end) - -local null_ls = require("null-ls") -null_ls.setup { - sources = { - null_ls.builtins.code_actions.gitsigns, - null_ls.builtins.formatting.autopep8, - null_ls.builtins.formatting.prettier, - null_ls.builtins.formatting.stylua, - null_ls.builtins.diagnostics.flake8, - null_ls.builtins.formatting.isort - }, - on_attach = on_attach, - capabilities = capabilities -} diff --git a/lua/my_options.lua b/lua/my_options.lua deleted file mode 100644 index 9801817..0000000 --- a/lua/my_options.lua +++ /dev/null @@ -1,35 +0,0 @@ -local utils = require('utils') -vim.cmd 'colorscheme gruvbox-material' -- Put your favorite colorscheme here -vim.cmd 'syntax enable' -vim.cmd 'filetype plugin indent on' -vim.cmd 'language en_US.utf-8' -utils.opt('o', 'hlsearch', true) -utils.opt('o', 'guifont', 'Hack NF:h9') -utils.opt('o', 'swapfile', false) -utils.opt('o', 'backup', false) -utils.opt('o', 'spelllang', 'en,de') -local indent = 2 -utils.opt('b', 'expandtab', true) -utils.opt('b', 'shiftwidth', indent) -utils.opt('b', 'smartindent', true) -utils.opt('b', 'tabstop', indent) -utils.opt('o', 'hidden', true) -utils.opt('o', 'ignorecase', true) -utils.opt('o', 'scrolloff', 4 ) -utils.opt('o', 'shiftround', true) -utils.opt('o', 'relativenumber', false) -utils.opt('o', 'smartcase', true) -utils.opt('o', 'splitbelow', true) -utils.opt('o', 'splitright', true) -utils.opt('o', 'wildmode', 'longest:full,full') -utils.opt('w', 'number', true) -utils.opt('o', 'clipboard', 'unnamed,unnamedplus') -utils.opt('o', 'mouse', 'a') -utils.opt('o', 'wrap', false) -utils.opt('o', 'termguicolors', true) -utils.opt('o', 'splitbelow', true) -utils.opt('o', 'splitright', true) -utils.opt('o', 'list', true) -utils.opt('o', 'updatetime', 300) -utils.opt('o', 'wrap', true) -utils.opt('o', 'showmatch', true) diff --git a/lua/my_plugins.lua b/lua/my_plugins.lua deleted file mode 100644 index 8c080b3..0000000 --- a/lua/my_plugins.lua +++ /dev/null @@ -1,55 +0,0 @@ -return require('packer').startup(function() - - -- Packer can manage itself as an optional plugin - use {'wbthomason/packer.nvim'} - use {'neovim/nvim-lspconfig'} - use {'nvim-treesitter/nvim-treesitter'} - use { - 'nvim-telescope/telescope.nvim', - requires = {{'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'}, {'kyazdani42/nvim-web-devicons'}} - } - use {'sainnhe/gruvbox-material'} - use {'lukas-reineke/indent-blankline.nvim'} - use {'nvim-lua/plenary.nvim'} - use {'lewis6991/gitsigns.nvim'} - use { - 'kyazdani42/nvim-tree.lua', - requires = 'kyazdani42/nvim-web-devicons' - } - use{'numToStr/Comment.nvim'} - use { - 'hrsh7th/nvim-cmp', - requires = { - 'hrsh7th/cmp-buffer', 'hrsh7th/cmp-nvim-lsp', - 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip', 'hrsh7th/cmp-nvim-lua', - 'octaltree/cmp-look', 'hrsh7th/cmp-path', 'hrsh7th/cmp-calc', - 'f3fora/cmp-spell', 'hrsh7th/cmp-emoji', 'hrsh7th/cmp-cmdline' - } - } - use {'rafamadriz/friendly-snippets'} - use {'onsails/lspkind-nvim'} - use {'Shatur/neovim-cmake', - requires = {'mfussenegger/nvim-dap'} - } - use {'AckslD/nvim-neoclip.lua'} - use { - 'hoob3rt/lualine.nvim', - requires = {'kyazdani42/nvim-web-devicons', opt = true} - } - use {'ahmedkhalf/project.nvim'} - use {'p00f/nvim-ts-rainbow'} - use {'simrat39/symbols-outline.nvim'} - use {'f-person/git-blame.nvim'} - use {'windwp/nvim-autopairs'} - use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make'} - use {'ray-x/lsp_signature.nvim'} - use {'s1n7ax/nvim-terminal'} - use { - 'williamboman/nvim-lsp-installer', - requires = {'neovim/nvim-lspconfig'} - } - use { - 'jose-elias-alvarez/null-ls.nvim', - requires = {'nvim-lua/plenary.nvim'} - } -end) diff --git a/lua/my_telescope.lua b/lua/my_telescope.lua deleted file mode 100644 index 23d08e7..0000000 --- a/lua/my_telescope.lua +++ /dev/null @@ -1,48 +0,0 @@ -local actions = require('telescope.actions') - -local mappingTab = { - i = { - [''] = actions.select_tab, - [''] = actions.select_default, - } -} - -require('telescope').setup { - defaults = { - mappings = { - i = { - [''] = actions.close, - [''] = actions.select_default + actions.center, - [''] = actions.send_selected_to_loclist, - [''] = actions.smart_send_to_qflist - } - } - }, - pickers = { - -- Your special builtin config goes in here - buffers = { - sort_lastused = true, - theme = 'ivy', - mappings = { - i = { - [''] = actions.delete_buffer, - [''] = actions.select_default, - }, - n = { - [''] = actions.delete_buffer, - } - } - }, - find_files = { - theme = 'ivy', - }, - oldfiles = { - theme = 'ivy', - }, - git_files = { - theme = 'ivy', - }, - lsp_dynamic_workspace_symbols = { - }, - } -} diff --git a/lua/overseer/template/user/clang/clang-tidy.lua b/lua/overseer/template/user/clang/clang-tidy.lua new file mode 100644 index 0000000..0590f4c --- /dev/null +++ b/lua/overseer/template/user/clang/clang-tidy.lua @@ -0,0 +1,24 @@ +return { + name = 'clang-tidy', + builder = function() + -- Full path to current file (see :help expand()) + local dir = vim.loop.cwd() + local file = vim.fn.expand('%:p') + return { + cmd = { 'clang-tidy' }, + -- cmd = { 'c:/Users/uid40528/scoop/apps/llvm/current/bin/clang-tidy.exe' }, + args = { file, '-p', 'build_nvim', '--quiet', '--config-file', dir .. '/.clang-tidy' }, + cwd = dir, + components = { + { 'on_result_diagnostics_quickfix', open = false }, + { 'on_output_parse', problem_matcher = '$gcc' }, + { 'on_result_diagnostics', remove_on_restart = true }, + { 'restart_on_save' }, + 'default', + }, + } + end, + condition = { + filetype = { 'cpp' }, + }, +} diff --git a/lua/overseer/template/user/cmake/build.lua b/lua/overseer/template/user/cmake/build.lua new file mode 100644 index 0000000..52c60b2 --- /dev/null +++ b/lua/overseer/template/user/cmake/build.lua @@ -0,0 +1,28 @@ +return { + name = 'CMake Build for nvim', + builder = function() + return { + cmd = { 'cmake' }, + args = { '--build', '.', '--', '-j8' }, + cwd = 'build_nvim', + -- components = {"on_output_parse", problem_matcher = "$gcc"} + -- components = {'on_output_quickfix', set_diagnostics = true, open = true} + components = { + { 'on_output_quickfix', open = true, open_on_match = true }, + { 'on_output_parse', problem_matcher = '$gcc' }, + 'default', + }, + } + end, + condition = { + callback = function(opts) + if vim.fn.executable('cmake') == 0 then + return false, 'Command "cmake" not found' + end + if vim.fn.findfile('CMakeLists.txt', opts.dir .. ';') == '' then + return false, 'No CMakeLists.txt found' + end + return true + end, + }, +} diff --git a/lua/overseer/template/user/cmake/clean.lua b/lua/overseer/template/user/cmake/clean.lua new file mode 100644 index 0000000..507eff9 --- /dev/null +++ b/lua/overseer/template/user/cmake/clean.lua @@ -0,0 +1,21 @@ +return { + name = 'CMake Clean for nvim', + builder = function() + return { + cmd = { 'cmake' }, + args = { '--build', '.', '-t', 'clean' }, + cwd = 'build_nvim', + } + end, + condition = { + callback = function(opts) + if vim.fn.executable('cmake') == 0 then + return false, 'Command "cmake" not found' + end + if vim.fn.findfile('CMakeLists.txt', opts.dir .. ';') == '' then + return false, 'No CMakeLists.txt found' + end + return true + end, + }, +} diff --git a/lua/overseer/template/user/cmake/cmake.lua b/lua/overseer/template/user/cmake/cmake.lua new file mode 100644 index 0000000..47f8e61 --- /dev/null +++ b/lua/overseer/template/user/cmake/cmake.lua @@ -0,0 +1,7 @@ +return { + 'builtin', + 'user.cmake.configure', + 'user.cmake.build', + 'user.cmake.clean', +} +-- https://gitlab.com/ranjithshegde/dotbare/-/tree/master/.config/nvim/lua/overseer diff --git a/lua/overseer/template/user/cmake/configure.lua b/lua/overseer/template/user/cmake/configure.lua new file mode 100644 index 0000000..1c9808a --- /dev/null +++ b/lua/overseer/template/user/cmake/configure.lua @@ -0,0 +1,22 @@ +return { + name = 'CMake Configure for nvim', + builder = function() + local cwd = vim.fn.getcwd() + return { + cmd = { 'cmake' }, + args = { '-B', 'build_nvim', '-S', cwd, '-G', 'Ninja' }, + cwd = build_nvim, + } + end, + condition = { + callback = function(opts) + if vim.fn.executable('cmake') == 0 then + return false, 'Command "cmake" not found' + end + if vim.fn.findfile('CMakeLists.txt', opts.dir .. ';') == '' then + return false, 'No CMakeLists.txt found' + end + return true + end, + }, +} diff --git a/lua/plugins/aider.lua b/lua/plugins/aider.lua new file mode 100644 index 0000000..52cb8bf --- /dev/null +++ b/lua/plugins/aider.lua @@ -0,0 +1,32 @@ +return { + 'GeorgesAlkhouri/nvim-aider', + cmd = { + 'AiderTerminalToggle', + 'AiderHealth', + }, + keys = { + { 'a/', 'AiderTerminalToggle', desc = 'Open Aider' }, + { 'as', 'AiderTerminalSend', desc = 'Send to Aider', mode = { 'n', 'v' } }, + { 'ac', 'AiderQuickSendCommand', desc = 'Send Command To Aider' }, + { 'ab', 'AiderQuickSendBuffer', desc = 'Send Buffer To Aider' }, + { 'a+', 'AiderQuickAddFile', desc = 'Add File to Aider' }, + { 'a-', 'AiderQuickDropFile', desc = 'Drop File from Aider' }, + { 'ar', 'AiderQuickReadOnlyFile', desc = 'Add File as Read-Only' }, + -- Example nvim-tree.lua integration if needed + { 'a+', 'AiderTreeAddFile', desc = 'Add File from Tree to Aider', ft = 'NvimTree' }, + { 'a-', 'AiderTreeDropFile', desc = 'Drop File from Tree from Aider', ft = 'NvimTree' }, + }, + dependencies = { + 'folke/snacks.nvim', + }, + opts = { + args = { + '--model gemini-2.5-pro', + '--no-auto-commits', + '--pretty', + '--stream', + }, + }, + config = true, + enabled = false, +} diff --git a/lua/plugins/avante.lua b/lua/plugins/avante.lua new file mode 100644 index 0000000..84551cd --- /dev/null +++ b/lua/plugins/avante.lua @@ -0,0 +1,58 @@ +return { + 'yetone/avante.nvim', + version = false, -- Set this to "*" to always pull the latest release version, or set it to false to update to the latest code changes. + opts = { + debug = false, + provider = 'gemini', + auto_suggestions_provider = 'openai', -- Since auto-suggestions are a high-frequency operation and therefore expensive, it is recommended to specify an inexpensive provider or even a free provider: copilot + openai = { + endpoint = 'https://api.openai.com/v1', + -- model = 'o3-mini', + timeout = 30000, -- Timeout in milliseconds + temperature = 0, + max_tokens = 4096, + }, + gemini = { + api_key_name = 'GEMINI_API_KEY', + model = 'gemini-2.5-flash-preview-04-17', + }, + }, + -- if you want to build from source then do `make BUILD_FROM_SOURCE=true` + build = 'make', + -- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows + dependencies = { + 'stevearc/dressing.nvim', + 'nvim-lua/plenary.nvim', + 'MunifTanjim/nui.nvim', + 'nvim-tree/nvim-web-devicons', -- or echasnovski/mini.icons + 'zbirenbaum/copilot.lua', -- for providers='copilot' + { + 'MeanderingProgrammer/render-markdown.nvim', + }, + }, + cmd = { + 'AvanteAsk', + 'AvanteBuild', + 'AvanteChat', + 'AvanteChatNew', + 'AvanteHistory', + 'AvanteClear', + 'AvanteEdit', + 'AvanteFocus', + 'AvanteRefresh', + 'AvanteStop', + 'AvanteSwitchProvider', + 'AvanteShowRepoMap', + 'AvanteToggle', + 'AvanteModels', + 'AvanteSwitchSelectorProvider', + }, + keys = { + { + 'aa', + 'AvanteAsk', + desc = 'Avante Ask', + }, + }, + enabled = false, +} diff --git a/lua/plugins/blink.lua b/lua/plugins/blink.lua new file mode 100644 index 0000000..6a96210 --- /dev/null +++ b/lua/plugins/blink.lua @@ -0,0 +1,105 @@ +return { + 'saghen/blink.cmp', + -- optional: provides snippets for the snippet source + dependencies = { + { + 'saghen/blink.compat', + -- use v2.* for blink.cmp v1.* + version = '2.*', + lazy = true, + opts = {}, + }, + 'rafamadriz/friendly-snippets', + 'dmitmel/cmp-cmdline-history', + 'fang2hou/blink-copilot', + }, + + -- use a release tag to download pre-built binaries + version = '1.*', + + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- 'super-tab' for mappings similar to vscode (tab to accept) + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- All presets have the following mappings: + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + keymap = { preset = 'enter' }, + + appearance = { + nerd_font_variant = 'mono', + }, + + -- (Default) Only show the documentation popup when manually triggered + completion = { + documentation = { auto_show = true }, + list = { + selection = { + preselect = false, + auto_insert = false, + }, + }, + trigger = { prefetch_on_insert = false }, + }, + + sources = { + default = { 'lsp', 'path', 'snippets', 'buffer', 'minuet' }, + providers = { + lsp = { + fallbacks = {}, + }, + cmdline_history = { + name = 'cmdline_history', + module = 'blink.compat.source', + score_offset = -3, + }, + copilot = { + name = 'copilot', + module = 'blink-copilot', + score_offset = 100, + async = true, + }, + minuet = { + name = 'minuet', + module = 'minuet.blink', + async = true, + -- Should match minuet.config.request_timeout * 1000, + -- since minuet.config.request_timeout is in seconds + timeout_ms = 3000, + score_offset = 50, -- Gives minuet higher priority among suggestions + enabled = vim.env.GEMINI_API_KEY ~= nil, + }, + }, + }, + + snippets = { + preset = 'luasnip', + }, + signature = { + enabled = true, + }, + cmdline = { + keymap = { preset = 'inherit' }, + completion = { + menu = { auto_show = true }, + list = { + selection = { + preselect = false, + auto_insert = false, + }, + }, + }, + sources = { 'buffer', 'cmdline', 'cmdline_history' }, + }, + + fuzzy = { implementation = 'prefer_rust_with_warning' }, + }, + opts_extend = { 'sources.default' }, + enabled = true, +} diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua new file mode 100644 index 0000000..6bee5d5 --- /dev/null +++ b/lua/plugins/cmp.lua @@ -0,0 +1,151 @@ +return { + 'hrsh7th/nvim-cmp', + branch = 'main', + lazy = false, + dependencies = { + 'neovim/nvim-lspconfig', + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-cmdline', + 'L3MON4D3/LuaSnip', + 'saadparwaiz1/cmp_luasnip', + 'onsails/lspkind.nvim', + 'zbirenbaum/copilot-cmp', + 'hrsh7th/cmp-path', + 'dmitmel/cmp-cmdline-history', + 'hrsh7th/cmp-nvim-lsp-signature-help', + }, + config = function() + local t = function(str) return vim.api.nvim_replace_termcodes(str, true, true, true) end + + local cmp = require('cmp') + local lspkind = require('lspkind') + local luasnip = require('luasnip') + lspkind.init({ + symbol_map = { + Copilot = '', + }, + }) + require('copilot_cmp').setup() + + cmp.setup({ + preselect = cmp.PreselectMode.None, + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + end, + }, + mapping = { + [''] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c', 's' }), + [''] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c', 's' }), + [''] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c', 's' }), + [''] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c', 's' }), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c', 's' }), + [''] = cmp.mapping(cmp.mapping.close(), { 'i', 'c', 's' }), + [''] = cmp.mapping({ + i = function(fallback) + if cmp.visible() and cmp.get_active_entry() then + cmp.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = false }) + else + fallback() + end + end, + c = cmp.mapping.confirm({ select = false }), + s = cmp.mapping.confirm({ select = false }), + }), + [''] = cmp.mapping(function(fallback) + if luasnip.expand_or_jumpable() then + vim.api.nvim_feedkeys(t('luasnip-expand-or-jump'), '', true) + else + fallback() + end + end, { + 'i', + 's', + }), + [''] = cmp.mapping(function(fallback) + if luasnip.jumpable(-1) then + vim.api.nvim_feedkeys(t('luasnip-jump-prev'), '', true) + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping( + cmp.mapping.complete({ + config = { + sources = { + { + name = 'cmdline_history', + }, + }, + }, + }), + { 'c' } + ), + }, + sources = cmp.config.sources({ + { name = 'copilot' }, + { name = 'nvim_lsp' }, + { name = 'nvim_lsp_signature_help' }, + { name = 'luasnip' }, + { + name = 'buffer', + option = { + get_bufnrs = function() return vim.api.nvim_list_bufs() end, + }, + }, + { name = 'path' }, + }), + + window = { + documentation = { + winhighlight = 'Normal:CmpDocumentation', + }, + completion = { + winhighlight = 'Normal:Pmenu,FloatBorder:Pmenu,Search:None', + col_offset = -3, + side_padding = 0, + }, + }, + formatting = { + fields = { 'kind', 'abbr', 'menu' }, + expandable_indicator = false, + format = function(entry, vim_item) + local kind = require('lspkind').cmp_format({ mode = 'symbol_text', maxwidth = 50, show_labelDetails = true })(entry, vim_item) + local strings = vim.split(kind.kind, '%s', { trimempty = true }) + kind.kind = ' ' .. (strings[1] or '') .. ' ' + kind.menu = ' (' .. (strings[2] or '') .. ')' + + return kind + end, + }, + }) + + -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline({ '/', '?' }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' }, + { name = 'cmdline_history' }, + { name = 'path' }, + { name = 'buffer' }, + }, + }) + + -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'cmdline', priority = 200 }, + { name = 'path', priority = 3 }, + { name = 'cmdline_history', priority = 3 }, + { name = 'buffer', priority = 3 }, + }, + matching = { disallow_symbol_nonprefix_matching = false }, + }) + end, + enabled = false, +} diff --git a/lua/plugins/codecompanion.lua b/lua/plugins/codecompanion.lua new file mode 100644 index 0000000..d580f57 --- /dev/null +++ b/lua/plugins/codecompanion.lua @@ -0,0 +1,35 @@ +return { + 'olimorris/codecompanion.nvim', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-treesitter/nvim-treesitter', + }, + branch = 'main', + config = function() + require('codecompanion').setup({ + strategies = { + chat = { + adapter = 'copilot', + }, + inline = { + adapter = 'copilot', + }, + }, + -- adapters = { + -- anthropic = function() + -- return require('codecompanion.adapters').extend('copilot', { + -- env = { + -- api_key = 'ghu_8hbMItSdtNIrzMI4svd94dem3ZCsk23VG446', + -- }, + -- }) + -- end, + -- }, + }) + end, + cmd = { + 'CodeCompanion', + 'CodeCompanionChat', + 'CodeCompanionCmd', + 'CodeCompanionActions ', + }, +} diff --git a/lua/plugins/comment.lua b/lua/plugins/comment.lua new file mode 100644 index 0000000..be7cedf --- /dev/null +++ b/lua/plugins/comment.lua @@ -0,0 +1,11 @@ +return { + 'numToStr/Comment.nvim', + version = '*', + opts = { + mappings = false, + }, + keys = { + { '', '(comment_toggle_linewise_current)', desc = 'Toggle comment' }, + { '', '(comment_toggle_linewise_visual)gv', mode = 'v', desc = 'Toggle comment' }, + }, +} diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua new file mode 100644 index 0000000..4ccca45 --- /dev/null +++ b/lua/plugins/conform.lua @@ -0,0 +1,28 @@ +return { + 'stevearc/conform.nvim', + cmd = { 'ConformInfo' }, + opts = { + default_format_opts = { + lsp_format = 'fallback', + }, + log_level = vim.log.levels.ERROR, + formatters_by_ft = { + lua = { 'stylua' }, + python = { 'ruff_format' }, + yaml = { 'prettier', timeout_ms = 5000 }, + cmake = { 'gersemi' }, + markdown = { 'prettier' }, + json = { 'fixjson' }, + toml = { 'taplo' }, + tex = { 'latexindent' }, + }, + }, + keys = { + { + 'f', + mode = { 'n', 'x', 'v' }, + function() require('conform').format() end, + desc = 'Format with Conform', + }, + }, +} diff --git a/lua/plugins/copilot.lua b/lua/plugins/copilot.lua new file mode 100644 index 0000000..d23d150 --- /dev/null +++ b/lua/plugins/copilot.lua @@ -0,0 +1,30 @@ +return { + 'zbirenbaum/copilot.lua', + cmd = 'Copilot', + event = 'InsertEnter', + config = function() + local node_cmd = nil + local docker_node = vim.fn.expand('$HOME') .. '/.nvm/versions/node/v22.12.0/bin/node' + if vim.fn.executable(docker_node) == 1 then + node_cmd = docker_node + end + require('copilot').setup({ + filetypes = { + yaml = false, + markdown = false, + python = true, + help = false, + gitcommit = false, + gitrebase = false, + hgcommit = false, + svn = false, + cvs = false, + cpp = true, + ['.'] = false, + }, + copilot_node_command = node_cmd, + suggestion = { enabled = false, auto_trigger = false }, + panel = { enabled = false }, + }) + end, +} diff --git a/lua/plugins/copilotChat.lua b/lua/plugins/copilotChat.lua new file mode 100644 index 0000000..cee96f1 --- /dev/null +++ b/lua/plugins/copilotChat.lua @@ -0,0 +1,37 @@ +return { + { + 'CopilotC-Nvim/CopilotChat.nvim', + dependencies = { + { 'nvim-lua/plenary.nvim', branch = 'master' }, + }, + build = 'make tiktoken', + opts = { + -- See Configuration section for options + }, + cmd = { + 'CopilotChat', + 'CopilotChatOpen', + 'CopilotChatClose', + 'CopilotChatToggle', + 'CopilotChatStop', + 'CopilotChatReset', + 'CopilotChatSave', + 'CopilotChatLoad', + 'CopilotChatPrompts', + 'CopilotChatModels', + 'CopilotChat', + }, + keys = { + { 'xx', 'CopilotChatToggle', desc = 'Copilot Chat' }, + { 'xC', 'CopilotChatOpen', desc = 'Copilot Chat Open' }, + { 'xX', 'CopilotChatClose', desc = 'Copilot Chat Close' }, + { 'xt', 'CopilotChatToggle', desc = 'Copilot Chat Toggle' }, + { 'xs', 'CopilotChatStop', desc = 'Copilot Chat Stop' }, + { 'xX', 'CopilotChatReset', desc = 'Copilot Chat Reset' }, + { 'xw', 'CopilotChatSave', desc = 'Copilot Chat Save' }, + { 'xl', 'CopilotChatLoad', desc = 'Copilot Chat Load' }, + { 'cp', 'CopilotChatPrompts', desc = 'Copilot Chat Prompts' }, + { 'cm', 'CopilotChatModels', desc = 'Copilot Chat Models' }, + }, + }, +} diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua new file mode 100644 index 0000000..084eae8 --- /dev/null +++ b/lua/plugins/dap.lua @@ -0,0 +1,141 @@ +return { + 'mfussenegger/nvim-dap', + version = false, + dependencies = { + { + 'mfussenegger/nvim-dap-python', + version = false, + }, + -- 'theHamsta/nvim-dap-virtual-text', + { + 'rcarriga/nvim-dap-ui', + version = false, + dependencies = { + 'nvim-neotest/nvim-nio', + }, + }, + { + 'LiadOz/nvim-dap-repl-highlights', + version = false, + }, + }, + keys = { + { '', function() require('dap').continue() end, desc = 'DAP start or continue' }, + { '', function() require('dap').run_last() end, desc = 'DAP run last' }, + { '', function() require('dap').run_last() end, desc = 'Run last' }, + { '', function() require('dap').goto_() end, desc = 'DAP goto' }, + { '', function() require('dap.ui.widgets').hover() end, desc = 'DAP Hover' }, + { '', function() require('dap').toggle_breakpoint() end, desc = 'DAP breakpoint' }, + { '', function() require('dap').step_over() end, desc = 'DAP step_over' }, + { '', function() require('dap').step_into() end, desc = 'DAP step_into' }, + { '', function() require('dap').step_out() end, desc = 'DAP step_out' }, + }, + config = function() + local dap = require('dap') + vim.fn.sign_define('DapBreakpoint', { text = '🛑', texthl = '', linehl = '', numhl = '' }) + + -- make sure we can exit the terminal with esc + vim.api.nvim_create_autocmd({ 'TermOpen' }, { + pattern = { '*dap-terminal*' }, + callback = function() + local opts = { noremap = true } + vim.api.nvim_buf_set_keymap(0, 't', '', [[]], opts) + end, + }) + + require('dap.ext.vscode').json_decode = require('utils.json_workaround').decode_json + + local masonpath = vim.fn.stdpath('data') .. '/mason' + + vim.keymap.set('x', 'k', function() + local lines = vim.fn.getregion(vim.fn.getpos('.'), vim.fn.getpos('v'), { type = vim.fn.mode() }) + dap.repl.execute(table.concat(lines, '\n')) + end, { desc = 'Dapl execute selection' }) + vim.keymap.set('n', 'k', function() + local line = vim.api.nvim_get_current_line() + dap.repl.execute(line) + end, { desc = 'DAP execute' }) + + local dapui = require('dapui') + dapui.setup() + dap.listeners.before.attach.dapui_config = function() dapui.open() end + dap.listeners.before.launch.dapui_config = function() dapui.open() end + dap.listeners.before.event_terminated.dapui_config = function() dapui.close() end + dap.listeners.before.event_exited.dapui_config = function() dapui.close() end + + if vim.fn.system('uname'):find('Windows') then + require('dap-python').setup('python') + else + require('dap-python').setup('/venv/bin/python') + end + + -- CPP + dap.adapters.codelldb = { + type = 'server', + port = '${port}', + executable = { + command = 'codelldb', + args = { '--port', '${port}' }, + + -- On windows you may have to uncomment this: + detached = false, + }, + } + + dap.adapters.cppdbg = { + id = 'cppdbg', + type = 'executable', + command = masonpath .. '/bin/OpenDebugAD7', + } + + dap.adapters.lldb = { + type = 'executable', + command = function() + if vim.fn.system('uname') == 'Linux' then + return 'lldb-vscode' + else + return os.getenv('SCOOP') .. '/apps/llvm/current/bin/lldb-vscode.exe' + end + end, + name = 'lldb', + } + + dap.configurations.cpp = { + { + name = 'Launch codelldb', + type = 'codelldb', + request = 'launch', + program = function() return vim.fn.input({ 'Path to executable: ', vim.fn.getcwd() .. '/build_nvim/', 'file' }) end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + }, + { + name = 'Launch lldb', + type = 'lldb', + request = 'launch', + program = function() return vim.fn.input({ 'Path to executable: ', vim.fn.getcwd() .. '/build_nvim', 'file' }) end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + args = {}, + + -- 💀 + -- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting: + -- + -- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope + -- + -- Otherwise you might get the following error: + -- + -- Error on launch: Failed to attach to the target process + -- + -- But you should be aware of the implications: + -- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html + -- runInTerminal = false, + }, + } + + -- EXTENSIONS + + require('nvim-dap-repl-highlights').setup() + -- require('nvim-dap-virtual-text').setup({}) + end, +} diff --git a/lua/plugins/dial.lua b/lua/plugins/dial.lua new file mode 100644 index 0000000..e51b82b --- /dev/null +++ b/lua/plugins/dial.lua @@ -0,0 +1,23 @@ +return { + 'monaqa/dial.nvim', + keys = { + { '', function() return require('dial.map').inc_normal() end, expr = true, desc = 'Increment' }, + { '', function() return require('dial.map').dec_normal() end, expr = true, desc = 'Decrement' }, + { '', function() return require('dial.map').inc_visual() end, mode = 'v', expr = true, desc = 'Increment' }, + { '', function() return require('dial.map').dec_visual() end, mode = 'v', expr = true, desc = 'Decrement' }, + }, + config = function() + local augends = require('dial.augend') + require('dial.config').augends:register_group({ + -- default augends used when no group name is specified + default = { + augends.integer.alias.decimal, -- nonnegative decimal number (0, 1, 2, 3, ...) + augends.integer.alias.hex, -- nonnegative hex number (0x0, 0x1, 0x2, ...) + augends.date.alias['%Y/%m/%d'], -- date (2027/04/15, etc.) + augends.constant.alias.bool, -- boolean value (true <-> false) + augends.constant.new({ elements = { 'True', 'False' } }), + augends.constant.new({ elements = { 'TRUE', 'FALSE' } }), + }, + }) + end, +} diff --git a/lua/plugins/diffview.lua b/lua/plugins/diffview.lua new file mode 100644 index 0000000..bce417c --- /dev/null +++ b/lua/plugins/diffview.lua @@ -0,0 +1,25 @@ +return { + 'sindrets/diffview.nvim', + dependencies = { + 'nvim-lua/plenary.nvim', + }, + opts = { + keymaps = { + view = { + ['b'] = false, + }, + file_panel = { + ['b'] = false, + }, + file_history_panel = { + ['b'] = false, + }, + }, + }, + cmd = 'DiffviewOpen', + keys = { + { 'bb', 'DiffviewOpen', desc = 'Diffview local' }, + { 'bd', 'DiffviewOpen origin/develop...', desc = 'Diffview vs develop' }, + { 'bm', 'DiffviewOpen origin/master...', desc = 'Diffview vs master' }, + }, +} diff --git a/lua/plugins/dressing.lua b/lua/plugins/dressing.lua new file mode 100644 index 0000000..9984933 --- /dev/null +++ b/lua/plugins/dressing.lua @@ -0,0 +1,3 @@ +return { + 'stevearc/dressing.nvim', +} diff --git a/lua/plugins/flash.lua b/lua/plugins/flash.lua new file mode 100644 index 0000000..66aea50 --- /dev/null +++ b/lua/plugins/flash.lua @@ -0,0 +1,33 @@ +return { + 'folke/flash.nvim', + opts = { + modes = { + search = { + enabled = false, + }, + char = { + keys = { 'f', 'F', 't', 'T', ';' }, + }, + }, + }, + keys = { + { + 's', + mode = { 'n', 'x', 'o' }, + function() + -- default options: exact mode, multi window, all directions, with a backdrop + require('flash').jump() + end, + desc = 'Flash jump', + }, + { + 'S', + mode = { 'n', 'o', 'x' }, + function() + require('flash').treesitter() + vim.api.nvim_feedkeys('V', 'n', true) + end, + desc = 'Flash treesitter', + }, + }, +} diff --git a/lua/plugins/fyler.lua b/lua/plugins/fyler.lua new file mode 100644 index 0000000..bd8647d --- /dev/null +++ b/lua/plugins/fyler.lua @@ -0,0 +1,24 @@ +return { + 'A7Lavinraj/fyler.nvim', + dependencies = { + 'nvim-tree/nvim-web-devicons', + }, + branch = 'stable', + opts = { + views = { + default_explorer = true, + confirm_simple = true, + }, + integrations = { + icon = 'nvim_web_devicons', -- default + }, + -- mappings = { + -- ['C-d'] = 'SelectVSplit', + -- ['C-s'] = 'SelectSplit', + -- }, + }, + keys = { + { '-', function() require('fyler').open() end, desc = 'Open Fyler' }, + }, + cmd = { 'Fyler' }, +} diff --git a/lua/plugins/gitsigns.lua b/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..fb1083c --- /dev/null +++ b/lua/plugins/gitsigns.lua @@ -0,0 +1,65 @@ +return { + 'lewis6991/gitsigns.nvim', + branch = 'main', + config = function() + require('gitsigns').setup({ + current_line_blame = false, + current_line_blame_opts = { + virt_text = true, + virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' + delay = 1000, + ignore_whitespace = false, + }, + on_attach = function(bufnr) + local gitsigns = require('gitsigns') + + -- Navigation + vim.keymap.set('n', ']c', function() + if vim.wo.diff then + vim.cmd.normal({ ']c', bang = true }) + else + gitsigns.nav_hunk('next') + end + end, { desc = 'Next hunk' }) + + vim.keymap.set('n', '[c', function() + if vim.wo.diff then + vim.cmd.normal({ '[c', bang = true }) + else + gitsigns.nav_hunk('prev') + end + end, { desc = 'Previous hunk' }) + + -- Actions + vim.keymap.set('n', 'hs', gitsigns.stage_hunk, { desc = 'Stage hunk' }) + vim.keymap.set('n', 'hr', gitsigns.reset_hunk, { desc = 'Reset hunk' }) + + vim.keymap.set('v', 'hs', function() gitsigns.stage_hunk({ vim.fn.line('.'), vim.fn.line('v') }) end, { desc = 'Stage hunk' }) + + vim.keymap.set('v', 'hr', function() gitsigns.reset_hunk({ vim.fn.line('.'), vim.fn.line('v') }) end, { desc = 'Reset hunk' }) + + vim.keymap.set('n', 'hS', gitsigns.stage_buffer, { desc = 'Stage buffer' }) + vim.keymap.set('n', 'hR', gitsigns.reset_buffer, { desc = 'Reset buffer' }) + vim.keymap.set('n', 'hp', gitsigns.preview_hunk, { desc = 'Preview hunk' }) + vim.keymap.set('n', 'hi', gitsigns.preview_hunk_inline, { desc = 'Preview hunk inline' }) + + vim.keymap.set('n', 'hb', function() gitsigns.blame_line({ full = true }) end, { desc = 'Blame line' }) + + vim.keymap.set('n', 'hd', gitsigns.diffthis, { desc = 'Diff this' }) + + vim.keymap.set('n', 'hD', function() gitsigns.diffthis('~') end, { desc = 'Diff this (cached)' }) + + vim.keymap.set('n', 'hQ', function() gitsigns.setqflist('all') end, { desc = 'Set quickfix list all' }) + vim.keymap.set('n', 'hq', gitsigns.setqflist, { desc = 'Set quickfix list' }) + + -- Toggles + vim.keymap.set('n', 'tb', gitsigns.toggle_current_line_blame, { desc = 'Toggle blame' }) + vim.keymap.set('n', 'td', gitsigns.toggle_deleted, { desc = 'Toggle deleted' }) + vim.keymap.set('n', 'tw', gitsigns.toggle_word_diff, { desc = 'Toggle word diff' }) + + -- Text object + vim.keymap.set({ 'o', 'x' }, 'ih', ':Gitsigns select_hunk') + end, + }) + end, +} diff --git a/lua/plugins/goose.lua b/lua/plugins/goose.lua new file mode 100644 index 0000000..44698f6 --- /dev/null +++ b/lua/plugins/goose.lua @@ -0,0 +1,37 @@ +return { + 'azorng/goose.nvim', + config = function() + require('goose').setup({ + keymap = { + global = { + toggle = 'xg', -- Open goose. Close if opened + open_input = 'xx', -- Opens and focuses on input window on insert mode + open_input_new_session = 'xX', -- Opens and focuses on input window on insert mode. Creates a new session + open_output = 'xo', -- Opens and focuses on output window + toggle_focus = 'xt', -- Toggle focus between goose and last window + close = 'xq', -- Close UI windows + toggle_fullscreen = 'xf', -- Toggle between normal and fullscreen mode + select_session = 'xs', -- Select and load a goose session + goose_mode_chat = 'xmc', -- Set goose mode to `chat`. (Tool calling disabled. No editor context besides selections) + goose_mode_auto = 'xma', -- Set goose mode to `auto`. (Default mode with full agent capabilities) + configure_provider = 'xp', -- Quick provider and model switch from predefined list + diff_open = 'xd', -- Opens a diff tab of a modified file since the last goose prompt + diff_next = 'x]', -- Navigate to next file diff + diff_prev = 'x[', -- Navigate to previous file diff + diff_close = 'xc', -- Close diff view tab and return to normal editing + diff_revert_all = 'xra', -- Revert all file changes since the last goose prompt + diff_revert_this = 'xrt', -- Revert current file changes since the last goose prompt + }, + window = { + submit = '', + }, + }, + }) + end, + dependencies = { + 'nvim-lua/plenary.nvim', + { + 'MeanderingProgrammer/render-markdown.nvim', + }, + }, +} diff --git a/lua/plugins/grug-far.lua b/lua/plugins/grug-far.lua new file mode 100644 index 0000000..77783b9 --- /dev/null +++ b/lua/plugins/grug-far.lua @@ -0,0 +1,12 @@ +return { + 'MagicDuck/grug-far.nvim', + config = function() require('grug-far').setup({}) end, + keys = { + { + '', + function() require('grug-far').open() end, + desc = 'GrugFar', + mode = { 'n', 'v' }, + }, + }, +} diff --git a/lua/plugins/incline.lua b/lua/plugins/incline.lua new file mode 100644 index 0000000..bb51c56 --- /dev/null +++ b/lua/plugins/incline.lua @@ -0,0 +1,30 @@ +return { + 'b0o/incline.nvim', + config = function() + local helpers = require('incline.helpers') + local devicons = require('nvim-web-devicons') + require('incline').setup({ + window = { + padding = 0, + margin = { horizontal = 0 }, + }, + render = function(props) + local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ':t') + if filename == '' then + filename = '[No Name]' + end + local ft_icon, ft_color = devicons.get_icon_color(filename) + local modified = vim.bo[props.buf].modified + return { + ft_icon and { ' ', ft_icon, ' ', guibg = ft_color, guifg = helpers.contrast_color(ft_color) } or '', + ' ', + { filename, gui = modified and 'bold,italic' or 'bold' }, + ' ', + guibg = '#44406e', + } + end, + }) + end, + -- Optional: Lazy load Incline + event = 'VeryLazy', +} diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua new file mode 100644 index 0000000..a564707 --- /dev/null +++ b/lua/plugins/init.lua @@ -0,0 +1 @@ +return {} diff --git a/lua/plugins/iron.lua b/lua/plugins/iron.lua new file mode 100644 index 0000000..ce10ed5 --- /dev/null +++ b/lua/plugins/iron.lua @@ -0,0 +1,63 @@ +return { + 'Vigemus/iron.nvim', + branch = 'master', + config = function() + local iron = require('iron.core') + + iron.setup({ + config = { + -- Whether a repl should be discarded or not + scratch_repl = true, + -- Your repl definitions come here + repl_definition = { + sh = { + -- Can be a table or a function that + -- returns a table (see below) + command = { 'zsh' }, + }, + python = { + command = { 'python3' }, -- or { "ipython", "--no-autoindent" } + format = require('iron.fts.common').bracketed_paste_python, + }, + }, + -- How the repl window will be displayed + -- See below for more information + repl_open_cmd = require('iron.view').split.vertical('50%'), + }, + -- Iron doesn't set keymaps by default anymore. + -- You can set them here or manually add keymaps to the functions in iron.core + keymaps = { + send_motion = 'sc', + visual_send = 'sc', + send_file = 'sf', + send_line = 'sl', + send_paragraph = 'sp', + send_until_cursor = 'su', + send_mark = 'sm', + mark_motion = 'mc', + mark_visual = 'mc', + remove_mark = 'md', + cr = 's', + interrupt = 's', + exit = 'sq', + clear = 'cl', + }, + -- If the highlight is on, you can change how it looks + -- For the available options, check nvim_set_hl + highlight = { + italic = true, + }, + ignore_blank_lines = true, -- ignore blank lines when sending visual select lines + }) + + -- iron also has a list of commands, see :h iron-commands for all available commands + end, + cmd = { + 'IronRepl', + 'IronRestart', + 'IronFocus', + 'IronHide', + 'IronRepl', + 'IronReplHere', + }, +} diff --git a/lua/plugins/lazydev.lua b/lua/plugins/lazydev.lua new file mode 100644 index 0000000..e44d7b2 --- /dev/null +++ b/lua/plugins/lazydev.lua @@ -0,0 +1,18 @@ +return { + { + 'folke/lazydev.nvim', + ft = 'lua', -- only load on lua files + branch = 'main', + opts = { + library = { + -- See the configuration section for more details + -- Load luvit types when the `vim.uv` word is found + { path = 'luvit-meta/library', words = { 'vim%.uv' } }, + }, + }, + }, + { + 'Bilal2453/luvit-meta', + lazy = true, + }, +} diff --git a/lua/plugins/live-preview.lua b/lua/plugins/live-preview.lua new file mode 100644 index 0000000..43619e0 --- /dev/null +++ b/lua/plugins/live-preview.lua @@ -0,0 +1,6 @@ +return { + 'brianhuster/live-preview.nvim', + dependencies = { + 'folke/snacks.nvim', + }, +} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua new file mode 100644 index 0000000..d368e3d --- /dev/null +++ b/lua/plugins/lsp.lua @@ -0,0 +1,89 @@ +local lspKeys = function(client, bufnr) + local base_opts = { noremap = true, silent = false, buffer = bufnr } + + local function opts(desc) return vim.tbl_extend('error', base_opts, { desc = desc }) end + + local mappings = { + { mode = { 'n', 'x' }, key = 'a', fn = vim.lsp.buf.code_action, desc = 'Code action' }, + { mode = 'n', key = 'e', fn = vim.lsp.buf.declaration, desc = 'Declaration' }, + { mode = 'n', key = 'h', fn = function() vim.lsp.buf.hover({ border = 'none' }) end, desc = 'Hover' }, + { mode = 'n', key = 'c', fn = vim.lsp.buf.outgoing_calls, desc = 'Outgoing calls' }, + { mode = 'n', key = 'C', fn = vim.lsp.buf.incoming_calls, desc = 'Incoming calls' }, + { mode = 'n', key = 'm', fn = vim.lsp.buf.rename, desc = 'Rename' }, + { mode = 'n', key = 'D', fn = vim.lsp.buf.type_definition, desc = 'Type definition' }, + { mode = { 'n', 'i', 'x' }, key = '', fn = vim.lsp.buf.signature_help, desc = 'Signature help' }, + { mode = 'n', key = 'v', fn = function() vim.diagnostic.open_float({ border = 'rounded' }) end, desc = 'Diagnostics Float' }, + { mode = 'n', key = '', fn = 'ClangdSwitchSourceHeader', desc = 'Switch Source/Header' }, + } + + for _, map in ipairs(mappings) do + vim.keymap.set(map.mode, map.key, map.fn, opts(map.desc)) + end + + if client.supports_method('inlayHintProvider') then + vim.keymap.set( + 'n', + 'i', + function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = bufnr }), { bufnr = bufnr }) end, + opts('Toggle inlay hints') + ) + end +end + +return { + 'neovim/nvim-lspconfig', + dependencies = { + 'williamboman/mason.nvim', + 'SmiteshP/nvim-navic', + }, + lazy = false, + config = function() + local servers = { + 'texlab', + 'copilot', + 'ty', + 'ruff', + 'clangd', + 'lua_ls', + 'jsonls', + 'dockerls', + 'yamlls', + 'neocmake', + 'markdown_oxide', + 'taplo', + } + + local capabilities = vim.lsp.protocol.make_client_capabilities() + -- capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) + capabilities = require('blink.cmp').get_lsp_capabilities(capabilities) + vim.lsp.config('*', { + capabilities = capabilities, + }) + + vim.lsp.enable(servers) + + local lsp_group = vim.api.nvim_create_augroup('UserLspAttach', { clear = true }) + vim.api.nvim_create_autocmd('LspAttach', { + group = lsp_group, + desc = 'Set buffer-local keymaps and options after an LSP client attaches', + callback = function(args) + local bufnr = args.buf + local client = vim.lsp.get_client_by_id(args.data.client_id) + if not client then + return + end + lspKeys(client, bufnr) + + if client.server_capabilities.completionProvider then + vim.bo[bufnr].omnifunc = 'v:lua.vim.lsp.omnifunc' + vim.bo[bufnr].formatexpr = 'v:lua.vim.lsp.formatexpr()' + end + + if client.server_capabilities.documentSymbolProvider then + local navic = require('nvim-navic') + navic.attach(client, bufnr) + end + end, + }) + end, +} diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua new file mode 100644 index 0000000..0ff9aeb --- /dev/null +++ b/lua/plugins/lualine.lua @@ -0,0 +1,79 @@ +return { + 'nvim-lualine/lualine.nvim', + dependencies = { + 'nvim-tree/nvim-web-devicons', + 'Isrothy/lualine-diagnostic-message', + }, + config = function() + require('lualine').setup({ + options = { + theme = 'auto', + disabled_filetypes = { + statusline = {}, + winbar = { 'dap-repl', 'dapui_console' }, + }, + section_separators = { left = '', right = '' }, + component_separators = { left = '', right = '' }, + }, + globalstatus = true, + extensions = { 'oil', 'toggleterm' }, + sections = { + lualine_b = { + 'branch', + 'diff', + { + 'diagnostics', + sources = { 'nvim_diagnostic' }, + }, + }, + lualine_c = { + { + 'getcwd', + }, + { + 'filename', + path = 1, + file_status = true, + }, + { + function() return require('nvim-navic').get_location() end, + cond = function() return package.loaded['nvim-navic'] and require('nvim-navic').is_available() end, + }, + }, + lualine_y = { + 'searchcount', + 'progress', + }, + }, + inactive_sections = { + lualine_c = { + 'getcwd', + { + 'filename', + path = 1, + file_status = true, + }, + }, + }, + tabline = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { + { + 'tabs', + mode = 2, + tabs_color = { + -- Same values as the general color option can be used here. + active = { bg = 'orange', fg = 'black' }, + inactive = { bg = 'grey', fg = 'black' }, + }, + }, + }, + lualine_x = {}, + lualine_y = {}, + lualine_z = {}, + }, + }) + end, + enabled = true, +} diff --git a/lua/plugins/luasnip-snippets.lua b/lua/plugins/luasnip-snippets.lua new file mode 100644 index 0000000..109b031 --- /dev/null +++ b/lua/plugins/luasnip-snippets.lua @@ -0,0 +1,9 @@ +return { + 'mireq/luasnip-snippets', + dependencies = { 'L3MON4D3/LuaSnip' }, + init = function() + -- Mandatory setup function + require('luasnip_snippets.common.snip_utils').setup() + end, + enabled = false, +} diff --git a/lua/plugins/luasnip.lua b/lua/plugins/luasnip.lua new file mode 100644 index 0000000..888eedd --- /dev/null +++ b/lua/plugins/luasnip.lua @@ -0,0 +1,111 @@ +return { + 'L3MON4D3/LuaSnip', + dependencies = { 'rafamadriz/friendly-snippets' }, + config = function() + local ls = require('luasnip') + ls.setup({ + -- Required to automatically include base snippets, like "c" snippets for "cpp" + -- load_ft_func = require('luasnip_snippets.common.snip_utils').load_ft_func, + -- ft_func = require('luasnip_snippets.common.snip_utils').ft_func, + -- To enable auto expansin + enable_autosnippets = true, + -- Uncomment to enable visual snippets triggered using + store_selection_keys = '', + }) + -- some shorthands... + local s = ls.snippet + local sn = ls.snippet_node + local isn = ls.indent_snippet_node + local t = ls.text_node + local i = ls.insert_node + local f = ls.function_node + local c = ls.choice_node + local d = ls.dynamic_node + local r = ls.restore_node + local l = require('luasnip.extras').lambda + local rep = require('luasnip.extras').rep + local p = require('luasnip.extras').partial + local m = require('luasnip.extras').match + local n = require('luasnip.extras').nonempty + local dl = require('luasnip.extras').dynamic_lambda + local fmt = require('luasnip.extras.fmt').fmt + local fmta = require('luasnip.extras.fmt').fmta + local types = require('luasnip.util.types') + local conds = require('luasnip.extras.expand_conditions') + + local function getRegA(capitalize) + local clipboard = vim.fn.getreg('a') + clipboard = clipboard:gsub('^m_', '') + if capitalize then + clipboard = clipboard:gsub('^%l', string.upper) + end + return clipboard + end + + ls.snippets = { + cpp = { + s('TEST_F_getset', { + t('TEST_F('), + i(1, 'TestClass'), + t(' ,test_'), + p(getRegA, false), + t({ '_set_get)', '{', ' ' }), + i(2, 'm_object'), + t('.set'), + p(getRegA, true), + t('('), + i(3, '32.F'), + t({ ');', ' ' }), + i(4, 'EXPECT_EQ('), + rep(3), + t(', '), + rep(2), + t('.get'), + p(getRegA, true), + t({ '());', '' }), + t({ '', '}', '' }), + }), + s('TEST_fn_getset', { + t('void '), + p(getRegA, false), + t('_'), + i(1, 'get'), + t('_'), + i(2, 'set'), + t({ '()', '{', ' ' }), + i(3, 'm_object'), + t('.set'), + p(getRegA, true), + t('('), + i(4, '32.F'), + t({ ');', ' ' }), + i(5, 'EXPECT_EQ('), + rep(4), + t(', '), + rep(3), + t('.get'), + p(getRegA, true), + t({ '());', '' }), + t({ '', '}', '', '' }), + + t('TEST_F('), + i(5), + t(' ,test_'), + p(getRegA, false), + t({ '_set_get)', '{', ' ' }), + p(getRegA, false), + t('_'), + rep(1), + t('_'), + rep(2), + t({ '();' }), + t({ '', '}' }), + }), + }, + } + + require('luasnip.loaders.from_vscode').lazy_load() + require('luasnip.loaders.from_vscode').lazy_load({ paths = { './my-snippets' } }) + end, + cmd = 'LuaSnipListAvailable', +} diff --git a/lua/plugins/mason.lua b/lua/plugins/mason.lua new file mode 100644 index 0000000..ed9e360 --- /dev/null +++ b/lua/plugins/mason.lua @@ -0,0 +1,20 @@ +return { + 'williamboman/mason.nvim', + dependencies = { + 'WhoIsSethDaniel/mason-tool-installer.nvim', + }, + build = ':MasonUpdate', + branch = 'main', + config = function() + require('mason').setup({ + ui = { + border = 'rounded', + }, + }) + require('mason-tool-installer').setup({ + + -- a list of all tools you want to ensure are installed upon + -- start + }) + end, +} diff --git a/lua/plugins/mini-sessions.lua b/lua/plugins/mini-sessions.lua new file mode 100644 index 0000000..59ca65b --- /dev/null +++ b/lua/plugins/mini-sessions.lua @@ -0,0 +1,5 @@ +return { + 'echasnovski/mini.sessions', + version = '*', + config = function() require('mini.sessions').setup() end, +} diff --git a/lua/plugins/mini_ai.lua b/lua/plugins/mini_ai.lua new file mode 100644 index 0000000..76d47a5 --- /dev/null +++ b/lua/plugins/mini_ai.lua @@ -0,0 +1,10 @@ +return { + 'echasnovski/mini.ai', + config = function() + require('mini.ai').setup({ + -- Number of lines within which textobject is searched + n_lines = 150, + search_method = 'cover', + }) + end, +} diff --git a/lua/plugins/minuet-ai.lua b/lua/plugins/minuet-ai.lua new file mode 100644 index 0000000..4fb8559 --- /dev/null +++ b/lua/plugins/minuet-ai.lua @@ -0,0 +1,34 @@ +return { + 'milanglacier/minuet-ai.nvim', + dependencies = { + 'nvim-lua/plenary.nvim', + }, + opts = { + provider = 'gemini', + provider_options = { + gemini = { + model = 'gemini-2.5-flash', + optional = { + generationConfig = { + maxOutputTokens = 256, + -- When using `gemini-2.5-flash`, it is recommended to entirely + -- disable thinking for faster completion retrieval. + thinkingConfig = { + thinkingBudget = 0, + }, + }, + safetySettings = { + { + -- HARM_CATEGORY_HATE_SPEECH, + -- HARM_CATEGORY_HARASSMENT + -- HARM_CATEGORY_SEXUALLY_EXPLICIT + category = 'HARM_CATEGORY_DANGEROUS_CONTENT', + -- BLOCK_NONE + threshold = 'BLOCK_ONLY_HIGH', + }, + }, + }, + }, + }, + }, +} diff --git a/lua/plugins/neogen.lua b/lua/plugins/neogen.lua new file mode 100644 index 0000000..6db094f --- /dev/null +++ b/lua/plugins/neogen.lua @@ -0,0 +1,32 @@ +return { + 'danymat/neogen', + dependencies = 'nvim-treesitter/nvim-treesitter', + opts = { + enabled = true, + languages = { + cpp = { + template = { + annotation_convention = 'custom', + custom = { + { nil, '/// file', { no_results = true, type = { 'file' } } }, + { nil, '/// $1', { no_results = true, type = { 'func', 'file' } } }, + { nil, '', { no_results = true, type = { 'file' } } }, + + { nil, '/// $1', { type = { 'func' } } }, + { 'tparam', '/// \\tparam %s $1' }, + { 'parameters', '/// \\param %s $1' }, + { 'return_statement', '/// \\return $1' }, + }, + }, + }, + }, + }, + keys = { + { + 'n', + function() require('neogen').generate({}) end, + desc = 'Add comment', + }, + }, + cmd = 'Neogen', +} diff --git a/lua/plugins/neogit.lua b/lua/plugins/neogit.lua new file mode 100644 index 0000000..c6e13aa --- /dev/null +++ b/lua/plugins/neogit.lua @@ -0,0 +1,25 @@ +return { + branch = 'master', + 'TimUntersberger/neogit', + dependencies = { + 'nvim-lua/plenary.nvim', + 'sindrets/diffview.nvim', + }, + config = function() + local neogit = require('neogit') + neogit.setup({ + integrations = { + diffview = true, + }, + graph_style = 'unicode', + }) + end, + keys = { + { + 't', + function() require('neogit').open() end, + desc = 'Open Neogit', + }, + }, + cmd = { 'Neogit ' }, +} diff --git a/lua/plugins/neotest.lua b/lua/plugins/neotest.lua new file mode 100644 index 0000000..bf4375f --- /dev/null +++ b/lua/plugins/neotest.lua @@ -0,0 +1,35 @@ +return { + 'nvim-neotest/neotest', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-treesitter/nvim-treesitter', + 'antoinemadec/FixCursorHold.nvim', + 'nvim-neotest/neotest-python', + }, + config = function() + local pythonVenv = require('utils.python_venv') + require('neotest').setup({ + adapters = { + require('neotest-python')({ + dap = { + justMyCode = false, + }, + runner = 'pytest', + python = pythonVenv.getPythonEnv, + }), + }, + }) + end, + keys = { + { + '', + function() require('neotest').run.run() end, + desc = 'Run nearest test', + }, + { + '', + function() require('neotest').run.run({ strategy = 'dap' }) end, + desc = 'Run nearest test', + }, + }, +} diff --git a/lua/plugins/nvim-highlight-colors.lua b/lua/plugins/nvim-highlight-colors.lua new file mode 100644 index 0000000..54b27ad --- /dev/null +++ b/lua/plugins/nvim-highlight-colors.lua @@ -0,0 +1,9 @@ +return { + 'brenoprata10/nvim-highlight-colors', + config = true, + opts = { + render = 'background', -- or 'foreground' or 'virtual', + enable_named_colors = true, + }, + cmd = { 'HighlightColors' }, +} diff --git a/lua/plugins/nvim-lint.lua b/lua/plugins/nvim-lint.lua new file mode 100644 index 0000000..eb788b7 --- /dev/null +++ b/lua/plugins/nvim-lint.lua @@ -0,0 +1,22 @@ +return { + 'mfussenegger/nvim-lint', + config = function() + require('lint').linters_by_ft = { + cpp = { 'clangtidy' }, + } + vim.api.nvim_create_autocmd({ 'BufWritePost' }, { + callback = function() + -- try_lint without arguments runs the linters defined in `linters_by_ft` + -- for the current filetype + require('lint').try_lint() + + -- You can call `try_lint` with a linter name or a list of names to always + -- run specific linters, independent of the `linters_by_ft` configuration + -- require('lint').try_lint('cspell') + end, + }) + end, + ft = { + 'cpp', + }, +} diff --git a/lua/plugins/nvim-rooter.lua b/lua/plugins/nvim-rooter.lua new file mode 100644 index 0000000..0a11b49 --- /dev/null +++ b/lua/plugins/nvim-rooter.lua @@ -0,0 +1,17 @@ +return { + 'notjedi/nvim-rooter.lua', + opts = { + rooter_patterns = { + '.git', + '_darcs', + '.hg', + '.bzr', + '.svn', + 'Makefile', + 'package.json', + 'build_nvim', + 'real_path.txt', + 'conaninfo.txt', + }, + }, +} diff --git a/lua/plugins/overseer.lua b/lua/plugins/overseer.lua new file mode 100644 index 0000000..6eb15f1 --- /dev/null +++ b/lua/plugins/overseer.lua @@ -0,0 +1,31 @@ +return { + 'stevearc/overseer.nvim', + config = function() + require('overseer').setup({ + templates = { 'builtin', 'user.cmake.cmake', 'user.clang.clang-tidy' }, + }) + end, + keys = { + { + '', + function() require('overseer').run_template() end, + mode = { 'n', 'x' }, + desc = 'Start task (overseer)', + }, + }, + cmd = { + 'OverseerOpen', + 'OverseerClose', + 'OverseerToggle', + 'OverseerSaveBundle', + 'OverseerLoadBundle', + 'OverseerDeleteBundle', + 'OverseerRunCmd', + 'OverseerRun', + 'OverseerInfo', + 'OverseerBuild', + 'OverseerQuickAction', + 'OverseerTaskAction', + 'OverseerClearCache', + }, +} diff --git a/lua/plugins/rainbow-delimiters.lua b/lua/plugins/rainbow-delimiters.lua new file mode 100644 index 0000000..e4f8aa0 --- /dev/null +++ b/lua/plugins/rainbow-delimiters.lua @@ -0,0 +1,6 @@ +return { + 'HiPhish/rainbow-delimiters.nvim', + dependencies = 'nvim-treesitter/nvim-treesitter', + event = 'VeryLazy', + version = false, +} diff --git a/lua/plugins/render-markdown.lua b/lua/plugins/render-markdown.lua new file mode 100644 index 0000000..cc9791a --- /dev/null +++ b/lua/plugins/render-markdown.lua @@ -0,0 +1,11 @@ +return { + 'MeanderingProgrammer/render-markdown.nvim', + dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons + ---@module 'render-markdown' + ---@type render.md.UserConfig + opts = { + completions = { blink = { enabled = true } }, + ft = { 'markdown', 'codecompanion', 'Avante' }, + }, + ft = { 'markdown', 'Avante' }, +} diff --git a/lua/plugins/rustaceanvim.lua b/lua/plugins/rustaceanvim.lua new file mode 100644 index 0000000..465d13e --- /dev/null +++ b/lua/plugins/rustaceanvim.lua @@ -0,0 +1,39 @@ +return { + 'mrcjkb/rustaceanvim', + ft = { 'rust' }, + config = function() + vim.g.rustaceanvim = { + server = { + on_attach = function(client, bufnr) + local options = { noremap = true, silent = false, buffer = bufnr } + vim.keymap.set('n', 'y', function() vim.cmd.RustLsp({ 'hover', 'actions' }) end, vim.tbl_extend('error', options, { desc = 'Hover' })) + + local group = vim.api.nvim_create_augroup('lsp_document_highlight', { clear = false }) + vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { + callback = function() vim.lsp.buf.document_highlight() end, + buffer = bufnr, + group = group, + desc = 'Document Highlight', + }) + vim.api.nvim_create_autocmd('CursorMoved', { + callback = function() vim.lsp.buf.clear_references() end, + buffer = bufnr, + group = group, + desc = 'Clear All the References', + }) + vim.api.nvim_create_autocmd({ 'LspDetach' }, { + group = group, + buffer = bufnr, + callback = function() + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds({ + group = group, + buffer = bufnr, + }) + end, + }) + end, + }, + } + end, +} diff --git a/lua/plugins/sidekick.lua b/lua/plugins/sidekick.lua new file mode 100644 index 0000000..df5251d --- /dev/null +++ b/lua/plugins/sidekick.lua @@ -0,0 +1,55 @@ +return { + 'folke/sidekick.nvim', + opts = { + -- add any options here + cli = { + mux = { + backend = 'copilot', + enabled = true, + }, + }, + }, + keys = { + { + '', + function() + -- if there is a next edit, jump to it, otherwise apply it if any + if not require('sidekick').nes_jump_or_apply() then + return '' -- fallback to normal tab + end + end, + expr = true, + desc = 'Goto/Apply Next Edit Suggestion', + }, + { + '', + function() require('sidekick.cli').focus() end, + mode = { 'n', 'x', 'i', 't' }, + desc = 'Sidekick Switch Focus', + }, + { + 'aa', + function() require('sidekick.cli').toggle({ focus = true }) end, + desc = 'Sidekick Toggle CLI', + mode = { 'n', 'v' }, + }, + { + 'ac', + function() require('sidekick.cli').toggle({ name = 'copilot', focus = true }) end, + desc = 'Sidekick Claude Toggle', + mode = { 'n', 'v' }, + }, + { + 'ag', + function() require('sidekick.cli').toggle({ name = 'grok', focus = true }) end, + desc = 'Sidekick Grok Toggle', + mode = { 'n', 'v' }, + }, + { + 'ap', + function() require('sidekick.cli').select_prompt() end, + desc = 'Sidekick Ask Prompt', + mode = { 'n', 'v' }, + }, + }, +} diff --git a/lua/plugins/snacks.lua b/lua/plugins/snacks.lua new file mode 100644 index 0000000..bf5ddf7 --- /dev/null +++ b/lua/plugins/snacks.lua @@ -0,0 +1,137 @@ +return { + 'folke/snacks.nvim', + priority = 1000, + version = false, + lazy = false, + ---@type snacks.Config + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + bigfile = { enabled = true }, + notifier = { enabled = false }, + quickfile = { enabled = true }, + statuscolumn = { enabled = true }, + words = { + enabled = true, + modes = { 'n', 'c' }, + }, + indent = { + indent = { + only_scope = false, + only_current = false, + }, + enabled = true, + animate = { + enabled = true, + }, + scope = { + enabled = true, + }, + chunk = { + enabled = true, + hl = 'Debug', + }, + }, + dashboard = { + sections = { + { section = 'header' }, + { icon = ' ', title = 'Keymaps', section = 'keys', indent = 2, padding = 1 }, + { icon = ' ', title = 'Recent Files', section = 'recent_files', indent = 2, padding = 1 }, + { icon = ' ', title = 'Projects', section = 'projects', indent = 2, padding = 1 }, + { section = 'startup' }, + }, + }, + picker = { + matcher = { + frecency = true, + cwd_bonus = true, + filename_bonus = true, + history_bonus = true, + }, + win = { + input = { + keys = { + [''] = { 'edit_tab', mode = { 'n', 'i' } }, + }, + }, + }, + formatters = { + file = { + truncate = 100, + filename_first = true, + }, + }, + }, + }, + keys = { + { 'g', function() Snacks.lazygit({ cwd = vim.fn.getcwd() }) end, desc = 'Lazygit' }, + { 'gf', function() Snacks.lazygit.log_file() end, desc = 'Lazygit Current File History' }, + { 'gl', function() Snacks.lazygit.log() end, desc = 'Lazygit Log (cwd)' }, + { 'm', function() Snacks.words.jump(vim.v.count1) end, desc = 'Next Reference', mode = { 'n' } }, + { '', function() Snacks.words.jump(-vim.v.count1) end, desc = 'Prev Reference', mode = { 'n' } }, + -- Top Pickers & Explorer + { '', function() Snacks.picker.smart() end, desc = 'Smart Find Files' }, + { 'b', function() Snacks.picker.buffers() end, desc = 'Buffers' }, + { 'l', function() Snacks.picker.grep({ cwd = vim.fn.getcwd() }) end, desc = 'Grep' }, + { ':', function() Snacks.picker.command_history() end, desc = 'Command History' }, + { 'n', function() Snacks.picker.notifications() end, desc = 'Notification History' }, + { 'e', function() Snacks.explorer() end, desc = 'File Explorer' }, + -- find + -- { "fb", function() Snacks.picker.buffers() end, desc = "Buffers" }, + -- { "f", function() Snacks.picker.files({ cwd = vim.fn.stdpath("config") }) end, desc = "Find Config File" }, + { 'f', function() Snacks.picker.files() end, desc = 'Find Files' }, + { 'g', function() Snacks.picker.git_files() end, desc = 'Find Git Files' }, + { 'p', function() Snacks.picker.projects() end, desc = 'Projects' }, + { 'o', function() Snacks.picker.recent() end, desc = 'Recent' }, + { 'i', function() Snacks.picker.recent({ filter = { cwd = true } }) end, desc = 'Recent in cwd' }, + -- git + { 'nb', function() Snacks.picker.git_branches() end, desc = 'Git Branches' }, + { 'nl', function() Snacks.picker.git_log() end, desc = 'Git Log' }, + { 'nL', function() Snacks.picker.git_log_line() end, desc = 'Git Log Line' }, + { 'ns', function() Snacks.picker.git_status() end, desc = 'Git Status' }, + { 'nS', function() Snacks.picker.git_stash() end, desc = 'Git Stash' }, + { 'nd', function() Snacks.picker.git_diff() end, desc = 'Git Diff (Hunks)' }, + { 'nf', function() Snacks.picker.git_log_file() end, desc = 'Git Log File' }, + -- Grep + { 'sb', function() Snacks.picker.lines() end, desc = 'Buffer Lines' }, + { 'sB', function() Snacks.picker.grep_buffers() end, desc = 'Grep Open Buffers' }, + -- { "sg", function() Snacks.picker.grep() end, desc = "Grep" }, + { 'd', function() Snacks.picker.grep_word() end, desc = 'Visual selection or word', mode = { 'n', 'x' } }, + -- search + -- { 's"', function() Snacks.picker.registers() end, desc = "Registers" }, + -- { 's/', function() Snacks.picker.search_history() end, desc = "Search History" }, + -- { "sa", function() Snacks.picker.autocmds() end, desc = "Autocmds" }, + -- { "sb", function() Snacks.picker.lines() end, desc = "Buffer Lines" }, + { 'sc', function() Snacks.picker.command_history() end, desc = 'Command History' }, + { 'sC', function() Snacks.picker.commands() end, desc = 'Commands' }, + { 'v', function() Snacks.picker.diagnostics() end, desc = 'Diagnostics' }, + { 'V', function() Snacks.picker.diagnostics_buffer() end, desc = 'Buffer Diagnostics' }, + { 'sh', function() Snacks.picker.help() end, desc = 'Help Pages' }, + { 'sH', function() Snacks.picker.highlights() end, desc = 'Highlights' }, + { 'si', function() Snacks.picker.icons() end, desc = 'Icons' }, + { 'j', function() Snacks.picker.jumps() end, desc = 'Jumps' }, + { 'sk', function() Snacks.picker.keymaps() end, desc = 'Keymaps' }, + { 'sl', function() Snacks.picker.loclist() end, desc = 'Location List' }, + { 'sm', function() Snacks.picker.marks() end, desc = 'Marks' }, + { 'sM', function() Snacks.picker.man() end, desc = 'Man Pages' }, + { 'sp', function() Snacks.picker.lazy() end, desc = 'Search for Plugin Spec' }, + { 'sq', function() Snacks.picker.qflist() end, desc = 'Quickfix List' }, + { 'sR', function() Snacks.picker.resume() end, desc = 'Resume' }, + { 'su', function() Snacks.picker.undo() end, desc = 'Undo History' }, + -- { "uC", function() Snacks.picker.colorschemes() end, desc = "Colorschemes" }, + -- LSP + { 'd', function() Snacks.picker.lsp_definitions() end, desc = 'Goto Definition' }, + { 'D', function() Snacks.picker.lsp_declarations() end, desc = 'Goto Declaration' }, + { 'r', function() Snacks.picker.lsp_references() end, nowait = true, desc = 'References' }, + { 'I', function() Snacks.picker.lsp_implementations() end, desc = 'Goto Implementation' }, + { 'e', function() Snacks.picker.lsp_type_definitions() end, desc = 'Goto T[y]pe Definition' }, + { '', function() Snacks.picker.lsp_symbols() end, desc = 'LSP Symbols' }, + { 'sS', function() Snacks.picker.lsp_workspace_symbols() end, desc = 'LSP Workspace Symbols' }, + { '', function() Snacks.picker.lsp_workspace_symbols() end, desc = 'LSP Workspace Symbols' }, + { 'gi', function() Snacks.picker.gh_issue() end, desc = 'GitHub Issues (open)' }, + { 'gI', function() Snacks.picker.gh_issue({ state = 'all' }) end, desc = 'GitHub Issues (all)' }, + { 'gp', function() Snacks.picker.gh_pr() end, desc = 'GitHub Pull Requests (open)' }, + { 'gP', function() Snacks.picker.gh_pr({ state = 'all' }) end, desc = 'GitHub Pull Requests (all)' }, + }, +} diff --git a/lua/plugins/texpresso.lua b/lua/plugins/texpresso.lua new file mode 100644 index 0000000..b4778c6 --- /dev/null +++ b/lua/plugins/texpresso.lua @@ -0,0 +1,3 @@ +return { + 'let-def/texpresso.vim', +} diff --git a/lua/plugins/tiny-glimmer.lua b/lua/plugins/tiny-glimmer.lua new file mode 100644 index 0000000..f237d26 --- /dev/null +++ b/lua/plugins/tiny-glimmer.lua @@ -0,0 +1,58 @@ +return { + 'rachartier/tiny-glimmer.nvim', + event = 'VeryLazy', + priority = 10, -- Low priority to catch other plugins' keybindings + config = function() + require('tiny-glimmer').setup({ + overwrite = { + yank = { + enabled = true, + default_animation = 'fade', + }, + search = { + enabled = true, + }, + undo = { + enabled = true, + default_animation = { + name = 'fade', + settings = { + from_color = '@comment.warning', + max_duration = 500, + min_duration = 500, + }, + }, + }, + redo = { + enabled = true, + default_animation = { + name = 'fade', + settings = { + from_color = '@comment.warning', + max_duration = 500, + min_duration = 500, + }, + }, + redo_mapping = '', + }, + }, + animations = { + fade = { + from_color = '@comment.warning', -- Start color (highlight group or hex) + }, + reverse_fade = { + from_color = '@comment.warning', -- Start color (highlight group or hex) + }, + pulse = { + from_color = '@comment.warning', -- Start color (highlight group or hex) + }, + bounce = { + from_color = '@comment.warning', -- Start color (highlight group or hex) + }, + left_to_right = { + from_color = '@comment.warning', -- Start color (highlight group or hex) + }, + }, + }) + end, +} diff --git a/lua/plugins/tiny-inline-diagnostics.lua b/lua/plugins/tiny-inline-diagnostics.lua new file mode 100644 index 0000000..74cc870 --- /dev/null +++ b/lua/plugins/tiny-inline-diagnostics.lua @@ -0,0 +1,11 @@ +return { + 'rachartier/tiny-inline-diagnostic.nvim', + event = 'VeryLazy', + priority = 1000, + config = function() + require('tiny-inline-diagnostic').setup({ + preset = 'powerline', + }) + vim.diagnostic.config({ virtual_text = false }) -- Disable default virtual text + end, +} diff --git a/lua/plugins/todo-comments.lua b/lua/plugins/todo-comments.lua new file mode 100644 index 0000000..d3d21dd --- /dev/null +++ b/lua/plugins/todo-comments.lua @@ -0,0 +1,9 @@ +return { + 'folke/todo-comments.nvim', + dependencies = { 'nvim-lua/plenary.nvim' }, + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }, +} diff --git a/lua/plugins/toggleterm.lua b/lua/plugins/toggleterm.lua new file mode 100644 index 0000000..6cdbb60 --- /dev/null +++ b/lua/plugins/toggleterm.lua @@ -0,0 +1,42 @@ +return { + 'akinsho/toggleterm.nvim', + config = function() + function _G.set_terminal_keymaps(term) + local opts = { noremap = true } + if term.cmd ~= 'lazygit' then + vim.api.nvim_buf_set_keymap(term.bufnr, 't', '', [[]], opts) + end + vim.api.nvim_buf_set_keymap(term.bufnr, 't', 'jk', [[]], opts) + vim.api.nvim_buf_set_keymap(term.bufnr, 't', '', [[h]], opts) + vim.api.nvim_buf_set_keymap(term.bufnr, 't', '', [[j]], opts) + vim.api.nvim_buf_set_keymap(term.bufnr, 't', '', [[k]], opts) + vim.api.nvim_buf_set_keymap(term.bufnr, 't', '', [[l]], opts) + end + + require('toggleterm').setup({ + on_open = set_terminal_keymaps, + }) + + local Terminal = require('toggleterm.terminal').Terminal + + function _lazygit_toggle() + local lazygit = Terminal:new({ + cmd = 'lazygit', + direction = 'float', + cwd = function() return vim.fn.getcwd() end, + float_opts = { + border = 'double', + }, + -- function to run on opening the terminal + on_open = function(term) + vim.cmd('startinsert!') + vim.api.nvim_buf_set_keymap(term.bufnr, 'n', 'q', 'close', { noremap = true, silent = true }) + end, + -- function to run on closing the terminal + on_close = function(term) vim.cmd('startinsert!') end, + }) + lazygit:open() + end + end, + cmd = 'ToggleTerm', +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..1c72204 --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,12 @@ +return { + 'nvim-treesitter/nvim-treesitter', + lazy = false, + branch = 'main', + build = ':TSUpdate', + config = function() + require('nvim-treesitter.install').compilers = { 'clang' } + require('nvim-treesitter').setup({}) + vim.treesitter.language.register('groovy', 'java') + require('nvim-treesitter.install').prefer_git = false + end, +} diff --git a/lua/plugins/which-key.lua b/lua/plugins/which-key.lua new file mode 100644 index 0000000..e894c23 --- /dev/null +++ b/lua/plugins/which-key.lua @@ -0,0 +1,13 @@ +return { + 'folke/which-key.nvim', + version = '*', + opts = { + plugins = { + marks = false, + registers = false, + presets = { + operators = false, + }, + }, + }, +} diff --git a/lua/themes/astrodark.lua b/lua/themes/astrodark.lua new file mode 100644 index 0000000..1811821 --- /dev/null +++ b/lua/themes/astrodark.lua @@ -0,0 +1,63 @@ +return { + 'AstroNvim/astrotheme', + lazy = true, + priority = 1000, + config = function() + local C = require('astrotheme.palettes.astrodark') + require('astrotheme').setup({ + palette = 'astrodark', -- String of the default palette to use when calling `:colorscheme astrotheme` + + termguicolors = true, -- Bool value, toggles if termguicolors are set by AstroTheme. + + terminal_color = true, -- Bool value, toggles if terminal_colors are set by AstroTheme. + + plugin_default = 'auto', -- Sets how all plugins will be loaded + -- "auto": Uses lazy / packer enabled plugins to load highlights. + -- true: Enables all plugins highlights. + -- false: Disables all plugins. + + plugins = { -- Allows for individual plugin overides using plugin name and value from above. + -- ['lualine'] = true, + }, + + palettes = { + global = {}, + astrodark = {}, + }, + highlights = { + global = { + modify_hl_groups = function(hl, c) end, + }, + astrodark = { + modify_hl_groups = function(hl, c) -- modify_hl_groups function allows you to modify hl groups, + hl.Type = { fg = c.Yellow } + hl.Comment = { italic = true } + end, + ['@lsp.mod.readonly'] = { bold = true }, + ['@lsp.type.namespace.cpp'] = { fg = C.rb }, + ['@lsp.type.variable'] = { fg = C.light_purple }, + -- ['@lsp.type.variable'] = { link = '@variable' }, + ['@variable'] = { fg = C.light_purple, link = '' }, + -- ['Function'] = { fg = C.light_cyan }, + ['@lsp.type.enumMember'] = { fg = C.cyan }, + ['Comment'] = { italic = true }, + ['Type'] = { fg = C.dark_orange }, + ['Structure'] = { link = 'Type' }, + ['Constant'] = { fg = 'NONE' }, + ['@parameter'] = { fg = C.toml }, + ['NormalFloat'] = { bg = C.surface0 }, + ['TelescopeBorder'] = { bg = C.surface0 }, + ['TelescopeNormal'] = { bg = C.surface0 }, + ['TelescopePreviewBorder'] = { link = 'TelescopeBorder' }, + ['TelescopeResultsBorder'] = { link = 'TelescopeResultsNormal' }, + ['TelescopePreviewNormal'] = { bg = C.surface0 }, + ['TelescopeTitle'] = { bg = C.surface0 }, + ['TelescopePromptNormal'] = { bg = C.surface0 }, + ['TelescopePromptBorder'] = { link = 'TelescopeBorder' }, + }, + }, + }) + vim.cmd('colorscheme astrodark') + end, + enabled = true, +} diff --git a/lua/themes/bamboo.lua b/lua/themes/bamboo.lua new file mode 100644 index 0000000..88ba1f7 --- /dev/null +++ b/lua/themes/bamboo.lua @@ -0,0 +1,82 @@ +return { + 'ribru17/bamboo.nvim', + lazy = true, + -- priority = 1000, + config = function() + local colors = require('bamboo.palette') + require('bamboo').setup({ + dim_inactive = false, -- Dim inactive windows/buffers + lualine = { + transparent = false, -- lualine center bar transparency + }, + code_style = { + comments = { italic = false }, + conditionals = { italic = false }, + keywords = {}, + functions = {}, + namespaces = { italic = false }, + parameters = { italic = false }, + strings = {}, + variables = {}, + }, + highlights = { + ['@lsp.type.comment'] = { link = '@comment', default = true }, + ['@comment'] = { fg = colors.vulgaris.light_grey, default = true }, + ['@lsp.type.parameter'] = { fg = colors.vulgaris.red }, + ['@lsp.mod.readonly'] = { fmt = 'bold', fg = 'NONE' }, + ['@lsp.typemod.parameter.readonly'] = { fmt = 'bold', fg = 'NONE' }, + ['@lsp.typemod.method.defaultLibrary.cpp'] = { fg = 'NONE' }, + ['@function.builtin'] = { fg = 'NONE' }, + ['LspReferenceRead'] = { bg = colors.vulgaris.green, fg = colors.vulgaris.bg1, fmt = 'nocombine' }, + ['LspReferenceWrite'] = { bg = colors.vulgaris.red, fg = colors.vulgaris.bg1, fmt = 'nocombine' }, + ['LspReferenceText'] = { bg = colors.vulgaris.cyan, fg = colors.vulgaris.bg1, fmt = 'nocombine' }, + -- ['NormalFloat'] = { bg = colors.vulgaris.bg3, fmt = 'nocombine' }, + -- ['FloatBorder'] = { bg = colors.vulgaris.bg_d, fmt = 'nocombine' }, + ['SnacksPickerList'] = { bg = colors.vulgaris.bg_d, fmt = 'nocombine' }, + ['SnacksPickerListCursorLine'] = { bg = colors.vulgaris.bg3, fmt = 'nocombine' }, + ['SnacksPickerPrompt'] = { bg = colors.vulgaris.bg_d, fmt = 'nocombine' }, + ['SnacksPickerInput'] = { bg = colors.vulgaris.bg_d, fmt = 'nocombine' }, + ['SnacksPickerPreview'] = { bg = colors.vulgaris.bg_d, fmt = 'nocombine' }, + ['SnacksPickerInputBorder'] = { bg = colors.vulgaris.bg_d, fmt = 'nocombine' }, + ['NonText'] = { fg = colors.vulgaris.blue }, + ['BlinkCmpMenu'] = { bg = colors.vulgaris.bg2 }, + ['BlinkCmpDoc'] = { bg = colors.vulgaris.bg2 }, + ['CmpDocumentation'] = { bg = colors.vulgaris.bg2 }, + ['BlinkCmpMenuSelection'] = { bg = colors.vulgaris.grey }, + ['PmenuSel'] = { bg = '#282C34', fg = 'NONE' }, + ['Pmenu'] = { fg = '#C5CDD9', bg = colors.vulgaris.bg3 }, + ['CmpItemAbbrDeprecated'] = { fg = '#7E8294', bg = 'NONE', strikethrough = true }, + ['CmpItemAbbrMatch'] = { fg = '#82AAFF', bg = 'NONE', bold = true }, + ['CmpItemAbbrMatchFuzzy'] = { fg = '#82AAFF', bg = 'NONE', bold = true }, + ['CmpItemMenu'] = { fg = '#C792EA', bg = 'NONE', italic = true }, + ['CmpItemKindField'] = { fg = '#EED8DA', bg = '#B5585F' }, + ['CmpItemKindProperty'] = { fg = '#EED8DA', bg = '#B5585F' }, + ['CmpItemKindEvent'] = { fg = '#EED8DA', bg = '#B5585F' }, + ['CmpItemKindText'] = { fg = '#C3E88D', bg = '#9FBD73' }, + ['CmpItemKindEnum'] = { fg = '#C3E88D', bg = '#9FBD73' }, + ['CmpItemKindKeyword'] = { fg = '#C3E88D', bg = '#9FBD73' }, + ['CmpItemKindConstant'] = { fg = '#FFE082', bg = '#D4BB6C' }, + ['CmpItemKindConstructor'] = { fg = '#FFE082', bg = '#D4BB6C' }, + ['CmpItemKindReference'] = { fg = '#FFE082', bg = '#D4BB6C' }, + ['CmpItemKindFunction'] = { fg = '#EADFF0', bg = '#A377BF' }, + ['CmpItemKindStruct'] = { fg = '#EADFF0', bg = '#A377BF' }, + ['CmpItemKindClass'] = { fg = '#EADFF0', bg = '#A377BF' }, + ['CmpItemKindModule'] = { fg = '#EADFF0', bg = '#A377BF' }, + ['CmpItemKindOperator'] = { fg = '#EADFF0', bg = '#A377BF' }, + ['CmpItemKindVariable'] = { fg = '#C5CDD9', bg = '#7E8294' }, + ['CmpItemKindFile'] = { fg = '#C5CDD9', bg = '#7E8294' }, + ['CmpItemKindUnit'] = { fg = '#F5EBD9', bg = '#D4A959' }, + ['CmpItemKindSnippet'] = { fg = '#F5EBD9', bg = '#D4A959' }, + ['CmpItemKindFolder'] = { fg = '#F5EBD9', bg = '#D4A959' }, + ['CmpItemKindMethod'] = { fg = '#DDE5F5', bg = '#6C8ED4' }, + ['CmpItemKindValue'] = { fg = '#DDE5F5', bg = '#6C8ED4' }, + ['CmpItemKindEnumMember'] = { fg = '#DDE5F5', bg = '#6C8ED4' }, + ['CmpItemKindInterface'] = { fg = '#D8EEEB', bg = '#58B5A8' }, + ['CmpItemKindColor'] = { fg = '#D8EEEB', bg = '#58B5A8' }, + ['CmpItemKindTypeParameter'] = { fg = '#D8EEEB', bg = '#58B5A8' }, + }, + }) + require('bamboo').load() + end, + enabled = false, +} diff --git a/lua/themes/everforest.lua b/lua/themes/everforest.lua new file mode 100644 index 0000000..2248446 --- /dev/null +++ b/lua/themes/everforest.lua @@ -0,0 +1,15 @@ +return { + 'neanias/everforest-nvim', + version = false, + lazy = true, + priority = 1000, -- make sure to load this before all the other start plugins + -- Optional; default configuration will be used if setup isn't called. + config = function() + require('everforest').setup({ + background = 'hard', + -- Your config here + }) + require('everforest').load() + end, + enabled = true, +} diff --git a/lua/themes/github-theme.lua b/lua/themes/github-theme.lua new file mode 100644 index 0000000..91219cf --- /dev/null +++ b/lua/themes/github-theme.lua @@ -0,0 +1,42 @@ +return { + 'projekt0n/github-nvim-theme', + lazy = false, -- make sure we load this during startup if it is your main colorscheme + priority = 1000, -- make sure to load this before all the other start plugins + config = function() + require('github-theme').setup({ + options = { + dim_inactive = true, + modules = { + 'cmp', + -- 'coc', + -- 'coc_explorer', + 'dapui', + -- 'diffchar', + -- 'dashboard', + 'diagnostic', + -- 'fidget', + -- 'fzf', + 'gitgutter', + 'gitsigns', + 'indent_blankline', + 'lsp_semantic_tokens', + -- 'lsp_trouble', + -- 'mini', + 'native_lsp', + 'neogit', + 'neotree', + -- 'notify', + -- 'nvimtree', + 'telescope', + 'treesitter', + 'treesitter_context', + 'whichkey', + }, + }, + }) + + -- vim.cmd('colorscheme github_dark') + vim.cmd('colorscheme github_dark_dimmed') + end, + enabled = false, +} diff --git a/lua/themes/gruvbox-baby.lua b/lua/themes/gruvbox-baby.lua new file mode 100644 index 0000000..6850639 --- /dev/null +++ b/lua/themes/gruvbox-baby.lua @@ -0,0 +1,7 @@ +return { + 'luisiacc/gruvbox-baby', + lazy = true, + priority = 1000, -- make sure to load this before all the other start plugins + config = function() vim.cmd('colorscheme gruvbox-baby') end, + enabled = true, +} diff --git a/lua/themes/gruvbox.lua b/lua/themes/gruvbox.lua new file mode 100644 index 0000000..cb67c99 --- /dev/null +++ b/lua/themes/gruvbox.lua @@ -0,0 +1,37 @@ +return { + 'ellisonleao/gruvbox.nvim', + priority = 1000, + lazy = true, + branch = 'main', + config = function() + -- local colors = require('gruvbox.palette').colors + + require('gruvbox').setup({ + undercurl = true, + underline = true, + bold = false, + italic = { + strings = false, + comments = true, + operators = false, + folds = true, + }, + strikethrough = true, + invert_selection = false, + invert_signs = false, + invert_tabline = false, + invert_intend_guides = false, + palette_overrides = {}, + overrides = { + -- ['@lsp.type.parameter'] = { fg = colors.faded_purple }, + ['@lsp.type.function'] = { fg = '#797df2' }, + ['@lsp.type.method'] = { fg = '#797df2' }, + ['@lsp.mod.readonly'] = { bold = true }, + }, + dim_inactive = true, + transparent_mode = false, + }) + vim.cmd('colorscheme gruvbox') + end, + enabled = true, +} diff --git a/lua/themes/gruvbox_flat.lua b/lua/themes/gruvbox_flat.lua new file mode 100644 index 0000000..d4de67a --- /dev/null +++ b/lua/themes/gruvbox_flat.lua @@ -0,0 +1,19 @@ +return { + 'eddyekofo94/gruvbox-flat.nvim', + priority = 1000, + config = function() + local colors = require('gruvbox.colors') + vim.g.gruvbox_flat_style = 'dark' + vim.g.gruvbox_colors = { + bg_search = 'purple', + fg_search = 'black', + } + vim.g.gruvbox_theme = { + Pmenu = { bg = 'bg_visual' }, + NormalFloat = { bg = 'bg_visual' }, + } + vim.g.gruvbox_dark_float = false + vim.cmd('colorscheme gruvbox-flat') + end, + enabled = false, +} diff --git a/lua/themes/gruvbox_material.lua b/lua/themes/gruvbox_material.lua new file mode 100644 index 0000000..c8a7629 --- /dev/null +++ b/lua/themes/gruvbox_material.lua @@ -0,0 +1,42 @@ +return { + 'sainnhe/gruvbox-material', + priority = 1000, + config = function() + -- local colors = require('gruvbox.colors') + -- vim.g.gruvbox_flat_style = "dark" + -- vim.g.gruvbox_colors = { + -- bg_search = 'purple', + -- fg_search = 'black', + -- } + -- vim.g.gruvbox_theme = { + -- Pmenu = { bg = 'bg_visual' }, + -- NormalFloat = { bg = 'bg_visual' } + -- } + -- vim.g.gruvbox_dark_float = false + vim.g.gruvbox_material_ui_contrast = 'high' + vim.g.gruvbox_material_dim_inactive_windows = 1 -- Dim inactive windows. Only works in neovim currently. + vim.g.gruvbox_material_disable_terminal_colors = 0 + local links = { + ['@lsp.type.namespace'] = '@namespace', + ['@lsp.type.type'] = '@type', + ['@lsp.type.class'] = '@type', + ['@lsp.type.enum'] = '@type', + ['@lsp.type.interface'] = '@type', + ['@lsp.type.struct'] = '@structure', + ['@lsp.type.parameter'] = '@parameter', + ['@lsp.type.variable'] = '@variable', + ['@lsp.type.property'] = '@property', + ['@lsp.type.enumMember'] = '@constant', + ['@lsp.type.function'] = '@function', + ['@lsp.type.method'] = '@method', + ['@lsp.type.macro'] = '@macro', + ['@lsp.type.decorator'] = '@function', + } + -- for newgroup, oldgroup in pairs(links) do + -- vim.api.nvim_set_hl(0, newgroup, { link = oldgroup, default = true }) + -- end + vim.cmd('colorscheme gruvbox-material') + vim.api.nvim_set_hl(0, '@lsp.mod.readonly', { italic = true, fg = 'Purple' }) + end, + enabled = false, +} diff --git a/lua/themes/kanagawa.lua b/lua/themes/kanagawa.lua new file mode 100644 index 0000000..ff6715a --- /dev/null +++ b/lua/themes/kanagawa.lua @@ -0,0 +1,40 @@ +return { + 'rebelot/kanagawa.nvim', + lazy = false, + priority = 1000, + config = function() + require('kanagawa').setup({ + compile = false, -- enable compiling the colorscheme + undercurl = true, -- enable undercurls + commentStyle = { italic = true }, + functionStyle = {}, + keywordStyle = { italic = true }, + statementStyle = { bold = true }, + typeStyle = {}, + transparent = false, -- do not set background color + dimInactive = false, -- dim inactive window `:h hl-NormalNC` + terminalColors = true, -- define vim.g.terminal_color_{0,17} + colors = { + -- add/modify theme and palette colors + palette = {}, + theme = { wave = {}, lotus = {}, dragon = {}, all = {} }, + }, + overrides = function(colors) -- add/modify highlights + return { + ['@lsp.mod.readonly'] = { bold = true }, + ['@lsp.mod.static'] = { italic = true }, + ['LspReferenceRead'] = { bg = colors.palette.lotusGreen, fg = colors.palette.dragonBlack0 }, + ['LspReferenceWrite'] = { bg = colors.palette.samuraiRed, fg = colors.palette.dragonBlack0 }, + } + end, + theme = 'wave', -- Load "wave" theme when 'background' option is not set + background = { + -- map the value of 'background' option to a theme + dark = 'wave', -- try "dragon" ! + light = 'lotus', + }, + }) + require('kanagawa').load('wave') + end, + enabled = true, +} diff --git a/lua/themes/material.lua b/lua/themes/material.lua new file mode 100644 index 0000000..d8ceaf2 --- /dev/null +++ b/lua/themes/material.lua @@ -0,0 +1,77 @@ +return { + 'marko-cerovac/material.nvim', + priority = 1000, + config = function() + local colors = require('material.colors') + require('material').setup({ + + contrast = { + terminal = false, -- Enable contrast for the built-in terminal + sidebars = false, -- Enable contrast for sidebar-like windows ( for example Nvim-Tree ) + floating_windows = true, -- Enable contrast for floating windows + cursor_line = false, -- Enable darker background for the cursor line + non_current_windows = true, -- Enable darker background for non-current windows + filetypes = {}, -- Specify which filetypes get the contrasted (darker) background + }, + + styles = { -- Give comments style such as bold, italic, underline etc. + comments = { --[[ italic = true ]] + }, + strings = { --[[ bold = true ]] + }, + keywords = { --[[ underline = true ]] + }, + functions = { --[[ bold = true, undercurl = true ]] + }, + variables = {}, + operators = {}, + types = {}, + }, + + plugins = { -- Uncomment the plugins that you use to highlight them + -- Available plugins: + 'dap', + -- "dashboard", + 'gitsigns', + -- "hop", + 'indent-blankline', + -- "lspsaga", + -- "mini", + -- "neogit", + -- "neorg", + 'nvim-cmp', + 'nvim-navic', + -- "nvim-tree", + 'nvim-web-devicons', + -- "sneak", + 'telescope', + -- "trouble", + 'which-key', + }, + + disable = { + colored_cursor = false, -- Disable the colored cursor + borders = false, -- Disable borders between verticaly split windows + background = false, -- Prevent the theme from setting the background (NeoVim then uses your terminal background) + term_colors = false, -- Prevent the theme from setting terminal colors + eob_lines = false, -- Hide the end-of-buffer lines + }, + + high_visibility = { + lighter = false, -- Enable higher contrast text for lighter style + darker = true, -- Enable higher contrast text for darker style + }, + + lualine_style = 'default', -- Lualine style ( can be 'stealth' or 'default' ) + + async_loading = true, -- Load parts of the theme asyncronously for faster startup (turned on by default) + + custom_colors = nil, -- If you want to everride the default colors, set this to a function + + custom_highlights = {}, -- Overwrite highlights with your own + }) + vim.g.material_style = 'darker' + vim.cmd('colorscheme material') + end, + enabled = false, +} diff --git a/lua/themes/monokai-pro.lua b/lua/themes/monokai-pro.lua new file mode 100644 index 0000000..8b05f2a --- /dev/null +++ b/lua/themes/monokai-pro.lua @@ -0,0 +1,64 @@ +return { + 'loctvl842/monokai-pro.nvim', + lazy = true, + config = function() + require('monokai-pro').setup({ + -- filter = 'spectrum' + override = function(c) + return { + ['@lsp.type.class'] = { link = 'Structure' }, + ['@lsp.type.decorator'] = { link = 'Function' }, + ['@lsp.type.enum'] = { link = 'Structure' }, + ['@lsp.type.enumNumber'] = { link = 'Constant' }, + ['@lsp.type.function'] = { link = 'Function' }, + ['@lsp.type.interface'] = { link = 'Structure' }, + ['@lsp.type.macro'] = { link = 'Macro' }, + -- ['@lsp.type.method'] = { link = 'Function' }, + ['@lsp.type.namespace'] = { link = 'Identifier' }, + ['@lsp.type.parameter'] = { link = '@lsp.typemod.parameter.declaration' }, + ['@lsp.type.property'] = { link = 'Identifier' }, + ['@lsp.type.struct'] = { link = 'Structure' }, + ['@lsp.type.type'] = { link = 'Type' }, + ['@lsp.type.typeParameter'] = { link = 'TypeDef' }, + ['@lsp.type.variable'] = { link = 'Identifier' }, + + -- mod + -- ["@lsp.mod.declaration"] = { fg = c.base.cyan }, + -- ["@lsp.mod.definition"] = { fg = c.base.cyan }, + -- ["@lsp.mod.readonly"] = { fg = c.base.magenta }, + -- ["@lsp.mod.static"] = {}, + ['@lsp.mod.deprecated'] = { strikethrough = true }, + -- ["@lsp.mod.abstract"] = {}, + -- ["@lsp.mod.async"] = {}, + -- ["@lsp.mod.modification"] = {}, + -- ["@lsp.mod.documentation"] = {}, + -- ["@lsp.mod.defaultLibrary"] = {}, + + ['@lsp.typemod.class.defaultLibrary'] = { fg = c.base.white }, + -- ["@lsp.typemod.decorator"] = {}, + -- ["@lsp.typemod.enum"] = {}, + -- ["@lsp.typemod.enumNumber"] = {}, + ['@lsp.typemod.function.declaration'] = { fg = c.base.green }, + ['@lsp.typemod.function.defaultLibrary'] = { fg = c.base.blue }, + -- ["@lsp.typemod.interface"] = {}, + -- ["@lsp.typemod.macro"] = {}, + -- ["@lsp.typemod.method"] = {}, + ['@lsp.typemod.namespace'] = { fg = c.base.red }, + -- ['@lsp.typemod.parameter.declaration'] = { fg = c.base.blue, italic = styles.parameter.italic }, + ['@lsp.typemod.property'] = { fg = '#9699f2' }, + -- ["@lsp.typemod.struct"] = {}, + -- ["@lsp.typemod.type"] = {}, + -- ["@lsp.typemod.typeParameter"] = {}, + ['@lsp.typemod.variable.readonly'] = { fg = c.base.magenta }, + + -- ['@lsp.type.parameter'] = { fg = '#797df2' }, + -- ['@lsp.type.function'] = { fg = '#797df2' }, + -- ['@lsp.type.method'] = { fg = '#797df2' }, + ['@lsp.mod.readonly'] = { bold = true }, + } + end, + }) + vim.cmd('colorscheme monokai-pro') + end, + enabled = true, +} diff --git a/lua/utils/init.lua b/lua/utils/init.lua index 2d1f40b..9569fc1 100644 --- a/lua/utils/init.lua +++ b/lua/utils/init.lua @@ -1,16 +1,12 @@ -local utils = { } +local utils = {} -local scopes = {o = vim.o, b = vim.bo, w = vim.wo} +local scopes = { o = vim.o, b = vim.bo, w = vim.wo } function utils.opt(scope, key, value) - scopes[scope][key] = value - if scope ~= 'o' then scopes['o'][key] = value end + scopes[scope][key] = value + if scope ~= 'o' then + scopes['o'][key] = value + end end -function utils.map(mode, lhs, rhs, opts) - local options = {noremap = true} - if opts then options = vim.tbl_extend('force', options, opts) end - vim.api.nvim_set_keymap(mode, lhs, rhs, options) -end - -return utils \ No newline at end of file +return utils diff --git a/lua/utils/json_workaround.lua b/lua/utils/json_workaround.lua new file mode 100644 index 0000000..d195128 --- /dev/null +++ b/lua/utils/json_workaround.lua @@ -0,0 +1,53 @@ +local M = {} +local function str_splice(string, start_idx, end_idx) + local new_content = string:sub(1, start_idx - 1) + if end_idx then + return new_content .. string:sub(end_idx + 1) + else + return new_content + end +end + +local function str_rfind(string, idx, needle) + for i = idx, 1, -1 do + if string:sub(i, i - 1 + needle:len()) == needle then + return i + end + end +end +local function get_to_line_end(string, idx) + local newline = string:find('\n', idx, true) + local to_end = newline and string:sub(idx, newline - 1) or string:sub(idx) + return to_end, newline +end + +M.decode_json = function(content) + local ok, data = pcall(vim.json.decode, content, { luanil = { object = true } }) + while not ok do + local char = data:match('invalid token at character (%d+)$') + if char then + local to_end, newline = get_to_line_end(content, char) + if to_end:match('^//') then + content = str_splice(content, char, newline) + goto continue + end + end + + char = data:match('Expected object key string but found [^%s]+ at character (%d+)$') + char = char or data:match('Expected value but found T_ARR_END at character (%d+)') + if char then + local comma_idx = str_rfind(content, char, ',') + if comma_idx then + content = str_splice(content, comma_idx, comma_idx) + goto continue + end + end + + error(data) + ::continue:: + ok, data = pcall(vim.json.decode, content, { luanil = { object = true } }) + end + return data +end + +return M diff --git a/lua/utils/python_venv.lua b/lua/utils/python_venv.lua new file mode 100644 index 0000000..866870b --- /dev/null +++ b/lua/utils/python_venv.lua @@ -0,0 +1,122 @@ +local M = {} +function M.getVenvSuffix() + if vim.loop.os_uname().sysname == 'Linux' then + return 'bin/python' + elseif vim.loop.os_uname().sysname == 'Windows_NT' then + return 'Scripts/python.exe' + end +end + +function M.getVenvFromJson(jsonfile) + if not vim.fn.filereadable(jsonfile) then + return nil + end + local f = io.open(jsonfile, 'r') + if not f then + return nil + end + local data = f:read('*a') + f:close() + if data then + local jdata = vim.json.decode(data) + if jdata['venvPath'] ~= nil and jdata['venv'] ~= nil then + return jdata['venvPath'] .. '/' .. jdata['venv'] + end + end + return nil +end + +function M.getPythonEnv() + local venv = os.getenv('VIRTUAL_ENV') + if venv ~= nil then + return string.format('%s/%s', venv, M.getVenvSuffix()) + end + local conda = os.getenv('CONDA_PREFIX') + if conda ~= nil then + return string.format('%s/%s', conda, 'python.exe') + end + + local cwd = vim.fn.getcwd() + + local jsonVenv = M.getVenvFromJson(cwd .. '/pyrightconfig.json') + if jsonVenv ~= nil then + return jsonVenv .. '/' .. M.getVenvSuffix() + end + + if vim.fn.executable(cwd .. '/venv/' .. M.getVenvSuffix()) == 1 then + return cwd .. '/venv/' .. M.getVenvSuffix() + elseif vim.fn.executable(cwd .. '/.venv/' .. M.getVenvSuffix()) == 1 then + return cwd .. '/.venv/' .. M.getVenvSuffix() + else + if vim.loop.os_uname().sysname == 'Linux' then + return '/usr/bin/python' + elseif vim.loop.os_uname().sysname == 'Windows_NT' then + return os.getenv('SCOOP') .. '/apps/python/current/python.exe' + end + end +end + +function M.getPythonEnvs() + local venvs = {} + local venv = os.getenv('VIRTUAL_ENV') + if venv ~= nil then + table.insert(venvs, { + name = 'VIRTUAL_ENV', + path = string.format('%s/%s', venv, M.getVenvSuffix()), + }) + end + local conda = os.getenv('CONDA_PREFIX') + if conda ~= nil then + table.insert(venvs, { + name = 'CONDA_PREFIX', + path = string.format('%s/%s', conda, 'python.exe'), + }) + end + + local cwd = vim.fn.getcwd() + + local jsonVenv = M.getVenvFromJson(cwd .. '/pyrightconfig.json') + if jsonVenv ~= nil then + table.insert(venvs, { + name = 'pyrightconfig.json', + path = jsonVenv .. '/' .. M.getVenvSuffix(), + }) + end + + local venvDirs = { 'venv', '.venv' } + for _, envDir in pairs(venvDirs) do + if vim.fn.executable(cwd .. '/' .. envDir .. '/' .. M.getVenvSuffix()) == 1 then + table.insert(venvs, { + name = envDir, + path = cwd .. '/' .. envDir .. '/' .. M.getVenvSuffix(), + }) + end + end + if vim.loop.os_uname().sysname == 'Linux' then + table.insert(venvs, { + name = 'system', + path = '/usr/bin/python', + }) + end + if vim.loop.os_uname().sysname == 'Windows_NT' then + table.insert(venvs, { + name = 'system', + path = os.getenv('SCOOP') .. '/apps/python/current/python.exe', + }) + end + return venvs +end + +M.pick_venv = function() + vim.ui.select(M.getPythonEnvs(), { + prompt = 'Select python venv', + format_item = function(item) return string.format('%s (%s)', item.name, item.path) end, + }, function(choice) + if not choice then + return + end + print(choice.path) + end) +end + +return M diff --git a/my-snippets/all.json b/my-snippets/all.json new file mode 100644 index 0000000..e69de29 diff --git a/my-snippets/cpp.json b/my-snippets/cpp.json new file mode 100644 index 0000000..38cd2da --- /dev/null +++ b/my-snippets/cpp.json @@ -0,0 +1,12 @@ +{ + "test_getter": { + "prefix": "test_getter", + "body": [ + "TEST(${1:TestClass}, ${2:TestFunction}", + "{", + "\tget${CLIPBOARD}()", + "};" + ], + "description": "Code snippet for testing the getter" + } +} diff --git a/my-snippets/package.json b/my-snippets/package.json new file mode 100644 index 0000000..5333d8b --- /dev/null +++ b/my-snippets/package.json @@ -0,0 +1,19 @@ +{ + "name": "my-snippets", + "contributes": { + "snippets": [ + { + "language": [ + "all" + ], + "path": "all.json" + }, + { + "language": [ + "cpp" + ], + "path": "cpp.json" + } + ] + } +} diff --git a/my_snippets/cpp.json b/my_snippets/cpp.json new file mode 100644 index 0000000..1e1c351 --- /dev/null +++ b/my_snippets/cpp.json @@ -0,0 +1,14 @@ +{ + "TEST_F for g/setter": { + "prefix": "TEST_F_getter", + "body": [ + "TEST_F($1, test_${CLIPBOARD/m_(.*)/${1}/}_${2:setter}_${3:getter})", + "{", + " set${CLIPBOARD/m_(.)(.*)/${1:/upcase}${2}/}($4);", + " ${5:type} result = get${CLIPBOARD/m_(.)(.*)/${1:/upcase}${2}/}();", + " EXPECT_EQ($4, result);$0", + "}" + ], + "description": "Generate TEST_F body for getter and setter functions" + } +} diff --git a/my_snippets/package.json b/my_snippets/package.json new file mode 100644 index 0000000..2dc03d6 --- /dev/null +++ b/my_snippets/package.json @@ -0,0 +1,14 @@ +{ + "name": "my_snippets", + "engines": { + "vscode": "^1.11.0" + }, + "contributes": { + "snippets": [ + { + "language": "cpp", + "path": "./cpp.json" + } + ] + } +} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..2116895 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,19 @@ +# pyproject.toml +[tool.pytest.ini_options] +minversion = "6.0" +addopts = "-ra -q" +testpaths = [ + "tests", +] +[tool.pyright] +venv = "venv" +venvPath = './' +reportOptionalMemberAccess = 'warning' +reportGeneralTypeIssues = 'warning' +analyzeUnannotatedFunctions = false +executionEnvironments = [ + { root = "./" } +] + +[tool.black] +line-length=120 diff --git a/pyrightconfig.json b/pyrightconfig.json new file mode 100644 index 0000000..ea3d8e9 --- /dev/null +++ b/pyrightconfig.json @@ -0,0 +1,4 @@ +{ + "venvPath": ".", + "venv": "venvVis" +} diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..cdd8c91 --- /dev/null +++ b/readme.md @@ -0,0 +1,9 @@ +# pre-commit + +Install with + +```bash +pre-commit install +``` + +`stylua` has to be installed in the system diff --git a/stylua.toml b/stylua.toml new file mode 100644 index 0000000..251e8aa --- /dev/null +++ b/stylua.toml @@ -0,0 +1,7 @@ +column_width = 160 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferSingle" +call_parentheses = "Always" +collapse_simple_statement = "FunctionOnly"