2022-05-11 21:00:57 -05:00
|
|
|
local utils_func = require('utils.funcs')
|
2022-02-24 02:51:02 -06:00
|
|
|
local map = utils_func.map
|
2022-01-10 09:55:15 -06:00
|
|
|
local M = {}
|
|
|
|
|
|
|
|
M.setup = function()
|
2022-05-11 21:00:57 -05:00
|
|
|
-- set mapleader to space
|
|
|
|
vim.g.mapleader = ' '
|
2022-01-10 09:55:15 -06:00
|
|
|
|
2022-05-11 21:00:57 -05:00
|
|
|
-- Get rid of highlight after search
|
|
|
|
map('n', '<esc>', ':noh<CR>')
|
2022-01-27 23:53:45 -06:00
|
|
|
|
|
|
|
-- Spell Checking
|
2022-05-11 21:00:57 -05:00
|
|
|
map('n', '<leader>st', ':set spell!<CR>')
|
2022-01-27 23:53:45 -06:00
|
|
|
|
2022-02-05 02:56:46 -06:00
|
|
|
-- Better split movement
|
2022-05-11 21:00:57 -05:00
|
|
|
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')
|
2022-02-05 02:56:46 -06:00
|
|
|
|
|
|
|
-- Better split closing
|
2022-05-11 21:00:57 -05:00
|
|
|
map('n', '<C-x>', '<C-w>c')
|
2022-02-05 02:56:46 -06:00
|
|
|
|
2022-06-28 13:09:38 -05:00
|
|
|
-- Switch between tabs faster
|
|
|
|
map('n', '<C-s>', ':tabnext<CR>')
|
|
|
|
map('n', '<C-a>', ':tabprevious<CR>')
|
|
|
|
|
2022-03-09 14:18:01 -06:00
|
|
|
-- Set current focused file as cwd
|
2022-05-11 21:00:57 -05:00
|
|
|
map('n', '<leader>cd', ':cd %:p:h<CR>')
|
2022-05-22 03:55:41 -05:00
|
|
|
|
|
|
|
local diagnostics_active = true
|
|
|
|
map('n', '<leader>lt', '', {
|
|
|
|
callback = function()
|
|
|
|
diagnostics_active = not diagnostics_active
|
|
|
|
if diagnostics_active then
|
2022-06-19 20:33:04 -05:00
|
|
|
vim.diagnostic.show()
|
2022-05-22 03:55:41 -05:00
|
|
|
else
|
2022-06-19 20:33:04 -05:00
|
|
|
vim.diagnostic.hide()
|
2022-05-22 03:55:41 -05:00
|
|
|
end
|
|
|
|
end,
|
|
|
|
})
|
2022-01-10 09:55:15 -06:00
|
|
|
end
|
|
|
|
|
|
|
|
return M
|