summaryrefslogtreecommitdiffstats
path: root/nvim/lua
diff options
context:
space:
mode:
authorDamjan 9000 <damjan.9000@gmail.com>2023-10-22 12:16:17 +0200
committerDamjan 9000 <damjan.9000@gmail.com>2023-11-03 21:01:49 +0100
commit2f5133ca998dd710062e390cba574d6e3ab42c3b (patch)
tree6d8fd484b4c1f3af103771d3e28f5296956dd345 /nvim/lua
parent891ed7cd86ae31462e6c5f1ec648861745fc08c5 (diff)
downloaddots-2f5133ca998dd710062e390cba574d6e3ab42c3b.tar.gz
Added lua/keymaps.lua
Diffstat (limited to 'nvim/lua')
-rw-r--r--nvim/lua/keymaps.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/nvim/lua/keymaps.lua b/nvim/lua/keymaps.lua
new file mode 100644
index 0000000..22d7796
--- /dev/null
+++ b/nvim/lua/keymaps.lua
@@ -0,0 +1,28 @@
+-- [[ 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 })
+
+-- [[ 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, { desc = 'Go to previous diagnostic message' })
+vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic message' })
+vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' })
+vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' })
+
+-- vim: ts=2 sts=2 sw=2 et