This commit is contained in:
hl committed 2026-01-20 05:44:05 +08:00
1 parent f6deff7390
commit 14a1dd7356
10 files changed
+146 -10

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
vim.g.mapleader = " "
require("nvchad/options")
require("nvchad/mappings")
require("lua/options")
require("lua/mappings")
require("lua/autocmds")
+24
View File
@@ -0,0 +1,24 @@
local augroup = vim.api.nvim_create_augroup('numbertoggle', { clear = true })
vim.api.nvim_create_autocmd({ 'BufEnter', 'FocusGained', 'InsertLeave', 'WinEnter' }, {
group = augroup,
callback = function()
if vim.o.number and vim.api.nvim_get_mode().mode ~= 'i' then
vim.o.relativenumber = true
end
end
})
vim.api.nvim_create_autocmd({ 'BufLeave', 'FocusLost', 'InsertEnter', 'WinLeave' }, {
group = augroup,
callback = function()
if vim.o.number then
vim.o.relativenumber = false
end
end
})
vim.api.nvim_create_autocmd('TextYankPost', {
callback = function()
vim.hl.on_yank({ timeout = 300, on_visual = true })
end
})
@@ -0,0 +1,5 @@
local map = vim.keymap.set
map('v', '<LeftRelease>', '"+ygv"*ygv', { noremap = true })
map('v', '<2-LeftRelease>', '"+ygv"*ygv', { noremap = true })
+4
View File
@@ -0,0 +1,4 @@
-- add yours here!
local o = vim.o
o.clipboard = 'unnamed,unnamedplus'
@@ -0,0 +1,42 @@
local map = vim.keymap.set
map("i", "<C-b>", "<ESC>^i", { desc = "move beginning of line" })
map("i", "<C-e>", "<End>", { desc = "move end of line" })
map("i", "<C-h>", "<Left>", { desc = "move left" })
map("i", "<C-l>", "<Right>", { desc = "move right" })
map("i", "<C-j>", "<Down>", { desc = "move down" })
map("i", "<C-k>", "<Up>", { desc = "move up" })
map("n", "<C-h>", "<C-w>h", { desc = "switch window left" })
map("n", "<C-l>", "<C-w>l", { desc = "switch window right" })
map("n", "<C-j>", "<C-w>j", { desc = "switch window down" })
map("n", "<C-k>", "<C-w>k", { desc = "switch window up" })
map("n", "<Esc>", "<cmd>noh<CR>", { desc = "general clear highlights" })
map("n", "<C-s>", "<cmd>w<CR>", { desc = "general save file" })
map("n", "<C-c>", "<cmd>%y+<CR>", { desc = "general copy whole file" })
map("n", "<leader>n", "<cmd>set nu!<CR>", { desc = "toggle line number" })
map("n", "<leader>rn", "<cmd>set rnu!<CR>", { desc = "toggle relative number" })
map({ "n", "x" }, "<leader>fm", function()
require("conform").format { lsp_fallback = true }
end, { desc = "general format file" })
-- global lsp mappings
map("n", "<leader>ds", vim.diagnostic.setloclist, { desc = "LSP diagnostic loclist" })
-- Comment
map("n", "<leader>/", "gcc", { desc = "toggle comment", remap = true })
map("v", "<leader>/", "gc", { desc = "toggle comment", remap = true })
-- terminal
map("t", "<C-x>", "<C-\\><C-N>", { desc = "terminal escape terminal mode" })
-- whichkey
map("n", "<leader>wK", "<cmd>WhichKey <CR>", { desc = "whichkey all keymaps" })
map("n", "<leader>wk", function()
vim.cmd("WhichKey " .. vim.fn.input "WhichKey: ")
end, { desc = "whichkey query lookup" })
@@ -0,0 +1,57 @@
local opt = vim.opt
local o = vim.o
local g = vim.g
-------------------------------------- options ------------------------------------------
o.laststatus = 3
o.showmode = false
o.splitkeep = "screen"
o.clipboard = "unnamedplus"
o.cursorline = true
o.cursorlineopt = "number"
-- Indenting
o.expandtab = true
o.shiftwidth = 2
o.smartindent = true
o.tabstop = 2
o.softtabstop = 2
opt.fillchars = { eob = " " }
o.ignorecase = true
o.smartcase = true
o.mouse = "a"
-- Numbers
o.number = true
o.numberwidth = 2
o.ruler = false
-- disable nvim intro
opt.shortmess:append "sI"
o.signcolumn = "yes"
o.splitbelow = true
o.splitright = true
o.timeoutlen = 400
o.undofile = true
-- interval for writing swap file to disk, also used by gitsigns
o.updatetime = 250
-- go to previous/next line with h,l,left arrow and right arrow
-- when cursor reaches end/beginning of line
opt.whichwrap:append "<>[]hl"
-- disable some default providers
g.loaded_node_provider = 0
g.loaded_python3_provider = 0
g.loaded_perl_provider = 0
g.loaded_ruby_provider = 0
-- add binaries installed by mason.nvim to path
local is_windows = vim.fn.has "win32" ~= 0
local sep = is_windows and "\\" or "/"
local delim = is_windows and ";" or ":"
vim.env.PATH = table.concat({ vim.fn.stdpath "data", "mason", "bin" }, sep) .. delim .. vim.env.PATH
+1 -5
View File
@@ -127,11 +127,7 @@ prompt adam1
export GOPATH=/opt/go
export PATH=$GOPATH/bin:$HOME/.yarn/bin:$HOME/.local/bin:$PATH
if [[ -x $(command -v zoxide) && $(zoxide --version) =~ '0.4' ]]; then
eval "$(zoxide init zsh)"
else
eval "$(zoxide init --cmd cd zsh)"
fi
eval "$(zoxide init --cmd cd zsh)"
export MANROFFOPT="-c"
export MANPAGER="sh -c 'col -bx|batcat -l man -p'"
+4 -4
View File
@@ -32,18 +32,18 @@ APT::Install-Suggests "0";" | tee /etc/apt/apt.conf.d/01norecommend >/dev/null
git -C /tmp clone https://git.tink.ltd:8443/tink/zsh-completions.git
cp /tmp/zsh-completions/src/* /usr/local/share/zsh/site-functions/
rm /tmp/zsh-completions -r
rm /tmp/zsh-completions -rf
}
personalize() {
mkdir -p $HOME/.config/fd
cp "$AWD/assets/root/.config" $HOME/ -r
cp "$AWD/assets/root/.zshrc" $HOME/
if ((DISTRO_PVE)); then
sed -i -E "s/.*prompt .*/prompt bart/g" $HOME/.zshrc
fi
mkdir -p $HOME/.config/micro
cp "$AWD/assets/root/.config/micro/settings.json" $HOME/.config/micro/
if [[ -x $(command -v zoxide) && $(zoxide --version) =~ '0.4' ]]; then
sed -i -E "s/.*zoxide init.*/eval \"\$(zoxide init zsh)\"/g" $HOME/.zshrc
fi
}
usage(){
+1 -1
View File
@@ -152,6 +152,6 @@ done;
setup
if $DO_INSTALL; then
$AWD/configure.sh
$AWD/install.sh $PKG_BASE
$AWD/configure.sh
fi
+1
View File
@@ -6,6 +6,7 @@ unrar
unzip
rsync
micro
neovim
ripgrep
fd-find
exa