woohooo
This commit is contained in:
commit
085347ddac
49 changed files with 1931 additions and 0 deletions
61
lua/config/keymaps.lua
Normal file
61
lua/config/keymaps.lua
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
-- [[ Basic Keymaps ]]
|
||||
-- See `:help vim.keymap.set()`
|
||||
|
||||
-- Clear highlights on search when pressing <Esc> in normal mode
|
||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
||||
|
||||
-- Toggle spell check
|
||||
vim.keymap.set('n', '<leader>ts', function()
|
||||
vim.o.spell = not vim.o.spell
|
||||
print(vim.o.spell and 'Spell check enabled' or 'Spell check disabled')
|
||||
end, { desc = '[T]oggle [S]pell check' })
|
||||
|
||||
-- Toggle word wrap
|
||||
vim.keymap.set('n', '<leader>tw', function()
|
||||
vim.o.wrap = not vim.o.wrap
|
||||
vim.cmd 'redraw'
|
||||
print(vim.o.wrap and 'Wrap enabled' or 'Wrap disabled')
|
||||
end, { desc = '[T]oggle [W]rap' })
|
||||
|
||||
-- Toggle colorcolumn
|
||||
vim.keymap.set('n', '<leader>tc', function()
|
||||
if vim.wo.colorcolumn == '' then
|
||||
vim.wo.colorcolumn = '80'
|
||||
else
|
||||
vim.wo.colorcolumn = ''
|
||||
end
|
||||
end, { desc = '[T]oggle [C]olorcolumn' })
|
||||
|
||||
-- Set colorcolumn to a specific value
|
||||
vim.keymap.set('n', '<leader>cc', function()
|
||||
local col = vim.fn.input 'Set colorcolumn to: '
|
||||
if col ~= '' then
|
||||
vim.wo.colorcolumn = col
|
||||
vim.bo.textwidth = tonumber(col) or 80
|
||||
end
|
||||
end, { desc = 'Set [C]olor[c]olumn width' })
|
||||
|
||||
-- Toggle textwidth auto-wrapping
|
||||
vim.keymap.set('n', '<leader>tt', function()
|
||||
if vim.bo.textwidth == 0 then
|
||||
local cc = vim.wo.colorcolumn
|
||||
local width = tonumber(cc) or 80
|
||||
vim.bo.textwidth = width
|
||||
print('Textwidth enabled (' .. width .. ')')
|
||||
else
|
||||
vim.bo.textwidth = 0
|
||||
print 'Textwidth disabled'
|
||||
end
|
||||
end, { desc = '[T]oggle [T]extwidth auto-wrap' })
|
||||
|
||||
-- Exit terminal mode
|
||||
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
|
||||
|
||||
-- Window navigation
|
||||
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
|
||||
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
|
||||
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
||||
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
||||
Loading…
Add table
Add a link
Reference in a new issue