vim: only highlight number of current line

This commit is contained in:
Fernando Schauenburg 2022-09-26 19:21:32 +02:00
parent c1bea90524
commit 0b7989d4ab
2 changed files with 2 additions and 18 deletions

View file

@ -10,23 +10,6 @@ autocmd({'BufNewFile', 'BufRead'}, {
command = "setlocal path+=~/.config/nvim/lua includeexpr=substitute(v:fname,'\\\\.','/','g')" command = "setlocal path+=~/.config/nvim/lua includeexpr=substitute(v:fname,'\\\\.','/','g')"
}) })
autocmd('InsertEnter', {
desc = 'Disable `cursorline` when entering Insert mode.',
group = id,
pattern = '*',
callback = function(args)
vim.w.had_cursorline = vim.opt.cursorline:get()
vim.opt.cursorline = false
end
})
autocmd('InsertLeave', {
desc = 'Enable `cursorline` when leaving Insert mode (if it was set before entering).',
group = id,
pattern = '*',
callback = function(args) vim.opt.cursorline = vim.w.had_cursorline end
})
autocmd('TextYankPost', { autocmd('TextYankPost', {
desc = 'Briefly highlight yanked text.', desc = 'Briefly highlight yanked text.',
group = id, group = id,

View file

@ -66,7 +66,8 @@ set_options {
wrap = false, -- don't wrap long lines initially wrap = false, -- don't wrap long lines initially
textwidth = 79, -- maximum width for text being inserted textwidth = 79, -- maximum width for text being inserted
colorcolumn = '+1', -- highlight column after 'textwidth' colorcolumn = '+1', -- highlight column after 'textwidth'
cursorline = true, -- highlight the line of the cursor cursorline = true, -- highlight the line of the cursor...
cursorlineopt = 'number',-- ...but only the line number
showbreak = '', -- prefix for wrapped lines showbreak = '', -- prefix for wrapped lines
scrolloff = 3, -- min. # of lines above and below cursor scrolloff = 3, -- min. # of lines above and below cursor
sidescrolloff = 3, -- min. # of columns to left and right of cursor sidescrolloff = 3, -- min. # of columns to left and right of cursor