aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schmucker <ts@its1.de>2026-05-13 17:21:37 +0200
committerThomas Schmucker <ts@its1.de>2026-05-13 17:21:37 +0200
commitf1018e8b5a8c898887c67fc00cf60f42421df129 (patch)
tree4889f3e56bf420f4a8db5ed4cf0d80829aa2aac7
parentc6db677ba798c7de4200a68c75a2bf3088166ead (diff)
downloaddotfiles-f1018e8b5a8c898887c67fc00cf60f42421df129.tar.gz
dotfiles-f1018e8b5a8c898887c67fc00cf60f42421df129.tar.bz2
dotfiles-f1018e8b5a8c898887c67fc00cf60f42421df129.zip
neovim: Tastenmappings etwas überarbeitet
-rw-r--r--nvim/lua/config/keymaps.lua40
1 files changed, 27 insertions, 13 deletions
diff --git a/nvim/lua/config/keymaps.lua b/nvim/lua/config/keymaps.lua
index 29dee94..558742d 100644
--- a/nvim/lua/config/keymaps.lua
+++ b/nvim/lua/config/keymaps.lua
@@ -16,24 +16,40 @@ function M.lsp(buffer, client)
16 map("n", "<leader>rn", vim.lsp.buf.rename, opts) 16 map("n", "<leader>rn", vim.lsp.buf.rename, opts)
17 map("n", "<leader>ca", vim.lsp.buf.code_action, opts) 17 map("n", "<leader>ca", vim.lsp.buf.code_action, opts)
18 18
19 local function run_in_terminal(cmd)
20 vim.cmd("botright split | terminal " .. cmd)
21 end
22
19 local function set_c_bindings() 23 local function set_c_bindings()
20 if client and client.name == "clangd" then map("n", "<leader>hs", "<cmd>ClangdSwitchSourceHeader<cr>", opts) end 24 map("n", "<leader>hs", "<cmd>ClangdSwitchSourceHeader<cr>", opts)
25
26 map("n", "<F5>", function()
27 vim.cmd("make")
28 vim.cmd("cwindow")
29 end, opts)
30
31 map("n", "<F6>", function() run_in_terminal("gmake test") end, opts)
21 end 32 end
22 33
23 local function set_python_bindings() 34 local function set_python_bindings()
24 if client and (client.name == "basedpyright" or client.name == "pyright" or client.name == "pylsp") then 35 map("n", "<F6>", function() run_in_terminal("pytest") end, opts)
25 local function run_pytest() 36 end
26 vim.cmd("botright split | terminal pytest")
27 end
28 37
29 map("n", "<F6>", run_pytest, { 38 local function set_npm_bindings()
30 desc = "Run pytest (nur Python-Projekt)", 39 map("n", "<F5>", function() run_in_terminal("npm run build") end, opts)
31 }) 40 map("n", "<F6>", function() run_in_terminal("npm test") end, opts)
32 end 41 map("n", "<F7>", function() run_in_terminal("npm start") end, opts)
33 end 42 end
34 43
35 set_c_bindings() 44 if client then
36 set_python_bindings() 45 if client.name == "clangd" then
46 set_c_bindings()
47 elseif client.name == "basedpyright" or client.name == "pyright" or client.name == "pylsp" then
48 set_python_bindings()
49 elseif client.name == "tsserver" or client.name == "vtsls" or client.name == "typescript_tools" then
50 set_npm_bindings()
51 end
52 end
37end 53end
38 54
39function M.gitsigns() 55function M.gitsigns()
@@ -103,8 +119,6 @@ function M.global()
103 return vim.v.count == 0 and "gk" or "k" 119 return vim.v.count == 0 and "gk" or "k"
104 end, { expr = true, silent = true }) 120 end, { expr = true, silent = true })
105 121
106 map("n", "<F5>", "<cmd>make<CR>", opts)
107
108 -- Kombinationen mit Leader-Key 122 -- Kombinationen mit Leader-Key
109 map("n", "<leader>K", function() 123 map("n", "<leader>K", function()
110 vim.diagnostic.open_float({ scope = "cursor", border = "rounded" }) 124 vim.diagnostic.open_float({ scope = "cursor", border = "rounded" })