diff options
| author | steven-na <noreply.github@stvnc.dev> | 2026-04-30 16:27:31 -0700 |
|---|---|---|
| committer | steven-na <noreply.github@stvnc.dev> | 2026-04-30 16:27:31 -0700 |
| commit | 424e2ba2243655a70aa3b96fc383e9632a65c7bc (patch) | |
| tree | 374b2cbc7f32fbb1d3541330189e6bd6f7c7c4c6 /arch | |
| parent | 31a03ba3ea9545737543efb5d03e020aa793ef5c (diff) | |
Scrolloff on top and colorscheme
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/nvim/.config/nvim/lua/options.lua | 2 | ||||
| -rw-r--r-- | arch/nvim/.config/nvim/lua/plugins/colorscheme.lua | 73 | ||||
| -rw-r--r-- | arch/nvim/.config/nvim/lua/plugins/extras.lua | 53 | ||||
| -rw-r--r-- | arch/nvim/.config/nvim/lua/plugins/fzf.lua | 26 | ||||
| -rw-r--r-- | arch/nvim/.config/nvim/lua/plugins/ui.lua | 37 |
5 files changed, 136 insertions, 55 deletions
diff --git a/arch/nvim/.config/nvim/lua/options.lua b/arch/nvim/.config/nvim/lua/options.lua index 9a97b4b..6d53af3 100644 --- a/arch/nvim/.config/nvim/lua/options.lua +++ b/arch/nvim/.config/nvim/lua/options.lua @@ -12,7 +12,7 @@ opt.softtabstop = 4 -- Visual opt.cursorline = true -opt.scrolloff = 10 +opt.scrolloff = 20 opt.signcolumn = "yes" opt.list = true opt.listchars = { tab = " ", trail = "·", nbsp = "␣" } diff --git a/arch/nvim/.config/nvim/lua/plugins/colorscheme.lua b/arch/nvim/.config/nvim/lua/plugins/colorscheme.lua index 8198402..1a583f4 100644 --- a/arch/nvim/.config/nvim/lua/plugins/colorscheme.lua +++ b/arch/nvim/.config/nvim/lua/plugins/colorscheme.lua @@ -7,11 +7,21 @@ return { local palette_path = vim.fn.expand("~/.cache/wallust/nvim.lua") local fallback = { - base00 = "#1e1e2e", base01 = "#181825", base02 = "#313244", - base03 = "#45475a", base04 = "#585b70", base05 = "#cdd6f4", - base06 = "#f5c2e7", base07 = "#b4befe", base08 = "#f38ba8", - base09 = "#fab387", base0A = "#f9e2af", base0B = "#a6e3a1", - base0C = "#94e2d5", base0D = "#89b4fa", base0E = "#cba6f7", + base00 = "#1e1e2e", + base01 = "#181825", + base02 = "#313244", + base03 = "#45475a", + base04 = "#585b70", + base05 = "#cdd6f4", + base06 = "#f5c2e7", + base07 = "#b4befe", + base08 = "#f38ba8", + base09 = "#fab387", + base0A = "#f9e2af", + base0B = "#a6e3a1", + base0C = "#94e2d5", + base0D = "#89b4fa", + base0E = "#cba6f7", base0F = "#f2cdcd", } @@ -21,14 +31,27 @@ return { end local transparent_groups = { - "Normal", "NormalNC", "NormalFloat", - "SignColumn", "FoldColumn", "EndOfBuffer", - "LineNr", "CursorLineNr", "CursorLine", - "StatusLine", "StatusLineNC", - "TabLine", "TabLineFill", "TabLineSel", - "VertSplit", "WinSeparator", - "Pmenu", "PmenuSbar", "PmenuThumb", - "FloatBorder", "FloatTitle", + "Normal", + "NormalNC", + "NormalFloat", + "SignColumn", + "FoldColumn", + "EndOfBuffer", + "LineNr", + "CursorLineNr", + "CursorLine", + "StatusLine", + "StatusLineNC", + "TabLine", + "TabLineFill", + "TabLineSel", + "VertSplit", + "WinSeparator", + "Pmenu", + "PmenuSbar", + "PmenuThumb", + "FloatBorder", + "FloatTitle", } local function apply_transparent() @@ -39,10 +62,16 @@ return { local function apply(palette) require("mini.base16").setup({ palette = palette }) - vim.api.nvim_set_hl(0, "LineNr", { fg = palette.base05 }) - vim.api.nvim_set_hl(0, "LineNrAbove", { fg = palette.base05 }) - vim.api.nvim_set_hl(0, "LineNrBelow", { fg = palette.base05 }) + vim.api.nvim_set_hl(0, "LineNr", { fg = palette.base05 }) + vim.api.nvim_set_hl(0, "LineNrAbove", { fg = palette.base05 }) + vim.api.nvim_set_hl(0, "LineNrBelow", { fg = palette.base05 }) vim.api.nvim_set_hl(0, "CursorLineNr", { fg = palette.base03, bold = true }) + vim.api.nvim_set_hl(0, "SignColumn", { bg = palette.base00 }) + vim.api.nvim_set_hl(0, "CursorLineSign", { bg = palette.base00 }) + vim.api.nvim_set_hl(0, "DiagnosticSignError", { fg = palette.base08, bg = palette.base00 }) + vim.api.nvim_set_hl(0, "DiagnosticSignWarn", { fg = palette.base0A, bg = palette.base00 }) + vim.api.nvim_set_hl(0, "DiagnosticSignInfo", { fg = palette.base0D, bg = palette.base00 }) + vim.api.nvim_set_hl(0, "DiagnosticSignHint", { fg = palette.base0C, bg = palette.base00 }) if vim.g.transparent_bg then apply_transparent() end @@ -54,12 +83,15 @@ return { -- Watch wallust output file and reload automatically local watcher = vim.uv.new_fs_event() if watcher then - watcher:start(palette_path, {}, vim.schedule_wrap(function() - apply(load_palette()) - end)) + watcher:start( + palette_path, + {}, + vim.schedule_wrap(function() + apply(load_palette()) + end) + ) end - -- Toggle: wipe background colors so the terminal bg shows through vim.keymap.set("n", "<leader>tt", function() vim.g.transparent_bg = not vim.g.transparent_bg if vim.g.transparent_bg then @@ -69,6 +101,7 @@ return { apply(load_palette()) vim.notify("Background: colorscheme", vim.log.levels.INFO) end + vim.api.nvim_exec_autocmds("User", { pattern = "TransparentToggle" }) end, { desc = "Toggle transparent background" }) end, } diff --git a/arch/nvim/.config/nvim/lua/plugins/extras.lua b/arch/nvim/.config/nvim/lua/plugins/extras.lua index 0194f45..c3f2492 100644 --- a/arch/nvim/.config/nvim/lua/plugins/extras.lua +++ b/arch/nvim/.config/nvim/lua/plugins/extras.lua @@ -38,15 +38,64 @@ return { "nullromo/go-up.nvim", opts = { respectScrolloff = true, + goUpLimit = "center", + ignoredFiletypes = { + "oil", + "snacks_dashboard", + }, }, -- specify options here config = function(_, opts) local goUp = require("go-up") goUp.setup(opts) - -- Use <C-a> to center - vim.keymap.set({ "n", "v" }, "<C-a>", function() + -- Use <C-r> to center + vim.keymap.set({ "n", "v" }, "<C-r>", function() require("go-up").centerScreen() end, { desc = "center the screen" }) + + vim.o.scrolloff = 0 -- disable native, we handle it entirely + vim.opt.fillchars:append({ eob = " " }) + + local SCROLLOFF = 20 -- your desired value + + vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI", "BufEnter" }, { + group = vim.api.nvim_create_augroup("ScrollOffEOF", { clear = true }), + callback = function() + local win_h = vim.api.nvim_win_get_height(0) + local off = math.min(SCROLLOFF, math.floor(win_h / 2)) + local line = vim.fn.line(".") + local last = vim.fn.line("$") + local winline = vim.fn.winline() + + -- Near top: scroll into go-up virtual lines (Ctrl-Y) + if line <= off then + local needed = off - winline + 1 + if needed > 0 then + vim.cmd('execute "normal! ' .. needed .. '\025"') + return + end + end + + -- Near bottom / EOF: scroll past last line (winrestview) + local dist_bot = last - line + local rem = vim.fn.line("w$") - vim.fn.line("w0") + 1 + if dist_bot < off and win_h - rem + dist_bot < off then + local view = vim.fn.winsaveview() + view.topline = view.topline + off - (win_h - rem + dist_bot) + vim.fn.winrestview(view) + return + end + + -- Middle: replicate normal scrolloff behavior + if winline > win_h - off then + -- too close to bottom of window, scroll down (Ctrl-E) + vim.cmd('execute "normal! ' .. (winline - (win_h - off)) .. '\005"') + elseif winline < off + 1 then + -- too close to top of window, scroll up (Ctrl-Y) + vim.cmd('execute "normal! ' .. (off + 1 - winline) .. '\025"') + end + end, + }) end, }, } diff --git a/arch/nvim/.config/nvim/lua/plugins/fzf.lua b/arch/nvim/.config/nvim/lua/plugins/fzf.lua index e507348..14b9407 100644 --- a/arch/nvim/.config/nvim/lua/plugins/fzf.lua +++ b/arch/nvim/.config/nvim/lua/plugins/fzf.lua @@ -2,22 +2,28 @@ return { "ibhagwan/fzf-lua", cmd = "FzfLua", keys = { - { "<leader>ff", "<cmd>FzfLua files<CR>", desc = "Find files" }, - { "<leader>fg", "<cmd>FzfLua live_grep<CR>", desc = "Live grep" }, - { "<leader>fb", "<cmd>FzfLua buffers<CR>", desc = "Buffers" }, - { "<leader>fs", "<cmd>FzfLua grep_cword<CR>", desc = "Grep word under cursor" }, - { "<leader>fr", "<cmd>FzfLua oldfiles<CR>", desc = "Recent files" }, - { "<leader>fc", "<cmd>FzfLua commands<CR>", desc = "Commands" }, + { "<leader>ff", "<cmd>FzfLua files<CR>", desc = "Find files" }, + { "<leader>fg", "<cmd>FzfLua live_grep<CR>", desc = "Live grep" }, + { "<leader>fb", "<cmd>FzfLua buffers<CR>", desc = "Buffers" }, + { "<leader>fs", "<cmd>FzfLua grep_cword<CR>", desc = "Grep word under cursor" }, + { "<leader>fr", "<cmd>FzfLua oldfiles<CR>", desc = "Recent files" }, + { "<leader>fc", "<cmd>FzfLua commands<CR>", desc = "Commands" }, { "<leader>fd", "<cmd>FzfLua diagnostics_document<CR>", desc = "Document diagnostics" }, - { "<leader>/", "<cmd>FzfLua blines<CR>", desc = "Search current buffer" }, + { "<leader>/", "<cmd>FzfLua blines<CR>", desc = "Search current buffer" }, }, opts = { winopts = { - height = 0.6, - width = 0.8, - border = "single", + height = 0.6, + width = 0.8, + border = "single", preview = { border = "single" }, }, fzf_opts = { ["--cycle"] = true }, + grep = { + rg_opts = "--hidden --follow --glob '!.git' --column --line-number --no-heading --color=always", + }, + files = { + rg_opts = "--files --hidden --follow --glob '!.git'", + }, }, } diff --git a/arch/nvim/.config/nvim/lua/plugins/ui.lua b/arch/nvim/.config/nvim/lua/plugins/ui.lua index cada32c..c2fc2eb 100644 --- a/arch/nvim/.config/nvim/lua/plugins/ui.lua +++ b/arch/nvim/.config/nvim/lua/plugins/ui.lua @@ -8,6 +8,7 @@ return { local ok, p = pcall(dofile, vim.fn.expand("~/.cache/wallust/nvim.lua")) if not ok then p = { + base01 = "#181825", base0D = "#89b4fa", base05 = "#cdd6f4", base04 = "#585b70", @@ -17,20 +18,21 @@ return { base0A = "#f9e2af", } end + local bg = vim.g.transparent_bg and "NONE" or p.base01 return { normal = { - a = { fg = p.base0D, bg = "NONE", gui = "bold" }, - b = { fg = p.base05, bg = "NONE" }, - c = { fg = p.base04, bg = "NONE" }, + a = { fg = p.base0D, bg = bg, gui = "bold" }, + b = { fg = p.base05, bg = bg }, + c = { fg = p.base04, bg = bg }, }, - insert = { a = { fg = p.base0B, bg = "NONE", gui = "bold" } }, - visual = { a = { fg = p.base0E, bg = "NONE", gui = "bold" } }, - replace = { a = { fg = p.base08, bg = "NONE", gui = "bold" } }, - command = { a = { fg = p.base0A, bg = "NONE", gui = "bold" } }, + insert = { a = { fg = p.base0B, bg = bg, gui = "bold" } }, + visual = { a = { fg = p.base0E, bg = bg, gui = "bold" } }, + replace = { a = { fg = p.base08, bg = bg, gui = "bold" } }, + command = { a = { fg = p.base0A, bg = bg, gui = "bold" } }, inactive = { - a = { fg = p.base04, bg = "NONE" }, - b = { fg = p.base04, bg = "NONE" }, - c = { fg = p.base04, bg = "NONE" }, + a = { fg = p.base04, bg = bg }, + b = { fg = p.base04, bg = bg }, + c = { fg = p.base04, bg = bg }, }, } end @@ -52,25 +54,16 @@ return { }, }) - vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI", "BufEnter" }, { - group = vim.api.nvim_create_augroup("ScrollOffEOF", {}), + vim.api.nvim_create_autocmd("User", { + pattern = "TransparentToggle", callback = function() - local win_h = vim.api.nvim_win_get_height(0) - local off = math.min(vim.o.scrolloff, math.floor(win_h / 2)) - local dist = vim.fn.line("$") - vim.fn.line(".") - local rem = vim.fn.line("w$") - vim.fn.line("w0") + 1 - if dist < off and win_h - rem + dist < off then - local view = vim.fn.winsaveview() - view.topline = view.topline + off - (win_h - rem + dist) - vim.fn.winrestview(view) - end + require("lualine").setup({ options = { theme = make_theme() } }) end, }) vim.api.nvim_create_autocmd("ColorScheme", { callback = function() require("lualine").setup({ options = { theme = make_theme() } }) - vim.o.laststatus = 0 end, }) end, |