From 8c6bcd7f53cf84229465c9e30207f7afca507174 Mon Sep 17 00:00:00 2001 From: darkclip Date: Tue, 20 Jan 2026 05:54:07 +0800 Subject: [PATCH] update --- assets/root/.config/nvim/init.lua | 8 +-- assets/root/.config/nvim/lua/mappings.lua | 41 +++++++++++++ assets/root/.config/nvim/lua/options.lua | 60 +++++++++++++++++++- assets/root/.config/nvim/nvchad/mappings.lua | 42 -------------- assets/root/.config/nvim/nvchad/options.lua | 57 ------------------- 5 files changed, 102 insertions(+), 106 deletions(-) delete mode 100644 assets/root/.config/nvim/nvchad/mappings.lua delete mode 100644 assets/root/.config/nvim/nvchad/options.lua diff --git a/assets/root/.config/nvim/init.lua b/assets/root/.config/nvim/init.lua index ec240cd..985a07f 100644 --- a/assets/root/.config/nvim/init.lua +++ b/assets/root/.config/nvim/init.lua @@ -1,7 +1,5 @@ vim.g.mapleader = " " -require("nvchad/options") -require("nvchad/mappings") -require("lua/options") -require("lua/mappings") -require("lua/autocmds") +require("options") +require("mappings") +require("autocmds") diff --git a/assets/root/.config/nvim/lua/mappings.lua b/assets/root/.config/nvim/lua/mappings.lua index 5d40bcc..a700550 100644 --- a/assets/root/.config/nvim/lua/mappings.lua +++ b/assets/root/.config/nvim/lua/mappings.lua @@ -1,5 +1,46 @@ local map = vim.keymap.set +map("i", "", "^i", { desc = "move beginning of line" }) +map("i", "", "", { desc = "move end of line" }) +map("i", "", "", { desc = "move left" }) +map("i", "", "", { desc = "move right" }) +map("i", "", "", { desc = "move down" }) +map("i", "", "", { desc = "move up" }) + +map("n", "", "h", { desc = "switch window left" }) +map("n", "", "l", { desc = "switch window right" }) +map("n", "", "j", { desc = "switch window down" }) +map("n", "", "k", { desc = "switch window up" }) + +map("n", "", "noh", { desc = "general clear highlights" }) + +map("n", "", "w", { desc = "general save file" }) +map("n", "", "%y+", { desc = "general copy whole file" }) + +map("n", "n", "set nu!", { desc = "toggle line number" }) +map("n", "rn", "set rnu!", { desc = "toggle relative number" }) + +map({ "n", "x" }, "fm", function() + require("conform").format { lsp_fallback = true } +end, { desc = "general format file" }) + +-- global lsp mappings +map("n", "ds", vim.diagnostic.setloclist, { desc = "LSP diagnostic loclist" }) + +-- Comment +map("n", "/", "gcc", { desc = "toggle comment", remap = true }) +map("v", "/", "gc", { desc = "toggle comment", remap = true }) + +-- terminal +map("t", "", "", { desc = "terminal escape terminal mode" }) + +-- whichkey +map("n", "wK", "WhichKey ", { desc = "whichkey all keymaps" }) + +map("n", "wk", function() + vim.cmd("WhichKey " .. vim.fn.input "WhichKey: ") +end, { desc = "whichkey query lookup" }) + map('v', '', '"+ygv"*ygv', { noremap = true }) map('v', '<2-LeftRelease>', '"+ygv"*ygv', { noremap = true }) diff --git a/assets/root/.config/nvim/lua/options.lua b/assets/root/.config/nvim/lua/options.lua index 4c99629..2de8960 100644 --- a/assets/root/.config/nvim/lua/options.lua +++ b/assets/root/.config/nvim/lua/options.lua @@ -1,4 +1,60 @@ --- add yours here! - +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 + + o.clipboard = 'unnamed,unnamedplus' diff --git a/assets/root/.config/nvim/nvchad/mappings.lua b/assets/root/.config/nvim/nvchad/mappings.lua deleted file mode 100644 index 4463f45..0000000 --- a/assets/root/.config/nvim/nvchad/mappings.lua +++ /dev/null @@ -1,42 +0,0 @@ -local map = vim.keymap.set - -map("i", "", "^i", { desc = "move beginning of line" }) -map("i", "", "", { desc = "move end of line" }) -map("i", "", "", { desc = "move left" }) -map("i", "", "", { desc = "move right" }) -map("i", "", "", { desc = "move down" }) -map("i", "", "", { desc = "move up" }) - -map("n", "", "h", { desc = "switch window left" }) -map("n", "", "l", { desc = "switch window right" }) -map("n", "", "j", { desc = "switch window down" }) -map("n", "", "k", { desc = "switch window up" }) - -map("n", "", "noh", { desc = "general clear highlights" }) - -map("n", "", "w", { desc = "general save file" }) -map("n", "", "%y+", { desc = "general copy whole file" }) - -map("n", "n", "set nu!", { desc = "toggle line number" }) -map("n", "rn", "set rnu!", { desc = "toggle relative number" }) - -map({ "n", "x" }, "fm", function() - require("conform").format { lsp_fallback = true } -end, { desc = "general format file" }) - --- global lsp mappings -map("n", "ds", vim.diagnostic.setloclist, { desc = "LSP diagnostic loclist" }) - --- Comment -map("n", "/", "gcc", { desc = "toggle comment", remap = true }) -map("v", "/", "gc", { desc = "toggle comment", remap = true }) - --- terminal -map("t", "", "", { desc = "terminal escape terminal mode" }) - --- whichkey -map("n", "wK", "WhichKey ", { desc = "whichkey all keymaps" }) - -map("n", "wk", function() - vim.cmd("WhichKey " .. vim.fn.input "WhichKey: ") -end, { desc = "whichkey query lookup" }) diff --git a/assets/root/.config/nvim/nvchad/options.lua b/assets/root/.config/nvim/nvchad/options.lua deleted file mode 100644 index 47c9476..0000000 --- a/assets/root/.config/nvim/nvchad/options.lua +++ /dev/null @@ -1,57 +0,0 @@ -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