win10/win7下不通过winmanager整合NERDTree和Tagbar的gVim8.0配置

" Startup {{{

filetype indent plugin on

" vim 文件折叠方式为 marker

augroup ft_vim

au!

au FileType vim setlocal foldmethod=marker

augroup END

"光标遇到折叠,折叠就打开,否则输入zo

set foldopen=all

"移开折叠时自动关闭折叠,否则输入zc

set foldclose=all

" }}}

" gvimrc_example {{{

" An example for a gvimrc file.

" The commands in this are executed when the GUI is started, after the vimrc

" has been executed.

"

" Maintainer: Bram Moolenaar

" Last change: 2016 Apr 05

"

" To use it, copy it to

" for Unix and OS/2: ~/.gvimrc

" for Amiga: s:.gvimrc

" for MS-DOS and Win32: $VIM\_gvimrc

" for OpenVMS: sys$login:.gvimrc

" Make external commands work through a pipe instead of a pseudo-tty

"set noguipty

" set the X11 font to use

" set guifont=-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-1

set ch=2 " Make command line two lines high

set mousehide " Hide the mouse when typing text

" Make shift-insert work like in Xterm

map

map!

" Only do this for Vim version 5.0 and later.

if version >= 500

" Switch on syntax highlighting if it wasn't on yet.

if !exists("syntax_on")

syntax on

endif

" For Win32 version, have "K" lookup the keyword in a help file

"if has("win32")

" let winhelpfile='windows.hlp'

" map K :execute "!start winhlp32 -k " . winhelpfile

"endif

" Set nice colors

" background for normal text is light grey

" Text below the last line is darker grey

" Cursor is green, Cyan when ":lmap" mappings are active

" Constants are not underlined but have a slightly lighter background

highlight Normal guibg=grey90

highlight Cursor guibg=Green guifg=NONE

highlight lCursor guibg=Cyan guifg=NONE

highlight NonText guibg=grey80

highlight Constant gui=NONE guibg=grey95

highlight Special gui=NONE guibg=grey95

endif

" }}}

" General {{{

" 语法高亮

syntax enable

syntax on

" 配色设置:http://ethanschoonover.com/solarized

if has('gui_running')

set background=dark

else

set background=light

endif

let g:solarized_termcolors=256

let g:solarized_termtrans=1

colorschem solarized

" 其他配置

set nocompatible " 关闭 vi 兼容模式

set guifont=Inconsolata:h12:cANSI " 设置字体

set number " 显示行号

set cursorline " 突出显示当前行

set ruler " 打开状态栏标尺,即打开光标的行列位置显示功能

set tabstop=4 " 设定 tab 长度为 4

set nobackup " 覆盖文件时不备份

set autochdir " 自动切换当前目录为当前文件所在的目录

set ignorecase smartcase " 搜索时忽略大小写,但在有一个或以上大写字母时仍保持对大小写敏感

set incsearch " 输入搜索内容时就显示搜索结果

set hlsearch " 搜索时高亮显示被找到的文本

" set guioptions-=T " 隐藏工具栏

" set guioptions-=m " 隐藏菜单栏

set smartindent " 开启新行时使用智能自动缩进

set laststatus=2 " 显示状态栏 (默认值为 1, 无法显示状态栏)

set ambiwidth=double " 显示中文引号

set cursorline " 行高亮

set cursorcolumn " 列高亮,与函数列表有冲突

nnoremap :g/^\s*$/d

set clipboard+=unnamed

"解决菜单乱码

set encoding=utf-8

"fileencodings需要注意顺序,前面的字符集应该比后面的字符集大

set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1

set langmenu=zh_CN.utf-8

set imcmdline

source $VIMRUNTIME/delmenu.vim

source $VIMRUNTIME/menu.vim

"解决consle输出乱码

language messages zh_CN.utf-8

" }}}

" plugins {{{

" miniBufExpl

let g:miniBufExplMapWindowNavVim = 1

let g:miniBufExplMapWindowNavArrows = 1

let g:miniBufExplMapCTabSwitchBufs = 1

let g:miniBufExplModSelTarget = 1

let g:miniBufExplMoreThanOne=0

" #######################################################################################################

" F3,F4,F4,F3,F3,打开后按此顺序连续反复几次,直到让Tagbar和NERDTree上下排列在左边窗口

" 打开非Tagbar自动打开的文件(如_vimrc)后光标在Tree窗口,单按F3有时也可达到上述效果

