- Add ghostty terminal configuration with custom themes and settings - Add multiple color themes (ayu-dark, catppuccin variants, moonfly) - Configure ghostty appearance: font, opacity, keybindings - Refactor nvim basic setup to use modern vim.opt API - Modernize LSP configuration with LspAttach autocmd - Update nvim-tree configuration for latest API - Simplify codecompanion plugin setup - Pin nvim-treesitter to main branch - Improve sway-dbus script with XDG runtime checks
67 lines
2.0 KiB
Lua
67 lines
2.0 KiB
Lua
-- HELPERS ----------------------------------------------------
|
|
local opt = vim.opt
|
|
|
|
-- SYNTAX & FILETYPE ------------------------------------------
|
|
vim.cmd "syntax on"
|
|
vim.cmd "filetype plugin indent on"
|
|
|
|
-- BASIC SETTINGS ---------------------------------------------
|
|
opt.number = true -- 顯示行號
|
|
opt.relativenumber = true -- 顯示相對行號
|
|
opt.tabstop = 2 -- Tab 寬度
|
|
opt.shiftwidth = 2 -- 縮排寬度
|
|
opt.expandtab = true -- 將 Tab 轉為空格
|
|
opt.foldenable = false -- 預設不折疊
|
|
|
|
opt.laststatus = 2 -- 始終顯示狀態列
|
|
opt.ruler = true -- 顯示游標位置
|
|
opt.cursorline = true -- 高亮當前行
|
|
opt.cursorcolumn = true -- 高亮當前列
|
|
opt.hlsearch = true -- 高亮搜尋結果
|
|
opt.wrap = false -- 不自動換行
|
|
|
|
opt.backspace = { "indent", "eol", "start" }
|
|
opt.encoding = "utf-8"
|
|
opt.completeopt = { "menu", "menuone", "noselect" }
|
|
opt.swapfile = false -- 不產生 swap 檔案
|
|
opt.mouse = "" -- 禁用滑鼠
|
|
|
|
opt.background = "dark"
|
|
|
|
-- 自動命令 (Auto-commands) -----------------------------------
|
|
|
|
-- 處理配色方案與背景透明度
|
|
vim.api.nvim_create_autocmd("ColorScheme", {
|
|
pattern = "*",
|
|
callback = function()
|
|
vim.cmd([[
|
|
highlight clear CursorLine
|
|
highlight Normal ctermbg=none
|
|
highlight LineNr ctermbg=none
|
|
highlight Folded ctermbg=none
|
|
highlight NonText ctermbg=none
|
|
highlight SpecialKey ctermbg=none
|
|
highlight VertSplit ctermbg=none
|
|
highlight SignColumn ctermbg=none
|
|
]])
|
|
end,
|
|
})
|
|
|
|
-- chezmoi 自動套用
|
|
vim.api.nvim_create_autocmd("BufWritePost", {
|
|
pattern = vim.fn.expand("~/.local/share/chezmoi/*"),
|
|
command = [[ ! chezmoi apply --source-path % ]],
|
|
})
|
|
|
|
-- 診斷設定
|
|
vim.diagnostic.config({ virtual_text = false, signs = true })
|
|
|
|
-- 特定語言設定
|
|
vim.api.nvim_create_autocmd("FileType", {
|
|
pattern = "rust",
|
|
callback = function()
|
|
vim.opt_local.shiftwidth = 4
|
|
vim.opt_local.tabstop = 4
|
|
end
|
|
})
|