fix dashboard

This commit is contained in:
2025-02-14 17:34:12 -08:00
parent a9518b1718
commit c839993a25
8 changed files with 527 additions and 563 deletions

View File

@@ -2,43 +2,57 @@ local augroup = vim.api.nvim_create_augroup
local autocmd = vim.api.nvim_create_autocmd
-- Restore cursor position
local restore_cursor = augroup('RestoreCursor', { clear = true })
autocmd('BufReadPost', {
group = restore_cursor,
callback = function()
local mark = vim.api.nvim_buf_get_mark(0, '"')
local lcount = vim.api.nvim_buf_line_count(0)
if mark[1] > 0 and mark[1] <= lcount then
pcall(vim.api.nvim_win_set_cursor, 0, mark)
end
end,
local restore_cursor = augroup("RestoreCursor", { clear = true })
autocmd("BufReadPost", {
group = restore_cursor,
callback = function()
local mark = vim.api.nvim_buf_get_mark(0, '"')
local lcount = vim.api.nvim_buf_line_count(0)
if mark[1] > 0 and mark[1] <= lcount then
pcall(vim.api.nvim_win_set_cursor, 0, mark)
end
end,
})
-- Help and man pages in vertical split
local help_config = augroup('HelpConfig', { clear = true })
autocmd('FileType', {
group = help_config,
pattern = { 'help', 'man' },
command = 'wincmd L'
local help_config = augroup("HelpConfig", { clear = true })
autocmd("FileType", {
group = help_config,
pattern = { "help", "man" },
command = "wincmd L",
})
-- Terminal settings
local term_config = augroup('TermConfig', { clear = true })
autocmd('TermOpen', {
group = term_config,
pattern = '*',
command = 'setlocal nonumber norelativenumber'
local term_config = augroup("TermConfig", { clear = true })
autocmd("TermOpen", {
group = term_config,
pattern = "*",
command = "setlocal nonumber norelativenumber",
})
local highlight_yank = augroup('HighlightYank', { clear = true })
autocmd('TextYankPost', {
group = highlight_yank,
pattern = '*',
callback = function()
vim.highlight.on_yank({ higroup = "IncSearch", timeout = 420 })
end,
local highlight_yank = augroup("HighlightYank", { clear = true })
autocmd("TextYankPost", {
group = highlight_yank,
pattern = "*",
callback = function()
vim.highlight.on_yank({ higroup = "IncSearch", timeout = 420 })
end,
})
function disable_for_dashboard()
local buftype = vim.api.nvim_buf_get_option(0, "buftype")
local filetype = vim.api.nvim_buf_get_option(0, "filetype")
if buftype == "nofile" and filetype == "dashboard" then
vim.b.indent_blankline_enabled = false
end
end
vim.cmd([[
augroup IndentBlankline
autocmd!
autocmd FileType dashboard lua disable_for_dashboard()
augroup END
]])
-- Code actions on cursor hold
-- local code_action = augroup('CodeAction', { clear = true })
-- autocmd({ 'CursorHold', 'CursorHoldI' }, {
@@ -49,4 +63,3 @@ autocmd('TextYankPost', {
-- end
-- end
-- })