From 2688ebea171f1f52366f78767d0489dd46a575fa Mon Sep 17 00:00:00 2001 From: "xiangkai.wu" Date: Thu, 16 Jul 2026 18:26:23 +0800 Subject: [PATCH] =?UTF-8?q?doc:=20=E6=96=B0=E5=A2=9E.vimrc=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vim/init.vim | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 vim/init.vim diff --git a/vim/init.vim b/vim/init.vim new file mode 100644 index 0000000..211ae96 --- /dev/null +++ b/vim/init.vim @@ -0,0 +1,39 @@ +set number +set relativenumber +syntax on + +" 设置缩进 +set tabstop=4 " 设置 Tab 显示为 4 个空格 +set softtabstop=4 " 编辑模式下退格键回退 4 个空格 +set shiftwidth=4 " 设置自动缩进的宽度为 4 个空格 +set expandtab " 将 Tab 转换为空格 +set autoindent " 启用自动缩进 + +lua require('plugins') + +" config for hop motion plugin +let mapleader=" " +nnoremap w HopWord +nnoremap s HopChar2 +nnoremap j HopLine +nnoremap k HopLineStart +xnoremap w HopWord +xnoremap s HopChar2 +xnoremap j HopLine +xnoremap k HopLineStart + +" 支持便捷粘贴复制 +nnoremap y "+y +nnoremap p "+p +xnoremap y "+y +xnoremap p "+p +inoremap + + +for n in range(char2nr('a'), char2nr('z')) + let c = nr2char(n) + if c ==# 'y' || c ==# 'p' | continue | endif + execute 'nnoremap ' . c . 'y "' . c . 'y' + execute 'xnoremap ' . c . 'y "' . c . 'y' + execute 'nnoremap ' . c . 'p "' . c . 'p' + execute 'xnoremap ' . c . 'p "' . c . 'p' +endfor