commit 025c9dc82af09274795437bcc7e42b6e49776ae3
parent 0f234ec6d26a5e8f0945e810e4d7659deba1220e
Author: Chris Bracken <chris@bracken.jp>
Date: Tue, 12 May 2026 14:16:36 +0900
nvim: merge colorscheme.lua into options.lua
It's not really a colour scheme so much as a bunch of UI options like
colorcolumn and text wrapping.
Diffstat:
3 files changed, 20 insertions(+), 36 deletions(-)
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
@@ -1,8 +1,7 @@
--- Core configuration options.
-require('config.options')
-
--- General key mappings.
-require('config.keymaps')
+require('config.options') -- Core configuration options.
+require('config.keymaps') -- General key mappings.
+require('config.snippets') -- Reusable code snippets.
+require('config.projects') -- Project-specific code.
-- Machine-local keymaps (if they exist).
local local_keymaps_path = vim.fn.expand('~/.local/config/nvim/lua/config/keymaps.lua')
@@ -10,14 +9,4 @@ if vim.fn.filereadable(local_keymaps_path) == 1 then
dofile(local_keymaps_path)
end
--- Colorschemes.
-require('config.colorscheme')
-
--- Reusable code snippets.
-require('config.snippets')
-
--- Project-specific code.
-require('config.projects')
-
--- Package manager.
-require('config.lazy')
+require('config.lazy') -- Package manager.
diff --git a/.config/nvim/lua/config/colorscheme.lua b/.config/nvim/lua/config/colorscheme.lua
@@ -1,20 +0,0 @@
-vim.opt.background = 'dark'
-if vim.fn.has('termguicolors') == 1 then
- vim.opt.cursorline = true -- Highlight cursor line, max column.
- vim.opt.termguicolors = true -- Enable 24-bit colour.
-
- vim.api.nvim_create_autocmd({ "WinEnter", "BufEnter" }, {
- callback = function()
- vim.opt_local.cursorline = true
- end,
- })
- vim.api.nvim_create_autocmd({ "WinLeave", "BufLeave" }, {
- callback = function()
- vim.opt_local.cursorline = false
- end,
- })
-
- -- Highlight over-length lines.
- vim.opt_local.colorcolumn = "80"
- vim.opt_local.textwidth = 80
-end
diff --git a/.config/nvim/lua/config/options.lua b/.config/nvim/lua/config/options.lua
@@ -37,3 +37,18 @@ for type, icon in pairs({ Error = "✘", Warn = "▲", Hint = "⚑", Info = "»"
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
end
+
+-- Set UI options.
+vim.opt.background = 'dark'
+vim.opt.termguicolors = true
+vim.opt.cursorline = true
+vim.opt.colorcolumn = "80"
+vim.opt.textwidth = 80
+
+-- Highlight cursor line only in the active window.
+vim.api.nvim_create_autocmd({ "WinEnter", "BufEnter", "WinLeave", "BufLeave" }, {
+ callback = function(ev)
+ local enable_cursorline = ev.event == "WinEnter" or ev.event == "BufEnter"
+ vim.opt_local.cursorline = enable_cursorline
+ end
+})