Linux停vim配置

Linux下vim配置

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Linux vim config (/etc/vimrc)
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Use Vim defaults (much better!)
" This should the priority setting, otherwise problems can appear
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nocompatible
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 编码设置
" fileformats(ffs)(vim才有)可指定多个,会依载入的档案形式来调整ff。
" 例如:set ffs=unix, dos ff=unix则预设为unix格式,但如读入的是dos格式的
" 档案,会自动调整为dos格式,这样存档时就会以dos格式存档。设置即为:
" set fileformats=unix
" set fileformat=unix并不会依据载入的档案形式来调整ff,并且只用unix形式
" 所以,可以解决windows下的^M问题。
" :set ff 可以查看当前文件fileformat
" :set ffs 查看vim设置
" 其实fileformats可以这样调整
" set fileformats=unix,dos 这样也应该是可以解决^M问题的,让vim自动
" 去选择是用dos,还是unix的,这应该是vim的默认设置,
" 当然也可以选择全局替换:%s/^M//g
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set fileencodings=utf-8,gb2312,gbk,gb18030
set termencoding=utf-8
set fileformat=unix
"set fileformats=unix
set encoding=prc

set bs=indent,eol,start " allow backspacing over everything in insert mode
set ai " always set autoindenting on
set viminfo='20,\"50 " read/write a .viminfo file, don't store more
" than 50 lines of registers

" Only do this part when compiled with support for autocommands
if has("autocmd")
augroup redhat
autocmd!
" In text files, always limit the width of text to 78 characters
autocmd BufRead *.txt set tw=78
" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal! g'\"" |
\ endif
" don't write swapfile on most commonly used directories for NFS mounts or USB sticks
autocmd BufNewFile,BufReadPre /media/*,/mnt/* set directory=~/tmp,/var/tmp,/tmp
" start with spec file template
autocmd BufNewFile *.spec 0r /usr/share/vim/vimfiles/template.spec
augroup END
endif

if has("cscope") && filereadable("/usr/bin/cscope")
set csprg=/usr/bin/cscope
set csto=0
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
endif

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if &t_Co > 2 || has("gui_running")
syntax on
set hlsearch
endif

if &term=="xterm"
set t_Co=8
set t_Sb=[4%dm
set t_Sf=[3%dm
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 检测文件类型
" 载入文件类型插件
" 为特定文件类型载入相关缩进文件
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
filetype on
filetype plugin on
filetype indent on
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" GUI config
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set ruler " show the cursor position all the time
set shortmess=atl " 启动的时候不显示援助索马里儿童的提示
set scrolloff=3 " 光标移动到buffer的顶部和底部时保持3行距离
" Don't wake up system with blinking cursor:
let &guicursor = &guicursor . ",a:blinkon0"

set history=50 " keep 50 lines of command line history
set number " 显示行号

set nobackup " no backup file
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" 缩进
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set tabstop=4 " 设定 tab 长度为4
set shiftwidth=4 " 缩进的空格数
set expandtab

Linux停vim配置

相关文章:

你感兴趣的文章:

标签云: