feat(config): add ghostty terminal and refactor neovim configuration
- 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
This commit is contained in:
@@ -1,51 +1,40 @@
|
||||
-- HELPERS ----------------------------------------------------
|
||||
local cmd = vim.cmd -- to execute Vim commands e.g. cmd('pwd')
|
||||
local fn = vim.fn -- to call Vim functions e.g. fn.bufnr()
|
||||
local g = vim.g -- a table to access global variables
|
||||
local scopes = {o = vim.o, b = vim.bo, w = vim.wo}
|
||||
local opt = vim.opt
|
||||
|
||||
-- SYNTAX & FILETYPE ------------------------------------------
|
||||
vim.cmd "syntax on"
|
||||
vim.cmd "filetype plugin indent on"
|
||||
|
||||
cmd "syntax on"
|
||||
-- 相對行號顯示
|
||||
-- cmd "set relativenumber"
|
||||
-- 絕對行號顯示
|
||||
-- cmd "set number"
|
||||
-- 混合模式,同時顯示相對行號和絕對行號
|
||||
cmd "set number relativenumber"
|
||||
cmd "set tabstop=2"
|
||||
cmd "set shiftwidth=2"
|
||||
cmd "set expandtab"
|
||||
cmd "set nofoldenable"
|
||||
-- BASIC SETTINGS ---------------------------------------------
|
||||
opt.number = true -- 顯示行號
|
||||
opt.relativenumber = true -- 顯示相對行號
|
||||
opt.tabstop = 2 -- Tab 寬度
|
||||
opt.shiftwidth = 2 -- 縮排寬度
|
||||
opt.expandtab = true -- 將 Tab 轉為空格
|
||||
opt.foldenable = false -- 預設不折疊
|
||||
|
||||
-- always show status
|
||||
cmd "set laststatus=2"
|
||||
opt.laststatus = 2 -- 始終顯示狀態列
|
||||
opt.ruler = true -- 顯示游標位置
|
||||
opt.cursorline = true -- 高亮當前行
|
||||
opt.cursorcolumn = true -- 高亮當前列
|
||||
opt.hlsearch = true -- 高亮搜尋結果
|
||||
opt.wrap = false -- 不自動換行
|
||||
|
||||
-- show cursor position
|
||||
cmd "set ruler"
|
||||
cmd "set cursorline"
|
||||
cmd "set cursorcolumn"
|
||||
cmd "set hlsearch"
|
||||
opt.backspace = { "indent", "eol", "start" }
|
||||
opt.encoding = "utf-8"
|
||||
opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
opt.swapfile = false -- 不產生 swap 檔案
|
||||
opt.mouse = "" -- 禁用滑鼠
|
||||
|
||||
-- no wrap line
|
||||
cmd "set nowrap"
|
||||
opt.background = "dark"
|
||||
|
||||
-- enable backspace
|
||||
cmd "set backspace=indent,eol,start"
|
||||
cmd "set encoding=utf-8"
|
||||
cmd "set completeopt=menu,menuone,noselect"
|
||||
cmd "set noswapfile"
|
||||
cmd "set mouse="
|
||||
|
||||
cmd "set background=dark"
|
||||
|
||||
cmd "filetype indent on"
|
||||
cmd "filetype on"
|
||||
cmd "filetype plugin on"
|
||||
-- 自動命令 (Auto-commands) -----------------------------------
|
||||
|
||||
-- 處理配色方案與背景透明度
|
||||
vim.api.nvim_create_autocmd("ColorScheme", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
cmd([[
|
||||
vim.cmd([[
|
||||
highlight clear CursorLine
|
||||
highlight Normal ctermbg=none
|
||||
highlight LineNr ctermbg=none
|
||||
@@ -58,17 +47,16 @@ vim.api.nvim_create_autocmd("ColorScheme", {
|
||||
end,
|
||||
})
|
||||
|
||||
-- chezmoi 自動套用
|
||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
pattern = "~/.local/share/chezmoi/*",
|
||||
pattern = vim.fn.expand("~/.local/share/chezmoi/*"),
|
||||
command = [[ ! chezmoi apply --source-path % ]],
|
||||
})
|
||||
|
||||
vim.diagnostic.get(0, { severity = {
|
||||
vim.diagnostic.severity.ERROR,
|
||||
vim.diagnostic.severity.WARN,
|
||||
} })
|
||||
vim.diagnostic.config({virtual_text = false, signs = true})
|
||||
-- 診斷設定
|
||||
vim.diagnostic.config({ virtual_text = false, signs = true })
|
||||
|
||||
-- 特定語言設定
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "rust",
|
||||
callback = function()
|
||||
|
||||
Reference in New Issue
Block a user