This commit is contained in:
saarsena@gmail.com 2026-04-08 06:38:52 -04:00
commit 085347ddac
49 changed files with 1931 additions and 0 deletions

22
lua/config/autocmds.lua Normal file
View file

@ -0,0 +1,22 @@
-- [[ Autocommands ]]
-- See `:help lua-guide-autocommands`
-- Highlight when yanking (copying) text
vim.api.nvim_create_autocmd('TextYankPost', {
desc = 'Highlight when yanking (copying) text',
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
callback = function()
vim.hl.on_yank()
end,
})
-- Set indent for C/C++ to 2 spaces
vim.api.nvim_create_autocmd('FileType', {
pattern = { 'c', 'cpp' },
callback = function()
vim.bo.tabstop = 2
vim.bo.shiftwidth = 2
vim.bo.softtabstop = 2
vim.bo.expandtab = true
end,
})

61
lua/config/keymaps.lua Normal file
View 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' })

34
lua/config/options.lua Normal file
View file

@ -0,0 +1,34 @@
-- [[ Setting options ]]
-- See `:help vim.o`
vim.o.number = true
vim.o.relativenumber = true
vim.o.mouse = 'a'
vim.o.showmode = false
vim.o.completeopt = 'menuone,noinsert,noselect'
vim.schedule(function()
vim.o.clipboard = 'unnamedplus'
end)
vim.o.breakindent = true
vim.o.wrap = true
vim.o.linebreak = true
vim.o.undofile = true
vim.o.ignorecase = true
vim.o.smartcase = true
vim.o.signcolumn = 'yes'
vim.o.updatetime = 250
vim.o.timeoutlen = 300
vim.o.splitright = true
vim.o.splitbelow = true
vim.opt.cmdheight = 0
vim.o.list = true
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '' }
vim.o.inccommand = 'split'
vim.o.cursorline = true
vim.o.scrolloff = 10
vim.o.confirm = true
vim.opt.termguicolors = true