vim之.vimrc配置记录(更新完成)

vim ~/.vimrc
由于如下配置写在.vimrc文件中,要注释的文本在左侧使用双引号

set hlsearch //高亮显示搜索到的内容
set incsearch //光标立刻跳转到搜索到的内容

set number/set nu  //显示行号
set nonumber/set nonu  //不显示行号
syntax on  //语法高亮
set cursorline  //突显当前行(在光标所在行的底下出现一条横线)
set shiftwidth=4  //自动缩进时,缩进长度为4
set softtabstop=4  
set tabstop=4
set expandtab
set autoindent

filetype indent on
set textwidth=80
set wrap
set linebreak
set scrolloff=5

" 在这里插入代码片当光标一段时间保持不动了,就禁用高亮
autocmd cursorhold * set nohlsearch
" 当输入查找命令时,再启用高亮
noremap n :set hlsearchn
noremap N :set hlsearchN
noremap / :set hlsearch/
noremap ? :set hlsearch?
noremap * *:set hlsearch

" 设置默认进行大小写不敏感查找
set ignorecase
" 如果有一个大写字母,则切换到大小写敏感查找
set smartcase

set nobackup
set nowb
set noswapfile
set undodir=~/.vim/.undo//

set autochdir

set listchars=tab:»■,trail:■
set list

set wildmenu
set wildmode=longest:list,full

set autoread

colorscheme desert

" Return to last edit position when opening files (You want this!)
autocmd BufReadPost *
    \ if line("'\"") > 0 && line("'\"") <= line("$") |
    \   exe "normal! g`\"" |
    \ endif

" Configure backspace so it acts as it should act
set backspace=eol,start,indent
set whichwrap+=<,>,h,l

" allows cursor change in tmux mode
if exists('$TMUX')
let &t_SI = "\Ptmux;\\]50;CursorShape=1\x7\\\"
    let &t_EI = "\Ptmux;\\]50;CursorShape=0\x7\\\"
else                                                                                                                                                                                                                                                                            
    let &t_SI = "\]50;CursorShape=1\x7"
    let &t_EI = "\]50;CursorShape=0\x7"
endif 

如上的配置基本可以满足日常的开发需求,后面如果学到了新的东西再更新,没有的话就这么多啦~

你可能感兴趣的:(vim)