diff --git a/environment.d/envvars.conf b/environment.d/envvars.conf index bb42f2f..d469d1c 100644 --- a/environment.d/envvars.conf +++ b/environment.d/envvars.conf @@ -14,3 +14,10 @@ TEXMFHOME=$HOME/.texmf PATH=/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:$HOME/.local/bin:$HOME/.cargo/bin:$PATH EDITOR=nv SUDO_EDITOR=nv + +# ......... +POSTGRES_HOST="localhost" +POSTGRES_PORT="5432" +POSTGRES_USER="gokard" +POSTGRES_PASSWORD="brokard" +POSTGRES_DATABASE="gokard" diff --git a/fish/config.fish b/fish/config.fish index ea8abd3..3e4d161 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -25,6 +25,7 @@ alias s="kitty +kitten ssh" alias zl='z "" ' alias jo='joshuto' alias nv='neovide --novsync --nofork' +alias cr='cargo run' # pwd based on the value of _ZO_RESOLVE_SYMLINKS. function __zoxide_pwd diff --git a/hypr_desktop/hyprland.conf b/hypr_desktop/hyprland.conf index ca0786c..4de4312 100644 --- a/hypr_desktop/hyprland.conf +++ b/hypr_desktop/hyprland.conf @@ -45,6 +45,7 @@ general { col.inactive_border=0x66333333 apply_sens_to_raw=0 # whether to apply the sensitivity to raw input (e.g. used by games where you aim using your mouse) + # layout=hy3 } @@ -68,6 +69,7 @@ animations { dwindle { preserve_split=true pseudotile=0 # enable pseudotiling on dwindle + permanent_direction_override=false } gestures { @@ -82,6 +84,7 @@ misc { animate_mouse_windowdragging=0 enable_swallow=true swallow_regex=^(.*)(kitty)(.*)$ + # swallow_exception_regex = ^(?:(?:^|\s)([a-zA-Z0-9]+\b)+(?:$|[^\w\s]))$ } @@ -186,6 +189,12 @@ bind=SUPERSHIFTALT,8,movetoworkspacesilent,8 bind=SUPERSHIFTALT,9,movetoworkspacesilent,9 bind=SUPERSHIFTALT,0,movetoworkspacesilent,10 +bind=SUPERALT,j,layoutmsg,preselect l +bind=SUPERALT,k,layoutmsg,preselect d +bind=SUPERALT,l,layoutmsg,preselect u +bind=SUPERALT,semicolon,layoutmsg,preselect r +bind=SUPERALT,h,layoutmsg,preselect n + bindm=SUPER,mouse:272,movewindow bindm=SUPER,mouse:273,resizewindow @@ -212,3 +221,4 @@ exec-once=firefox exec-once=streamdeck -n exec-once=copyq --start-server exec-once=/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 +# plugin=/home/dashie/gits/hy3/build/libhy3.so diff --git a/nvim/ftdetect/cl.lua b/nvim/ftdetect/cl.lua new file mode 100644 index 0000000..34ed312 --- /dev/null +++ b/nvim/ftdetect/cl.lua @@ -0,0 +1 @@ +vim.cmd [[ autocmd BufRead,BufNewFile *.cl set filetype=cl ]] diff --git a/nvim/ftplugin/rust.lua b/nvim/ftplugin/rust.lua index bcda183..de81005 100644 --- a/nvim/ftplugin/rust.lua +++ b/nvim/ftplugin/rust.lua @@ -3,10 +3,6 @@ local rt = require("rust-tools") rt.setup({ server = { on_attach = function(_, bufnr) - -- Hover actions - vim.keymap.set("n", "", rt.hover_actions.hover_actions, { buffer = bufnr }) - -- Code action groups - vim.keymap.set("n", "a", rt.code_action_group.code_action_group, { buffer = bufnr }) end, }, }) diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index cbab5df..f607fd6 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,72 +1,72 @@ { - "LazyVim": { "branch": "main", "commit": "5202a0f006b817d79dbfd07d93bd297fca5f48b4" }, - "LuaSnip": { "branch": "master", "commit": "e77fa9ad0b1f4fc6cddf54e51047e17e90c7d7ed" }, - "alpha-nvim": { "branch": "main", "commit": "87c204040e3f5d4c1c95067b35905d8f8a2f2545" }, - "bufferline.nvim": { "branch": "main", "commit": "a4bd44523316928a7c4a5c09a3407d02c30b6027" }, - "catppuccin": { "branch": "main", "commit": "dd176757cc745f71bd54c472a9f58d5f8a54661d" }, + "LazyVim": { "branch": "main", "commit": "7ce1b1519a45f48aa4b5f35b7b7a886b42fe56d8" }, + "LuaSnip": { "branch": "master", "commit": "bc8ec05022743d3f08bda7a76c6bb5e9a9024581" }, + "alpha-nvim": { "branch": "main", "commit": "dafa11a6218c2296df044e00f88d9187222ba6b0" }, + "bufferline.nvim": { "branch": "main", "commit": "ef4fdc5cea3473801dce89b5fdfe633380c80c65" }, + "catppuccin": { "branch": "main", "commit": "73587f9c454da81679202f1668c30fea6cdafd5e" }, "cmp-async-path": { "branch": "main", "commit": "d8229a93d7b71f22c66ca35ac9e6c6cd850ec61d" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, - "crates.nvim": { "branch": "main", "commit": "5a529df8fe3504ccf1ca9526e196f48b2f723c72" }, - "dressing.nvim": { "branch": "master", "commit": "f5d7fa1fa5ce6bcebc8f07922f39b1eda4d01e37" }, + "crates.nvim": { "branch": "main", "commit": "1d4bb1e7a0fe8bae3f97061be5fbf6f9081a27e2" }, + "dressing.nvim": { "branch": "master", "commit": "91b9ba8a9474d2c4156dc2f3e858e07ae8faecf0" }, "editorconfig.nvim": { "branch": "master", "commit": "5b9e303e1d6f7abfe616ce4cc8d3fffc554790bf" }, "flit.nvim": { "branch": "main", "commit": "f60e4b3d49bb5a5e97cfffe66f2e671eb422078e" }, - "friendly-snippets": { "branch": "main", "commit": "631f79e346b0b3203d2ce3eae619ca8d612e5463" }, - "gitsigns.nvim": { "branch": "main", "commit": "7dfe4be94b4f84a9931098f0f0f618d055e50bd5" }, + "friendly-snippets": { "branch": "main", "commit": "8d91ba2dc2421a54981115f61b914974f938fa77" }, + "gitsigns.nvim": { "branch": "main", "commit": "372d5cb485f2062ac74abc5b33054abac21d8b58" }, "harpoon": { "branch": "master", "commit": "f7040fd0c44e7a4010369136547de5604b9c22a1" }, "indent-blankline.nvim": { "branch": "master", "commit": "018bd04d80c9a73d399c1061fa0c3b14a7614399" }, "instant.nvim": { "branch": "master", "commit": "294b6d08143b3db8f9db7f606829270149e1a786" }, - "lazy.nvim": { "branch": "main", "commit": "903f0fe542fc35b74f3c09494f9c175346dfa76d" }, - "leap.nvim": { "branch": "main", "commit": "0eb3611593e135150e2f7880ec67568ccb51c17a" }, - "lsp-inlayhints.nvim": { "branch": "main", "commit": "62c7b8dd8ac9933b071912fe3c789ef2cb704672" }, - "lualine.nvim": { "branch": "master", "commit": "84ffb80e452d95e2c46fa29a98ea11a240f7843e" }, + "lazy.nvim": { "branch": "main", "commit": "57cce98dfdb2f2dd05a0567d89811e6d0505e13b" }, + "leap.nvim": { "branch": "main", "commit": "f74473d23ebf60957e0db3ff8172349a82e5a442" }, + "lsp-inlayhints.nvim": { "branch": "main", "commit": "84ca3abe8aaecbb5b30ad89e4701d4a9c821b72c" }, + "lualine.nvim": { "branch": "master", "commit": "c28a7427c3fb29322db136f0564ec58807b26747" }, "markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "7276ffffcf51a8304b5fd4b81293be4ee010ec47" }, - "mason-nvim-dap.nvim": { "branch": "main", "commit": "ab69c2e7da555b30f60b69c3614c0c142f2a70cc" }, - "mason.nvim": { "branch": "main", "commit": "253961cfe9b0a63b2524088be294acd7522366e5" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "a5ca8b03972b347b74b2ad2f7f23f120a514593b" }, + "mason-nvim-dap.nvim": { "branch": "main", "commit": "aa7f489903460f2c2e15a6a874c8b933722fe109" }, + "mason.nvim": { "branch": "main", "commit": "84af7a1fa1dbdb0f201849be7993d999a05d973b" }, "mini.ai": { "branch": "main", "commit": "fdb8dd34c326040f99b178536eeaee41d1efe643" }, "mini.bufremove": { "branch": "main", "commit": "93c7230e83f5acb8890cdb2abaf3557f09305b01" }, "mini.comment": { "branch": "main", "commit": "9ead47cef4266efa5145808b838762c658b74f74" }, "mini.indentscope": { "branch": "main", "commit": "43f6761c9a3e397b7c12b3c72f678bcf61efcfcf" }, "mini.pairs": { "branch": "main", "commit": "771c08bd313614c7e9a1904d277ac76eb226f674" }, "mini.surround": { "branch": "main", "commit": "cc962bae0890217f8473390abc8cef988519d370" }, - "neoconf.nvim": { "branch": "main", "commit": "ccc79c8096b0171c770a59a05d69a22f49d6d6c9" }, - "neodev.nvim": { "branch": "main", "commit": "fe48362be179b5705edcbcb947c1d84b263d5698" }, + "neoconf.nvim": { "branch": "main", "commit": "6aaeb48336b369d7ed8ef243bfd0d76ec79362cd" }, + "neodev.nvim": { "branch": "main", "commit": "864b35006d3de24c60e44b566de8018f919b13e6" }, "neoscroll.nvim": { "branch": "master", "commit": "d7601c26c8a183fa8994ed339e70c2d841253e93" }, - "nui.nvim": { "branch": "main", "commit": "ecd9def93891b9260b15b5fcef542eaabf4145c9" }, - "null-ls.nvim": { "branch": "main", "commit": "33b853a3933eed3137cd055aac4e539e69832ad0" }, - "nvim-cmp": { "branch": "main", "commit": "11102d3db12c7f8b35265ad0e17a21511e5b1e68" }, - "nvim-dap": { "branch": "master", "commit": "6cedcb527e264c8f25e86afa8dae74c6692dee51" }, - "nvim-dap-ui": { "branch": "master", "commit": "286f682f366fbc652b38dff893569374e9433dd3" }, - "nvim-dap-virtual-text": { "branch": "master", "commit": "ab988dbb7d20cdaebf9b3ef7554a89f6895de042" }, - "nvim-highlight-colors": { "branch": "main", "commit": "8d7e7fe540b404ec06a248d6e5797eaf3362420c" }, - "nvim-jdtls": { "branch": "master", "commit": "aa04fc0e4d8acbfa43efc6a6f7162b01987257a1" }, - "nvim-lspconfig": { "branch": "master", "commit": "427378a03ffc1e1bc023275583a49b1993e524d0" }, - "nvim-navic": { "branch": "master", "commit": "83dc174da915f9dbc9b51169e9b62a2e0d42b527" }, + "nui.nvim": { "branch": "main", "commit": "1f43b13d133eb4b4f53a4485379d9afa58808389" }, + "null-ls.nvim": { "branch": "main", "commit": "5855128178fa78293acdfb5b4e41ef046779240b" }, + "nvim-cmp": { "branch": "main", "commit": "777450fd0ae289463a14481673e26246b5e38bf2" }, + "nvim-dap": { "branch": "master", "commit": "debd7c2f80eaf20c5f5df25db8d8c1b9b18f4421" }, + "nvim-dap-ui": { "branch": "master", "commit": "56a2df0e96bfa64ebd6967e7cad877a1530633d5" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "9dc45a6eb33871f4c5cb2ba08fa307467657471e" }, + "nvim-highlight-colors": { "branch": "main", "commit": "14670d94c7813bfe929ed2ca2d3875f4f468173e" }, + "nvim-jdtls": { "branch": "master", "commit": "ffb8f63689197b845c2388f0df5f0d1bd21c968f" }, + "nvim-lspconfig": { "branch": "master", "commit": "1ec6f5cbf6ffc44c84783d70039df5295ca22b4e" }, + "nvim-navic": { "branch": "master", "commit": "27124a773d362628b114cd12016e743dab4ccf3e" }, "nvim-spectre": { "branch": "master", "commit": "6e5ce371f93625c7dc43f5e2647d3647f2ea15e2" }, - "nvim-tree.lua": { "branch": "master", "commit": "bb375fb20327c49920c41d2b51c1ce2f4fe7deb3" }, - "nvim-treesitter": { "branch": "master", "commit": "08e8b2c08bfdcd20e4561620ca0ccda0bb2e050a" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "8673926519ea61069f9c1366d1ad1949316d250e" }, - "nvim-ts-context-commentstring": { "branch": "main", "commit": "0bf8fbc2ca8f8cdb6efbd0a9e32740d7a991e4c3" }, - "nvim-web-devicons": { "branch": "master", "commit": "4ec26d67d419c12a4abaea02f1b6c57b40c08d7e" }, + "nvim-tree.lua": { "branch": "master", "commit": "d1410cb0896a3aad5d84ddc54284774a627c6d63" }, + "nvim-treesitter": { "branch": "master", "commit": "584ccea56e2d37b31ba292da2b539e1a4bb411ca" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "b55fe6175f0001347a433c9df358c8cbf8a4e90f" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "729d83ecb990dc2b30272833c213cc6d49ed5214" }, + "nvim-web-devicons": { "branch": "master", "commit": "0568104bf8d0c3ab16395433fcc5c1638efc25d4" }, "persistence.nvim": { "branch": "main", "commit": "c814fae5c37aa0aba9cd9da05df6e52b88d612c3" }, - "plenary.nvim": { "branch": "master", "commit": "9ac3e9541bbabd9d73663d757e4fe48a675bb054" }, + "plenary.nvim": { "branch": "master", "commit": "253d34830709d690f013daf2853a9d21ad7accab" }, "rust-tools.nvim": { "branch": "master", "commit": "71d2cf67b5ed120a0e31b2c8adb210dd2834242f" }, "tailwindcss-colorizer-cmp.nvim": { "branch": "main", "commit": "f044050da3ec6e1cdb31985beecec6810cc27f0b" }, "telescope-file-browser.nvim": { "branch": "master", "commit": "e0fcb12702ad0d2873544a31730f9aaef04fd032" }, "telescope-project.nvim": { "branch": "master", "commit": "fa081e35ba7397e5147a51ece693aa3afda167fc" }, "telescope-zoxide": { "branch": "main", "commit": "68966349aa1b8e9ade403e18479ecf79447389a7" }, - "telescope.nvim": { "branch": "master", "commit": "713d26b98583b160b50fb827adb751f768238ed3" }, + "telescope.nvim": { "branch": "master", "commit": "942fe5faef47b21241e970551eba407bc10d9547" }, "todo-comments.nvim": { "branch": "main", "commit": "8febc60a76feefd8203077ef78b6a262ea1a41f9" }, - "toggleterm.nvim": { "branch": "main", "commit": "68fdf851c2b7901a7065ff129b77d3483419ddce" }, - "tokyonight.nvim": { "branch": "main", "commit": "ab0ac67f4f32f44c3480f4b81ed90e11cb4f3763" }, - "trouble.nvim": { "branch": "main", "commit": "d56bfc0c501ced4002a57cb60433362fb2ce9c4d" }, + "toggleterm.nvim": { "branch": "main", "commit": "b86982429325112d2b20c6d0cc7a5c4b182ab705" }, + "tokyonight.nvim": { "branch": "main", "commit": "1b0c88094548a62641ece1e668fa9a234e1c539e" }, + "trouble.nvim": { "branch": "main", "commit": "2ae7237c2917d661f458443c9a88680f8ca2d7b2" }, "typst.vim": { "branch": "main", "commit": "7f67aea9305dc213fe61725faaafecead94f9d07" }, "vim-illuminate": { "branch": "master", "commit": "a2907275a6899c570d16e95b9db5fd921c167502" }, "vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" }, - "vim-startuptime": { "branch": "master", "commit": "01b67169c3ebe41f163c07bf6853555ca19bc27f" }, - "vimtex": { "branch": "master", "commit": "a7b1654ef59bfd8c15ab3e0eb27451319174a131" }, - "which-key.nvim": { "branch": "main", "commit": "4acffc92953a90a790603bfdab7c92319ab167b1" } + "vim-startuptime": { "branch": "master", "commit": "6580cf539c33a212f4f5542068a3b4dd2b3ad834" }, + "vimtex": { "branch": "master", "commit": "e8542f26b45e489fe7cfa7894737ccb0fe937fcd" }, + "which-key.nvim": { "branch": "main", "commit": "4b73390eec680b4c061ea175eb32c0ff3412271d" } } \ No newline at end of file diff --git a/nvim/lua/config/keymaps.lua b/nvim/lua/config/keymaps.lua index ae6bcbf..dc6dc62 100644 --- a/nvim/lua/config/keymaps.lua +++ b/nvim/lua/config/keymaps.lua @@ -24,12 +24,12 @@ map("v", "l", "k", opts) map("v", ";", "l", opts) -- debug -map("n", "", ':lua require("dap").toggle_breakpoint()', opts) -map("n", "", ':lua require("dap").step_over()', opts) -map("n", "", ':lua require("dap").step_into()', opts) -map("n", "", ':lua require("dapui").toggle() :lua require("dap").continue() ', opts) -map("n", "", ':lua require("dap").continue()', opts) -map("n", "", ':lua require("dap").close() :lua require("dapui").toggle()', opts) +map("n", "db", ':lua require("dap").toggle_breakpoint()', { desc = "Toggle breakpoint" }) +map("n", "do", ':lua require("dap").step_over()', { desc = "Step over" }) +map("n", "di", ':lua require("dap").step_into()', { desc = "Step into" }) +map("n", "dc", ':lua require("dap").continue()', { desc = "Continue" }) +map("n", "dt", ':lua require("dapui").toggle() :lua require("dap").continue() ', { desc = "Open DAP" }) +map("n", "dq", ':lua require("dap").close() :lua require("dapui").toggle()', { desc = "Close DAP" }) -- file tree map("n", "", ":lua require('nvim-tree.api').tree.toggle()", opts) @@ -41,21 +41,18 @@ map("n", "", ":lua require('toggleterm').toggle(1)", opts) map("n", "", ":BufferLineCyclePrev", opts) map("n", "", ":BufferLineCycleNext", opts) --- formatting -map("n", "", ":lua vim.lsp.buf.format { async = true }", opts) -map("n", "a", ":Telescope lsp_definitions", opts) -map("n", "s", ":Telescope lsp_references", opts) -map("n", "d", ":Telescope lsp_type_definitions", opts) -map("n", "f", ":Telescope lsp_implementations", opts) -map("n", "q", ":lua vim.lsp.buf.code_action()", opts) -map("n", "w", ":lua vim.lsp.buf.signature_help()", opts) -map("n", "e", ":lua vim.lsp.buf.hover()", opts) -map("n", "r", ":lua vim.lsp.buf.rename()", opts) -map("n", "gq", ":lua require('telescope.builtin').git_commits()", opts) -map("n", "gw", ":lua require('telescope.builtin').git_bcommits()", opts) -map("n", "ge", ":lua require('telescope.builtin').git_branches()", opts) -map("n", "gr", ":lua require('telescope.builtin').git_status()", opts) -map("n", "ga", ":lua require('telescope.builtin').git_stash()", opts) +-- git +map("n", "gq", ":lua require('telescope.builtin').git_commits()", { desc = "Commits" }) +map("n", "gw", ":lua require('telescope.builtin').git_bcommits()", { desc = "Commits in branch" }) +map("n", "ge", ":lua require('telescope.builtin').git_branches()", { desc = "Branches" }) +map("n", "gr", ":lua require('telescope.builtin').git_status()", { desc = "Git status" }) +map("n", "ga", ":lua require('telescope.builtin').git_stash()", { desc = "Git stash" }) +map("n", "gg", function() + Util.float_term({ "gitui" }, { cwd = Util.get_root() }) +end, { desc = "gitui (root dir)" }) +map("n", "gG", function() + Util.float_term({ "gitui" }) +end, { desc = "gitui (cwd)" }) -- window switching function _G.set_terminal_maps() @@ -76,20 +73,30 @@ map("n", "", ":wincmd k", opts) map("n", "", ":wincmd l", opts) -- harpoon man -map("n", "", ":lua require('harpoon.ui').nav_file(1)", opts) -map("n", "", ":lua require('harpoon.ui').nav_file(2)", opts) -map("n", "", ":lua require('harpoon.ui').nav_file(3)", opts) -map("n", "fma", ":lua require('harpoon.mark').add_file()", opts) -map("n", "fmd", ":lua require('harpoon.mark').remove_file()", opts) +map("n", "h1", ":lua require('harpoon.ui').nav_file(1)", { desc = "First Harpoon File" }) +map("n", "h2", ":lua require('harpoon.ui').nav_file(2)", { desc = "Second Harpoon File" }) +map("n", "h3", ":lua require('harpoon.ui').nav_file(3)", { desc = "First Harpoon File" }) +map("n", "ha", ":lua require('harpoon.mark').add_file()", { desc = "First Harpoon File" }) +map("n", "hd", ":lua require('harpoon.mark').remove_file()", { desc = "First Harpoon File" }) +map("n", "hm", ":Telescope harpoon marks", { noremap = true, silent = true, desc = "Show harpoon marks" }) -- telescope -map("n", "fb", ":lua require('telescope').extensions.file_browser.file_browser{}", {}) -map("n", "ff", ":lua require('telescope.builtin').find_files()", {}) -map("n", "fg", ":lua require('telescope.builtin').live_grep()", {}) -map("n", "fh", ":lua require('telescope.builtin').help_tags()", {}) -map("n", "fp", ":lua require'telescope'.extensions.project.project{}", { noremap = true, silent = true }) -map("n", "fm", ":Telescope harpoon marks", { noremap = true, silent = true }) -vim.keymap.set("n", "z", ":lua require('telescope').extensions.zoxide.list{}") +map("n", "fb", function() + require("telescope").extensions.file_browser.file_browser({}) +end, { desc = "File Browser" }) +map("n", "ff", function() + require("telescope.builtin").find_files() +end, { desc = "Find Files" }) +map("n", "fg", function() + require("telescope.builtin").live_grep() +end, { desc = "Live Grep" }) +map("n", "fh", function() + require("telescope.builtin").help_tags() +end, { desc = "Help" }) +map("n", "fp", function() + require("telescope").extensions.project.project({}) +end, { noremap = true, silent = true, desc = "Projects" }) +map("n", "z", ":lua require('telescope').extensions.zoxide.list{}", { desc = "Zoxide" }) -- trouble map("n", "t", "TroubleToggle", term_opts) @@ -125,12 +132,4 @@ end) -- neovide paste vim.g.neovide_input_use_logo = 1 -vim.api.nvim_set_keymap('i', '', 'pI', { noremap = true, silent = true}) - --- gitui -map("n", "gg", function() - Util.float_term({ "gitui" }, { cwd = Util.get_root() }) -end, { desc = "gitui (root dir)" }) -map("n", "gG", function() - Util.float_term({ "gitui" }) -end, { desc = "gitui (cwd)" }) +vim.api.nvim_set_keymap("i", "", "pI", { noremap = true, silent = true }) diff --git a/nvim/lua/config/lsp-keymap.lua b/nvim/lua/config/lsp-keymap.lua new file mode 100644 index 0000000..10d083e --- /dev/null +++ b/nvim/lua/config/lsp-keymap.lua @@ -0,0 +1,99 @@ +local M = {} + +---@type PluginLspKeys +M._keys = nil + +---@return (LazyKeys|{has?:string})[] +function M.get() + local format = require("lazyvim.plugins.lsp.format").format + if not M._keys then + ---@class PluginLspKeys + -- stylua: ignore + M._keys = { + { "cld", vim.diagnostic.open_float, desc = "Line Diagnostics" }, + { "cl", "LspInfo", desc = "Lsp Info" }, + { "ca", "Telescope lsp_definitions", desc = "Goto Definition", has = "definition" }, + { "cs", "Telescope lsp_references", desc = "References" }, + { "gD", vim.lsp.buf.declaration, desc = "Goto Declaration" }, + { "cf", "Telescope lsp_implementations", desc = "Goto Implementation" }, + { "cd", "Telescope lsp_type_definitions", desc = "Goto Type Definition" }, + { "ce", vim.lsp.buf.hover, desc = "Hover" }, + { "cw", vim.lsp.buf.signature_help, desc = "Signature Help", has = "signatureHelp" }, + { "", vim.lsp.buf.signature_help, mode = "i", desc = "Signature Help", has = "signatureHelp" }, + { "]d", M.diagnostic_goto(true), desc = "Next Diagnostic" }, + { "[d", M.diagnostic_goto(false), desc = "Prev Diagnostic" }, + { "]e", M.diagnostic_goto(true, "ERROR"), desc = "Next Error" }, + { "[e", M.diagnostic_goto(false, "ERROR"), desc = "Prev Error" }, + { "]w", M.diagnostic_goto(true, "WARN"), desc = "Next Warning" }, + { "[w", M.diagnostic_goto(false, "WARN"), desc = "Prev Warning" }, + { "", format, desc = "Format Document", has = "documentFormatting" }, + -- { "cf", format, desc = "Format Range", mode = "v", has = "documentRangeFormatting" }, + { "cq", vim.lsp.buf.code_action, desc = "Code Action", mode = { "n", "v" }, has = "codeAction" }, + { + "cA", + function() + vim.lsp.buf.code_action({ + context = { + only = { + "source", + }, + diagnostics = {}, + }, + }) + end, + desc = "Source Action", + has = "codeAction", + } + } + if require("lazyvim.util").has("inc-rename.nvim") then + M._keys[#M._keys + 1] = { + "cr", + function() + require("inc_rename") + return ":IncRename " .. vim.fn.expand("") + end, + expr = true, + desc = "Rename", + has = "rename", + } + else + M._keys[#M._keys + 1] = { "r", vim.lsp.buf.rename, desc = "Rename", has = "rename" } + end + end + return M._keys +end + +function M.on_attach(client, buffer) + local Keys = require("lazy.core.handler.keys") + local keymaps = {} ---@type table + + for _, value in ipairs(M.get()) do + local keys = Keys.parse(value) + if keys[2] == vim.NIL or keys[2] == false then + keymaps[keys.id] = nil + else + keymaps[keys.id] = keys + end + end + + for _, keys in pairs(keymaps) do + if not keys.has or client.server_capabilities[keys.has .. "Provider"] then + local opts = Keys.opts(keys) + ---@diagnostic disable-next-line: no-unknown + opts.has = nil + opts.silent = opts.silent ~= false + opts.buffer = buffer + vim.keymap.set(keys.mode or "n", keys[1], keys[2], opts) + end + end +end + +function M.diagnostic_goto(next, severity) + local go = next and vim.diagnostic.goto_next or vim.diagnostic.goto_prev + severity = severity and vim.diagnostic.severity[severity] or nil + return function() + go({ severity = severity }) + end +end + +return M diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua index f3911a5..049cf56 100644 --- a/nvim/lua/plugins/lsp.lua +++ b/nvim/lua/plugins/lsp.lua @@ -42,7 +42,27 @@ return { tailwindcss = {}, cssls = {}, html = {}, - clangd = {}, + clangd = { + root_pattern = { + ".clangd", + ".clang-tidy", + ".clang-format", + "compile_commands.json", + "compile_flags.txt", + "configure.ac", + ".git", + "build/compile_commands.json", + }, + filetypes = { + "c", + "cpp", + "objc", + "objcpp", + "cuda", + "proto", + "cl", + }, + }, pyright = {}, cmake = {}, bashls = {}, @@ -110,6 +130,7 @@ return { sqlls = {}, taplo = {}, lemminx = {}, + opencl_ls = {}, yamlls = {}, lua_ls = { -- mason = false, -- set to false if you don't want this server to be installed with mason @@ -140,7 +161,7 @@ return { -- setup formatting and keymaps require("lazyvim.util").on_attach(function(client, buffer) require("lazyvim.plugins.lsp.format").on_attach(client, buffer) - require("lazyvim.plugins.lsp.keymaps").on_attach(client, buffer) + require("config.lsp-keymap").on_attach(client, bufnr) end) -- diagnostics @@ -157,6 +178,7 @@ return { vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") local optslsp = { noremap = false, silent = true, buffer = bufnr } require("lsp-inlayhints").on_attach(client, bufnr) + -- keymaps end local function setup(server) @@ -225,7 +247,7 @@ return { nls.builtins.formatting.shfmt, nls.builtins.diagnostics.flake8, nls.builtins.formatting.autopep8, - nls.builtins.formatting.prettierd + nls.builtins.formatting.prettierd, }, } end, diff --git a/nvim/lua/plugins/plugins.lua b/nvim/lua/plugins/plugins.lua index 73e56bb..0bfcdc0 100644 --- a/nvim/lua/plugins/plugins.lua +++ b/nvim/lua/plugins/plugins.lua @@ -5,6 +5,14 @@ return { colorscheme = "tokyonight-night", }, }, + { + "nvim-telescope/telescope.nvim", + cmd = "Telescope", + keys = function() return {} end, + config = function(opts) + require("telescope").setup(opts) + end, + }, { "akinsho/toggleterm.nvim", lazy = true, @@ -177,4 +185,36 @@ return { lazy = true, event = "FileType typst", }, + { + "folke/which-key.nvim", + event = "VeryLazy", + opts = { + plugins = { spelling = true }, + defaults = { + mode = { "n", "v" }, + ["g"] = { name = "+goto" }, + ["gz"] = { name = "+surround" }, + ["]"] = { name = "+next" }, + ["["] = { name = "+prev" }, + [""] = { name = "+tabs" }, + ["b"] = { name = "+buffer" }, + ["c"] = { name = "+code" }, + ["f"] = { name = "+file/find" }, + ["g"] = { name = "+git" }, + ["gh"] = { name = "+hunks" }, + ["q"] = { name = "+quit/session" }, + ["s"] = { name = "+search" }, + ["u"] = { name = "+ui" }, + ["w"] = { name = "+windows" }, + ["x"] = { name = "+diagnostics/quickfix" }, + ["h"] = { name = "+harpoon" }, + ["d"] = { name = "+DAP" }, + }, + }, + config = function(_, opts) + local wk = require("which-key") + wk.setup(opts) + wk.register(opts.defaults) + end, + }, }