首页 > 其他分享 >vim 个人简单定制化(不含插件)

vim 个人简单定制化(不含插件)

时间:2022-10-25 11:23:22浏览次数:48  
标签:插件 set indent 折叠 vim let tab 定制 filetype

.vimrc 简单定制化

" Jzheng
" ===
set nocompatible
filetype on
filetype indent on
filetype plugin on
filetype plugin indent on
set mouse=a
set encoding=utf-8

set clipboard=unnamed "剪贴板=未命名寄存器

" Prevent incorrect backgroung rendering
let &t_ut=''

" ===
" === Main code display
" ===
set number "显示行号
set relativenumber "采用相对行号
set ruler "启用标尺
set cursorline "高亮光标行
syntax enable "启用语法高亮,只在当前文件中有效
syntax on "针对所有缓冲区中的文件启用语法高亮度

" ===
" === Editor behavior
" ===
" Better tab
set ts=4
set expandtab
set autoindent
set list
set listchars=tab:▸\ ,trail:▫ "显示 tab,空格
set scrolloff=5 "光标行翻滚上下限

" Prevent auto line split
set wrap
set tw=0

set indentexpr=
" Better backspace
set backspace=indent,eol,start


"代码折叠
set foldmethod=indent "可选:[1]index:相同缩进折叠,[2]manual:默认折叠方式,[3]syntax:语法高亮折叠
set foldlevel=99

"不同模式下光标的类型
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_SR = "\<Esc>]50;CursorShape=2\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"

" Show command autocomplete
set wildignore=log/**,node_modules/**,target/**,tmp/**,*.rbc " 将忽略在选项wildignore中指定的文件模式,
set wildmenu                                                 " show a navigable menu for tab completion
set wildmode=longest,list,full

" ===
" === Status/command bar
" ===
set laststatus=2
set autochdir
set showcmd
set formatoptions-=tc


" Searching options
set hlsearch
exec "noh"
set incsearch
set ignorecase
set smartcase "智能判断大小写

" ===
" === Restore Cursor Position "保存光标位置
" ===
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif

代码折叠常用命令

  1. zM:关闭所有折叠
  2. zR:打开所有折叠
  3. za:打开或关闭当前光标所在处的折叠
  4. 打开所有嵌套的折叠

标签:插件,set,indent,折叠,vim,let,tab,定制,filetype
From: https://www.cnblogs.com/zjacky/p/16807781.html

相关文章