2023-02-19 23:01:47 +01:00
|
|
|
-- [[ Basic Keymaps ]]
|
|
|
|
|
|
|
|
-- Keymaps for better default experience
|
|
|
|
-- See `:help vim.keymap.set()`
|
|
|
|
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
|
|
|
|
|
|
|
|
-- Remap for dealing with word wrap
|
|
|
|
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
|
|
|
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
2023-05-16 11:42:40 +02:00
|
|
|
vim.keymap.set('n', '<Up>', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
|
|
|
vim.keymap.set('n', '<Down>', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
2023-02-19 23:01:47 +01:00
|
|
|
|
|
|
|
-- Remap for vertical navigation
|
|
|
|
vim.keymap.set('n', '<C-d>', '<C-d>zz', { noremap = true, silent = true })
|
|
|
|
vim.keymap.set('n', '<C-u>', '<C-u>zz', { noremap = true, silent = true })
|
|
|
|
vim.keymap.set('n', 'n', 'nzzzv', { noremap = true, silent = true })
|
|
|
|
vim.keymap.set('n', 'N', 'Nzzzv', { noremap = true, silent = true })
|
|
|
|
|
2023-05-16 11:42:40 +02:00
|
|
|
-- Remap for moving selected line / block of text in visual mode
|
|
|
|
vim.keymap.set('v', '<M-k>', ":m '<-2<cr>gv=gv", { desc = 'Move selected lines up' })
|
2023-05-21 21:38:58 +02:00
|
|
|
vim.keymap.set('v', '<M-j>', ":m '>+1<cr>gv=gv", { desc = 'Move selected lines down' })
|
2023-05-16 11:42:40 +02:00
|
|
|
|
2023-02-19 23:01:47 +01:00
|
|
|
-- [[ Highlight on yank ]]
|
|
|
|
-- See `:help vim.highlight.on_yank()`
|
|
|
|
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
|
|
|
vim.api.nvim_create_autocmd('TextYankPost', {
|
|
|
|
callback = function()
|
|
|
|
vim.highlight.on_yank()
|
|
|
|
end,
|
|
|
|
group = highlight_group,
|
|
|
|
pattern = '*',
|
|
|
|
})
|
|
|
|
|
|
|
|
-- Diagnostic keymaps
|
|
|
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
|
|
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
|
|
|
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)
|
|
|
|
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist)
|
|
|
|
|
2023-05-21 21:38:58 +02:00
|
|
|
-- terminal
|
|
|
|
vim.keymap.set('t', '<C-x>', vim.api.nvim_replace_termcodes('<C-\\><C-N>', true, true, true), { desc = 'Escape terminal mode' })
|
2023-02-19 23:01:47 +01:00
|
|
|
|
|
|
|
return {}
|