From 5cca66915ae369ed2293dd8e7a3b5edcbc760beb Mon Sep 17 00:00:00 2001 From: dla Date: Thu, 12 Sep 2024 18:02:57 +0700 Subject: [PATCH] Add keymaps --- lua/custom/keymaps.lua | 9 +++++++++ lua/custom/options.lua | 1 + 2 files changed, 10 insertions(+) create mode 100644 lua/custom/keymaps.lua diff --git a/lua/custom/keymaps.lua b/lua/custom/keymaps.lua new file mode 100644 index 00000000..7c120aa2 --- /dev/null +++ b/lua/custom/keymaps.lua @@ -0,0 +1,9 @@ +-- vim.keymap.set('n', '', 'nohlsearch') +vim.keymap.set('n', 'l', ':set hlsearch!', { noremap = true, silent = true, desc = 'Toggle highlight search' }) + +-- Map Ctrl-s to save the file in normal and insert mode +vim.keymap.set('n', '', ':w', { noremap = true, silent = true }) +vim.keymap.set('i', '', ':w', { noremap = true, silent = true }) + +-- Map Ctrl-c to yank (copy) the selected text in visual mode +vim.api.nvim_set_keymap('v', '', '"+y', { noremap = true, silent = true }) diff --git a/lua/custom/options.lua b/lua/custom/options.lua index c12ba5c3..0c376db4 100644 --- a/lua/custom/options.lua +++ b/lua/custom/options.lua @@ -4,3 +4,4 @@ vim.opt.smarttab = true -- Enable smarttab vim.opt.expandtab = true -- Convert tabs to spaces vim.opt.smartindent = true -- Enable smart indentation vim.opt.autoindent = true -- Enable auto indentation +vim.opt.relativenumber = true