material/tool/vim/.vimrc

42 lines
1.3 KiB
VimL
Raw Normal View History

2024-10-27 09:23:50 +00:00
syntax on
set number "显示行号
2024-11-23 11:00:35 +00:00
"set rnu "相对行号
2024-10-27 09:23:50 +00:00
set ts=4
"set expandtab "tab to space
set autoindent "自动缩进
set encoding=utf-8 "使用utf-8字符编码
set fileencoding=utf-8
"set cindent
set nocompatible "?
"set guifont=consolas:h14
set wrap "自动折行
set cursorline "光标行高亮
set hlsearch "高亮显示搜索结果
set incsearch "搜索模式下,每输入一个字符,就跳到对应结果
set ignorecase "忽略搜索大小写
2024-11-23 11:00:35 +00:00
2024-10-27 09:23:50 +00:00
nnoremap <space>b :buffers<cr>:b<space>
nnoremap <space>e :b#<cr>
2024-11-23 11:00:35 +00:00
nnoremap <space>n :bnext<cr>
2024-10-27 09:23:50 +00:00
nnoremap <space>s :split<space>
2024-11-23 11:00:35 +00:00
nnoremap <space>v :vsp<space>
nnoremap <space>d <c-w>w
2024-10-27 09:23:50 +00:00
nnoremap <space>w :w<cr>
2024-11-23 11:00:35 +00:00
nnoremap <space>q :q<cr>
2025-02-27 22:25:34 +08:00
nnoremap <space>fq :q!<cr>
2024-10-27 09:23:50 +00:00
nnoremap <space>tt :tabedit<space>
2025-02-27 22:25:34 +08:00
nnoremap <space>tm :vert term<cr>
2024-10-27 09:23:50 +00:00
inoremap jf <esc>
inoremap jl <c-x><c-l>
cnoremap jf <c-c>
2025-02-27 22:25:34 +08:00
"inoremap jq <esc>:wq<cr>
"inoremap jw <c-x><c-n>
"nnoremap <space>to :tabonly<cr>
2024-11-23 11:00:35 +00:00
2025-02-27 22:25:34 +08:00
augroup numbertoggle "智能切换绝对行号和相对行号
2024-11-23 11:00:35 +00:00
autocmd!
autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu && mode() != "i" | set rnu | endif
autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif
augroup END