1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2024-11-01 01:31:14 +00:00

[neovim] Add keymaps for gitdiff

This commit is contained in:
Daniel Carrillo 2023-03-26 12:43:25 +02:00
parent fcd4ea34d0
commit bb342fc0ce
Signed by: dcarrillo
GPG Key ID: E4CD5C09DAED6E16

View File

@ -15,7 +15,6 @@ vim.g.mapleader = " "
-- term_mode = "t",
-- command_mode = "c",
-- Normal --
-- Better window navigation
keymap("n", "<C-h>", "<C-w>h", opts)
keymap("n", "<C-j>", "<C-w>j", opts)
@ -23,22 +22,22 @@ keymap("n", "<C-k>", "<C-w>k", opts)
keymap("n", "<C-l>", "<C-w>l", opts)
-- Resize with arrows
keymap("n", "<C-Up>", ":resize -2<CR>", opts)
keymap("n", "<C-Down>", ":resize +2<CR>", opts)
keymap("n", "<C-Left>", ":vertical resize -2<CR>", opts)
keymap("n", "<C-Right>", ":vertical resize +2<CR>", opts)
keymap("n", "<C-Up>", ":resize -2<cr>", opts)
keymap("n", "<C-Down>", ":resize +2<cr>", opts)
keymap("n", "<C-Left>", ":vertical resize -2<cr>", opts)
keymap("n", "<C-Right>", ":vertical resize +2<cr>", opts)
-- Navigate buffers
keymap("n", "<S-l>", ":bnext<CR>", opts)
keymap("n", "<C-PageDown>", ":bnext<CR>", opts)
keymap("n", "<S-h>", ":bprevious<CR>", opts)
keymap("n", "<C-PageUp>", ":bprevious<CR>", opts)
keymap("n", "<S-l>", ":bnext<cr>", opts)
keymap("n", "<C-PageDown>", ":bnext<cr>", opts)
keymap("n", "<S-h>", ":bprevious<cr>", opts)
keymap("n", "<C-PageUp>", ":bprevious<cr>", opts)
-- Clear highlights
keymap("n", "<leader>h", "<cmd>nohlsearch<CR>", opts)
keymap("n", "<leader>h", "<cmd>nohlsearch<cr>", opts)
-- Close buffers
keymap("n", "<S-q>", "<cmd>Bdelete!<CR>", opts)
keymap("n", "<S-q>", "<cmd>Bdelete!<cr>", opts)
-- LSP / Diagnostics
keymap("n", "<leader>xx", "<cmd>TroubleToggle<cr>", opts)
@ -61,43 +60,34 @@ keymap("n", "<leader>ls", "<cmd>lua vim.lsp.buf.signature_help()<cr>", opts)
-- Better paste
keymap("v", "p", '"_dP', opts)
-- Insert --
-- Press jk fast to enter
keymap("i", "jk", "<ESC>", opts)
-- Visual --
-- Stay in indent mode
keymap("v", "<", "<gv", opts)
keymap("v", ">", ">gv", opts)
-- NeoTree
keymap("n", "<leader>e", ":Neotree toggle<CR>", opts)
keymap("n", "<leader>gg", ":Neotree float git_status<CR>", opts)
keymap("n", "<leader>e", ":Neotree toggle<cr>", opts)
keymap("n", "<leader>gg", ":Neotree float git_status<cr>", opts)
-- Telescope
keymap("n", "<leader>ff", ":Telescope find_files<CR>", opts)
keymap("n", "<C-p>", ":Telescope find_files<CR>", opts)
keymap("n", "<leader>fg", ":Telescope live_grep<CR>", opts)
keymap("n", "<leader>fb", ":Telescope buffers<CR>", opts)
keymap("n", "<leader>fc", ":Telescope commands<CR>", opts)
keymap("n", "<leader>ff", ":Telescope find_files<cr>", opts)
keymap("n", "<C-p>", ":Telescope find_files<cr>", opts)
keymap("n", "<leader>fg", ":Telescope live_grep<cr>", opts)
keymap("n", "<leader>fb", ":Telescope buffers<cr>", opts)
keymap("n", "<leader>fc", ":Telescope commands<cr>", opts)
-- Comment
keymap("n", "<leader>/", "<cmd>lua require'Comment.api'.toggle.linewise.current()<CR>", opts)
keymap("x", "<leader>/", "<esc><cmd>lua require'Comment.api'.toggle.linewise(vim.fn.visualmode())<CR>", opts)
keymap("n", "<leader>/", "<cmd>lua require'Comment.api'.toggle.linewise.current()<cr>", opts)
keymap("x", "<leader>/", "<esc><cmd>lua require'Comment.api'.toggle.linewise(vim.fn.visualmode())<cr>", opts)
-- DAP
keymap("n", "<leader>db", "<cmd>lua require'dap'.toggle_breakpoint()<cr>", opts)
keymap("n", "<leader>dc", "<cmd>lua require'dap'.continue()<cr>", opts)
keymap("n", "<leader>di", "<cmd>lua require'dap'.step_into()<cr>", opts)
keymap("n", "<leader>do", "<cmd>lua require'dap'.step_over()<cr>", opts)
keymap("n", "<leader>dO", "<cmd>lua require'dap'.step_out()<cr>", opts)
keymap("n", "<leader>dr", "<cmd>lua require'dap'.repl.toggle()<cr>", opts)
keymap("n", "<leader>dl", "<cmd>lua require'dap'.run_last()<cr>", opts)
keymap("n", "<leader>du", "<cmd>lua require'dapui'.toggle()<cr>", opts)
keymap("n", "<leader>dt", "<cmd>lua require'dap'.terminate()<cr>", opts)
-- Gitdiff
keymap("n", "<leader>df", ":DiffviewFileHistory %<cr>", opts)
keymap("n", "<leader>dc", ":DiffviewClose<cr>", opts)
-- Projections
keymap("n", "<leader>fp", ":Telescope projections<CR>", opts)
keymap("n", "<leader>fp", ":Telescope projections<cr>", opts)
-- Base64
keymap("v", "<leader>64e", ":<c-u>lua require'b64'.encode()<cr>", opts)