diff options
Diffstat (limited to '.config/nvim/lua')
| -rw-r--r-- | .config/nvim/lua/config/plugins/blink-cmp.lua | 11 | ||||
| -rw-r--r-- | .config/nvim/lua/config/plugins/conform.lua | 1 | ||||
| -rw-r--r-- | .config/nvim/lua/config/plugins/fzflua.lua | 4 | ||||
| -rw-r--r-- | .config/nvim/lua/config/plugins/jupytext.lua | 6 | ||||
| -rw-r--r-- | .config/nvim/lua/config/plugins/learn.lua | 8 | ||||
| -rw-r--r-- | .config/nvim/lua/config/plugins/leetcode.lua | 22 | ||||
| -rw-r--r-- | .config/nvim/lua/config/plugins/lsp.lua | 16 | ||||
| -rw-r--r-- | .config/nvim/lua/config/plugins/notebook.lua | 14 | ||||
| -rw-r--r-- | .config/nvim/lua/config/plugins/rustacean.lua | 26 | ||||
| -rw-r--r-- | .config/nvim/lua/config/plugins/snacks.lua | 1 | ||||
| -rw-r--r-- | .config/nvim/lua/config/plugins/treesitter.lua | 70 | ||||
| -rw-r--r-- | .config/nvim/lua/mappings.lua | 8 |
12 files changed, 119 insertions, 68 deletions
diff --git a/.config/nvim/lua/config/plugins/blink-cmp.lua b/.config/nvim/lua/config/plugins/blink-cmp.lua index 424d463..9f622c7 100644 --- a/.config/nvim/lua/config/plugins/blink-cmp.lua +++ b/.config/nvim/lua/config/plugins/blink-cmp.lua @@ -49,6 +49,12 @@ return { -- (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 }, @@ -56,6 +62,11 @@ return { 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", diff --git a/.config/nvim/lua/config/plugins/conform.lua b/.config/nvim/lua/config/plugins/conform.lua index afc2dd5..55660e9 100644 --- a/.config/nvim/lua/config/plugins/conform.lua +++ b/.config/nvim/lua/config/plugins/conform.lua @@ -22,7 +22,6 @@ return { typescriptreact = { "prettierd", "prettier", stop_after_first = true }, css = { "prettierd", "prettier", stop_after_first = true }, html = { "prettierd", "prettier", stop_after_first = true }, - htmldjango = { "djlint" }, typst = { "prettypst" }, }, format_on_save = { diff --git a/.config/nvim/lua/config/plugins/fzflua.lua b/.config/nvim/lua/config/plugins/fzflua.lua index ea8a744..8dfdeb3 100644 --- a/.config/nvim/lua/config/plugins/fzflua.lua +++ b/.config/nvim/lua/config/plugins/fzflua.lua @@ -22,8 +22,8 @@ return { }, 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]], + -- 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/lua/config/plugins/jupytext.lua b/.config/nvim/lua/config/plugins/jupytext.lua deleted file mode 100644 index 2f57193..0000000 --- a/.config/nvim/lua/config/plugins/jupytext.lua +++ /dev/null @@ -1,6 +0,0 @@ -return { - "GCBallesteros/jupytext.nvim", - config = true, - -- Depending on your nvim distro or config you may need to make the loading not lazy - -- lazy=false, -} diff --git a/.config/nvim/lua/config/plugins/learn.lua b/.config/nvim/lua/config/plugins/learn.lua deleted file mode 100644 index 2d82d9f..0000000 --- a/.config/nvim/lua/config/plugins/learn.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - -- { - -- "m4xshen/hardtime.nvim", - -- lazy = false, - -- dependencies = { "MunifTanjim/nui.nvim" }, - -- opts = {}, - -- }, -} diff --git a/.config/nvim/lua/config/plugins/leetcode.lua b/.config/nvim/lua/config/plugins/leetcode.lua new file mode 100644 index 0000000..920aba9 --- /dev/null +++ b/.config/nvim/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/lua/config/plugins/lsp.lua b/.config/nvim/lua/config/plugins/lsp.lua index 4d4dcc0..eb812d2 100644 --- a/.config/nvim/lua/config/plugins/lsp.lua +++ b/.config/nvim/lua/config/plugins/lsp.lua @@ -138,7 +138,12 @@ return { [vim.diagnostic.severity.HINT] = " ", }, }, - virtual_text = { current_line = true }, + virtual_text = { + source = "if_many", + spacing = 2, + }, + update_in_insert = true, + virtual_lines = false, -- virtual_text = { -- source = "if_many", -- spacing = 2, @@ -164,6 +169,7 @@ return { -- - 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 = {}, @@ -184,6 +190,13 @@ return { "--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 -- @@ -208,6 +221,7 @@ return { 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 diff --git a/.config/nvim/lua/config/plugins/notebook.lua b/.config/nvim/lua/config/plugins/notebook.lua deleted file mode 100644 index f3eff87..0000000 --- a/.config/nvim/lua/config/plugins/notebook.lua +++ /dev/null @@ -1,14 +0,0 @@ -return { - { - "jeryldev/pyworks.nvim", - dependencies = { - "benlubas/molten-nvim", - "3rd/image.nvim", - }, - config = function() - require("pyworks").setup() -- See Configuration section for options - end, - lazy = false, - priority = 100, - }, -} diff --git a/.config/nvim/lua/config/plugins/rustacean.lua b/.config/nvim/lua/config/plugins/rustacean.lua index 849db6e..1187aad 100644 --- a/.config/nvim/lua/config/plugins/rustacean.lua +++ b/.config/nvim/lua/config/plugins/rustacean.lua @@ -1,5 +1,29 @@ return { "mrcjkb/rustaceanvim", - version = "^6", -- Recommended + 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/lua/config/plugins/snacks.lua b/.config/nvim/lua/config/plugins/snacks.lua index b83beb9..dd731dd 100644 --- a/.config/nvim/lua/config/plugins/snacks.lua +++ b/.config/nvim/lua/config/plugins/snacks.lua @@ -25,6 +25,7 @@ return { { 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" }, }, diff --git a/.config/nvim/lua/config/plugins/treesitter.lua b/.config/nvim/lua/config/plugins/treesitter.lua index 3c95b41..3e866c5 100644 --- a/.config/nvim/lua/config/plugins/treesitter.lua +++ b/.config/nvim/lua/config/plugins/treesitter.lua @@ -2,40 +2,42 @@ return { { "nvim-treesitter/nvim-treesitter", event = "VeryLazy", - build = ":TSUpdate", - config = function() - require("nvim-treesitter.configs").setup({ - ensure_installed = { - "c", - "lua", - "vim", - "vimdoc", - "query", - "markdown", - "markdown_inline", - "rust", + 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>", }, - 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, - }, - }) - end, + }, + 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/lua/mappings.lua b/.config/nvim/lua/mappings.lua index 25b566a..9f17f28 100644 --- a/.config/nvim/lua/mappings.lua +++ b/.config/nvim/lua/mappings.lua @@ -13,6 +13,12 @@ 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" }, @@ -48,7 +54,7 @@ wk.add({ desc = "Search by Grep", }, { - "<leader>d", + "<leader>h", function() require("fzf-lua").lsp_document_diagnostics() end, |
