Dot_Files/.config/nvim/lua/core/mappings.lua

45 lines
1.0 KiB
Lua
Executable File

local utils_func = require('utils.funcs')
local map = utils_func.map
local M = {}
M.setup = function()
-- set mapleader to space
vim.g.mapleader = ' '
-- Get rid of highlight after search
map('n', '<esc>', ':noh<CR>')
-- Spell Checking
map('n', '<leader>st', ':set spell!<CR>')
-- Better split movement
map('n', '<C-l>', '<C-w>l')
map('n', '<C-h>', '<C-w>h')
map('n', '<C-k>', '<C-w>k')
map('n', '<C-j>', '<C-w>j')
-- Better split closing
map('n', '<C-x>', '<C-w>c')
-- Switch between tabs faster
map('n', '<C-s>', ':tabnext<CR>')
map('n', '<C-a>', ':tabprevious<CR>')
-- Set current focused file as cwd
map('n', '<leader>cd', ':cd %:p:h<CR>')
local diagnostics_active = true
map('n', '<leader>lt', '', {
callback = function()
diagnostics_active = not diagnostics_active
if diagnostics_active then
vim.diagnostic.show()
else
vim.diagnostic.hide()
end
end,
})
end
return M