" 两者都自动打开时,按此顺序:F4,F4,F3,F3(即先关掉NERDTree—F4,再打开NERDTree—F4,最后连续按两次F3)

" #######################################################################################################

" Tagbar

map :TagbarToggle

let g:tagbar_left = 1

let g:tagbar_vertical = 30

let g:tagbar_sort = 0 "close the sort

autocmd BufReadPost *.cpp,*.c,*.h,*.hpp,*.cc,*.py call tagbar#autoopen()

" NERDTree

map :NERDTreeToggle

autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") &&b:NERDTreeType == "primary") q endif

autocmd vimenter * NERDTree

" ctrlp

let g:ctrlp_map = ''

let g:ctrlp_cmd = 'CtrlP'

" 自动补全插件 jedi-vim

let g:SuperTabDefaultCompletionType = "context"

let g:jedi#popup_on_dot = 0

" python 语法检测之ale

let g:ale_linters = {'python': ['flake8'], 'reStructuredText': ['rstcheck']}

let g:ale_fixers = {'python': ['remove_trailing_lines', 'trim_whitespace', 'autopep8']}

" }}}

" python {{{

"Pydiction

" ------------------------------------------------------------------------

let g:pydiction_location = 'D:\gVim\vim\vim80\ftplugin\complete-dict'

let g:pydiction_menu_height = 20

autocmd FileType python map :!python %

" noocomplete 自动补全插件,官方配置

" ------------------------------------------------------------------------

set completeopt=longest,menu

"Note: This option must be set in .vimrc(_vimrc). NOT IN .gvimrc(_gvimrc)!

" Disable AutoComplPop.

let g:acp_enableAtStartup = 0

" Use neocomplete.

let g:neocomplete#enable_at_startup = 1

" Use smartcase.

let g:neocomplete#enable_smart_case = 1

" Set minimum syntax keyword length.

let g:neocomplete#sources#syntax#min_keyword_length = 3

" Define dictionary.

let g:neocomplete#sources#dictionary#dictionaries = {

\ 'default' : '',

\ 'vimshell' : $HOME.'/.vimshell_hist',

\ 'scheme' : $HOME.'/.gosh_completions'

\ }

" Define keyword.

if !exists('g:neocomplete#keyword_patterns')

let g:neocomplete#keyword_patterns = {}

endif

let g:neocomplete#keyword_patterns['default'] = '\h\w*'

" Plugin key-mappings.

inoremap neocomplete#undo_completion()

inoremap neocomplete#complete_common_string()

" Recommended key-mappings.

" : close popup and save indent.

inoremap =my_cr_function()

function! s:my_cr_function()

return (pumvisible() ? "\" : "" ) . "\"

" For no inserting key.

"return pumvisible() ? "\" : "\"

endfunction

" : completion.

inoremap pumvisible() ? "\" : "\"

" , : close popup and delete backword char.

inoremap neocomplete#smart_close_popup()."\"

inoremap neocomplete#smart_close_popup()."\"

" Close popup by .

"inoremap pumvisible() ? "\" : "\"

" AutoComplPop like behavior.

"let g:neocomplete#enable_auto_select = 1

" Shell like behavior(not recommended).

"set completeopt+=longest

"let g:neocomplete#enable_auto_select = 1

"let g:neocomplete#disable_auto_complete = 1

"inoremap pumvisible() ? "\" : "\\"

" Enable omni completion.

autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS

autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags

autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS

autocmd FileType python setlocal omnifunc=pythoncomplete#Complete

autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags

" Enable heavy omni completion.

if !exists('g:neocomplete#sources#omni#input_patterns')

let g:neocomplete#sources#omni#input_patterns = {}

endif

"let g:neocomplete#sources#omni#input_patterns.php = '[^. \t]->\h\w*\\h\w*::'

"let g:neocomplete#sources#omni#input_patterns.c = '[^.[:digit:] *\t]\%(\.\->\)'

"let g:neocomplete#sources#omni#input_patterns.cpp = '[^.[:digit:] *\t]\%(\.\->\)\\h\w*::'

" For perlomni.vim setting.

" https://github.com/c9s/perlomni.vim

let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\\h\w*::'

" }}}

  • 发表于:
  • 原文链接:http://kuaibao.qq.com/s/20180118G0X32J00?refer=cp_1026

扫码关注云+社区