From d4a1d0622c29712eb7bcd08db84ae5e1e3e9beba Mon Sep 17 00:00:00 2001 From: tiyn Date: Sat, 12 Oct 2024 19:21:05 +0200 Subject: [PATCH] nvim: updated plugins, improved keymaps --- .config/nvim/lazy-lock.json | 84 +++--- .config/nvim/lua/keymap.lua | 302 +++++++------------- .config/nvim/lua/plugins/mapx.lua | 9 - .config/nvim/lua/plugins/nvim-lspconfig.lua | 2 +- .config/nvim/lua/plugins/which-key.lua | 6 + 5 files changed, 155 insertions(+), 248 deletions(-) delete mode 100644 .config/nvim/lua/plugins/mapx.lua create mode 100644 .config/nvim/lua/plugins/which-key.lua diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 8042807..770a519 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -2,69 +2,69 @@ "action-hints.nvim": { "branch": "main", "commit": "ab10fef255dd4bc933c92d8f9969828f2f856e71" }, "barbecue": { "branch": "main", "commit": "cd7e7da622d68136e13721865b4d919efd6325ed" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-under-comparator": { "branch": "master", "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, - "comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, - "conform.nvim": { "branch": "master", "commit": "393210360b9e807862e5329763526509f52b5218" }, + "comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "conform.nvim": { "branch": "master", "commit": "40d4e98fcc3e6f485f0e8924c63734bc7e305967" }, "cpsm": { "branch": "master", "commit": "1a5fc1b6169bb80c29b0b986130c4f3f1a9ed82e" }, - "diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "fterm.nvim": { "branch": "master", "commit": "d1320892cc2ebab472935242d9d992a2c9570180" }, "fzy-lua-native": { "branch": "master", "commit": "820f745b7c442176bcc243e8f38ef4b985febfaf" }, - "git-blame.nvim": { "branch": "master", "commit": "ad1d1365c9189d89797fe8d559677d5f55dc2830" }, - "gitsigns.nvim": { "branch": "main", "commit": "805610a9393fa231f2c2b49cb521bfa413fadb3d" }, - "goto-preview": { "branch": "main", "commit": "3552fad4a0244ffd9ac86508e29ccc5166f19eb8" }, - "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" }, - "knap": { "branch": "main", "commit": "d4ea571d2d4e139d288b758c5bab31788d30eea3" }, - "lazy.nvim": { "branch": "main", "commit": "d3974346b6cef2116c8e7b08423256a834cb7cbc" }, - "leap.nvim": { "branch": "main", "commit": "f1f19fc268b406b00b50091f51f16d9634fbe449" }, - "lsp_signature.nvim": { "branch": "master", "commit": "c6aeb2f1d2538bbdfdaab1664d9d4c3c75aa9db8" }, - "lspkind-nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, - "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, - "luasnip": { "branch": "master", "commit": "b152822e1a4bafb6bdf11a16cc26525cbd95ee00" }, + "git-blame.nvim": { "branch": "master", "commit": "2883a7460f611c2705b23f12d58d398d5ce6ec00" }, + "gitsigns.nvim": { "branch": "main", "commit": "863903631e676b33e8be2acb17512fdc1b80b4fb" }, + "goto-preview": { "branch": "main", "commit": "1519ea3512828c944eed5b2bbb66a8f8deb92447" }, + "indent-blankline.nvim": { "branch": "master", "commit": "e7a4442e055ec953311e77791546238d1eaae507" }, + "knap": { "branch": "main", "commit": "0040760bb504a713ea5988c7c490a15faf477c57" }, + "lazy.nvim": { "branch": "main", "commit": "1159bdccd8910a0fd0914b24d6c3d186689023d9" }, + "leap.nvim": { "branch": "main", "commit": "c6bfb191f1161fbabace1f36f578a20ac6c7642c" }, + "lsp_signature.nvim": { "branch": "master", "commit": "fc38521ea4d9ec8dbd4c2819ba8126cea743943b" }, + "lspkind-nvim": { "branch": "master", "commit": "59c3f419af48a2ffb2320cea85e44e5a95f71664" }, + "lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, + "luasnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" }, "mapx.nvim": { "branch": "main", "commit": "c3dd43474a5fc2f266309bc04a69b74eb2524671" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "05744f0f1967b5757bd05c08df4271ab8ec990aa" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" }, "mason-null-ls.nvim": { "branch": "main", "commit": "de19726de7260c68d94691afb057fa73d3cc53e7" }, - "mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" }, - "modes.nvim": { "branch": "main", "commit": "4035a46aaabe43faf1b54740575af9dd5bb03809" }, - "none-ls.nvim": { "branch": "main", "commit": "f5632db2491fbe02b54f1a321a98548a8ba2bd15" }, - "nvim-autopairs": { "branch": "master", "commit": "14e97371b2aab6ee70054c1070a123dfaa3e217e" }, - "nvim-cmp": { "branch": "main", "commit": "8f3c541407e691af6163e2447f3af1bd6e17f9a3" }, - "nvim-colorizer.lua": { "branch": "master", "commit": "0b3950aed7bc35b78200bc292156aa77d2a4d342" }, - "nvim-docs-view": { "branch": "master", "commit": "78d88bca16f32a430572758677f9246f6d7f7b94" }, - "nvim-hlslens": { "branch": "main", "commit": "3e8fceb2b030100857ee72741a8f48c9a1d8595e" }, - "nvim-lspconfig": { "branch": "master", "commit": "97762065bf7e1ac617d0a8710eb7ec2d656287a9" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "modes.nvim": { "branch": "main", "commit": "326cff3282419b3bcc745061978c1e592cae055d" }, + "none-ls.nvim": { "branch": "main", "commit": "6bdd9b3364e12ffb346ac224db3df37de0b1429b" }, + "nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" }, + "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "6ed09146ee637006367b5e225be6208a1ea02579" }, + "nvim-docs-view": { "branch": "master", "commit": "365593534e0acd762bfddce6e8313315ffa4fa36" }, + "nvim-hlslens": { "branch": "main", "commit": "07afd4dd14405ad14b142a501a3abea6ae44b21b" }, + "nvim-lspconfig": { "branch": "master", "commit": "d141895d1d9f41048fff201d62a2d6e96d299e32" }, "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, - "nvim-scrollbar": { "branch": "main", "commit": "35f99d559041c7c0eff3a41f9093581ceea534e8" }, - "nvim-surround": { "branch": "main", "commit": "6d0dc3dbb557bcc6a024969da461df4ba803fc48" }, - "nvim-tree.lua": { "branch": "master", "commit": "64f61e4c913047a045ff90bd188dd3b54ee443cf" }, - "nvim-treesitter": { "branch": "master", "commit": "268611e3ece8463bfb5b09044dcd1b76a28ffbb6" }, - "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" }, + "nvim-scrollbar": { "branch": "main", "commit": "d09f14aa16c9f2748e77008f9da7b1f76e4e7b85" }, + "nvim-surround": { "branch": "main", "commit": "ec2dc7671067e0086cdf29c2f5df2dd909d5f71f" }, + "nvim-tree.lua": { "branch": "master", "commit": "1c9553a19f70df3dcb171546a3d5e034531ef093" }, + "nvim-treesitter": { "branch": "master", "commit": "5a2ff8b7ca5470b1011ed82ef3fdd53139ffc467" }, + "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, "nvim-ts-rainbow": { "branch": "master", "commit": "ef95c15a935f97c65a80e48e12fe72d49aacf9b9" }, - "nvim-ufo": { "branch": "main", "commit": "a5390706f510d39951dd581f6d2a972741b3fa26" }, - "nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" }, + "nvim-ufo": { "branch": "main", "commit": "203c9f434feec57909ab4b1e028abeb3349b7847" }, + "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, "nvim-yarp": { "branch": "master", "commit": "bb5f5e038bfe119d3b777845a76b0b919b35ebc8" }, - "plenary.nvim": { "branch": "master", "commit": "08e301982b9a057110ede7a735dd1b5285eb341f" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, "popup-menu.nvim": { "branch": "master", "commit": "b618bd0c824a20417d845fa0022327228e6988a2" }, "projections.nvim": { "branch": "pre_release", "commit": "889914169fa1f5c00fb8659653b5a8330fb223e6" }, - "promise-async": { "branch": "main", "commit": "93540c168c5ed2b030ec3e6c40ab8bbb85e36355" }, + "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, "renamer.nvim": { "branch": "master", "commit": "1614d466df53899f11dd5395eaac3c09a275c384" }, "spelunker.vim": { "branch": "master", "commit": "a0bc530f62798bbe053905555a4aa9ed713485eb" }, "symbols-outline.nvim": { "branch": "master", "commit": "564ee65dfc9024bdde73a6621820866987cbb256" }, - "tabular": { "branch": "master", "commit": "339091ac4dd1f17e225fe7d57b48aff55f99b23a" }, + "tabular": { "branch": "master", "commit": "12437cd1b53488e24936ec4b091c9324cafee311" }, "tccs.nvim": { "branch": "master", "commit": "e50c1504286b5ee2700961a600f26c9b338bd042" }, "telescope.nvim": { "branch": "master", "commit": "776b509f80dd49d8205b9b0d94485568236d1192" }, "tidy.nvim": { "branch": "main", "commit": "58fcc63de53840fa78946e4161e8883e67213f92" }, - "todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" }, - "trouble.nvim": { "branch": "main", "commit": "b9cf677f20bb2faa2dacfa870b084e568dca9572" }, - "undotree": { "branch": "master", "commit": "56c684a805fe948936cda0d1b19505b84ad7e065" }, + "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" }, + "trouble.nvim": { "branch": "main", "commit": "254145ffd528b98eb20be894338e2d5c93fa02c2" }, + "undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" }, "vim-abolish": { "branch": "master", "commit": "dcbfe065297d31823561ba787f51056c147aa682" }, "vim-hug-neovim-rpc": { "branch": "master", "commit": "93ae38792bc197c3bdffa2716ae493c67a5e7957" }, - "vim-illuminate": { "branch": "master", "commit": "e522e0dd742a83506db0a72e1ced68c9c130f185" }, - "vim-markdown": { "branch": "master", "commit": "a657e697376909c41475a686eeef7fc7a4972d94" }, + "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, + "vim-markdown": { "branch": "master", "commit": "8f6cb3a6ca4e3b6bcda0730145a0b700f3481b51" }, "vim-renamer": { "branch": "master", "commit": "9c6346eb4556cf2d8ca55de6969247ab14fe2383" }, - "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }, + "which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" }, "wilder.nvim": { "branch": "master", "commit": "679f348dc90d80ff9ba0e7c470c40a4d038dcecf" }, "winshift.nvim": { "branch": "main", "commit": "37468ed6f385dfb50402368669766504c0e15583" } -} \ No newline at end of file +} diff --git a/.config/nvim/lua/keymap.lua b/.config/nvim/lua/keymap.lua index d39fdab..cd0808b 100644 --- a/.config/nvim/lua/keymap.lua +++ b/.config/nvim/lua/keymap.lua @@ -1,198 +1,108 @@ -- setup keymap function -local m = require("mapx").setup({ global = true, whichkey = true }) - --- setup keymap groups -m.nname("g", "LSP: goto") -m.nname("gp", "LSP: preview") -m.cname("w", "Write") -m.cname("w!", "Write: overwrite") -m.nname("g", "Git") -m.nname("f", "Telescope: find ...") -m.nname("gd", "Git: diff") -m.nname("s", "Substitute") -m.nname("t", "Terminal") -m.nname("", "Navigation") - --- unmap unwanted commands -m.nnoremap("Zt", "") -m.nnoremap("ZT", "") -m.nnoremap("", "") -m.inoremap("", "") -m.inoremap("", "") -m.inoremap("", "") -m.inoremap("", "") -m.inoremap("", "") -m.inoremap("", "") -m.inoremap("", "") -m.nnoremap("", "") -m.inoremap("", "") -m.nnoremap("", "") -m.inoremap("", "") -m.nnoremap("", "") -m.inoremap("", "") -m.nnoremap("", "") - --- spell -m.nmap("s", "z=", "Spell: display suggestions") - --- shortcuts for quitting -m.nnoremap("ZA", ":xa", "Exit: write and quit all buffers") -m.nnoremap("ZQ", ":conf q", "Exit: quit current buffer") -m.nnoremap("ZZ", ":x", "Exit: write and quit current buffer") - --- shortcut for split navigation -m.nnoremap("", "h", "Navigation: go to left window") -m.nnoremap("", "j", "Navigation: go to lower window") -m.nnoremap("", "k", "Navigation: go to upper window") -m.nnoremap("", "l", "Navigation: go to right window") - --- remap for dealing with word wrap -m.nmap( - "j", - "v:count == 0 ? 'gj' : 'j'", - { "expr", "silent" }, - "Navigation: go down in wrapped lines" -) -m.nmap("k", "v:count == 0 ? 'gk' : 'k'", { "expr", "silent" }, "Navigation: go up in wrapped lines") - --- compiler for languages -m.nnoremap("c", ":w! | !compiler %", "Compile: current file") - --- save file as sudo on files that require root permission -m.cnoremap( - "w!!", - 'execute "silent! write !sudo tee % >/dev/null" edit!', - "Write: overwrite file over with sudo" -) - --- tpope/vim-abolish -m.nnoremap("sa", ":%S//g", "Substitute: free form") -m.nnoremap("ss", ":%S/\\<\\>//g", "Substitute: word under cursor") - --- simrat39/symbols-outline.nvim -m.nmap("", ":SymbolsOutline", "CTags: toggle") - --- nvim-tree/nvim-tree.lua -m.nmap("", ":NvimTreeToggle toggle", "File tree: toggle") - --- mbbill/undotree -m.nmap("", ":UndotreeToggle", "Undo tree: toggle") - --- amrbashir/nvim-docs-view -m.nnoremap("go", ":DocsViewToggle", "LSP: toggle documentation window") - --- numtostr/fterm.nvim -m.nnoremap("tt", require("FTerm").toggle, "Terminal: open") -m.tnoremap("tt", require("FTerm").toggle, "Terminal: open") -local lazygit = require("FTerm"):new({ - cmd = "lazygit", +local wk = require("which-key") +local lazygit = require("FTerm"):new({ cmd = "lazygit" }) + +wk.add({ + -- setup keymap groups + {mode = "n", "g", desc = "LSP: goto"}, + {mode = "n", "gp", desc = "LSP: preview"}, + {mode = "c", "w", desc = "Write"}, + {mode = "c", "w!", desc = "Write: overwrite"}, + {mode = "n", "g", desc = "Git"}, + {mode = "n", "f", desc = "Telescope: find"}, + {mode = "n", "gd", desc = "Git: diff"}, + {mode = "n", "s", desc = "Substitute"}, + {mode = "n", "t", desc = "Terminal"}, + {mode = "n", "", desc = "Navigation"}, + -- unmap unwanted commands + {mode = "n", "Zt", "", noremap = true}, + {mode = "n", "ZT", "", noremap = true}, + {mode = "n", "", "", noremap = true}, + {mode = "n", "", "", noremap = true}, + {mode = "n", "", "", noremap = true}, + {mode = "n", "", "", noremap = true}, + {mode = "n", "", "", noremap = true}, + {mode = "n", "", "", noremap = true}, + {mode = "n", "", "", noremap = true}, + {mode = "n", "", "", noremap = true}, + {mode = "n", "", "", noremap = true}, + {mode = "n", "", "", noremap = true}, + {mode = "n", "", "", noremap = true}, + {mode = "n", "", "", noremap = true}, + {mode = "n", "", "", noremap = true}, + {mode = "n", "", "", noremap = true}, + {mode = "n", "", "", noremap = true}, + -- spell + {mode = "n", "s", "z=", desc = "Spell: display suggestions"}, + -- shortcuts for quitting + {mode = "n", "ZA", ":xa", desc = "Exit: write and quit all buffers", noremap = true}, + {mode = "n", "ZQ", ":conf q", desc = "Exit: quit current buffer", noremap = true}, + {mode = "n", "ZZ", ":x", desc = "Exit: write and quit current buffer", noremap = true}, + -- shortcut for split navigation + {mode = "n", "", "h", desc = "Navigation: go to left window", noremap = true}, + {mode = "n", "", "j", desc = "Navigation: go to lower window", noremap = true}, + {mode = "n", "", "k", desc = "Navigation: go to upper window", noremap = true}, + {mode = "n", "", "l", desc = "Navigation: go to right window", noremap = true}, + -- remap for dealing with word wrap + {mode = "n", "j", "gj", desc = "Navigation: go down in wrapped lines", silent = true}, + {mode = "n", "k", "gk", desc = "Navigation: go up in wrapped lines", silent = true}, + -- compiler for languages + {mode = "n", "c", ":w! | !compiler %", desc = "Compile: current file", noremap = true}, + {mode = "n", "w!!", 'execute "silent! write !sudo tee % >/dev/null" edit!', desc = "Write: overwrite file over with sudo", noremap = true}, + -- tpope/vim-abolish + {mode = "n", "sa", ":%S//g", desc = "Substitute: free form", noremap = true}, + {mode = "n", "ss", ":%S/\\<\\>//g", desc = "Substitute: word under cursor", noremap = true}, + -- simrat39/symbols-outline.nvim + {mode = "n", "", ":SymbolsOutline", desc = "CTags: toggle"}, + -- nvim-tree/nvim-tree.lua + {mode = "n", "", ":NvimTreeToggle toggle", desc = "File tree: toggle"}, + -- mbbill/undotree + {mode = "n", "", ":UndotreeToggle", desc = "Undo tree: toggle"}, + -- amrbashir/nvim-docs-view + {mode = "n", "go", ":DocsViewToggle", desc = "LSP: toggle documentation window", noremap = true}, + -- numtostr/fterm.nvim + {mode = "n", "tt", require("FTerm").toggle, desc = "Terminal: open", noremap = true}, + {mode = "n", "gt", function() lazygit:toggle() end, desc = "Git: open lazygit", noremap = true}, + {mode = "n", "tg", function() lazygit:toggle() end, desc = "Terminal: open lazygit", noremap = true}, + {mode = "n", "tg", function() lazygit:toggle() end, desc = "Terminal: open lazygit", noremap = true}, + -- sindrets/diffview.nvim + {mode = "n", "gdo", ":DiffviewOpen", desc = "Git: open diff"}, + {mode = "n", "gdc", ":DiffviewClose", desc = "Git: close diff"}, + -- folke/trouble.nvim + {mode = "n", "x", ":TroubleToggle", desc = "LSP: toggle error list"}, + -- hrsh7th/nvim-cmp + {mode = "n", "gd", vim.lsp.buf.definition(), desc = "LSP: goto definition", noremap = true}, + {mode = "n", "gD", vim.lsp.buf.declaration(), desc = "LSP: goto declaration", noremap = true}, + {mode = "n", "gi", vim.lsp.buf.implementation(), desc = "LSP: list implementation", noremap = true}, + {mode = "n", "gr", function() vim.lsp.buf.references() end, desc = "LSP: list references", noremap = true}, + {mode = "n", "K", vim.lsp.buf.hover(), desc = "LSP: show documentation", noremap = true}, + {mode = "n", "", function() require("conform").format({ async = true, lsp_fallback = true }) end, desc = "LSP: format", noremap = true}, + -- rmagatti/goto-preview + {mode = "n", "gpd", function() require("goto-preview").goto_preview_definition() end, desc = "LSP: preview definition", noremap = true}, + {mode = "n", "gpy", function() require("goto-preview").goto_preview_type_definition() end, desc = "LSP: preview type definition", noremap = true}, + {mode = "n", "gpi", function() require("goto-preview").goto_preview_implementation() end, desc = "LSP: list preview implementation", noremap = true}, + {mode = "n", "gpD", function() require("goto-preview").goto_preview_declaration() end, desc = "LSP: preview declaration", noremap = true}, + {mode = "n", "gpr", function() require("goto-preview").goto_preview_references() end, desc = "LSP: list preview references", noremap = true}, + {mode = "n", "gpc", function() require("goto-preview").close_all_win() end, desc = "LSP: close all preview windows", noremap = true}, + -- filipdutescu/renamer.nvim + {mode = "n", "", function() require("renamer").rename() end, desc = "LSP: rename", noremap = true}, + -- nvim-telescope/telescope.nvim + {mode = "n", "", ":Telescope find_files", desc = "Telescope: find files", noremap = true}, + {mode = "n", "ff", ":Telescope find_files", desc = "Telescope: find files", noremap = true}, + -- kamykn/spelunker.vim + {mode = "n", "t", ":call spelunker#toggle()", desc = "Spelunker: toggle spell check", noremap = true}, + {mode = "n", "l", function() if vim.opt.spelllang._value == "de_de" then vim.opt.spelllang = "en_us" print("Spell language set to en_us") else vim.opt.spelllang = "de_de" print("Spell language set to de_de") end vim.opt.spell = false end, desc = "Spell: toggle spell language", noremap = true}, + -- kevinhwang91/nvim-ufo + {mode = "n", "K", function() local winid = require("ufo").peekFoldedLinesUnderCursor() if not winid then vim.lsp.buf.hover() end end, desc = "LSP: peek folded section", noremap = true}, + -- kevinhwang91/nvim-hlslens + {mode = "n", "n", [[execute('normal! ' . v:count1 . 'n')lua require('hlslens').start()]], desc = "Search: search forward", noremap = true, silent = true}, + {mode = "n", "N", [[execute('normal! ' . v:count1 . 'N')lua require('hlslens').start()]], desc = "Search: search backwards", noremap = true, silent = true}, + -- sindrets/winshift.nvim + {mode = "n", "m", ":WinShift", desc = "Navigation: enter window shift mode", noremap = true}, + -- ggandor/leap.nvim + {mode = "n", "f", "(leap-forward)", desc = "Navigation: enter leap mode for forward movement", noremap = true}, + {mode = "n", "F", "(leap-backward)", desc = "Navigation: enter leap mode for backwards movement", noremap = true}, + {mode = "n", "gf", "(leap-from-window)", desc = "Navigation: enter leap mode for other windows", noremap = true}, + -- gnikdroy/projections.nvim + {mode = "n", "fp", function() vim.cmd("Telescope projections") end, desc = "Telescope: find projects", noremap = true}, }) -m.nnoremap("gt", function() - lazygit:toggle() -end, "Git: open lazygit") -m.tnoremap("gt", function() - lazygit:toggle() -end, "Git: open lazygit") -m.nnoremap("tg", function() - lazygit:toggle() -end, "Terminal: open lazygit") -m.tnoremap("tg", function() - lazygit:toggle() -end, "Terminal: open lazygit") - --- sindrets/diffview.nvim -m.nmap("gdo", ":DiffviewOpen", "Git: open diff") -m.nmap("gdc", ":DiffviewClose", "Git: close diff") - --- folke/trouble.nvim -m.nmap("x", ":TroubleToggle", "LSP: toggle error list") - --- hrsh7th/nvim-cmp -m.nnoremap("gd", vim.lsp.buf.definition(), "LSP: goto definition") -m.nnoremap("gD", vim.lsp.buf.declaration(), "LSP: goto declaration") -m.nnoremap("gi", vim.lsp.buf.implementation(), "LSP: list implementation") -m.nnoremap("gr", function() - vim.lsp.buf.references() -end, "LSP: list references") -m.nnoremap("gy", vim.lsp.buf.type_definition(), "LSP: goto type definition") -m.nnoremap("K", vim.lsp.buf.hover(), "LSP: show documentation") -m.nnoremap("", function() - require("conform").format({ async = true, lsp_fallback = true }) -end, "LSP: format") - --- rmagatti/goto-preview -m.nnoremap("gpd", function() - require("goto-preview").goto_preview_definition() -end, "LSP: preview definition") -m.nnoremap("gpy", function() - require("goto-preview").goto_preview_type_definition() -end, "LSP: preview type definition") -m.nnoremap("gpi", function() - require("goto-preview").goto_preview_implementation() -end, "LSP: list preview implementation") -m.nnoremap("gpD", function() - require("goto-preview").goto_preview_declaration() -end, "LSP: preview declaration") -m.nnoremap("gpr", function() - require("goto-preview").goto_preview_references() -end, "LSP: list preview references") -m.nnoremap("gpc", function() - require("goto-preview").close_all_win() -end, "LSP: close all preview windows") - --- filipdutescu/renamer.nvim -m.nnoremap("", function() - require("renamer").rename() -end, "LSP: rename") - --- nvim-telescope/telescope.nvim -m.nnoremap("", ":Telescope find_files", "Telescope: find files") -m.nnoremap("ff", ":Telescope find_files", "Telescope: find files") - --- kamykn/spelunker.vim -m.nnoremap("t", ":call spelunker#toggle()", "Spelunker: toggle spell check") -m.nnoremap("l", function() - if vim.opt.spelllang._value == "de_de" then - vim.opt.spelllang = "en_us" - print("Spell language set to en_us") - else - vim.opt.spelllang = "de_de" - print("Spell language set to de_de") - end - vim.opt.spell = false -end, "Spell: toggle spell language") - --- kevinhwang91/nvim-ufo -m.nnoremap("K", function() - local winid = require("ufo").peekFoldedLinesUnderCursor() - if not winid then - vim.lsp.buf.hover() - end -end, "LSP: peek folded section") - --- kevinhwang91/nvim-hlslens -m.nnoremap( - "n", - [[execute('normal! ' . v:count1 . 'n')lua require('hlslens').start()]], - "silent", - "Search: search forward" -) -m.nnoremap( - "N", - [[execute('normal! ' . v:count1 . 'N')lua require('hlslens').start()]], - "silent", - "Search: search backwards" -) - --- sindrets/winshift.nvim -m.nnoremap("m", ":WinShift", "Navigation: enter window shift mode") - --- ggandor/leap.nvim -m.nnoremap("f", "(leap-forward)", "Navigation: enter leap mode for forward movement") -m.nnoremap("F", "(leap-backward)", "Navigation: enter leap mode for backwards movement") -m.nnoremap("gf", "(leap-from-window)", "Navigation: enter leap mode for other windows") - --- gnikdroy/projections.nvim -m.nnoremap("fp", function() - vim.cmd("Telescope projections") -end, "Telescope: find projects") diff --git a/.config/nvim/lua/plugins/mapx.lua b/.config/nvim/lua/plugins/mapx.lua deleted file mode 100644 index 6ebc2c9..0000000 --- a/.config/nvim/lua/plugins/mapx.lua +++ /dev/null @@ -1,9 +0,0 @@ -return { - -- improved keybindings, previewing them - { - "b0o/mapx.nvim", - dependencies = { - "folke/which-key.nvim", - } - } - } diff --git a/.config/nvim/lua/plugins/nvim-lspconfig.lua b/.config/nvim/lua/plugins/nvim-lspconfig.lua index d98317d..d4d07af 100644 --- a/.config/nvim/lua/plugins/nvim-lspconfig.lua +++ b/.config/nvim/lua/plugins/nvim-lspconfig.lua @@ -34,7 +34,7 @@ return { "r_language_server", "sqlls", "texlab", - "tsserver", + -- "tsserver", "yamlls", } }) diff --git a/.config/nvim/lua/plugins/which-key.lua b/.config/nvim/lua/plugins/which-key.lua new file mode 100644 index 0000000..1e5815b --- /dev/null +++ b/.config/nvim/lua/plugins/which-key.lua @@ -0,0 +1,6 @@ +return { + -- improved keybindings, previewing them + { + "folke/which-key.nvim", + } + }