From a751b6fb7b7be68e3b2b1fe2c6a8ee34a153d299 Mon Sep 17 00:00:00 2001 From: gin Date: Mon, 25 May 2026 10:55:43 +0800 Subject: [PATCH] add nvim --- nvim/init.lua | 3 +++ nvim/lua/core/keymap.lua | 13 +++++++++++++ nvim/lua/core/option.lua | 40 ++++++++++++++++++++++++++++++++++++++++ zsh/aliases.zsh | 1 + zsh/zsh | 1 - zsh/zshrc | 2 +- 6 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 nvim/init.lua create mode 100644 nvim/lua/core/keymap.lua create mode 100644 nvim/lua/core/option.lua delete mode 120000 zsh/zsh diff --git a/nvim/init.lua b/nvim/init.lua new file mode 100644 index 0000000..88dae7e --- /dev/null +++ b/nvim/init.lua @@ -0,0 +1,3 @@ +require('core.option') +require('core.keymap') + diff --git a/nvim/lua/core/keymap.lua b/nvim/lua/core/keymap.lua new file mode 100644 index 0000000..640294a --- /dev/null +++ b/nvim/lua/core/keymap.lua @@ -0,0 +1,13 @@ +local keymap = vim.keymap.set +local opts = { noremap = true, silent = true } + +keymap({ 'n', 'v' }, 'H', '0', opts) +keymap({ 'n', 'v' }, 'J', '5j', opts) +keymap({ 'n', 'v' }, 'K', '5k', opts) +keymap({ 'n', 'v' }, 'L', '$', opts) +keymap('n', 'n', 'nzz', opts) +keymap('n', 'N', 'Nzz', opts) +keymap('n', 's', 'w', opts) +keymap('n', 'nh', 'nohlsearch', opts) +keymap('n', 'sj', 'set splitbelowsplit', opts) +keymap('n', 'sl', 'set nosplitrightvsplit', opts) diff --git a/nvim/lua/core/option.lua b/nvim/lua/core/option.lua new file mode 100644 index 0000000..67c092d --- /dev/null +++ b/nvim/lua/core/option.lua @@ -0,0 +1,40 @@ +local opt = vim.opt + +opt.tabstop = 2 +opt.shiftwidth = 2 +opt.softtabstop = 2 + +opt.scrolloff = 18 +opt.encoding = 'utf-8' + +opt.autoindent = true +opt.smartindent = true +opt.wrap = false +opt.number = true +opt.relativenumber = true +opt.wildmenu = true +opt.hlsearch = true +opt.incsearch = true +opt.ignorecase = true +opt.smartcase = true +opt.autochdir = true +opt.cursorline = true +opt.termguicolors = true +opt.splitbelow = true +opt.splitright = true +opt.expandtab = true +opt.visualbell = true +opt.showcmd = true +opt.autoread = true +opt.swapfile = false + +opt.mouse = '' +opt.signcolumn = 'yes' +opt.shortmess = 'atI' +opt.updatetime = 100 +opt.redrawtime = 1500 +opt.timeoutlen = 500 + +-- folding +opt.foldenable = false +opt.foldlevel = 99 diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index 29262cd..22dce41 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -1,3 +1,4 @@ alias ls="ls --color=auto" alias ll="ls -l" alias grep="grep --color=auto" +alias vim="nvim" diff --git a/zsh/zsh b/zsh/zsh deleted file mode 120000 index 705b4f4..0000000 --- a/zsh/zsh +++ /dev/null @@ -1 +0,0 @@ -/root/.config/zsh \ No newline at end of file diff --git a/zsh/zshrc b/zsh/zshrc index d691a69..62a86ba 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -8,4 +8,4 @@ source ${0:A:h}/aliases.zsh source ${0:A:h}/prompt.zsh # set default editor -export EDITOR=vim +export EDITOR=nvim