现在的位置: 首页 > 综合 > 正文

vim configure

2013年10月07日 ⁄ 综合 ⁄ 共 3817字 ⁄ 字号 评论关闭

set mouse=a
set nocompatible                " don't emulate vanilla vi faithfully, to break its limitations
set incsearch                   " Enable incremental searching by default
set showmatch                   " Highlight the matches of the last search
set backspace=2                 " allow backspacing over everything in insert mode
set autoindent                  " always set autoindenting on
set textwidth=0                 " Don't wrap words by default
set ts=4                        " Change tab spacing to a lower value (default=8)
set encoding=utf-8              " you really should be using utf-8 now
set termencoding=utf-8          " ditto
"set fileencodings=utf-8,latin1 " use utf-8, fall back to latin1 if invalid bytes are found
syntax on                       " enable syntax highlighting for many languages
set background=dark             " better syntax colours for black terminals
if exists(":filetype")          " newer versions of Vim support more intelligent filetype determination
    filetype plugin indent on
    runtime ftplugin/man.vim    " to always have :Man available
endif
command -range=% -nargs=* Tidy <line1>,<line2>!
    \perltidy -your -preferred -default -options <args>

vmap <tab> >gv 
vmap <s-tab> <gv

nmap <tab> I<tab><esc>
nmap <s-tab> ^i<bs><esc>

"let perl_include_pod   = 1
"let perl_extended_vars = 1
"let perl_sync_dist     = 250

filetype off
set nocompatible
set modelines=0

set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set ic
set ai
set nu

command -range Cm <line1>,<line2>s/^/#/
command -range Uc <line1>,<line2>s/^#//

set encoding=utf-8
set scrolloff=3
set autoindent
set showmode
set showcmd
set hidden
set wildmenu
set wildmode=list:longest
set visualbell
set ttyfast
set ruler
set backspace=indent,eol,start
set laststatus=2

let mapleader = ","
nnoremap <leader>1 yypVr-
nnoremap <leader>2 yypVr=

set ignorecase
set smartcase
set gdefault
set incsearch
set showmatch
set hlsearch

set wrap
set textwidth=79
set formatoptions=qrn1
nnoremap j gj
nnoremap k gk

nnoremap ; :
nnoremap <leader>W :%s/\s\+$//<cr>:let @/=''<CR>
nnoremap <leader>w <C-w>v<C-w>l
syntax on
set backup
set backupdir=~/.vim/backup
set directory=~/.vim/tmp

set noerrorbells

set cursorline

set nocompatible

set history=50 " keep 50 lines of command line history

set showcmd " display incomplete commands

set incsearch " do incremental searching

set number

set autoindent

set showmatch "显示匹配括弧

set cindent

set smartindent

syntax on

set nohls

set noet "tab不是空格 写makefile时的命令前的tab

"Turn backup off,since most stuff is in SVN ,git anyway...
"set backupdir=/tmp/backup/
set nobackup
set nowb
set noswapfile

nmap <F9> <C-W>w "两个文件间进行切换
nmap <F7> <C-W>< "左移
nmap <F8> <C-W>> "右移
"nmap wq :wq!<ENTER>
"nmap Wq :wq!<ENTER>
"nmap wQ :wq!<ENTER>
nmap :WQ<ENTER> :wq<ENTER>
nmap <F3> :Tlist<ENTER>
"nmap q :q!<ENTER>
nmap :Q<ENTER> :q<ENTER>

"set encoding=prc
"set fileencoding=prc
let&termencoding=&encoding
set fileencodings=utf8,gbk,prc,ucs-bom

set fileformat=unix "去除^M

"set dy=lastling "为什么文件很多行仅仅在没行开头显示@

set clipboard+=unnamed "与windows共享剪切板

" 不要生成swap文件,当buffer被丢弃的时候隐藏它
setlocal noswapfile
set bufhidden=hide

" 状态行颜色
highlight StatusLine guifg=SlateBlue guibg=Yellow
highlight StatusLineNC guifg=Gray guibg=White

" 在状态行上显示光标所在位置的行号和列号
set ruler
set rulerformat=%20(%2*%<%f%=\ %m%r\ %3l\ %c\ %p%%%)

" 不让vim发出讨厌的滴滴声
set noerrorbells
set novisualbell
set t_vb=

" 在被分割的窗口间显示空白,便于阅读
set fillchars=vert:\ ,stl:\ ,stlnc:\

" 可以在buffer的任何地方使用鼠标(类似office中在工作区双击鼠标定位)
set mouse=a
set selection=exclusive
set selectmode=mouse,key

" 启动的时候不显示那个援助索马里儿童的提示
set shortmess=atI

" 设定默认解码
set fenc=utf-8
set fencs=utf-8,usc-bom,euc-jp,gb18030,gbk,gb2312,cp936

colorscheme evening
"颜色配置文件在/usr/shar/vim
"/vim72/colors/目录下

set foldmethod=syntax "开启折叠功能(语法折叠) 
set foldlevel=100   "  启动vim时不要自动折叠代码 
let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1
"let ctags -R --fields=+lS
"set tags=/home/dongyulong/source/embedded/linux-2.6.25.8/tags
"let g:winManagerWindowLayout='FileExplorer|TagList'
nmap <F2> :WMToggle<cr>
set cscopequickfix=s-,c-,d-,i-,t-,e-

set tags=/home/dongyulong/source/embedded/linux-2.6.34/tags
"When .vimrc is edited,reload it
autocmd! bufwritepost vimrc source ~/.vimrc

set ruler "Always show current psition

set cmdheight=2 "The commandbar height

set so=7 "Set 7 lines to the curors - when moving vertical..

set hlsearch "查找高亮

"让文本也高亮
augroup filetypedetect
au BufNewFile,BufRead *.* setf ztxt
augroup END

抱歉!评论已关闭.