aboutsummaryrefslogtreecommitdiff
path: root/lua/pml68/remap.lua
diff options
context:
space:
mode:
authorpml68 <tutorialmester@gmail.com>2024-03-18 21:33:54 +0100
committerpml68 <tutorialmester@gmail.com>2024-03-18 21:33:54 +0100
commit30073d82a57a4839f9687c9dbcde627c112b1839 (patch)
treeefe4ff05512462fc94edeea7c1f5996149cfa96c /lua/pml68/remap.lua
parentfeat: missed the Float part (diff)
downloadnvim-30073d82a57a4839f9687c9dbcde627c112b1839.tar.gz
feat: autocompletion, keymaps and more
Diffstat (limited to 'lua/pml68/remap.lua')
-rw-r--r--lua/pml68/remap.lua37
1 files changed, 37 insertions, 0 deletions
diff --git a/lua/pml68/remap.lua b/lua/pml68/remap.lua
index 578cb6f..dab15ca 100644
--- a/lua/pml68/remap.lua
+++ b/lua/pml68/remap.lua
@@ -5,6 +5,7 @@ vim.keymap.set("v", "<leader>cs", "<cmd> Silicon <CR>")
vim.keymap.set("n", "<leader>cp", ":!xclip -sel clip -target image/png -i 2024*.png && rm 2024*.png <CR>")
vim.keymap.set("n", "<leader>u", "<cmd>UndotreeToggle<CR>")
+-- keyboard problems (temporary)
function starting()
local pos = vim.api.nvim_win_get_cursor(0)[2]
local line = vim.api.nvim_get_current_line()
@@ -13,3 +14,39 @@ function starting()
end
vim.keymap.set("n", "<leader>s", "<cmd> lua starting() <CR>")
+
+-- switch between windows
+vim.keymap.set("n", "<C-h>", "<C-w>h")
+vim.keymap.set("n", "<C-l>", "<C-w>l")
+vim.keymap.set("n", "<C-j>", "<C-w>j")
+vim.keymap.set("n", "<C-k>", "<C-w>k")
+
+-- close current buffer
+vim.keymap.set("n", "<leader>x", "<cmd> bd <CR>")
+
+-- termtoggle
+vim.keymap.set("n", "<leader>h", "<cmd> ToggleTerm direction=horizontal <CR>")
+vim.keymap.set("n", "<leader>v", "<cmd> ToggleTerm direction=vertical <CR>")
+
+-- Diagnostics, LSP
+vim.keymap.set('n', 'gl', '<cmd>lua vim.diagnostic.open_float()<cr>')
+vim.keymap.set('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<cr>')
+vim.keymap.set('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<cr>')
+
+vim.api.nvim_create_autocmd('LspAttach', {
+ desc = 'LSP actions',
+ callback = function(event)
+ local opts = {buffer = event.buf}
+
+ vim.keymap.set('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>', opts)
+ vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>', opts)
+ vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>', opts)
+ vim.keymap.set('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<cr>', opts)
+ vim.keymap.set('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>', opts)
+ vim.keymap.set('n', 'gr', '<cmd>lua vim.lsp.buf.references()<cr>', opts)
+ vim.keymap.set('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>', opts)
+ vim.keymap.set('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>', opts)
+ vim.keymap.set({'n', 'x'}, '<F3>', '<cmd>lua vim.lsp.buf.format({async = true})<cr>', opts)
+ vim.keymap.set('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>', opts)
+ end
+})