dotfiles/home/dot_config/nvim/lua/basic/setup.lua
jay 1dd35ed47a Refactor: Update neovim configuration
This commit refactors the neovim configuration to include several updates:

-   Added LSP support for Zig (`zls`).
-   Added `analyzer` and `zls` to `ale` linters.
-   Added `zigfmt` to `ale` fixers.
-   Added `towolf/vim-helm` as a plugin.
-   Added configuration for `lualine` to display Treesitter status.
-   Included SSH config from `conf.d/*.conf`.
-   Updated keymaps for LSP formatting.
-   Modified tabwidth and shiftwidth for rust files.
2025-04-07 12:24:11 +08:00

74 lines
1.7 KiB
Lua

-- 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}
cmd "syntax on"
cmd "set number"
cmd "set tabstop=2"
cmd "set shiftwidth=2"
cmd "set expandtab"
cmd "set nofoldenable"
-- always show status
cmd "set laststatus=2"
-- show cursor position
cmd "set ruler"
cmd "set cursorline"
cmd "set cursorcolumn"
cmd "set hlsearch"
-- no wrap line
cmd "set nowrap"
-- 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"
vim.api.nvim_create_autocmd("ColorScheme", {
pattern = "*",
callback = function()
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,
})
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = "~/.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.api.nvim_create_autocmd("FileType", {
pattern = "rust",
callback = function()
vim.opt_local.shiftwidth = 4
vim.opt_local.tabstop = 4
end
})