move old nvim config

This commit is contained in:
Barrett Ruth 2026-02-10 18:44:55 -05:00
parent c9ae53e233
commit e7740e9989
27 changed files with 492 additions and 704 deletions

View file

@ -7,6 +7,28 @@ au('BufEnter', {
group = aug,
})
au('BufWritePost', {
pattern = (vim.env.XDG_CONFIG_HOME or (vim.env.HOME .. '/.config'))
.. '/firefox/userChrome.css',
callback = function()
if not vim.tbl_contains({ 'firefox', 'zen-browser' }, vim.env.BROWSER) then
return
end
vim.notify(
'Updating firefox-based browser userChrome.css...',
vim.log.levels.INFO
)
local src = (vim.env.XDG_CONFIG_HOME or (vim.env.HOME .. '/.config'))
.. '/firefox/userChrome.css'
local targets =
vim.fn.glob(vim.env.HOME .. '/.zen/*release*/chrome', true, true)
for _, dir in ipairs(targets) do
vim.fn.system({ 'cp', '-f', src, dir .. '/userChrome.css' })
end
end,
group = aug,
})
au({ 'TermOpen', 'BufWinEnter' }, {
callback = function(args)
if vim.bo[args.buf].buftype == 'terminal' then
@ -18,7 +40,6 @@ au({ 'TermOpen', 'BufWinEnter' }, {
group = aug,
})
-- TODO: out of date (config no longer in $XDG_CONFIG_HOME/nvim)
au('BufWritePost', {
pattern = (
os.getenv('XDG_CONFIG_HOME') or (os.getenv('HOME') .. '/.config')
@ -61,16 +82,16 @@ au({ 'FocusLost', 'BufLeave', 'VimLeave' }, {
group = aug,
})
au({ 'VimEnter', 'BufWinEnter', 'BufEnter' }, {
callback = function()
vim.api.nvim_set_option_value('cursorline', true, { scope = 'local' })
end,
vim.api.nvim_create_autocmd('WinEnter', {
group = aug,
callback = function()
vim.wo.cursorline = true
end,
})
au('WinLeave', {
callback = function()
vim.api.nvim_set_option_value('cursorline', false, { scope = 'local' })
end,
vim.api.nvim_create_autocmd('WinLeave', {
group = aug,
callback = function()
vim.wo.cursorline = false
end,
})

View file

@ -0,0 +1,30 @@
local api = vim.api
local ns = api.nvim_create_namespace('highlight_undo')
api.nvim_set_hl(0, 'HighlightUndo', { link = 'IncSearch', default = true })
for _, key in ipairs({ 'u', '<C-r>', 'U' }) do
vim.keymap.set('n', key, function()
api.nvim_buf_attach(0, false, {
on_bytes = function(_, buf, _, sr, sc, _, _, _, _, ner, nec)
local er, ec = sr + ner, sc + nec
if er >= api.nvim_buf_line_count(buf) then
ec = #(api.nvim_buf_get_lines(buf, -2, -1, false)[1] or '')
end
vim.schedule(function()
if not api.nvim_buf_is_valid(buf) then
return
end
vim.hl.range(buf, ns, 'HighlightUndo', { sr, sc }, { er, ec })
vim.defer_fn(function()
if api.nvim_buf_is_valid(buf) then
api.nvim_buf_clear_namespace(buf, ns, 0, -1)
end
end, 300)
end)
return true
end,
})
return key
end, { expr = true })
end

View file

@ -2,8 +2,23 @@ local o, opt = vim.o, vim.opt
o.autowrite = true
local f, background = io.open(vim.env.HOME .. '/.zshenv', 'r'), 'light'
if f then
local content = f:read('*a')
f:close()
local theme = content:match('export THEME=(%S+)')
background = theme
elseif vim.env.THEME then
background = vim.env.THEME
end
o.background = background == 'daylight' and 'light' or 'dark'
o.breakindent = true
o.cursorline = true
o.cmdheight = 0
o.conceallevel = 0
opt.diffopt:append('linematch:60')