/ 中存储网

Ubuntu环境下vim配置使用的方法及命令

2014-12-25 00:00:00 来源:中存储网

第一种
“不使用与vi兼容的键盘模式
set nocompatible
“检测文件的类型
filetype on
“记录历史的行数
set history=1000
“修改一个文件后,自动进行备份,备份的文件名为原文件名加“~“后缀
if has(“vms”)
set nobackup
else
set backup
endif
” 可以在buffer的任何地方使用鼠标
set mouse=a
set selection=exclusive
set selectmode=mouse,key
“———————–
“界面设置
“———————-
“显示行号
set nu!
“高亮显示当前行
set cursorline
“背景使用黑色
set background=dark
“去除vim的GUI版本中的toolbar
set guioptions-=T
“在编辑过程中,在右下角显示光标位置
set ruler
“always show the status line
set laststatus=2
“———————
“格式设置
“———————
“自动换行
set wrap
“整词换行
set linebreak
“自动对齐
set autoindent
“智能对齐
set smartindent
“设置自动缩进
set ai!
“设置tab键为4个空格
set tabstop=4
“不要用空格代替制表符
set noexpandtab
“设置行间交错为4个空格
set shiftwidth=4
“使退格键可用
set backspace=2
“允许backspace和光标键跨越行边界
set whichwrap+=<,>,h,l
“———————
“编程设置
“———————
“语法高亮度显示
syntax on
“设置匹配模式,类似当输入一个左括号时会匹配相应的那个右括号
set showmatch
“——————–
“搜索相关设置
“——————-
“默认情况下,搜索结果是高亮度显示的,该设置关闭高亮显示
“set nohlsearch
“随输入增量搜索
set incsearch
“设置字体
set guifont=Monaco 10
“不使用与vi兼容的键盘模式set nocompatible
“检测文件的类型filetype on
“记录历史的行数set history=1000
“修改一个文件后,自动进行备份,备份的文件名为原文件名加“~“后缀if has(“vms”)set nobackupelseset backupendif
” 可以在buffer的任何地方使用鼠标set mouse=aset selection=exclusiveset selectmode=mouse,key
“———————–”界面设置”———————-
“显示行号set nu!
“高亮显示当前行set cursorline
“背景使用黑色set background=dark
“去除vim的GUI版本中的toolbarset guioptions-=T
“在编辑过程中,在右下角显示光标位置set ruler
“always show the status lineset laststatus=2
“———————”格式设置”———————
“自动换行set wrap
“整词换行set linebreak
“自动对齐set autoindent
“智能对齐set smartindent
“设置自动缩进set ai!
“设置tab键为4个空格set tabstop=4
“不要用空格代替制表符set noexpandtab
“设置行间交错为4个空格set shiftwidth=4
“使退格键可用set backspace=2
“允许backspace和光标键跨越行边界set whichwrap+=<,>,h,l
“———————”编程设置”———————
“语法高亮度显示syntax on
“设置匹配模式,类似当输入一个左括号时会匹配相应的那个右括号set showmatch
“——————–”搜索相关设置”——————-
“默认情况下,搜索结果是高亮度显示的,该设置关闭高亮显示”set nohlsearch
“随输入增量搜索set incsearch
“设置字体set guifont=Monaco 10

第二种

” Vim color file

” Author: Tomas Restrepo <tomas@winterdom.com>

” Note: Based on the monokai theme for textmate

” by Wimer Hazenberg and its darker variant

” by Hamish Stuart Macpherson

hi clear

set background=dark

if version > 580

” no guarantees for version 5.8 and below, but this makes it stop

” complaining

hi clear

if exists(“syntax_on”)

syntax reset

endif

endif

let g:colors_name=”molokai”

if exists(“g:molokai_original”)

let s:molokai_original = g:molokai_original

else

let s:molokai_original = 0

endif

hi Boolean         guifg=#AE81FF

hi Character       guifg=#E6DB74

hi Number          guifg=#AE81FF

hi String          guifg=#E6DB74

hi Conditional     guifg=#F92672               gui=bold

hi Constant        guifg=#AE81FF               gui=bold

hi Cursor          guifg=#000000 guibg=#F8F8F0

hi Debug           guifg=#BCA3A3               gui=bold

