Thanks to visit codestin.com
Credit goes to github.com

Skip to content

BenVim/vim-ben-vimrc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

vim-ben-vimrc

#vimrc

set nocompatible
set t_Co=256
set termencoding=utf-8
set encoding=utf-8
set fileencodings=utf8,ucs-bom,gbk,cp936,gb2312,gb18030
set cul " 光标所在位置高亮显示
set laststatus=2 " 总是显示状态行
set number " 显示行号
set cursorline "为光标所在行加下划线
set autoread   "文件在Vim之外修改过,自动重新读入
set backspace=2
set expandtab  "以下三个配置配合使用,设置tab和缩进空格数
set shiftwidth=4
set tabstop=4
set ignorecase "检索时忽略大小写
set hls " 检索时高亮显示匹配项
set helplang=cn "帮助系统设置为中文

set showcmd " 右下角显示未完成的命令
set ruler " 显示鼠标位置 
set history=50 " 保存50个历史命令

set nobackup
set nowb
set noswapfile
set helplang=cn

syntax enable
syntax on
"colorscheme molokai
set nocp
filetype plugin on
filetype on

" Vundle Manager
set rtp+=~/.vim/bundle/Vundle.vim " set the runtime path to include Vundle and initialize
call vundle#begin()

Plugin 'VundleVim/Vundle.vim'
Plugin 'Shougo/Neocomplete.vim'
Plugin 'wincent/command-t' 
Plugin 'mattn/emmet-vim'
Plugin 'kien/ctrlp.vim'
Plugin 'jQuery'
Plugin 'scrooloose/nerdtree'
"Plugin 'vim-commentary'
Plugin 'bling/vim-airline'
"Plugin 'Valloric/YouCompleteMe'

call vundle#end()
filetype plugin indent on " required.

execute pathogen#infect()

" airline settings
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#left_sep = ' '
let g:airline#extensions#tabline#left_alt_sep = '|'

""""""""""""""""""""""""""""""
" lookupfile setting
""""""""""""""""""""""""""""""
let g:LookupFile_MinPatLength = 2               "最少输入2个字符才开始查找
let g:LookupFile_PreserveLastPattern = 0        "不保存上次查找的字符串
let g:LookupFile_PreservePatternHistory = 1     "保存查找历史
let g:LookupFile_AlwaysAcceptFirst = 1          "回车打开第一个匹配项目
let g:LookupFile_AllowNewFiles = 0              "不允许创建不存在的文件
if filereadable("./filenametags")                "设置tag文件的名字
let g:LookupFile_TagExpr = '"./filenametags"'
endif
"映射LookupFile为,lk
nmap  lk :LUTags
"映射LUBufs为,ll
nmap  ll :LUBufs
"映射LUWalk为,lw
nmap  lw :LUWalk

" lookup file with ignore case
function! LookupFile_IgnoreCaseFunc(pattern)
    let _tags = &tags
    try
        let &tags = eval(g:LookupFile_TagExpr)
        let newpattern = '\c' . a:pattern
        let tags = taglist(newpattern)
    catch
        echohl ErrorMsg | echo "Exception: " . v:exception | echohl NONE
        return ""
    finally
        let &tags = _tags
    endtry
    " Show the matches for what is typed so far.
    let files = map(tags, 'v:val["filename"]')
    return files
endfunction
let g:LookupFile_LookupFunc ='LookupFile_IgnoreCaseFunc'

" Settings for tagslist
let Tlist_Use_Right_Window = 1  " 让taglist窗口出现在Vim的右边
let Tlist_File_Fold_Auto_Close = 1  " 当同时显示多个文件中的tag时,设置为1,可使taglist只显示当前文件tag,其它文件的tag都被折叠起来。
let Tlist_Show_One_File = 1 " 只显示一个文件中的tag,默认为显示多个
let Tlist_Sort_Type ='name'   " Tag的排序规则,以名字排序。默认是以在文件中出现的顺序排序
let Tlist_GainFocus_On_ToggleOpen = 1 "Taglist窗口打开时,立刻切换为有焦点状态
let Tlist_Exit_OnlyWindow = 1 "如果taglist窗口是最后一个窗口,则退出vim
let Tlist_WinWidth = 32 "设置窗体宽度为32,可以根据自己喜好设置
let Tlist_Ctags_Cmd ='/usr/local/Cellar/ctags/5.8_1/bin/ctags'
""""""""""""""""""""""
" Neocomplete setting
""""""""""""""""""""""
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_smart_case = 1
let g:neocomplete#sources#syntax#min_keyword_length = 3
let g:neocomplete#lock_buffer_name_pattern = '\*ku\*'

" 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
autocmd FileType php setlocal omnifunc=phpcomplete#CompletePHP
autocmd FileType c setlocal omnifunc=ccomplete#Complete
" 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*::'


"只有在是PHP文件时,才启用PHP补全
"au FileType php call AddPHPFuncList()
"function AddPHPFuncList()
    set dictionary-=/Users/Ben/.vim/doc/php_function.txt dictionary+=/Users/Ben/.vim/doc/php_function.txt
 "   set complete-=k complete+=k
"endfunction

let g:ycm_global_ycm_extra_conf='/Users/Ben/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
let g:ycm_collect_identifiers_from_tag_files = 1

" emment settings
let g:user_emmet_mode='n'    "only enable normal mode functions.
let g:user_emmet_mode='inv'  "enable all functions, which is equal to
let g:user_emmet_mode='a'    "enable all function in all mode.
let g:emmet_html5 = 0

let g:user_emmet_install_global = 0
autocmd FileType html,css EmmetInstall
" let g:user_emmet_leader_key='' 
" let g:user_emmet_expandabbr_key=''

" ctrlp settings
let g:ctrlp_map = ''
let g:ctrlp_cmd = 'CtrlP'

let g:ctrlp_working_path_mode = 'ra'
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " Linux/MacOSX
let g:ctrlp_user_command = 'find %s -type f'        " MacOSX/Linux






" lazy method of appending this onto your .vimrc ":w! >> ~/.vimrc"
" ------------------------------------------------------------------
" this block of commands has been autogenerated by solarized.vim and
" includes the current, non-default Solarized option values.
" To use, place these commands in your .vimrc file (replacing any
" existing colorscheme commands). See also ":help solarized"

" ------------------------------------------------------------------
" Solarized Colorscheme Config
" ------------------------------------------------------------------
let g:solarized_termcolors=256    "default value is 16
syntax enable
set background=dark
colorscheme solarized
" ------------------------------------------------------------------

" The following items are available options, but do not need to be
" included in your .vimrc as they are currently set to their defaults.

" let g:solarized_termtrans=0
" let g:solarized_degrade=0
" let g:solarized_bold=1
" let g:solarized_underline=1
" let g:solarized_italic=1
" let g:solarized_contrast="normal"
" let g:solarized_visibility="normal"
" let g:solarized_diffmode="normal"
" let g:solarized_hitrail=0
" let g:solarized_menu=1

" NODTREE SETTTING

autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
map  :NERDTreeToggle
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif

let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'

About

vimrc

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors