From 91f852787c4c372427ea8748756d4da5a7b7582c Mon Sep 17 00:00:00 2001 From: Seymur Bagirov Date: Sun, 17 Mar 2024 06:52:42 +0400 Subject: [PATCH] nvim lazy.nvim cleanup. add some stuff to hypr config --- hypr/autostart.conf | 2 +- hypr/hypridle.conf | 3 +- hypr/nvidia.conf | 5 + hypr/plugins.conf | 4 +- nvim/lazy-lock.json | 60 ++-- nvim/lua/themystery/plugins/codesnap.lua | 8 - nvim/lua/themystery/plugins/gitsigns.lua | 8 + nvim/lua/themystery/plugins/init.lua | 18 +- nvim/lua/themystery/plugins/lsp.lua | 340 +++++++++---------- nvim/lua/themystery/plugins/rustaceanvim.lua | 5 - nvim/lua/themystery/plugins/treesitter.lua | 11 +- nvim/lua/themystery/plugins/ufo.lua | 16 +- 12 files changed, 244 insertions(+), 236 deletions(-) create mode 100644 hypr/nvidia.conf create mode 100644 nvim/lua/themystery/plugins/gitsigns.lua delete mode 100644 nvim/lua/themystery/plugins/rustaceanvim.lua diff --git a/hypr/autostart.conf b/hypr/autostart.conf index ee55179..9bc3e3d 100755 --- a/hypr/autostart.conf +++ b/hypr/autostart.conf @@ -30,8 +30,8 @@ source = ~/.config/hypr/plugins.conf source = ~/.config/hypr/wallpaper.conf # env -env = XDG_SESSION_TYPE,wayland env = WLR_DRM_NO_ATOMIC, 1 env = DOTNET_CLI_TELEMETRY_OPTOUT, true +source = ~/.config/hypr/nvidia.conf windowrulev2 = immediate, title:^(Overwatch)$ windowrulev2 = immediate, class:^(steam_app_1088710)$ diff --git a/hypr/hypridle.conf b/hypr/hypridle.conf index c0cfc48..cb35002 100644 --- a/hypr/hypridle.conf +++ b/hypr/hypridle.conf @@ -1,4 +1,4 @@ -$lockCmd = pidof hyprlock || hyprlock +$lockCmd = hyprlock general { lock_cmd = $lockCmd # dbus/sysd lock command (loginctl lock-session) unlock_cmd = loginctl unlock-session # same as above, but unlock @@ -10,5 +10,4 @@ general { listener { timeout = 500 # in seconds on-timeout = loginctl lock-session # command to run when timeout has passed - on-resume = notify-send "Hello!" # command to run when activity is detected after timeout has fired. } diff --git a/hypr/nvidia.conf b/hypr/nvidia.conf new file mode 100644 index 0000000..36d6d75 --- /dev/null +++ b/hypr/nvidia.conf @@ -0,0 +1,5 @@ +env = LIBVA_DRIVER_NAME,nvidia +env = XDG_SESSION_TYPE,wayland +env = GBM_BACKEND,nvidia-drm +env = __GLX_VENDOR_LIBRARY_NAME,nvidia +env = WLR_NO_HARDWARE_CURSORS,1 diff --git a/hypr/plugins.conf b/hypr/plugins.conf index b21d339..6bd03e5 100644 --- a/hypr/plugins.conf +++ b/hypr/plugins.conf @@ -1,8 +1,8 @@ -exec-once = hyprpm reload -n +# exec-once = hyprpm reload -n # keymaps -bind = $mainMod, W, hycov:toggleoverview +# bind = $mainMod, W, hycov:toggleoverview diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index e0c5a38..0d256b2 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,55 +1,55 @@ { "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, "Ionide-vim": { "branch": "master", "commit": "8435bae84b26b602dbb68399661b3989915cc4d3" }, - "LuaSnip": { "branch": "master", "commit": "f3b3d3446bcbfa62d638b1903ff00a78b2b730a1" }, + "LuaSnip": { "branch": "master", "commit": "a7a4b4682c4b3e2ba82b82a4e6e5f5a0e79dec32" }, "barbecue": { "branch": "main", "commit": "cd7e7da622d68136e13721865b4d919efd6325ed" }, - "cloak.nvim": { "branch": "main", "commit": "9abe4e986e924fc54a972c1b0ff52b65a0622624" }, + "cloak.nvim": { "branch": "main", "commit": "462e84e1659d984196d09f7d16690b19b9aee804" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "codesnap.nvim": { "branch": "main", "commit": "bf50e508010d58757fa72d2c0b4e11c6b29dfc74" }, - "copilot.vim": { "branch": "release", "commit": "4d32b064fedbdbf8f3fa83afa1b19ebafd3a035c" }, + "codesnap.nvim": { "branch": "main", "commit": "53b3d2544a3219d9774c3234f1fb34949b7be6b3" }, + "copilot.vim": { "branch": "release", "commit": "9484e35cf222e9360e05450622a884f95c662c4c" }, "csharpls-extended-lsp.nvim": { "branch": "master", "commit": "bde4aebe0dc74952188c2130c6831a1d8e4ce5c6" }, "friendly-snippets": { "branch": "main", "commit": "dcd4a586439a1c81357d5b9d26319ae218cc9479" }, - "gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" }, + "gitsigns.nvim": { "branch": "main", "commit": "4e348641b8206c3b8d23080999e3ddbe4ca90efc" }, "harpoon": { "branch": "harpoon2", "commit": "a38be6e0dd4c6db66997deab71fc4453ace97f9c" }, - "image.nvim": { "branch": "master", "commit": "b0e24e6f4b2c8a7a5656e8418bbfd2200cabc9b9" }, - "indent-blankline.nvim": { "branch": "master", "commit": "821a7acd88587d966f7e464b0b3031dfe7f5680c" }, - "kitty-scrollback.nvim": { "branch": "main", "commit": "93b4286c4e2c9d4a73ccbefb3adbc688d3ed5fe4" }, - "lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" }, - "leap.nvim": { "branch": "main", "commit": "b41f48643b483bb0881c0f7804f6f0be7bb95155" }, - "lsp-zero.nvim": { "branch": "v3.x", "commit": "abac76482ec3012a2b359ba956a74e2ffd33d46f" }, - "lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "21d33d69a81f6351e5a5f49078b2e4f0075c8e73" }, + "image.nvim": { "branch": "master", "commit": "0dd8bdbb8855bc98c534a902c91dc9eddb8155b1" }, + "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" }, + "kitty-scrollback.nvim": { "branch": "main", "commit": "af95c02d558216202639609a56123fed9d8fb193" }, + "lazy.nvim": { "branch": "main", "commit": "83493db50a434a4c5c648faf41e2ead80f96e478" }, + "leap.nvim": { "branch": "main", "commit": "1f7c33f7c8fcad27c3da71a20c804931b8996f75" }, + "lsp-zero.nvim": { "branch": "v3.x", "commit": "14c9164413df4be17a5a0ca9e01a376691cbcaef" }, + "lualine.nvim": { "branch": "master", "commit": "af4c3cf17206810880d2a93562e0a4c0d901c684" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "1bed24274d911bb3ed730c516ffce27e8fdeeac3" }, "mason.nvim": { "branch": "main", "commit": "3b5068f0fc565f337d67a2d315d935f574848ee7" }, - "neo-tree.nvim": { "branch": "v3.x", "commit": "f3941c57ec85d7bdb44fa53fd858fd80f159018f" }, - "neodev.nvim": { "branch": "main", "commit": "3157f2e876fd6223d36cfa76bee4709247d62fa5" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "742db4e60c74e5fbcc596aaf9e7575e1342dfd09" }, + "neodev.nvim": { "branch": "main", "commit": "84e0290f5600e8b89c0dfcafc864f45496a53400" }, "noice.nvim": { "branch": "main", "commit": "bf67d70bd7265d075191e7812d8eb42b9791f737" }, - "nui.nvim": { "branch": "main", "commit": "c3c7fd618dcb5a89e443a2e1033e7d11fdb0596b" }, + "nui.nvim": { "branch": "main", "commit": "3dc46d725f7b94bee5117c0a699b57b1902b5d65" }, "nvim-autopairs": { "branch": "master", "commit": "c6139ca0d5ad7af129ea6c89cb4c56093f2c034a" }, "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, - "nvim-dap": { "branch": "master", "commit": "fc880e82059eb21c0fa896be60146e5f17680648" }, + "nvim-dap": { "branch": "master", "commit": "c43c2473ecb482a9d91f32c1d4c0098fffad3c7d" }, "nvim-dap-ui": { "branch": "master", "commit": "9720eb5fa2f41988e8770f973cd11b76dd568a5d" }, "nvim-lightbulb": { "branch": "master", "commit": "8f00b89dd1b1dbde16872bee5fbcee2e58c9b8e9" }, - "nvim-lspconfig": { "branch": "master", "commit": "ec7d51a619049c7c597f469f81ea199db6794651" }, + "nvim-lspconfig": { "branch": "master", "commit": "4bdd3800b4148f670c6cf55ef65f490148eeb550" }, "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, "nvim-notify": { "branch": "master", "commit": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15" }, - "nvim-treesitter": { "branch": "master", "commit": "6e2b56cbe75ddf18e6efecee44bc3936d70b0b3e" }, - "nvim-treesitter-context": { "branch": "master", "commit": "b8d1ffe58a88e0356da56b167373e89c4579ce15" }, + "nvim-treesitter": { "branch": "master", "commit": "f87882858438834d2fbb6379aa2be37de901751b" }, + "nvim-treesitter-context": { "branch": "master", "commit": "b8b7e52c1517d401d7c519787d5dc4528c41291a" }, "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" }, - "nvim-ufo": { "branch": "main", "commit": "553d8a9c611caa9f020556d4a26b760698e5b81b" }, - "nvim-web-devicons": { "branch": "master", "commit": "0bb67ef952ea3eb7b1bac9c011281471d99a27bc" }, - "onedarkpro.nvim": { "branch": "main", "commit": "3fbb6e8c35589e6373fcb8d49b6318f794740343" }, - "plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" }, - "promise-async": { "branch": "main", "commit": "94f6f03c6c1e2aab551aacdf0c1e597a7269abb6" }, - "rainbow-delimiters.nvim": { "branch": "master", "commit": "64b7006a36cec099da7eaeb056c4a27dd5d73342" }, - "rustaceanvim": { "branch": "master", "commit": "19f12173ccb7993f86ea26b0e21bbb883c3b86c7" }, + "nvim-ufo": { "branch": "main", "commit": "7b14dd650b57291a49f037f1ede325d46e08b258" }, + "nvim-web-devicons": { "branch": "master", "commit": "a851380fbea4c1312d11f13d5cdc86a7a19808dd" }, + "onedarkpro.nvim": { "branch": "main", "commit": "e4fc3641aa3b52e30496bf34b87f70ef5506686e" }, + "plenary.nvim": { "branch": "master", "commit": "f7adfc4b3f4f91aab6caebf42b3682945fbc35be" }, + "promise-async": { "branch": "main", "commit": "93540c168c5ed2b030ec3e6c40ab8bbb85e36355" }, + "rainbow-delimiters.nvim": { "branch": "master", "commit": "cfc3f53cfa0fbabd95bd33747288aea24fe45211" }, + "rustaceanvim": { "branch": "master", "commit": "69a22c2ec63ab375190006751562b62ebb318250" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, - "telescope.nvim": { "branch": "master", "commit": "2e1e382df42467029b493c143c2e727028140214" }, + "telescope.nvim": { "branch": "master", "commit": "e9e01d699843af530ef4ad2c8679a7e273bb3dd1" }, "trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" }, - "undotree": { "branch": "master", "commit": "9dbbf3b7d19dda0d22ceca461818e4739ad8154d" }, - "vim-fugitive": { "branch": "master", "commit": "2e88f14a585c014691904ba8fe39e6ea851c9422" }, + "undotree": { "branch": "master", "commit": "aa93a7e5890dbbebbc064cd22260721a6db1a196" }, + "vim-fugitive": { "branch": "master", "commit": "41beedabc7e948c787ea5696e04c3544c3674e23" }, "vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" } } \ No newline at end of file diff --git a/nvim/lua/themystery/plugins/codesnap.lua b/nvim/lua/themystery/plugins/codesnap.lua index c0b59a4..bd55198 100644 --- a/nvim/lua/themystery/plugins/codesnap.lua +++ b/nvim/lua/themystery/plugins/codesnap.lua @@ -1,13 +1,5 @@ return { "mistricky/codesnap.nvim", - -- config = function() - -- vim.keymap.set("n", "cs", "CodeSnapPreviewOn" - -- require("codesnap").setup({ - -- mac_window_bar = true, - -- opacity = true, - -- watermark = "TheMystery" - -- }) - -- end, config = function() vim.keymap.set("n", "csv", "CodeSnapPreviewOn") require("codesnap").setup({ diff --git a/nvim/lua/themystery/plugins/gitsigns.lua b/nvim/lua/themystery/plugins/gitsigns.lua new file mode 100644 index 0000000..fafec81 --- /dev/null +++ b/nvim/lua/themystery/plugins/gitsigns.lua @@ -0,0 +1,8 @@ +return { + "lewis6991/gitsigns.nvim", + config = function() + -- TODOS: Add keybindings + require("gitsigns").setup() + end +} + diff --git a/nvim/lua/themystery/plugins/init.lua b/nvim/lua/themystery/plugins/init.lua index 9c1de22..a22e68e 100644 --- a/nvim/lua/themystery/plugins/init.lua +++ b/nvim/lua/themystery/plugins/init.lua @@ -7,28 +7,16 @@ return { vim.api.nvim_set_keymap("i", "", 'copilot#Accept("")', { silent = true, expr = true }) end }, - { - "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" - }, { "mbbill/undotree", config = function() vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) end }, - { - "lewis6991/gitsigns.nvim", - opts = {} - }, - { - "windwp/nvim-ts-autotag", - event = "InsertEnter", - opts = {} - }, { "windwp/nvim-autopairs", event = "InsertEnter", - opts = {} + config = true }, { "kosayoda/nvim-lightbulb", @@ -55,7 +43,8 @@ return { }, { "ionide/Ionide-vim", - event = "VimEnter" + event = "VimEnter", + enabled = false }, { 'ggandor/leap.nvim', @@ -66,5 +55,4 @@ return { }, "SmiteshP/nvim-navic", "Decodetalkers/csharpls-extended-lsp.nvim", - "HiPhish/rainbow-delimiters.nvim" } diff --git a/nvim/lua/themystery/plugins/lsp.lua b/nvim/lua/themystery/plugins/lsp.lua index 679dd75..c64b377 100644 --- a/nvim/lua/themystery/plugins/lsp.lua +++ b/nvim/lua/themystery/plugins/lsp.lua @@ -1,194 +1,192 @@ return { - 'VonHeikemen/lsp-zero.nvim', - branch = 'v3.x', - dependencies = { - -- LSP Support - 'neovim/nvim-lspconfig', - 'williamboman/mason.nvim', - 'williamboman/mason-lspconfig.nvim', - - -- Autocompletion - 'hrsh7th/nvim-cmp', - 'hrsh7th/cmp-buffer', - 'hrsh7th/cmp-path', - 'saadparwaiz1/cmp_luasnip', - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-nvim-lua', - - -- Snippets - 'L3MON4D3/LuaSnip', - 'rafamadriz/friendly-snippets', - - -- extras - "SmiteshP/nvim-navic", - "Decodetalkers/csharpls-extended-lsp.nvim", - - -- rust - 'mrcjkb/rustaceanvim' + { + 'mrcjkb/rustaceanvim', + version = '^4', -- Recommended + ft = { 'rust' }, }, - config = function() - local lsp = require("lsp-zero") + { + 'VonHeikemen/lsp-zero.nvim', + branch = 'v3.x', + dependencies = { + -- LSP Support + 'neovim/nvim-lspconfig', + 'williamboman/mason.nvim', + 'williamboman/mason-lspconfig.nvim', - lsp.configure('csharp_ls', { - handlers = { - ["textDocument/definition"] = require("csharpls_extended").handler, - ["textDocument/typeDefinition"] = require("csharpls_extended").handler - } - }) + -- Autocompletion + 'hrsh7th/nvim-cmp', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + 'saadparwaiz1/cmp_luasnip', + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-nvim-lua', - lsp.configure('clangd', { - cmd = { 'clangd', '--offset-encoding=utf-16' }, - }) - -- this code makes it so that the css language server doesn't complain about tailwindcss classes - lsp.configure("cssls", { - settings = { - css = { - lint = { unknownAtRules = "ignore" } - }, - scss = { - lint = { unknownAtRules = "ignore" } - }, - less = { - lint = { unknownAtRules = "ignore" } + -- Snippets + 'L3MON4D3/LuaSnip', + 'rafamadriz/friendly-snippets', + + -- extras + "SmiteshP/nvim-navic", + "Decodetalkers/csharpls-extended-lsp.nvim", + + -- rust + 'mrcjkb/rustaceanvim' + }, + config = function() + local lsp = require("lsp-zero") + + lsp.configure('csharp_ls', { + handlers = { + ["textDocument/definition"] = require("csharpls_extended").handler, + ["textDocument/typeDefinition"] = require("csharpls_extended").handler } - } - }) - -- - -- lsp.configure("rust_analyzer", { - -- settings = { - -- ["rust-analyzer"] = { - -- checkOnSave = true, - -- check = { - -- command = "clippy" - -- } - -- } - -- } - -- }) + }) - lsp.set_server_config({ - capabilities = { - textDocument = { - foldingRange = { - dynamicRegistration = false, - lineFoldingOnly = true + lsp.configure('clangd', { + cmd = { 'clangd', '--offset-encoding=utf-16' }, + }) + -- this code makes it so that the css language server doesn't complain about tailwindcss classes + lsp.configure("cssls", { + settings = { + css = { + lint = { unknownAtRules = "ignore" } + }, + scss = { + lint = { unknownAtRules = "ignore" } + }, + less = { + lint = { unknownAtRules = "ignore" } } } - } - }) + }) + -- + -- lsp.configure("rust_analyzer", { + -- settings = { + -- ["rust-analyzer"] = { + -- checkOnSave = true, + -- check = { + -- command = "clippy" + -- } + -- } + -- } + -- }) - local cmp = require('cmp') - local cmp_action = lsp.cmp_action() - local cmp_format = lsp.cmp_format() - require('luasnip.loaders.from_vscode').lazy_load() + local cmp = require('cmp') + local cmp_action = lsp.cmp_action() + local cmp_format = lsp.cmp_format() - vim.opt.completeopt = { 'menu', 'menuone', 'noselect' } + require('luasnip.loaders.from_vscode').lazy_load() - cmp.setup({ - formatting = cmp_format, - preselect = 'item', - completion = { - completeopt = 'menu,menuone,noinsert' - }, - window = { - documentation = cmp.config.window.bordered(), - }, - sources = { - { name = 'path' }, - { name = 'nvim_lsp' }, - { name = 'nvim_lua' }, - { name = 'buffer', keyword_length = 3 }, - { name = 'luasnip', keyword_length = 2 }, - }, - mapping = cmp.mapping.preset.insert({ - -- confirm completion item - [''] = cmp.mapping.confirm({ select = false, behavior = cmp.ConfirmBehavior.Insert }), - [''] = cmp.mapping.confirm({ select = false, behavior = cmp.ConfirmBehavior.Replace }), + vim.opt.completeopt = { 'menu', 'menuone', 'noselect' } - -- toggle completion menu - [''] = cmp_action.toggle_completion(), + cmp.setup({ + formatting = cmp_format, + preselect = 'item', + completion = { + completeopt = 'menu,menuone,noinsert' + }, + window = { + documentation = cmp.config.window.bordered(), + }, + sources = { + { name = 'path' }, + { name = 'nvim_lsp' }, + { name = 'nvim_lua' }, + { name = 'buffer', keyword_length = 3 }, + { name = 'luasnip', keyword_length = 2 }, + }, + mapping = cmp.mapping.preset.insert({ + -- confirm completion item + [''] = cmp.mapping.confirm({ select = false, behavior = cmp.ConfirmBehavior.Insert }), + [''] = cmp.mapping.confirm({ select = false, behavior = cmp.ConfirmBehavior.Replace }), - -- tab complete - -- [''] = cmp_action.tab_complete(), - [''] = cmp.mapping.select_prev_item(), + -- toggle completion menu + [''] = cmp_action.toggle_completion(), - -- navigate between snippet placeholder - [''] = cmp_action.luasnip_jump_forward(), - [''] = cmp_action.luasnip_jump_backward(), + -- tab complete + -- [''] = cmp_action.tab_complete(), + [''] = cmp.mapping.select_prev_item(), - -- scroll documentation window - [''] = cmp.mapping.scroll_docs(5), - [''] = cmp.mapping.scroll_docs(-5), - }), - }) + -- navigate between snippet placeholder + [''] = cmp_action.luasnip_jump_forward(), + [''] = cmp_action.luasnip_jump_backward(), + + -- scroll documentation window + [''] = cmp.mapping.scroll_docs(5), + [''] = cmp.mapping.scroll_docs(-5), + }), + }) - local navic = require("nvim-navic") + local navic = require("nvim-navic") - lsp.on_attach(function(client, bufnr) - local opts = { buffer = bufnr, remap = false } - lsp.default_keymaps({ buffer = bufnr }) - if client.server_capabilities.documentSymbolProvider then - navic.attach(client, bufnr) - end - vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) - vim.keymap.set("n", "dc", function() vim.lsp.buf.hover() end, opts) - vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() end, opts) - vim.keymap.set("n", "ed", function() vim.diagnostic.open_float() end, opts) - vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) - vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) - -- for the code action key map to work you need to change key binding('.' symbol) of your terminal, otherwise it won't work - vim.keymap.set("n", "", function() vim.lsp.buf.code_action() end, opts) - vim.keymap.set("n", "vrr", function() vim.lsp.buf.references() end, opts) - vim.keymap.set("n", "vrn", function() vim.lsp.buf.rename() end, opts) - vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts) - -- sometimes lsp fails, we can restart it with this keymap - vim.keymap.set('n', "lr", vim.cmd.LspRestart, opts) - end) - - require("mason").setup({}); - require("mason-lspconfig").setup({ - ensure_installed = { 'tsserver', 'svelte', 'lua_ls', 'csharp_ls', 'rust_analyzer' }, - handlers = { - lsp.default_setup, - lua_ls = function() - local lua_opts = lsp.nvim_lua_ls() - require('lspconfig').lua_ls.setup(lua_opts) - end, - rust_analyzer = lsp.noop, - } - }) - - - lsp.set_sign_icons({ - error = '✘', - warn = '▲', - hint = '⚑', - info = '' - }) - - vim.diagnostic.config({ - virtual_text = false, - severity_sort = true, - float = { - style = 'minimal', - border = 'rounded', - source = 'always', - header = '', - prefix = '', - }, - }) - - vim.g.rustaceanvim = { - server = { - capabilities = lsp.get_capabilities(), - on_attach = function() - local bufnr = vim.api.nvim_get_current_buf() - vim.keymap.set("n", "", function() vim.cmd.RustLsp('codeAction') end, {silent = true, buffer = bufnr, remap = true}) + lsp.on_attach(function(client, bufnr) + local opts = { buffer = bufnr, remap = false } + lsp.default_keymaps({ buffer = bufnr }) + if client.server_capabilities.documentSymbolProvider then + navic.attach(client, bufnr) end - }, + vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) + vim.keymap.set("n", "dc", function() vim.lsp.buf.hover() end, opts) + vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() end, opts) + vim.keymap.set("n", "ed", function() vim.diagnostic.open_float() end, opts) + vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) + vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) + -- for the code action key map to work you need to change key binding('.' symbol) of your terminal, otherwise it won't work + vim.keymap.set("n", "", function() vim.lsp.buf.code_action() end, opts) + vim.keymap.set("n", "vrr", function() vim.lsp.buf.references() end, opts) + vim.keymap.set("n", "vrn", function() vim.lsp.buf.rename() end, opts) + vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts) + -- sometimes lsp fails, we can restart it with this keymap + vim.keymap.set('n', "lr", vim.cmd.LspRestart, opts) + end) - } - end + require("mason").setup({}); + require("mason-lspconfig").setup({ + ensure_installed = { 'tsserver', 'svelte', 'lua_ls', 'csharp_ls' }, + handlers = { + lsp.default_setup, + lua_ls = function() + local lua_opts = lsp.nvim_lua_ls() + require('lspconfig').lua_ls.setup(lua_opts) + end, + rust_analyzer = lsp.noop, + } + }) + + + lsp.set_sign_icons({ + error = '✘', + warn = '▲', + hint = '⚑', + info = '' + }) + + vim.diagnostic.config({ + virtual_text = false, + severity_sort = true, + float = { + style = 'minimal', + border = 'rounded', + source = 'always', + header = '', + prefix = '', + }, + }) + + vim.g.rustaceanvim = { + server = { + -- capabilities = lsp.get_capabilities(), + on_attach = function() + local bufnr = vim.api.nvim_get_current_buf() + vim.keymap.set("n", "", function() vim.cmd.RustLsp('codeAction') end, + { silent = true, buffer = bufnr, remap = true }) + end + }, + + } + end + } } diff --git a/nvim/lua/themystery/plugins/rustaceanvim.lua b/nvim/lua/themystery/plugins/rustaceanvim.lua deleted file mode 100644 index bf412af..0000000 --- a/nvim/lua/themystery/plugins/rustaceanvim.lua +++ /dev/null @@ -1,5 +0,0 @@ -return { - 'mrcjkb/rustaceanvim', - version = '^4', -- Recommended - ft = { 'rust' }, -} diff --git a/nvim/lua/themystery/plugins/treesitter.lua b/nvim/lua/themystery/plugins/treesitter.lua index 2942db8..ca68380 100644 --- a/nvim/lua/themystery/plugins/treesitter.lua +++ b/nvim/lua/themystery/plugins/treesitter.lua @@ -1,7 +1,11 @@ return { { "nvim-treesitter/nvim-treesitter", - dependencies = { "HiPhish/rainbow-delimiters.nvim" }, + build = ":TSUpdate", + dependencies = { + "HiPhish/rainbow-delimiters.nvim", + "windwp/nvim-ts-autotag" + }, config = function() require 'nvim-treesitter.configs'.setup { -- A list of parser names, or "all" @@ -29,6 +33,11 @@ return { } } require('rainbow-delimiters.setup').setup() + vim.filetype.add { + pattern = { + ['.*/hypr/.*%.conf'] = 'hyprlang' + } + } end }, "nvim-treesitter/nvim-treesitter-context" diff --git a/nvim/lua/themystery/plugins/ufo.lua b/nvim/lua/themystery/plugins/ufo.lua index ad17817..81dc7e9 100644 --- a/nvim/lua/themystery/plugins/ufo.lua +++ b/nvim/lua/themystery/plugins/ufo.lua @@ -1,7 +1,8 @@ return { "kevinhwang91/nvim-ufo", dependencies = { - "kevinhwang91/promise-async" + "kevinhwang91/promise-async", + 'VonHeikemen/lsp-zero.nvim' }, config = function() vim.o.foldcolumn = '1' -- '0' is not bad @@ -15,5 +16,18 @@ return { vim.keymap.set('n', 'zM', require('ufo').closeAllFolds) vim.keymap.set('n', 'zr', require('ufo').openFoldsExceptKinds) vim.keymap.set('n', 'zm', require('ufo').closeFoldsWith) -- closeAllFolds == closeFoldsWith(0) + + local lsp = require('lsp-zero') + + lsp.set_server_config({ + capabilities = { + textDocument = { + foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true + } + } + } + }) end }