From 79e010e68130a639be0cbfaf9db35f8e975897a9 Mon Sep 17 00:00:00 2001 From: Damjan 9000 Date: Sun, 22 Oct 2023 12:16:17 +0200 Subject: Added lua/keymaps.lua --- lua/keymaps.lua | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lua/keymaps.lua (limited to 'lua/keymaps.lua') diff --git a/lua/keymaps.lua b/lua/keymaps.lua new file mode 100644 index 0000000..22d7796 --- /dev/null +++ b/lua/keymaps.lua @@ -0,0 +1,28 @@ +-- [[ Basic Keymaps ]] + +-- Keymaps for better default experience +-- See `:help vim.keymap.set()` +vim.keymap.set({ 'n', 'v' }, '', '', { 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', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) + +-- vim: ts=2 sts=2 sw=2 et -- cgit v1.2.3-70-g09d2