hi Define          guifg=#66D9EF

hi Delimiter       guifg=#8F8F8F

hi DiffAdd                       guibg=#13354A

hi DiffChange      guifg=#89807D guibg=#4C4745

hi DiffDelete      guifg=#960050 guibg=#1E0010

hi DiffText                      guibg=#4C4745 gui=italic,bold

hi Directory       guifg=#A6E22E               gui=bold

hi Error           guifg=#960050 guibg=#1E0010

hi ErrorMsg        guifg=#F92672 guibg=#232526 gui=bold

hi Exception       guifg=#A6E22E               gui=bold

hi Float           guifg=#AE81FF

hi FoldColumn      guifg=#465457 guibg=#000000

hi Folded          guifg=#465457 guibg=#000000

hi Function        guifg=#A6E22E

hi Identifier      guifg=#FD971F

hi Ignore          guifg=#808080 guibg=bg

hi IncSearch       guifg=#C4BE89 guibg=#000000

hi Keyword         guifg=#F92672               gui=bold

hi Label           guifg=#E6DB74               gui=none

hi Macro           guifg=#C4BE89               gui=italic

hi SpecialKey      guifg=#66D9EF               gui=italic

hi MatchParen      guifg=#000000 guibg=#FD971F gui=bold

hi ModeMsg         guifg=#E6DB74

hi MoreMsg         guifg=#E6DB74

hi Operator        guifg=#F92672

” complete menu

hi Pmenu           guifg=#66D9EF guibg=#000000

hi PmenuSel                      guibg=#808080

hi PmenuSbar                     guibg=#080808

hi PmenuThumb      guifg=#66D9EF

hi PreCondit       guifg=#A6E22E               gui=bold

hi PreProc         guifg=#A6E22E

hi Question        guifg=#66D9EF

hi Repeat          guifg=#F92672               gui=bold

hi Search          guifg=#FFFFFF guibg=#455354

” marks column

hi SignColumn      guifg=#A6E22E guibg=#232526

hi SpecialChar     guifg=#F92672               gui=bold

hi SpecialComment  guifg=#465457               gui=bold

hi Special         guifg=#66D9EF guibg=bg      gui=italic

hi SpecialKey      guifg=#888A85               gui=italic

if has(“spell”)

hi SpellBad    guisp=#FF0000 gui=undercurl

hi SpellCap    guisp=#7070F0 gui=undercurl

hi SpellLocal  guisp=#70F0F0 gui=undercurl

hi SpellRare   guisp=#FFFFFF gui=undercurl

endif

hi Statement       guifg=#F92672               gui=bold

hi StatusLine      guifg=#455354 guibg=fg

hi StatusLineNC    guifg=#808080 guibg=#080808

hi StorageClass    guifg=#FD971F               gui=italic

hi Structure       guifg=#66D9EF

hi Tag             guifg=#F92672               gui=italic

hi Title           guifg=#ef5939

hi Todo            guifg=#FFFFFF guibg=bg      gui=bold

hi Typedef         guifg=#66D9EF

hi Type            guifg=#66D9EF               gui=none

hi Underlined      guifg=#808080               gui=underline

hi VertSplit       guifg=#808080 guibg=#080808 gui=bold

hi VisualNOS                     guibg=#403D3D

hi Visual                        guibg=#403D3D

hi WarningMsg      guifg=#FFFFFF guibg=#333333 gui=bold

hi WildMenu        guifg=#66D9EF guibg=#000000

if s:molokai_original == 1

hi Normal          guifg=#F8F8F2 guibg=#272822

hi Comment         guifg=#75715E gui=italic

hi CursorLine                    guibg=#3E3D32

hi CursorColumn                  guibg=#3E3D32

hi LineNr          guifg=#BCBCBC guibg=#3B3A32

hi NonText         guifg=#BCBCBC guibg=#3B3A32

else

hi Normal          guifg=#F8F8F2 guibg=#1B1D1E

hi Comment         guifg=#465457 gui=italic

hi CursorLine                    guibg=#000000

hi CursorColumn                  guibg=#000000

hi LineNr          guifg=#BCBCBC guibg=#232526

hi NonText         guifg=#BCBCBC guibg=#232526

end

set guifont=Monaco 10

set nu