Neovim/lua/keymaps.lua

26 lines
811 B
Lua

-- Custom keymaps
local map = vim.keymap.set
-- save file on <STRG + S>
map({ "i", "x", "n", "s" }, "<C-s>", "<cmd>w<cr><esc>", { desc = "Save file" })
-- new file
map("n", "<C-t>", "<cmd>enew<cr>", { desc = "New File" })
map({ 'n', 'i' }, '<C-z>', '<cmd>u<CR>') -- undo with STRG + z
map({ 'n', 'i' }, '<C-y>', '<cmd>redo<CR>') -- redo with STRG + y
-- Shift + Tab remove one tab
map({ 'n', 'i' }, '<S-tab>', '<cmd><<CR>')
map({ 'n', 'i' }, '<C-g>', '<cmd>Telescope<CR>', { noremap = true })
-- Scroll sideways with Shift + Scrollwheel like in browsers/other text editors
map({ 'n', 'i' }, '<S-ScrollWheelUp>', '<ScrollWheelLeft>', { noremap = true })
map({ 'n', 'i' }, '<S-ScrollWheelDown>', '<ScrollWheelRight>', { noremap = true })
map({ 'n' }, "q", "<cmd>bd<CR>", { desc = "Close buffer" })