配置linux下的vimrc

  • 2019 年 10 月 4 日
  • 筆記

我运维和dba通常使用的如下:

set paste

set shortmess=atI

syntax enable

syntax on

set ai

set ruler

set autoindent

set nocompatible

set magic

set confirm

set history=1000

set cursorline

highlight Comment ctermfg=lightblue guifg=darkblue

set cindent

set tabstop=4

set softtabstop=4

set shiftwidth=4

set smarttab

set si

set wrap

set showmatch

set smartindent

set cin

set hlsearch

au BufReadPost * if line("'"") > 0|if line("'"") <= line("$")|exe("norm '"")|else|exe "norm $"|endif|endif

set nu

设置状态栏

set laststatus=2 

highlight StatusLine cterm=bold ctermfg=yellow ctermbg=blue

function! CurDir()

let curdir = substitute(getcwd(), $HOME, "~", "g")

return curdir

endfunction

set statusline=[%n] %f%m%r%h | pwd: %{CurDir()} |%=| %l,%c %p%% | ascii=%b,hex=%b%{((&fenc=="")?"":" | ".&fenc)} | %{$USER} @ %{hostname()}