if filereadable(expand(“~/.vimrc.bundles”))
source ~/.vimrc.bundles
endif
set ff=unix
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin ‘VundleVim/Vundle.vim’
Plugin ‘vim-airline/vim-airline’
Plugin ‘vim-airline/vim-airline-themes’
Plugin ‘michaelHL/awesome-vim-colorschemes’
Plugin ‘Tagbar’
Plugin ‘majutsushi/tagbar’
Plugin ‘scrooloose/nerdtree’
Plugin ‘inkarkat/vim-ingo-library’
Plugin ‘inkarkat/vim-mark’
Plugin ‘Tabular’
Plugin ‘godlygeek/tabular’
Plugin ‘plasticboy/vim-markdown’
Plugin ‘morhetz/gruvbox’
Plugin ‘christoomey/vim-run-interactive’
" Plugin ‘vim-colors-solarized’
call vundle#end()
filetype plugin indent on " required
syntax enable
syntax on
" colorscheme evening
" colorscheme OceanicNext
" colorscheme railscasts
" colorscheme garden
set cindent
set cinoptions=t0,g1,h1,N-s,j1
set ruler
set showcmd
set hlsearch
set colorcolumn=81
set number
set cursorline
colorscheme molokai
" set cursorcolumn
set t_Co=256
set background=dark
" set background=light
"set backspace=indent,eol,start
" highlight Normal guibg=Black
set incsearch
set list listchars=tab:>-,trail:-
nmap m
"let g:solarized_termcolors=256
let g:tagbar_ctags_bin=‘/usr/bin/ctags’
nmap :TagbarToggle
let g:tagbar_right=1
let g:tagbar_width=40
" syntax enable
" colorscheme solarized
" 按TAB键时命令行自动补齐"
set wildmenu
“使用vim而非vi”
set nocp
“(4)源文件和头文件之间快速切换”
“a: 切换到任意文件。需要手动输入文件的后缀”
"nmap ,a :find %:t:r.
“,c: 切换到同名c语言的源文件”
"nmap ,c :find %:t:r.c
“,C: 切换到同名c++的源文件,以tabpage形式打开”
"nmap ,C :tabf %:t:r.cpp
“,h 切换到当前文件对于的头文件”
"nmap ,h :find %:t:r.h
set mouse=a
"set selection=exclusive
"set selectmode=mouse,key
set nomodeline
set ruler
set showmatch
set paste
" 设置编码
set fileencodings=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936
set termencoding=utf-8
set encoding=utf-8
set spell spelllang=en_us
" 在处理未保存或只读文件的时候,弹出确认
set confirm
" " 自动缩进
set autoindent
set cindent
" " Tab键的宽度
set tabstop=8
" " 统一缩进为4
set softtabstop=4
set shiftwidth=4
" " 不要用空格代替制表符
set noexpandtab
" 历史记录数
set history=1000
highlight WhitespaceEOL ctermbg=red guibg=red
match WhitespaceEOL /\s+$/
map :NERDTreeToggle
let g:NERDTreeDirArrowExpandable = ‘+’
let g:NERDTreeDirArrowCollapsible = ‘-’
let g:NERDTreeWinPos=‘left’
let g:NERDTreeSize=30
let g:NERDTreeShowLineNumbers=1
let g:NERDTreeHidden=0
if has(“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
C
S
C
O
P
E
D
B
e
n
d
i
f
s
e
t
c
s
v
e
r
b
e
n
d
i
f
"
n
m
a
p
<
C
−
@
>
s
:
c
s
f
i
n
d
s
<
C
−
R
>
=
e
x
p
a
n
d
(
"
<
c
w
o
r
d
>
"
)
<
C
R
>
<
C
R
>
"
n
m
a
p
<
C
−
@
>
g
:
c
s
f
i
n
d
g
<
C
−
R
>
=
e
x
p
a
n
d
(
"
<
c
w
o
r
d
>
"
)
<
C
R
>
<
C
R
>
"
n
m
a
p
<
C
−
@
>
c
:
c
s
f
i
n
d
c
<
C
−
R
>
=
e
x
p
a
n
d
(
"
<
c
w
o
r
d
>
"
)
<
C
R
>
<
C
R
>
"
n
m
a
p
<
C
−
@
>
t
:
c
s
f
i
n
d
t
<
C
−
R
>
=
e
x
p
a
n
d
(
"
<
c
w
o
r
d
>
"
)
<
C
R
>
<
C
R
>
"
n
m
a
p
<
C
−
@
>
e
:
c
s
f
i
n
d
e
<
C
−
R
>
=
e
x
p
a
n
d
(
"
<
c
w
o
r
d
>
"
)
<
C
R
>
<
C
R
>
"
n
m
a
p
<
C
−
@
>
f
:
c
s
f
i
n
d
f
<
C
−
R
>
=
e
x
p
a
n
d
(
"
<
c
f
i
l
e
>
"
)
<
C
R
>
<
C
R
>
"
n
m
a
p
<
C
−
@
>
i
:
c
s
f
i
n
d
i
<
C
−
R
>
=
e
x
p
a
n
d
(
"
<
c
f
i
l
e
>
"
)
<
C
R
>
CSCOPE_DB endif set csverb endif "nmap <C-@>s :cs find s <C-R>=expand("<cword>")<CR><CR> "nmap <C-@>g :cs find g <C-R>=expand("<cword>")<CR><CR> "nmap <C-@>c :cs find c <C-R>=expand("<cword>")<CR><CR> "nmap <C-@>t :cs find t <C-R>=expand("<cword>")<CR><CR> "nmap <C-@>e :cs find e <C-R>=expand("<cword>")<CR><CR> "nmap <C-@>f :cs find f <C-R>=expand("<cfile>")<CR><CR> "nmap <C-@>i :cs find i ^<C-R>=expand("<cfile>")<CR>
CSCOPEDBendifsetcsverbendif"nmap<C−@>s:csfinds<C−R>=expand("<cword>")<CR><CR>"nmap<C−@>g:csfindg<C−R>=expand("<cword>")<CR><CR>"nmap<C−@>c:csfindc<C−R>=expand("<cword>")<CR><CR>"nmap<C−@>t:csfindt<C−R>=expand("<cword>")<CR><CR>"nmap<C−@>e:csfinde<C−R>=expand("<cword>")<CR><CR>"nmap<C−@>f:csfindf<C−R>=expand("<cfile>")<CR><CR>"nmap<C−@>i:csfindi<C−R>=expand("<cfile>")<CR>
“nmap <C-@>d :cs find d =expand(”")
cnoreabbrev cs cs find
" 打开自动定位到最后编辑的位置, 需要确认.viminfo当前用户可写
if has(“autocmd”)
au BufReadPost * if line(“'”“) > 1 && line(”‘“”) <= line(“$”) | exe "normal! g’“” | endif
endif
" ============"
" 3. 多窗口操作"
" ============"
" +:扩大窗口"
"map + +
“- : 缩小窗口”
"map - -
“C-l 移动到右侧窗口”
"map l
“C-h 移动到左侧窗口”
"map h
“C-j 移动到下方窗口”
"map j
“C-k 移动到上方窗口”
"map k
"空格打开关闭折叠
nnoremap @=((foldclosed(line(‘.’)) < 0) ? ‘zc’ : ‘zo’)
vim 设置鼠标的光标定位功能和如何鼠标复制粘贴功能
vi ~/.vimrc
添加 set mouse=a
vi打开一个文本,发现鼠标可以对光标定位。
想要复制粘贴剪切,Shift+鼠标左键选中,Shift+鼠标右键选择