diff options
| author | Tom Li Dobnik <tomlidobnik1@gmail.com> | 2026-03-03 18:46:16 +0100 |
|---|---|---|
| committer | Tom Li Dobnik <tomlidobnik1@gmail.com> | 2026-03-03 18:46:16 +0100 |
| commit | f7bbc5e6740f6199d7ed0fe704daaa7efd98c093 (patch) | |
| tree | d6cd8984dbf2a8a909f16dde865a19a343c31d48 /.config/nvim-old | |
| parent | 1f156148fadab8468a46e598296b18b54f7860ce (diff) | |
nvim update
Diffstat (limited to '.config/nvim-old')
39 files changed, 1687 insertions, 0 deletions
diff --git a/.config/nvim-old/.editorconfig b/.config/nvim-old/.editorconfig new file mode 100644 index 0000000..9a6cc75 --- /dev/null +++ b/.config/nvim-old/.editorconfig @@ -0,0 +1,3 @@ +[*.lua] +indent_style = space +indent_size = 2 diff --git a/.config/nvim-old/.luarc.json b/.config/nvim-old/.luarc.json new file mode 100644 index 0000000..59e3c38 --- /dev/null +++ b/.config/nvim-old/.luarc.json @@ -0,0 +1,10 @@ +{ + "diagnostics.globals": [ + "MiniFiles", + "Snacks", + "MiniSplitjoin", + "hipatterns", + "MiniDiff", + "vim" + ] +}
\ No newline at end of file diff --git a/.config/nvim-old/after/ftplugin/css.lua b/.config/nvim-old/after/ftplugin/css.lua new file mode 100644 index 0000000..5b3770c --- /dev/null +++ b/.config/nvim-old/after/ftplugin/css.lua @@ -0,0 +1,3 @@ +local set = vim.opt_local + +set.shiftwidth = 2 diff --git a/.config/nvim-old/after/ftplugin/html.lua b/.config/nvim-old/after/ftplugin/html.lua new file mode 100644 index 0000000..5b3770c --- /dev/null +++ b/.config/nvim-old/after/ftplugin/html.lua @@ -0,0 +1,3 @@ +local set = vim.opt_local + +set.shiftwidth = 2 diff --git a/.config/nvim-old/after/ftplugin/javascript.lua b/.config/nvim-old/after/ftplugin/javascript.lua new file mode 100644 index 0000000..5b3770c --- /dev/null +++ b/.config/nvim-old/after/ftplugin/javascript.lua @@ -0,0 +1,3 @@ +local set = vim.opt_local + +set.shiftwidth = 2 diff --git a/.config/nvim-old/after/ftplugin/javascriptreact.lua b/.config/nvim-old/after/ftplugin/javascriptreact.lua new file mode 100644 index 0000000..5b3770c --- /dev/null +++ b/.config/nvim-old/after/ftplugin/javascriptreact.lua @@ -0,0 +1,3 @@ +local set = vim.opt_local + +set.shiftwidth = 2 diff --git a/.config/nvim-old/after/ftplugin/json.lua b/.config/nvim-old/after/ftplugin/json.lua new file mode 100644 index 0000000..a38fed5 --- /dev/null +++ b/.config/nvim-old/after/ftplugin/json.lua @@ -0,0 +1,3 @@ +local set = vim.opt_local + +set.conceallevel = 0 diff --git a/.config/nvim-old/after/ftplugin/lua.lua b/.config/nvim-old/after/ftplugin/lua.lua new file mode 100644 index 0000000..c0e2391 --- /dev/null +++ b/.config/nvim-old/after/ftplugin/lua.lua @@ -0,0 +1,5 @@ +local set = vim.opt_local + +set.shiftwidth = 2 +set.number = true +set.relativenumber = true diff --git a/.config/nvim-old/after/ftplugin/md.lua b/.config/nvim-old/after/ftplugin/md.lua new file mode 100644 index 0000000..5b3770c --- /dev/null +++ b/.config/nvim-old/after/ftplugin/md.lua @@ -0,0 +1,3 @@ +local set = vim.opt_local + +set.shiftwidth = 2 diff --git a/.config/nvim-old/after/ftplugin/rust.lua b/.config/nvim-old/after/ftplugin/rust.lua new file mode 100644 index 0000000..4060c9d --- /dev/null +++ b/.config/nvim-old/after/ftplugin/rust.lua @@ -0,0 +1,13 @@ +local bufnr = vim.api.nvim_get_current_buf() +vim.keymap.set("n", "<leader>ca", function() + vim.cmd.RustLsp("codeAction") -- supports rust-analyzer's grouping + -- or vim.lsp.buf.codeAction() if you don't want grouping. +end, { silent = true, buffer = bufnr }) +vim.keymap.set( + "n", + "K", -- Override Neovim's built-in hover keymap with rustaceanvim's hover actions + function() + vim.cmd.RustLsp({ "hover", "actions" }) + end, + { silent = true, buffer = bufnr } +) diff --git a/.config/nvim-old/init.lua b/.config/nvim-old/init.lua new file mode 100644 index 0000000..75ae3e9 --- /dev/null +++ b/.config/nvim-old/init.lua @@ -0,0 +1,5 @@ +vim.g.bullets_enable_in_empty_buffers = 0 +require("config.lazy") +require("options") +require("mappings") +require("autocmds") diff --git a/.config/nvim-old/lazy-lock.json b/.config/nvim-old/lazy-lock.json new file mode 100644 index 0000000..2130986 --- /dev/null +++ b/.config/nvim-old/lazy-lock.json @@ -0,0 +1,46 @@ +{ + "LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" }, + "blink-emoji.nvim": { "branch": "master", "commit": "066013e4c98a9318408ee3f1ca2dbcb6fa3e4c06" }, + "blink.cmp": { "branch": "main", "commit": "4b18c32adef2898f95cdef6192cbd5796c1a332d" }, + "blink.compat": { "branch": "main", "commit": "2ed6d9a28b07fa6f3bface818470605f8896408c" }, + "bullets.vim": { "branch": "master", "commit": "89294b8930e660936374fb763ac48a1ac51dd29c" }, + "cmp-sql": { "branch": "master", "commit": "54193ac99e3855c6ffaa36f83a7c50213df03157" }, + "conform.nvim": { "branch": "master", "commit": "c2526f1cde528a66e086ab1668e996d162c75f4f" }, + "csharp.nvim": { "branch": "main", "commit": "e44e275dabbcfc188ce1a5f504aad778e917c814" }, + "fidget.nvim": { "branch": "main", "commit": "7fa433a83118a70fe24c1ce88d5f0bd3453c0970" }, + "flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" }, + "friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" }, + "fzf-lua": { "branch": "main", "commit": "9004cbb4c065a32b690e909c49903967b45301eb" }, + "gitsigns.nvim": { "branch": "main", "commit": "9f3c6dd7868bcc116e9c1c1929ce063b978fa519" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "leetcode.nvim": { "branch": "master", "commit": "fdd3f91800b3983e27bc9fcfb99cfa7293d7f11a" }, + "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, + "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "21c2a84ce368e99b18f52ab348c4c02c32c02fcf" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "443f1ef8b5e6bf47045cb2217b6f748a223cf7dc" }, + "mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" }, + "mini.icons": { "branch": "main", "commit": "68c178e0958d95b3977a771f3445429b1bded985" }, + "mini.nvim": { "branch": "main", "commit": "dbb073bd2ed4a7bb35daafc7989567f0ff1426ee" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "f3df514fff2bdd4318127c40470984137f87b62e" }, + "nord.nvim": { "branch": "master", "commit": "80c1e5321505aeb22b7a9f23eb82f1e193c12470" }, + "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "338409dd8a6ed74767bad3eb5269f1b903ffb3cf" }, + "nvim-dap": { "branch": "master", "commit": "b516f20b487b0ac6a281e376dfac1d16b5040041" }, + "nvim-lspconfig": { "branch": "master", "commit": "44acfe887d4056f704ccc4f17513ed41c9e2b2e6" }, + "nvim-osc52": { "branch": "main", "commit": "04cfaba1865ae5c53b6f887c3ca7304973824fb2" }, + "nvim-treesitter": { "branch": "main", "commit": "dc42c209f3820bdfaae0956f15de29689aa6b451" }, + "nvim-web-devicons": { "branch": "master", "commit": "746ffbb17975ebd6c40142362eee1b0249969c5c" }, + "oil.nvim": { "branch": "master", "commit": "f55b25e493a7df76371cfadd0ded5004cb9cd48a" }, + "outline.nvim": { "branch": "main", "commit": "ead1820d49c8e79ce89cab1c2c318981b695c9d2" }, + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "e2858c43caafec291f915ef25fbed27bbe78abbd" }, + "render-markdown.nvim": { "branch": "main", "commit": "48b4175dbca8439d30c1f52231cbe5a712c8f9d9" }, + "rustaceanvim": { "branch": "master", "commit": "88575b98bb9937fb9983ddec5e532b67e75ce677" }, + "snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" }, + "structlog.nvim": { "branch": "main", "commit": "45b26a2b1036bb93c0e83f4225e85ab3cee8f476" }, + "typst-preview.nvim": { "branch": "master", "commit": "e123a7ab64e52d836e00dea9251e85b201f38966" }, + "undotree": { "branch": "master", "commit": "d8f99084d98c32f651860eb0baaf89759f91debc" }, + "uv.nvim": { "branch": "main", "commit": "b0bce1b61584fde99c316aa0587a4996c52df206" }, + "vim-tmux-navigator": { "branch": "master", "commit": "e41c431a0c7b7388ae7ba341f01a0d217eb3a432" }, + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } +} diff --git a/.config/nvim-old/lua/autocmds.lua b/.config/nvim-old/lua/autocmds.lua new file mode 100644 index 0000000..13f235c --- /dev/null +++ b/.config/nvim-old/lua/autocmds.lua @@ -0,0 +1,28 @@ +vim.api.nvim_create_autocmd("TextYankPost", { + desc = "Highlight when yanking (copying) text", + group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }), + callback = function() + vim.highlight.on_yank() + end, +}) + +vim.api.nvim_create_autocmd("FileType", { + pattern = { "gitcommit", "markdown" }, + callback = function(event) + vim.keymap.set("i", "`", "`", { buffer = event.buf }) + end, +}) + +vim.api.nvim_create_autocmd("InsertEnter", { + pattern = "*.md", + callback = function() + vim.opt.conceallevel = 0 + end, +}) + +vim.api.nvim_create_autocmd("InsertLeave", { + pattern = "*.md", + callback = function() + vim.opt.conceallevel = 3 + end, +}) diff --git a/.config/nvim-old/lua/config/lazy.lua b/.config/nvim-old/lua/config/lazy.lua new file mode 100644 index 0000000..ba9b8f3 --- /dev/null +++ b/.config/nvim-old/lua/config/lazy.lua @@ -0,0 +1,36 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end + +-- Hey! Put lazy into the runtimepath for neovim! +vim.opt.runtimepath:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + { import = "config.plugins" }, + }, + ui = { + backdrop = 100, + }, + change_detection = { + -- automatically check for config file changes and reload the ui + enabled = false, + notify = false, -- get a notification when changes are found + }, +}) diff --git a/.config/nvim-old/lua/config/plugins/blink-cmp.lua b/.config/nvim-old/lua/config/plugins/blink-cmp.lua new file mode 100644 index 0000000..9f622c7 --- /dev/null +++ b/.config/nvim-old/lua/config/plugins/blink-cmp.lua @@ -0,0 +1,125 @@ +return { + { + "saghen/blink.compat", + version = "*", + lazy = true, + opts = {}, + }, + { + "saghen/blink.cmp", + event = "VeryLazy", + -- optional: provides snippets for the snippet source + dependencies = { + "rafamadriz/friendly-snippets", + "moyiz/blink-emoji.nvim", + "ray-x/cmp-sql", + }, + + -- use a release tag to download pre-built binaries + version = "1.*", + -- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust + -- build = 'cargo build --release', + -- If you use nix, you can build from source using latest nightly rust with: + -- build = 'nix run .#build-plugin', + opts = { + snippets = { + preset = "luasnip", -- Choose LuaSnip as the snippet engine + }, + -- '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) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { + preset = "default", + }, + + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = "mono", + }, + + -- (Default) Only show the documentation popup when manually triggered + completion = { + menu = { auto_show = true }, + trigger = { + show_on_keyword = true, + show_on_trigger_character = true, + show_on_insert_on_trigger_character = true, + }, + documentation = { auto_show = true, window = { border = "single" } }, + }, + signature = { enabled = true }, + + sources = { + default = { "lsp", "path", "snippets", "buffer", "emoji", "sql" }, + providers = { + lsp = { + name = "LSP", + module = "blink.cmp.sources.lsp", + min_keyword_length = 0, + }, + snippets = { + name = "snippets", + module = "blink.cmp.sources.snippets", + enabled = true, + min_keyword_length = 2, + score_offset = 80, + }, + emoji = { + module = "blink-emoji", + name = "Emoji", + score_offset = 15, -- Tune by preference + opts = { insert = true }, -- Insert emoji (default) or complete its name + -- should_show_items = function() + -- return vim.tbl_contains( + -- -- Enable emoji completion only for git commits and markdown. + -- -- By default, enabled for all file-types. + -- { "gitcommit", "markdown" }, + -- vim.o.filetype + -- ) + -- end, + }, + sql = { + -- IMPORTANT: use the same name as you would for nvim-cmp + name = "sql", + module = "blink.compat.source", + + -- all blink.cmp source config options work as normal: + score_offset = -3, + + -- this table is passed directly to the proxied completion source + -- as the `option` field in nvim-cmp's source config + -- + -- this is NOT the same as the opts in a plugin's lazy.nvim spec + opts = {}, + should_show_items = function() + return vim.tbl_contains( + -- Enable emoji completion only for git commits and markdown. + -- By default, enabled for all file-types. + { "sql" }, + vim.o.filetype + ) + end, + }, + }, + }, + + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = "prefer_rust_with_warning" }, + }, + opts_extend = { "sources.default" }, + }, +} diff --git a/.config/nvim-old/lua/config/plugins/colorscheme.lua b/.config/nvim-old/lua/config/plugins/colorscheme.lua new file mode 100644 index 0000000..ea130c7 --- /dev/null +++ b/.config/nvim-old/lua/config/plugins/colorscheme.lua @@ -0,0 +1,14 @@ +return { + "shaunsingh/nord.nvim", + priority = 1000, + init = function() + vim.cmd.colorscheme("nord") + vim.cmd.hi("Comment gui=none") + -- Set transparency + vim.cmd("hi Normal guibg=NONE ctermbg=NONE") + vim.cmd("hi NormalFloat guibg=NONE ctermbg=NONE") + vim.cmd("hi SignColumn guibg=NONE") + vim.cmd("hi FloatBorder guibg=NONE") + vim.cmd("hi CursorLine guibg=NONE") + end, +} diff --git a/.config/nvim-old/lua/config/plugins/conform.lua b/.config/nvim-old/lua/config/plugins/conform.lua new file mode 100644 index 0000000..5747200 --- /dev/null +++ b/.config/nvim-old/lua/config/plugins/conform.lua @@ -0,0 +1,40 @@ +return { + "stevearc/conform.nvim", + event = "VeryLazy", + keys = { + { + "<leader>f", + function() + require("conform").format({ async = true, lsp_format = "fallback" }) + end, + mode = "", + desc = "Format buffer", + }, + }, + + opts = { + formatters_by_ft = { + lua = { "stylua" }, + python = { "isort", "black" }, + rust = { "rustfmt" }, + javascript = { "prettierd", "prettier", stop_after_first = true }, + typescript = { "prettierd", "prettier", stop_after_first = true }, + typescriptreact = { "prettierd", "prettier", stop_after_first = true }, + css = { "prettierd", "prettier", stop_after_first = true }, + html = { "prettierd", "prettier", stop_after_first = true }, + typst = { "prettypst" }, + xml = { "xmlformatter" }, + }, + format_on_save = { + timeout_ms = 500, + lsp_format = "fallback", + }, + formatters = { + xmlformat = { + command = "xmlformat", + args = { "--selfclose", "-" }, + stdin = true, + }, + }, + }, +} diff --git a/.config/nvim-old/lua/config/plugins/flash.lua b/.config/nvim-old/lua/config/plugins/flash.lua new file mode 100644 index 0000000..feec135 --- /dev/null +++ b/.config/nvim-old/lua/config/plugins/flash.lua @@ -0,0 +1,18 @@ +return { + "folke/flash.nvim", + event = "VeryLazy", + opts = { + modes = { + search = { enabled = false }, + char = { enabled = false }, + treesitter = { enabled = false }, + remote = { enabled = false }, + }, + }, + -- stylua: ignore + keys = { + { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, + { "R", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, + { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, + }, +} diff --git a/.config/nvim-old/lua/config/plugins/fzflua.lua b/.config/nvim-old/lua/config/plugins/fzflua.lua new file mode 100644 index 0000000..8dfdeb3 --- /dev/null +++ b/.config/nvim-old/lua/config/plugins/fzflua.lua @@ -0,0 +1,29 @@ +return { + "ibhagwan/fzf-lua", + event = "VeryLazy", + dependencies = { "echasnovski/mini.icons" }, + opts = { + keymap = { + builtin = { + ["<S-j>"] = "preview-page-down", + ["<S-k>"] = "preview-page-up", + }, + }, + winopts = { + row = 1, + col = 0, + width = 1, + height = 0.4, + title_pos = "left", + preview = { + layout = "horizontal", + title_pos = "right", + }, + }, + files = { + -- Show hidden files but respect .gitignore + -- rg_opts = [[--color=never --hidden --files -g "!.git" --ignore-file ~/.config/git/ignore]], + -- fd_opts = [[--color=never --hidden --type f --type l --exclude .git --ignore-file ~/.config/git/ignore]], + }, + }, +} diff --git a/.config/nvim-old/lua/config/plugins/gitsigns.lua b/.config/nvim-old/lua/config/plugins/gitsigns.lua new file mode 100644 index 0000000..13c3b20 --- /dev/null +++ b/.config/nvim-old/lua/config/plugins/gitsigns.lua @@ -0,0 +1,36 @@ +return { + { + "lewis6991/gitsigns.nvim", + event = "VeryLazy", + opts = { + signs = { + add = { text = "▎" }, + change = { text = "▎" }, + delete = { text = "" }, + topdelete = { text = "" }, + changedelete = { text = "▎" }, + untracked = { text = "▎" }, + }, + on_attach = function(buffer) + local gs = package.loaded.gitsigns + + local function map(mode, l, r, desc) + vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc }) + end + + -- stylua: ignore start + map("n", "]g", gs.next_hunk, "Next Hunk") + map("n", "[g", gs.prev_hunk, "Prev Hunk") + map({ "n", "v" }, "<leader>gs", ":Gitsigns stage_hunk<CR>", "Stage Hunk") + map({ "n", "v" }, "<leader>gr", ":Gitsigns reset_hunk<CR>", "Reset Hunk") + map("n", "<leader>gS", gs.stage_buffer, "Stage Buffer") + map("n", "<leader>gd", gs.diffthis, "Diff this") + map("n", "<leader>gu", gs.undo_stage_hunk, "Undo Stage Hunk") + map("n", "<leader>gR", gs.reset_buffer, "Reset Buffer") + map("n", "<leader>gp", gs.preview_hunk, "Preview Hunk") + map("n", "<leader>gb", function() gs.blame_line({ full = true }) end, "Blame Line") + map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", "GitSigns Select Hunk") + end, + }, + }, +} diff --git a/.config/nvim-old/lua/config/plugins/leetcode.lua b/.config/nvim-old/lua/config/plugins/leetcode.lua new file mode 100644 index 0000000..920aba9 --- /dev/null +++ b/.config/nvim-old/lua/config/plugins/leetcode.lua @@ -0,0 +1,22 @@ +return { + "kawre/leetcode.nvim", + build = function() + if vim.fn.exists(":TSUpdate") == 2 then + vim.cmd("TSUpdate html") + end + end, + dependencies = { + -- include a picker of your choice, see picker section for more details + "nvim-lua/plenary.nvim", + "MunifTanjim/nui.nvim", + }, + opts = { + -- configuration goes here + lang = "rust", + storage = { + home = vim.fn.expand("~/leetcode"), + cache = vim.fn.stdpath("cache") .. "/leetcode", + }, + image_support = false, + }, +} diff --git a/.config/nvim-old/lua/config/plugins/lsp.lua b/.config/nvim-old/lua/config/plugins/lsp.lua new file mode 100644 index 0000000..eb812d2 --- /dev/null +++ b/.config/nvim-old/lua/config/plugins/lsp.lua @@ -0,0 +1,240 @@ +return { + "neovim/nvim-lspconfig", + event = "VeryLazy", + dependencies = { + { "williamboman/mason.nvim", opts = {} }, + "williamboman/mason-lspconfig.nvim", + "WhoIsSethDaniel/mason-tool-installer.nvim", + { + "j-hui/fidget.nvim", + opts = { + notification = { + window = { + winblend = 0, + }, + }, + }, + }, + }, + config = function() + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("kickstart-lsp-attach", { clear = true }), + callback = function(event) + local map = function(keys, func, desc, mode) + mode = mode or "n" + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = "LSP: " .. desc }) + end + + -- Jump to the definition of the word under your cursor. + -- This is where a variable was first declared, or where a function is defined, etc. + -- To jump back, press <C-t>. + map("gd", require("fzf-lua").lsp_definitions, "Goto Definition") + + map("gk", function() + vim.diagnostic.open_float() + end, "Open floating diagnostic") + + -- Find references for the word under your cursor. + map("gr", require("fzf-lua").lsp_references, "Goto References") + + -- Jump to the implementation of the word under your cursor. + -- Useful when your language has ways of declaring types without an actual implementation. + map("gI", require("fzf-lua").lsp_implementations, "Goto Implementation") + + -- Jump to the type of the word under your cursor. + -- Useful when you're not sure what type a variable is and you want to see + -- the definition of its *type*, not where it was *defined*. + map("<leader>D", require("fzf-lua").lsp_typedefs, "Type Definition") + + -- Fuzzy find all the symbols in your current document. + -- Symbols are things like variables, functions, types, etc. + map("<leader>ds", require("fzf-lua").lsp_document_symbols, "Document Symbols") + + -- Fuzzy find all the symbols in your current workspace. + -- Similar to document symbols, except searches over your entire project. + map("<leader>ws", require("fzf-lua").lsp_live_workspace_symbols, "Workspace Symbols") + + -- Rename the variable under your cursor. + -- Most Language Servers support renaming across files, etc. + map("gR", vim.lsp.buf.rename, "Rename") + + -- Execute a code action, usually your cursor needs to be on top of an error + -- or a suggestion from your LSP for this to activate. + map("<leader>ca", vim.lsp.buf.code_action, "Code Action", { "n", "x" }) + + -- WARN: This is not Goto Definition, this is Goto Declaration. + -- For example, in C this would take you to the header. + map("gD", vim.lsp.buf.declaration, "Goto Declaration") + local function client_supports_method(client, method, bufnr) + if vim.fn.has("nvim-0.11") == 1 then + return client:supports_method(method, bufnr) + else + return client.supports_method(method, { bufnr = bufnr }) + end + end + + -- The following two autocommands are used to highlight references of the + -- word under your cursor when your cursor rests there for a little while. + -- See `:help CursorHold` for information about when this is executed + -- + -- When you move your cursor, the highlights will be cleared (the second autocommand). + local client = vim.lsp.get_client_by_id(event.data.client_id) + if + client + and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) + then + local highlight_augroup = vim.api.nvim_create_augroup("kickstart-lsp-highlight", { clear = false }) + vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.document_highlight, + }) + + vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.clear_references, + }) + + vim.api.nvim_create_autocmd("LspDetach", { + group = vim.api.nvim_create_augroup("kickstart-lsp-detach", { clear = true }), + callback = function(event2) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds({ group = "kickstart-lsp-highlight", buffer = event2.buf }) + end, + }) + end + + -- The following code creates a keymap to toggle inlay hints in your + -- code, if the language server you are using supports them + -- + vim.api.nvim_set_hl(0, "LspInlayHint", { fg = "#4c566a", bg = "NONE", italic = true }) + + -- This may be unwanted, since they displace some of your code + if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then + map("<leader>th", function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = event.buf })) + end, "Toggle Inlay Hints") + end + end, + }) + + vim.keymap.set("n", "gK", function() + local new_config = not vim.diagnostic.config().virtual_lines + vim.diagnostic.config({ virtual_lines = new_config }) + end, { desc = "Toggle diagnostic virtual_lines" }) + + -- Diagnostic Config + -- See :help vim.diagnostic.Opts + vim.diagnostic.config({ + severity_sort = true, + float = { border = "rounded", source = "if_many" }, + underline = { severity = vim.diagnostic.severity.ERROR }, + signs = { + text = { + [vim.diagnostic.severity.ERROR] = " ", + [vim.diagnostic.severity.WARN] = " ", + [vim.diagnostic.severity.INFO] = " ", + [vim.diagnostic.severity.HINT] = " ", + }, + }, + virtual_text = { + source = "if_many", + spacing = 2, + }, + update_in_insert = true, + virtual_lines = false, + -- virtual_text = { + -- source = "if_many", + -- spacing = 2, + -- format = function(diagnostic) + -- local diagnostic_message = { + -- [vim.diagnostic.severity.ERROR] = diagnostic.message, + -- [vim.diagnostic.severity.WARN] = diagnostic.message, + -- [vim.diagnostic.severity.INFO] = diagnostic.message, + -- [vim.diagnostic.severity.HINT] = diagnostic.message, + -- } + -- return diagnostic_message[diagnostic.severity] + -- end, + -- }, + }) + local original_capabilities = vim.lsp.protocol.make_client_capabilities() + local capabilities = require("blink.cmp").get_lsp_capabilities(original_capabilities) + -- Enable the following language servers + -- Feel free to add/remove any LSPs that you want here. They will automatically be installed. + -- + -- Add any additional override configuration in the following tables. Available keys are: + -- - cmd (table): Override the default command used to start the server + -- - filetypes (table): Override the default list of associated filetypes for the server + -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. + -- - settings (table): Override the default settings passed when initializing the server. + -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ + local lspconfig_util = require("lspconfig.util") + local servers = { + bashls = {}, + marksman = {}, + pyright = { + settings = { + python = { + analysis = { + typeCheckingMode = "basic", + autoSearchPaths = true, + useLibraryCodeForTypes = true, + }, + }, + }, + }, + clangd = { + cmd = { + "clangd", + "--fallback-style={BasedOnStyle: LLVM, IndentWidth: 4, TabWidth: 4, UseTab: Never}", + }, + }, + rust_analyzer = { + single_file_support = true, + root_dir = function(fname) + return lspconfig_util.root_pattern("Cargo.toml", "rust-project.json", ".git")(fname) + or vim.fs.dirname(fname) + end, + }, + lua_ls = {}, + } -- Ensure the servers and tools above are installed + -- + -- To check the current status of installed tools and/or manually install + -- other tools, you can run + -- :Mason + -- + -- You can press `g?` for help in this menu. + -- + -- `mason` had to be setup earlier: to configure its options see the + -- `dependencies` table for `nvim-lspconfig` above. + -- + -- You can add other tools here that you want Mason to install + -- for you, so that they are available from within Neovim. + local ensure_installed = vim.tbl_keys(servers or {}) + vim.list_extend(ensure_installed, { + "stylua", + "prettierd", + }) + require("mason-tool-installer").setup({ ensure_installed = ensure_installed }) + + require("mason-lspconfig").setup({ + ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer) + automatic_installation = false, + automatic_enable = false, + handlers = { + function(server_name) + if server_name == "rust_analyzer" then + return + end + local server = servers[server_name] or {} + -- This handles overriding only values explicitly passed + -- by the server configuration above. Useful when disabling + -- certain features of an LSP (for example, turning off formatting for ts_ls) + server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {}) + require("lspconfig")[server_name].setup(server) + end, + }, + }) + end, +} diff --git a/.config/nvim-old/lua/config/plugins/lualine.lua b/.config/nvim-old/lua/config/plugins/lualine.lua new file mode 100644 index 0000000..466d7b4 --- /dev/null +++ b/.config/nvim-old/lua/config/plugins/lualine.lua @@ -0,0 +1,218 @@ +return { + "nvim-lualine/lualine.nvim", + event = "VeryLazy", + dependencies = { "nvim-tree/nvim-web-devicons" }, + -- Eviline config for lualine + -- Author: shadmansaleh + -- Credit: glepnir + config = function() + local lualine = require("lualine") + + -- Color table for highlights + -- stylua: ignore + local colors = { + bg = '#434c5e', + fg = '#d8dee9', + yellow = '#ebcb8b', + cyan = '#88c0d0', + darkblue = '#5e81ac', + green = '#a3be8c', + orange = '#d08770', + violet = '#b48ead', + blue = '#81a1c1', + red = '#bf616a', + } + + local conditions = { + buffer_not_empty = function() + return vim.fn.empty(vim.fn.expand("%:t")) ~= 1 + end, + hide_in_width = function() + return vim.fn.winwidth(0) > 80 + end, + check_git_workspace = function() + local filepath = vim.fn.expand("%:p:h") + local gitdir = vim.fn.finddir(".git", filepath .. ";") + return gitdir and #gitdir > 0 and #gitdir < #filepath + end, + } + + local config = { + options = { + component_separators = "", + section_separators = "", + theme = { + normal = { c = { fg = colors.fg, bg = colors.bg } }, + inactive = { c = { fg = colors.fg, bg = colors.bg } }, + }, + }, + sections = { + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + lualine_c = {}, + lualine_x = {}, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + lualine_c = {}, + lualine_x = {}, + }, + } + + -- Inserts a component in lualine_c at left section + local function ins_left(component) + table.insert(config.sections.lualine_c, component) + end + + -- Inserts a component in lualine_x at right section + local function ins_right(component) + table.insert(config.sections.lualine_x, component) + end + + -- ins_left({ + -- function() + -- return "▊" + -- end, + -- color = { fg = colors.blue }, -- Sets highlighting of component + -- padding = { left = 0, right = 1 }, -- We don't need space before this + -- }) + + ins_left({ + -- mode component + function() + return " " .. string.upper(vim.fn.mode()) + end, + color = function() + -- auto change color according to neovims mode + local mode_color = { + n = colors.red, + i = colors.green, + v = colors.blue, + [""] = colors.blue, + V = colors.blue, + c = colors.violet, + no = colors.red, + s = colors.orange, + S = colors.orange, + [""] = colors.orange, + ic = colors.yellow, + R = colors.violet, + Rv = colors.violet, + cv = colors.red, + ce = colors.red, + r = colors.cyan, + rm = colors.cyan, + ["r?"] = colors.cyan, + ["!"] = colors.red, + t = colors.red, + } + return { fg = mode_color[vim.fn.mode()] } + end, + padding = { right = 1 }, + }) + + ins_left({ + "filename", + cond = conditions.buffer_not_empty, + color = { fg = colors.green, gui = "bold" }, + }) + ins_left({ + "filesize", + cond = conditions.buffer_not_empty, + }) + + ins_right({ "location" }) + + ins_right({ "progress", color = { fg = colors.fg, gui = "bold" } }) + + ins_left({ + "diagnostics", + sources = { "nvim_diagnostic" }, + symbols = { error = " ", warn = " ", info = " " }, + diagnostics_color = { + error = { fg = colors.red }, + warn = { fg = colors.yellow }, + info = { fg = colors.cyan }, + }, + }) + -- + -- -- Insert mid section. You can make any number of sections in neovim :) + -- -- for lualine it's any number greater then 2 + -- ins_left({ + -- function() + -- return "%=" + -- end, + -- }) + -- + -- ins_left({ + -- -- Lsp server name . + -- function() + -- local msg = "No Active Lsp" + -- local buf_ft = vim.api.nvim_get_option_value("filetype", { buf = 0 }) + -- local clients = vim.lsp.get_clients() + -- if next(clients) == nil then + -- return msg + -- end + -- for _, client in ipairs(clients) do + -- local filetypes = client.config.filetypes + -- if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then + -- return client.name + -- end + -- end + -- return msg + -- end, + -- icon = " LSP:", + -- color = { fg = "#ffffff", gui = "bold" }, + -- }) + + -- ins_right({ + -- "filetype", + -- color = { fg = colors.fg, gui = "bold" }, + -- }) + -- -- Add components to right sections + -- ins_right({ + -- "o:encoding", -- option component same as &encoding in viml + -- fmt = string.upper, -- I'm not sure why it's upper case either ;) + -- cond = conditions.hide_in_width, + -- color = { fg = colors.green, gui = "bold" }, + -- }) + -- + -- ins_right({ + -- "fileformat", + -- fmt = string.upper, + -- color = { fg = colors.green, gui = "bold" }, + -- }) + + -- ins_right({ + -- "branch", + -- icon = "", + -- color = { fg = colors.violet, gui = "bold" }, + -- }) + + -- ins_right({ + -- "diff", + -- symbols = { added = " ", modified = " ", removed = " " }, + -- diff_color = { + -- added = { fg = colors.green }, + -- modified = { fg = colors.orange }, + -- removed = { fg = colors.red }, + -- }, + -- cond = conditions.hide_in_width, + -- }) + + -- ins_right({ + -- function() + -- return "▊" + -- end, + -- color = { fg = colors.blue }, + -- padding = { left = 1 }, + -- }) + + lualine.setup(config) + end, +} diff --git a/.config/nvim-old/lua/config/plugins/luasnip.lua b/.config/nvim-old/lua/config/plugins/luasnip.lua new file mode 100644 index 0000000..a051cee --- /dev/null +++ b/.config/nvim-old/lua/config/plugins/luasnip.lua @@ -0,0 +1,21 @@ +return { + "L3MON4D3/LuaSnip", + version = "v2.*", + event = "VeryLazy", + build = "make install_jsregexp", + config = function() + require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/lua/config/snippets/" }) + local ls = require("luasnip") + vim.keymap.set({ "i", "s" }, "<C-d>", function() + ls.jump(1) + end, { silent = true }) + vim.keymap.set({ "i", "s" }, "<C-u>", function() + ls.jump(-1) + end, { silent = true }) + ls.config.setup({ + enable_autosnippets = true, + region_check_events = "InsertEnter", + delete_check_events = "InsertLeave", + }) + end, +} diff --git a/.config/nvim-old/lua/config/plugins/markdown.lua b/.config/nvim-old/lua/config/plugins/markdown.lua new file mode 100644 index 0000000..223d3fb --- /dev/null +++ b/.config/nvim-old/lua/config/plugins/markdown.lua @@ -0,0 +1,220 @@ +return { + { + "bullets-vim/bullets.vim", + ft = "markdown", + config = function() + vim.g.bullets_delete_last_bullet_if_empty = 1 + end, + }, + { + "stevearc/conform.nvim", + event = "VeryLazy", + optional = true, + opts = { + formatters = { + ["markdownlint-cli2"] = { + condition = function(_, ctx) + local diag = vim.tbl_filter(function(d) + return d.source == "markdownlint" + end, vim.diagnostic.get(ctx.buf)) + return #diag > 0 + end, + }, + }, + formatters_by_ft = { + ["markdown"] = { "prettier", "markdownlint-cli2" }, + ["markdown.mdx"] = { "prettier", "markdownlint-cli2" }, + }, + }, + }, + { + "williamboman/mason.nvim", + event = "VeryLazy", + opts = { ensure_installed = { "markdownlint-cli2" } }, + }, + { + "nvimtools/none-ls.nvim", + event = "VeryLazy", + optional = true, + opts = function(_, opts) + local nls = require("null-ls") + opts.sources = vim.list_extend(opts.sources or {}, { + nls.builtins.diagnostics.markdownlint_cli2, + }) + end, + }, + { + "mfussenegger/nvim-lint", + event = "VeryLazy", + + optional = true, + opts = { + linters_by_ft = { + markdown = { "markdownlint-cli2" }, + }, + }, + }, + { + "neovim/nvim-lspconfig", + event = "VeryLazy", + + opts = { + servers = { + marksman = {}, + }, + }, + }, + + { + "iamcco/markdown-preview.nvim", + event = "VeryLazy", + + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + build = function() + require("lazy").load({ plugins = { "markdown-preview.nvim" } }) + vim.fn["mkdp#util#install"]() + end, + keys = { + { + "<leader>ow", + ft = "markdown", + "<cmd>MarkdownPreviewToggle<cr>", + desc = "Markdown Preview", + }, + }, + config = function() + vim.cmd([[do FileType]]) + end, + }, + + { + "MeanderingProgrammer/render-markdown.nvim", + ft = "markdown", + config = function() + require("render-markdown").setup({ + win_options = { + conceallevel = { + default = 0, -- Set default conceallevel to 0 + rendered = 3, -- Keep rendered mode at 3 + }, + }, + bullet = { + -- Turn on / off list bullet rendering + enabled = true, + }, + latex = { enabled = false }, + checkbox = { + -- Turn on / off checkbox state rendering + enabled = true, + -- Determines how icons fill the available space: + -- inline: underlying text is concealed resulting in a left aligned icon + -- overlay: result is left padded with spaces to hide any additional text + position = "inline", + unchecked = { + -- Replaces '[ ]' of 'task_list_marker_unchecked' + icon = " ", + -- Highlight for the unchecked icon + highlight = "RenderMarkdownUnchecked", + -- Highlight for item associated with unchecked checkbox + scope_highlight = nil, + }, + checked = { + -- Replaces '[x]' of 'task_list_marker_checked' + icon = " ", + -- Highlight for the checked icon + highlight = "RenderMarkdownChecked", + -- Highlight for item associated with checked checkbox + scope_highlight = nil, + }, + }, + html = { + -- Turn on / off all HTML rendering + enabled = true, + comment = { + -- Turn on / off HTML comment concealing + conceal = false, + }, + }, + heading = { + -- left_pad = 1, + sign = false, + icons = { " ", " ", " ", " ", " ", " " }, + backgrounds = { + "Headline1Bg", + "Headline2Bg", + "Headline3Bg", + "Headline4Bg", + "Headline5Bg", + "Headline6Bg", + }, + foregrounds = { + "Headline1Fg", + "Headline2Fg", + "Headline3Fg", + "Headline4Fg", + "Headline5Fg", + "Headline6Fg", + }, + }, + ft = { "markdown" }, + }) + + local color1_bg = "#bf616a" + local color2_bg = "#d08770" + local color5_bg = "#5e81ac" + local color4_bg = "#a3be8c" + local color6_bg = "#b48ead" + local color3_bg = "#ebcb8b" + local color_fg = "#2e3440" + + vim.cmd(string.format([[highlight @markup.strong guifg=%s]], color2_bg)) + vim.cmd(string.format([[highlight @markup.italic guifg=%s]], color2_bg)) + vim.cmd(string.format([[highlight RenderMarkdownCodeInline guifg=%s]], color4_bg)) + + -- Heading background color highlights + vim.cmd(string.format([[highlight Headline1Bg guifg=%s guibg=%s]], color_fg, color1_bg)) + vim.cmd(string.format([[highlight Headline2Bg guifg=%s guibg=%s]], color_fg, color2_bg)) + vim.cmd(string.format([[highlight Headline3Bg guifg=%s guibg=%s]], color_fg, color3_bg)) + vim.cmd(string.format([[highlight Headline4Bg guifg=%s guibg=%s]], color_fg, color4_bg)) + vim.cmd(string.format([[highlight Headline5Bg guifg=%s guibg=%s]], color_fg, color5_bg)) + vim.cmd(string.format([[highlight Headline6Bg guifg=%s guibg=%s]], color_fg, color6_bg)) + + -- Heading foreground color highlights (bold and with specific colors) + vim.cmd(string.format([[highlight Headline1Fg cterm=bold gui=bold guifg=%s]], color1_bg)) + vim.cmd(string.format([[highlight Headline2Fg cterm=bold gui=bold guifg=%s]], color2_bg)) + vim.cmd(string.format([[highlight Headline3Fg cterm=bold gui=bold guifg=%s]], color3_bg)) + vim.cmd(string.format([[highlight Headline4Fg cterm=bold gui=bold guifg=%s]], color4_bg)) + vim.cmd(string.format([[highlight Headline5Fg cterm=bold gui=bold guifg=%s]], color5_bg)) + vim.cmd(string.format([[highlight Headline6Fg cterm=bold gui=bold guifg=%s]], color6_bg)) + + vim.cmd(string.format([[highlight RenderMarkdownH1Bg guifg=%s guibg=%s]], color_fg, color1_bg)) + vim.cmd(string.format([[highlight RenderMarkdownH2Bg guifg=%s guibg=%s]], color_fg, color2_bg)) + vim.cmd(string.format([[highlight RenderMarkdownH3Bg guifg=%s guibg=%s]], color_fg, color3_bg)) + vim.cmd(string.format([[highlight RenderMarkdownH4Bg guifg=%s guibg=%s]], color_fg, color4_bg)) + vim.cmd(string.format([[highlight RenderMarkdownH5Bg guifg=%s guibg=%s]], color_fg, color5_bg)) + vim.cmd(string.format([[highlight RenderMarkdownH6Bg guifg=%s guibg=%s]], color_fg, color6_bg)) + + -- Apply custom foreground colors for headings (bold) + vim.cmd(string.format([[highlight RenderMarkdownH1 guifg=%s guibg=%s cterm=bold gui=bold]], color1_bg, color_fg)) + vim.cmd(string.format([[highlight RenderMarkdownH2 guifg=%s guibg=%s cterm=bold gui=bold]], color2_bg, color_fg)) + vim.cmd(string.format([[highlight RenderMarkdownH3 guifg=%s guibg=%s cterm=bold gui=bold]], color3_bg, color_fg)) + vim.cmd(string.format([[highlight RenderMarkdownH4 guifg=%s guibg=%s cterm=bold gui=bold]], color4_bg, color_fg)) + vim.cmd(string.format([[highlight RenderMarkdownH5 guifg=%s guibg=%s cterm=bold gui=bold]], color5_bg, color_fg)) + vim.cmd(string.format([[highlight RenderMarkdownH6 guifg=%s guibg=%s cterm=bold gui=bold]], color6_bg, color_fg)) + Snacks.toggle({ + name = "Render Markdown", + get = function() + return require("render-markdown.state").enabled + end, + set = function(enabled) + local m = require("render-markdown") + if enabled then + m.enable() + else + m.disable() + end + end, + }):map("<leader>or", { desc = "Toggle Render Markdown" }) + end, + }, +} diff --git a/.config/nvim-old/lua/config/plugins/mini.lua b/.config/nvim-old/lua/config/plugins/mini.lua new file mode 100644 index 0000000..fe6a3aa --- /dev/null +++ b/.config/nvim-old/lua/config/plugins/mini.lua @@ -0,0 +1,27 @@ +return { + { + "echasnovski/mini.nvim", + event = "VeryLazy", + enabled = true, + config = function() + require("mini.icons").setup() + require("mini.move").setup() + require("mini.ai").setup() + require("mini.surround").setup() + require("mini.pairs").setup() + -- + -- HACK: The Key Commands -> for help run ;h nvim-surround.usage + -- + -- Old text Command New text + -- -------------------------------------------------------------------------------- + -- surr*ound_words ysiw) (surround_words) + -- *make strings ys$" "make strings" + -- [delete ar*ound me!] ds] delete around me! + -- remove <b>HTML t*ags</b> dst remove HTML tags + -- 'change quot*es' cs'" "change quotes" + -- <b>or tag* types</b> csth1<CR> <h1>or tag types</h1> + -- delete(functi*on calls) dsf function calls + -- + end, + }, +} diff --git a/.config/nvim-old/lua/config/plugins/neotree.lua b/.config/nvim-old/lua/config/plugins/neotree.lua new file mode 100644 index 0000000..11a0a98 --- /dev/null +++ b/.config/nvim-old/lua/config/plugins/neotree.lua @@ -0,0 +1,17 @@ +return { + { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "MunifTanjim/nui.nvim", + "nvim-tree/nvim-web-devicons", -- optional, but recommended + }, + lazy = false, -- neo-tree will lazily load itself + opts = { + window = { + position = "right", + }, + }, + }, +} diff --git a/.config/nvim-old/lua/config/plugins/oil.lua b/.config/nvim-old/lua/config/plugins/oil.lua new file mode 100644 index 0000000..555768f --- /dev/null +++ b/.config/nvim-old/lua/config/plugins/oil.lua @@ -0,0 +1,37 @@ +return { + "stevearc/oil.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + require("oil").setup({ + default_file_explorer = true, + keymaps = { + ["l"] = "actions.select", + ["h"] = "actions.parent", + ["<CR>"] = "actions.select", + ["<C-s>"] = nil, + ["<C-h>"] = nil, + ["<C-l>"] = nil, + }, + delete_to_trash = true, + view_options = { + show_hidden = true, + }, + skip_confirm_for_simple_edits = true, + float = { + max_width = 80, + max_height = 30, + override = function(conf) + return conf + end, + }, + }) + vim.keymap.set("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory" }) + + vim.api.nvim_create_autocmd("FileType", { + pattern = "oil", + callback = function() + vim.opt_local.cursorline = true + end, + }) + end, +} diff --git a/.config/nvim-old/lua/config/plugins/rustacean.lua b/.config/nvim-old/lua/config/plugins/rustacean.lua new file mode 100644 index 0000000..1187aad --- /dev/null +++ b/.config/nvim-old/lua/config/plugins/rustacean.lua @@ -0,0 +1,29 @@ +return { + "mrcjkb/rustaceanvim", + version = "^8", -- Recommended + lazy = false, -- This plugin is already lazy + init = function() + local capabilities = vim.lsp.protocol.make_client_capabilities() + local ok, blink = pcall(require, "blink.cmp") + if ok then + capabilities = blink.get_lsp_capabilities(capabilities) + end + + vim.g.rustaceanvim = { + tools = { + enable_clippy = false, + }, + server = { + capabilities = capabilities, + standalone = true, + status_notify_level = false, + load_vscode_settings = false, + default_settings = { + ["rust-analyzer"] = { + checkOnSave = false, + }, + }, + }, + } + end, +} diff --git a/.config/nvim-old/lua/config/plugins/snacks.lua b/.config/nvim-old/lua/config/plugins/snacks.lua new file mode 100644 index 0000000..dd731dd --- /dev/null +++ b/.config/nvim-old/lua/config/plugins/snacks.lua @@ -0,0 +1,84 @@ +return { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + opts = { + bigfile = { enabled = true }, + notifier = { timeout = 2000 }, + quickfile = { enabled = true }, + statuscolumn = { enabled = true }, + image = { + enabled = true, + doc = { + enabled = true, + float = true, + inline = false, + max_width = 60, + max_height = 30, + }, + }, + dashboard = { + enabled = true, + autokeys = "wert", + preset = { + keys = { + { icon = " ", key = "f", desc = "Find File", action = ":lua Snacks.dashboard.pick('files')" }, + { icon = " ", key = "g", desc = "Grep", action = ":lua Snacks.dashboard.pick('live_grep')", padding = 1 }, + { icon = " ", key = "n", desc = "New File", action = ":ene | startinsert" }, + { icon = " ", key = "c", desc = "LeetCode", action = ":Leet" }, + { icon = " ", key = "l", desc = "Lazy", action = ":Lazy", enabled = package.loaded.lazy ~= nil }, + { icon = " ", key = "q", desc = "Quit", action = ":qa" }, + }, + }, + formats = { + key = function(item) + return { { "[", hl = "special" }, { item.key, hl = "key" }, { "]", hl = "special" } } + end, + }, + sections = { + { section = "recent_files", limit = 4, padding = 1 }, + { section = "keys", padding = 1 }, + { section = "startup" }, + }, + }, + styles = { + snacks_image = { + relative = "editor", + col = -1, + }, + lazygit = { + wo = { + winhighlight = "NormalFloat:None,FloatBorder:SnacksInputBorder,FloatTitle:SnacksInputTitle", + cursorline = false, + }, + }, + float = { + backdrop = false, + }, + blame_line = { + backdrop = false, + }, + }, + }, + init = function() + vim.api.nvim_create_autocmd("User", { + pattern = "VeryLazy", + callback = function() + _G.dd = function(...) + Snacks.debug.inspect(...) + end + _G.bt = function() + Snacks.debug.backtrace() + end + vim.print = _G.dd + Snacks.toggle.option("spell", { name = "Spelling" }):map("<leader>ts") + Snacks.toggle.option("wrap", { name = "Wrap" }):map("<leader>tw") + Snacks.toggle.diagnostics():map("<leader>td") + Snacks.toggle + .option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }) + :map("<leader>tc") + Snacks.toggle.indent():map("<leader>ti") + end, + }) + end, +} diff --git a/.config/nvim-old/lua/config/plugins/treesitter.lua b/.config/nvim-old/lua/config/plugins/treesitter.lua new file mode 100644 index 0000000..3e866c5 --- /dev/null +++ b/.config/nvim-old/lua/config/plugins/treesitter.lua @@ -0,0 +1,43 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + event = "VeryLazy", + opts = { + ensure_installed = { + "c", + "lua", + "vim", + "vimdoc", + "query", + "markdown", + "markdown_inline", + "rust", + "css", + "javascript", + "svelte", + "tsx", + "typst", + }, + auto_install = true, + incremental_selection = { + enable = true, + keymaps = { + node_incremental = "<Enter>", + scope_incremental = false, + node_decremental = "<Backspace>", + }, + }, + highlight = { + enable = true, + disable = function(lang, buf) + local max_filesize = 100 * 1024 -- 100 KB + local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) + if ok and stats and stats.size > max_filesize then + return true + end + end, + additional_vim_regex_highlighting = false, + }, + }, + }, +} diff --git a/.config/nvim-old/lua/config/plugins/typst.lua b/.config/nvim-old/lua/config/plugins/typst.lua new file mode 100644 index 0000000..2443773 --- /dev/null +++ b/.config/nvim-old/lua/config/plugins/typst.lua @@ -0,0 +1,9 @@ +return { + "chomosuke/typst-preview.nvim", + -- lazy = false, -- or ft = 'typst' + ft = "typst", + version = "1.*", + opts = { + invert_colors = "auto", + }, -- lazy.nvim will implicitly calls `setup {}` +} diff --git a/.config/nvim-old/lua/config/plugins/utils.lua b/.config/nvim-old/lua/config/plugins/utils.lua new file mode 100644 index 0000000..273de1a --- /dev/null +++ b/.config/nvim-old/lua/config/plugins/utils.lua @@ -0,0 +1,58 @@ +return { + { + "ojroques/nvim-osc52", + event = "VeryLazy", + config = function() + vim.keymap.set("v", "Y", require("osc52").copy_visual) + end, + }, + { -- For CSS colors + "NvChad/nvim-colorizer.lua", + event = "BufReadPre", + opts = { + user_default_options = { + names = false, + tailwind = "both", + css = true, + css_fn = true, + mode = "background", + }, + }, + }, + { -- for file outline + "hedyhli/outline.nvim", + event = "VeryLazy", + opts = {}, + }, + { -- Undotree + "mbbill/undotree", + event = "VeryLazy", + config = function() + vim.g.undotree_SplitWidth = 50 + vim.g.undotree_WindowLayout = 3 + end, + }, + { -- for colored brackets and divs + "HiPhish/rainbow-delimiters.nvim", + event = "VeryLazy", + }, + { -- for tmux navigation + event = "VeryLazy", + "christoomey/vim-tmux-navigator", + cmd = { + "TmuxNavigateLeft", + "TmuxNavigateDown", + "TmuxNavigateUp", + "TmuxNavigateRight", + "TmuxNavigatePrevious", + "TmuxNavigatorProcessList", + }, + keys = { + { "<c-h>", "<cmd><C-U>TmuxNavigateLeft<cr>" }, + { "<c-j>", "<cmd><C-U>TmuxNavigateDown<cr>" }, + { "<c-k>", "<cmd><C-U>TmuxNavigateUp<cr>" }, + { "<c-l>", "<cmd><C-U>TmuxNavigateRight<cr>" }, + { "<c-\\>", "<cmd><C-U>TmuxNavigatePrevious<cr>" }, + }, + }, +} diff --git a/.config/nvim-old/lua/config/plugins/uv.lua b/.config/nvim-old/lua/config/plugins/uv.lua new file mode 100644 index 0000000..121921b --- /dev/null +++ b/.config/nvim-old/lua/config/plugins/uv.lua @@ -0,0 +1,7 @@ +return { + "benomahony/uv.nvim", + event = "VeryLazy", + opts = { + picker_integration = true, + }, +} diff --git a/.config/nvim-old/lua/config/plugins/which-key.lua b/.config/nvim-old/lua/config/plugins/which-key.lua new file mode 100644 index 0000000..9e97f9f --- /dev/null +++ b/.config/nvim-old/lua/config/plugins/which-key.lua @@ -0,0 +1,27 @@ +return { + "folke/which-key.nvim", + event = "VeryLazy", + opts = { + win = { + wo = { + winblend = 0, + }, + }, + preset = "helix", + icons = { + rules = false, + }, + delay = 500, + spec = { + { "<leader>c", group = "Code", mode = { "n", "x" } }, + { "<leader>d", group = "Document" }, + { "<leader>g", group = "Git" }, + { "<leader>m", group = "Marks" }, + { "<leader>r", group = "Rename" }, + { "<leader>s", group = "Search" }, + { "<leader>t", group = "Toggle" }, + { "<leader>w", group = "Workspace" }, + { "<leader>l", group = "LSP" }, + }, + }, +} diff --git a/.config/nvim-old/lua/config/snippets/all.lua b/.config/nvim-old/lua/config/snippets/all.lua new file mode 100644 index 0000000..e2a2ef1 --- /dev/null +++ b/.config/nvim-old/lua/config/snippets/all.lua @@ -0,0 +1,10 @@ +local ls = require("luasnip") +local s = ls.snippet +local t = ls.text_node +local i = ls.insert_node + +return { + s("hi", { + t("Hello, world!"), + }), +} diff --git a/.config/nvim-old/lua/mappings.lua b/.config/nvim-old/lua/mappings.lua new file mode 100644 index 0000000..9f17f28 --- /dev/null +++ b/.config/nvim-old/lua/mappings.lua @@ -0,0 +1,71 @@ +local wk = require("which-key") + +vim.keymap.set("n", "x", '"_x', { noremap = true, silent = true }) +vim.keymap.set("x", "x", '"_x', { noremap = true, silent = true }) +vim.keymap.set("v", "x", '"_x', { noremap = true, silent = true }) +vim.keymap.set("n", "c", '"_c') +vim.keymap.set("n", "C", '"_C') +vim.keymap.set("n", "cc", '"_cc') +vim.keymap.set("x", "c", '"_c') + +local fzf = require("fzf-lua") + +wk.add({ + { + mode = { "n" }, + { "<leader>qr", "<cmd>Leet run<CR>", desc = "Run code" }, + { "<leader>qs", "<cmd>Leet submit<CR>", desc = "Submit code" }, + { "<leader>qi", "<cmd>Leet info<CR>", desc = "Get info" }, + { "<leader>qo", "<cmd>Leet open<CR>", desc = "Open in browser" }, + { "<leader>qd", "<cmd>Leet desc<CR>", desc = "Toggle decription" }, + { "<leader>qm", "<cmd>Leet menu<CR>", desc = "Open menu" }, + { "<C-d>", "<C-d>zz", desc = "Move down in buffer with cursor centered" }, + { "<C-u>", "<C-u>zz", desc = "Move up in buffer with cursor centered" }, + { "n", "nzzzv", desc = "Search next with cursor centered" }, + { "N", "Nzzzv", desc = "Search previous with cursor centered" }, + { "<leader>u", "<cmd>UndotreeToggle<CR>", desc = "Toggle undo tree" }, + { "<leader>o", "<cmd>Outline<CR>", desc = "Toggle Outline" }, + { "<Esc>", "<cmd>nohlsearch<CR>", hidden = true }, -- Unhighlight + { "<C-h>", "<C-w><C-h>", hidden = true }, -- Move to left window + { "<C-l>", "<C-w><C-l>", hidden = true }, -- Move to right window + { "<C-j>", "<C-w><C-j>", hidden = true }, -- Move to lower window + { "<C-k>", "<C-w><C-k>", hidden = true }, -- Move to upper window + { "<C-q>", "<C-w><C-q>", hidden = true }, -- Close window + { "<leader>l", "<cmd>Neotree toggle<CR>", desc = "Neotree toggle" }, + { + "<leader><leader>", + function() + require("fzf-lua").buffers() + end, + desc = "Search Buffers", + }, + { + "<leader>s", + function() + require("fzf-lua").files() + end, + desc = "Search Files", + }, + { + "<leader>/", + function() + require("fzf-lua").live_grep() + end, + desc = "Search by Grep", + }, + { + "<leader>h", + function() + require("fzf-lua").lsp_document_diagnostics() + end, + desc = "Search Diagnostics", + }, + { + "<leader>n", + function() + Snacks.notifier.show_history() + end, + desc = "Notification History", + }, + }, +}) diff --git a/.config/nvim-old/lua/options.lua b/.config/nvim-old/lua/options.lua new file mode 100644 index 0000000..c61f4c9 --- /dev/null +++ b/.config/nvim-old/lua/options.lua @@ -0,0 +1,36 @@ +local set = vim.opt +local g = vim.g + +g.mapleader = " " +g.maplocalleader = " " +g.have_nerd_font = true +set.number = true +set.relativenumber = true +set.termguicolors = true +set.tabstop = 4 +set.shiftwidth = 4 +set.swapfile = false +set.expandtab = true +set.mouse = "a" +set.showmode = false +set.breakindent = true +set.undofile = true +set.ignorecase = true +set.smartcase = true +set.signcolumn = "yes" +set.updatetime = 250 +set.timeoutlen = 300 +set.splitright = true +set.splitbelow = true +set.list = true +set.listchars = { tab = "» ", trail = "·", nbsp = "␣" } +set.inccommand = "split" +set.cursorline = true +set.scrolloff = 4 +set.sidescrolloff = 4 +set.conceallevel = 2 +set.wrap = false + +vim.schedule(function() + set.clipboard = "unnamedplus" +end) diff --git a/.config/nvim-old/nvim-pack-lock.json b/.config/nvim-old/nvim-pack-lock.json new file mode 100644 index 0000000..9da8e87 --- /dev/null +++ b/.config/nvim-old/nvim-pack-lock.json @@ -0,0 +1,85 @@ +{ + "plugins": { + "LuaSnip": { + "rev": "dae4f5aaa3574bd0c2b9dd20fb9542a02c10471c", + "src": "https://github.com/L3MON4D3/LuaSnip" + }, + "alpha-nvim": { + "rev": "a9d8fb72213c8b461e791409e7feabb74eb6ce73", + "src": "https://github.com/goolord/alpha-nvim" + }, + "blink.cmp": { + "rev": "4b18c32adef2898f95cdef6192cbd5796c1a332d", + "src": "https://github.com/saghen/blink.cmp", + "version": "1.0.0 - 2.0.0" + }, + "efmls-configs-nvim": { + "rev": "2dd907fe0043b95a901a9aee814f17804aa4426d", + "src": "https://github.com/creativenull/efmls-configs-nvim" + }, + "flash.nvim": { + "rev": "fcea7ff883235d9024dc41e638f164a450c14ca2", + "src": "https://github.com/folke/flash.nvim" + }, + "fzf-lua": { + "rev": "b56cd2ffbce57bfd9133a645bd02cd86895a7e3f", + "src": "https://www.github.com/ibhagwan/fzf-lua" + }, + "gitsigns.nvim": { + "rev": "9f3c6dd7868bcc116e9c1c1929ce063b978fa519", + "src": "https://www.github.com/lewis6991/gitsigns.nvim" + }, + "leetcode.nvim": { + "rev": "fdd3f91800b3983e27bc9fcfb99cfa7293d7f11a", + "src": "https://github.com/kawre/leetcode.nvim" + }, + "mason.nvim": { + "rev": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65", + "src": "https://github.com/mason-org/mason.nvim" + }, + "mini.nvim": { + "rev": "0098de999048af0539183d625c52d733318a441b", + "src": "https://www.github.com/echasnovski/mini.nvim" + }, + "nord.nvim": { + "rev": "80c1e5321505aeb22b7a9f23eb82f1e193c12470", + "src": "https://github.com/shaunsingh/nord.nvim" + }, + "nui.nvim": { + "rev": "de740991c12411b663994b2860f1a4fd0937c130", + "src": "https://github.com/MunifTanjim/nui.nvim" + }, + "nvim-lspconfig": { + "rev": "ead0f5f342d8d323441e7d4b88f0fc436a81ad5f", + "src": "https://www.github.com/neovim/nvim-lspconfig" + }, + "nvim-tree.lua": { + "rev": "c988e289428d9202b28ba27479647033c7dd2956", + "src": "https://www.github.com/nvim-tree/nvim-tree.lua" + }, + "nvim-treesitter": { + "rev": "cb2cb74f3c3cbbcc17e79cada2060165d616d849", + "src": "https://github.com/nvim-treesitter/nvim-treesitter" + }, + "oil.nvim": { + "rev": "0fcc83805ad11cf714a949c98c605ed717e0b83e", + "src": "https://github.com/stevearc/oil.nvim" + }, + "outline.nvim": { + "rev": "ead1820d49c8e79ce89cab1c2c318981b695c9d2", + "src": "https://github.com/hedyhli/outline.nvim" + }, + "plenary.nvim": { + "rev": "b9fd5226c2f76c951fc8ed5923d85e4de065e509", + "src": "https://github.com/nvim-lua/plenary.nvim" + }, + "rustaceanvim": { + "rev": "d50597d482a6f44ddfc54d1af2f69f052053b4de", + "src": "https://github.com/mrcjkb/rustaceanvim" + }, + "which-key.nvim": { + "rev": "3aab2147e74890957785941f0c1ad87d0a44c15a", + "src": "https://github.com/folke/which-key.nvim" + } + } +}
\ No newline at end of file |
