This commit is contained in:
Harivansh Rathi 2026-03-12 19:06:07 -04:00
parent 02c996d21a
commit 28622332a3
83 changed files with 6969 additions and 57 deletions

View file

@ -0,0 +1,31 @@
local api = vim.api
local augroup = api.nvim_create_augroup('UserAutocmds', { clear = true })
api.nvim_create_autocmd('TextYankPost', {
group = augroup,
callback = function()
vim.highlight.on_yank({ higroup = 'Visual', timeout = 200 })
end,
})
api.nvim_create_autocmd('BufReadPost', {
group = augroup,
callback = function()
if ({ gitcommit = true, gitrebase = true })[vim.bo.filetype] then
return
end
local mark = api.nvim_buf_get_mark(0, '"')
if mark[1] > 0 and mark[1] <= api.nvim_buf_line_count(0) then
pcall(api.nvim_win_set_cursor, 0, mark)
end
end,
})
api.nvim_create_autocmd('VimResized', {
group = augroup,
callback = function()
local tab = vim.fn.tabpagenr()
vim.cmd('tabdo wincmd =')
vim.cmd('tabnext ' .. tab)
end,
})

View file

@ -0,0 +1,21 @@
map('n', '<leader>w', '<cmd>w<cr>')
map('n', '<leader>q', '<cmd>q<cr>')
map('n', '<C-g>', '<cmd>Git<cr><cmd>only<cr>')
map('n', '<Tab>', '<cmd>bnext<cr>')
map('n', '<S-Tab>', '<cmd>bprev<cr>')
map('n', '<leader>x', '<cmd>bdelete<cr>')
map('n', '<leader>b', '<cmd>enew<cr>')
map('n', '<C-h>', '<C-w>h')
map('n', '<C-j>', '<C-w>j')
map('n', '<C-k>', '<C-w>k')
map('n', '<C-l>', '<C-w>l')
map('n', 'J', 'mzJ`z')
map('x', 'x', '"_x')
map('x', 'p', '"_dP')
map('n', '<Esc>', '<cmd>nohlsearch<cr>')
map('n', '<leader>t', '<cmd>setlocal wrap!<cr>')
map('t', '<Esc>', '<C-\\><C-n>')

View file

@ -0,0 +1,42 @@
local o, opt = vim.o, vim.opt
o.number = true
o.relativenumber = true
o.tabstop = 2
o.shiftwidth = 2
o.expandtab = true
o.smartindent = true
o.breakindent = true
o.ignorecase = true
o.smartcase = true
o.hlsearch = false
o.incsearch = true
o.termguicolors = true
o.scrolloff = 8
o.signcolumn = 'yes'
o.wrap = false
o.showmode = false
o.laststatus = 3
o.cmdheight = 0
opt.fillchars = { vert = '|', fold = '-', foldsep = '|', diff = '-' }
opt.shortmess:append('S')
o.splitbelow = true
o.splitright = true
o.swapfile = false
o.backup = false
o.undofile = true
o.undodir = vim.fn.stdpath('data') .. '/undo'
o.foldlevel = 99
o.foldlevelstart = 99
o.foldenable = true
o.updatetime = 250
o.mouse = 'a'
o.clipboard = 'unnamedplus'