remap escape

This commit is contained in:
Andrzej Stepien 2024-03-15 12:40:59 +01:00
parent ba309b39b3
commit 2204a1f0cf
1 changed files with 8 additions and 9 deletions

View File

@ -1,22 +1,21 @@
function map(mode, lhs, rhs, opts) function map(mode, lhs, rhs, opts)
local options = { noremap = true, silent = true } local options = { noremap = true, silent = true }
if opts then if opts then
options = vim.tbl_extend("force", options, opts) options = vim.tbl_extend("force", options, opts)
end end
vim.keymap.set(mode, lhs, rhs, options) vim.keymap.set(mode, lhs, rhs, options)
end end
--This code just maps vim.keymap.set() to something easier to type. Also, typing { noremap = true, silent = true } wont be needed, because that is also implemented in the function. --This code just maps vim.keymap.set() to something easier to type. Also, typing { noremap = true, silent = true } wont be needed, because that is also implemented in the function.
vim.g.mapleader = " " vim.g.mapleader = " "
map("i", "jk", "<esc>") -- remap escape
map("n", "<leader>+", ":bNext<cr>") --switch tabs map("n", "<leader>+", ":bNext<cr>") --switch tabs
map("n", "<leader>n", ":Neotree toggle<cr>") --open Nerdtree map("n", "<leader>n", ":Neotree toggle<cr>") --open Nerdtree
map("n", "<leader>z", ":ZenMode<cr>") --open ZenMode (distraction-free) map("n", "<leader>z", ":ZenMode<cr>") --open ZenMode (distraction-free)
map("n", "<leader>d", ":ToggleDiag<cr>") -- toggle all diagnostics map("n", "<leader>d", ":ToggleDiag<cr>") -- toggle all diagnostics
-- vim.api.nvim_create_autocmd('LspAttach', { -- vim.api.nvim_create_autocmd('LspAttach', {
-- desc = 'LSP actions', -- desc = 'LSP actions',
-- callback = function() -- callback = function()