From c0ad3bf837fe1d5439611c92f18cc5c8c79a7154 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Mon, 26 Dec 2016 21:11:19 +0800 Subject: [PATCH] Clone from wsdjeg/Dotfiles/config/nvim --- autoload/zvim.vim | 38 ++ autoload/zvim/debug.vim | 13 + autoload/zvim/mpv.vim | 34 ++ autoload/zvim/plug.vim | 185 +++++++++ autoload/zvim/util.vim | 269 ++++++++++++++ config/autocmds.vim | 78 ++++ config/commands.vim | 8 + config/functions.vim | 236 ++++++++++++ config/general.vim | 125 +++++++ config/init.vim | 170 +++++++++ config/main.vim | 27 ++ config/mappings.vim | 239 ++++++++++++ config/neovim.vim | 65 ++++ config/plugins.vim | 475 ++++++++++++++++++++++++ config/plugins/ctrlp.vim | 54 +++ config/plugins/ctrlsf.vim | 7 + config/plugins/denite.vim | 1 + config/plugins/deoplete.vim | 28 ++ config/plugins/goyo.vim | 18 + config/plugins/gruvbox.vim | 1 + config/plugins/java_getset.vim | 19 + config/plugins/jedi-vim.vim | 0 config/plugins/neocomplcache.vim | 84 +++++ config/plugins/neocomplete.vim | 46 +++ config/plugins/neomake.vim | 12 + config/plugins/neosnippet.vim | 24 ++ config/plugins/open-brower.vim | 31 ++ config/plugins/phpcomplete-extended.vim | 0 config/plugins/syntastic.vim | 12 + config/plugins/tagbar.vim | 2 + config/plugins/taglist.vim | 11 + config/plugins/unite-gtags.vim | 9 + config/plugins/unite.vim | 306 +++++++++++++++ config/plugins/vim-airline.vim | 59 +++ config/plugins/vim-grepper.vim | 0 config/plugins/vim-ref.vim | 34 ++ config/plugins/vim-startify.vim | 33 ++ config/plugins/vimfiler.vim | 53 +++ ginit.vim | 4 + 39 files changed, 2810 insertions(+) create mode 100644 autoload/zvim.vim create mode 100644 autoload/zvim/debug.vim create mode 100644 autoload/zvim/mpv.vim create mode 100644 autoload/zvim/plug.vim create mode 100644 autoload/zvim/util.vim create mode 100644 config/autocmds.vim create mode 100644 config/commands.vim create mode 100644 config/functions.vim create mode 100644 config/general.vim create mode 100644 config/init.vim create mode 100644 config/main.vim create mode 100644 config/mappings.vim create mode 100644 config/neovim.vim create mode 100644 config/plugins.vim create mode 100644 config/plugins/ctrlp.vim create mode 100644 config/plugins/ctrlsf.vim create mode 100644 config/plugins/denite.vim create mode 100644 config/plugins/deoplete.vim create mode 100644 config/plugins/goyo.vim create mode 100644 config/plugins/gruvbox.vim create mode 100644 config/plugins/java_getset.vim create mode 100644 config/plugins/jedi-vim.vim create mode 100644 config/plugins/neocomplcache.vim create mode 100644 config/plugins/neocomplete.vim create mode 100644 config/plugins/neomake.vim create mode 100644 config/plugins/neosnippet.vim create mode 100644 config/plugins/open-brower.vim create mode 100644 config/plugins/phpcomplete-extended.vim create mode 100644 config/plugins/syntastic.vim create mode 100644 config/plugins/tagbar.vim create mode 100644 config/plugins/taglist.vim create mode 100644 config/plugins/unite-gtags.vim create mode 100644 config/plugins/unite.vim create mode 100644 config/plugins/vim-airline.vim create mode 100644 config/plugins/vim-grepper.vim create mode 100644 config/plugins/vim-ref.vim create mode 100644 config/plugins/vim-startify.vim create mode 100644 config/plugins/vimfiler.vim create mode 100644 ginit.vim diff --git a/autoload/zvim.vim b/autoload/zvim.vim new file mode 100644 index 000000000..4ada5cf65 --- /dev/null +++ b/autoload/zvim.vim @@ -0,0 +1,38 @@ +function! zvim#tab() abort + if getline('.')[col('.')-2] ==# '{'&& pumvisible() + return "\" + endif + if neosnippet#expandable() && getline('.')[col('.')-2] ==# '(' && !pumvisible() + return "\(neosnippet_expand)" + elseif neosnippet#jumpable() && getline('.')[col('.')-2] ==# '(' && !pumvisible() && !neosnippet#expandable() + return "\(neosnippet_jump)" + elseif neosnippet#expandable_or_jumpable() && getline('.')[col('.')-2] !=#'(' + return "\(neosnippet_expand_or_jump)" + elseif pumvisible() + return "\" + else + return "\" + endif +endfunction + +function! zvim#enter() abort + if pumvisible() + if getline('.')[col('.') - 2]==# '{' + return "\" + elseif g:settings.autocomplete_method ==# 'neocomplete'||g:settings.autocomplete_method ==# 'deoplete' + return "\" + else + return "\a" + endif + elseif getline('.')[col('.') - 2]==#'{'&&getline('.')[col('.')-1]==#'}' + return "\\ko" + else + return "\" + endif +endfunction + +function! zvim#format() abort + let save_cursor = getcurpos() + normal! gg=G + call setpos('.', save_cursor) +endfunction diff --git a/autoload/zvim/debug.vim b/autoload/zvim/debug.vim new file mode 100644 index 000000000..4579303ff --- /dev/null +++ b/autoload/zvim/debug.vim @@ -0,0 +1,13 @@ +let s:debug_message = [] +function! zvim#debug#completion_debug(ArgLead, CmdLine, CursorPos) abort + call add(s:debug_message, "arglead:[".a:ArgLead ."] cmdline:[" .a:CmdLine ."] cursorpos:[" .a:CursorPos ."]") +endfunction + +function! zvim#debug#get_message() abort + return join(s:debug_message, "\n") +endfunction + +function! zvim#debug#clean_message() abort + let s:debug_message = [] + return s:debug_message +endfunction diff --git a/autoload/zvim/mpv.vim b/autoload/zvim/mpv.vim new file mode 100644 index 000000000..dd39552bd --- /dev/null +++ b/autoload/zvim/mpv.vim @@ -0,0 +1,34 @@ +let s:playId = 0 +fu! s:handler(id, data, event) abort + if a:event ==# 'exit' + echom 'job ' . a:id . ' exit with code:' . string(a:data) + let s:playId = 0 + endif +endf +function! zvim#mpv#stop() abort + if s:playId != 0 + call jobstop(s:playId) + let s:playId = 0 + endif + delcommand MStop +endfunction +function! zvim#mpv#play(file,...) abort + if has('nvim') + if s:playId != 0 + call jobstop(s:playId) + let s:playId = 0 + endif + let s:playId = jobstart(['mpv','--vid=no',a:file],{ + \ 'on_stdout': function('s:handler'), + \ 'on_stderr': function('s:handler'), + \ 'on_exit': function('s:handler'), + \ }) + else + if type(s:playId) == 8 && job_status(s:playId) ==# 'run' + call job_stop(s:playId) + let s:playId =0 + endif + let s:playId = job_start(['mpv','--vid=no',a:file]) + endif + command! MStop call zvim#mpv#stop() +endfunction diff --git a/autoload/zvim/plug.vim b/autoload/zvim/plug.vim new file mode 100644 index 000000000..6bffd477a --- /dev/null +++ b/autoload/zvim/plug.vim @@ -0,0 +1,185 @@ +let s:save_cpo = &cpo +set cpo&vim +function! s:install_manager() + " Fsep && Psep + if has('win16') || has('win32') || has('win64') + let s:Psep = ';' + let s:Fsep = '\' + else + let s:Psep = ':' + let s:Fsep = '/' + endif + " auto install plugin manager + if g:settings.plugin_manager ==# 'neobundle' + "auto install neobundle + if filereadable(expand(g:settings.plugin_bundle_dir) + \ . 'neobundle.vim'. s:Fsep. 'README.md') + let g:settings.neobundle_installed = 1 + else + if executable('git') + exec '!git clone ' + \ .'https://github.com/' + \ .'Shougo/neobundle.vim' + \ . ' ' + \ . g:settings.plugin_bundle_dir + \ . 'neobundle.vim' + let g:settings.neobundle_installed = 1 + else + echohl WarningMsg + echom "You need install git!" + echohl None + endif + endif + exec 'set runtimepath+=' + \ . g:settings.plugin_bundle_dir + \ . 'neobundle.vim' + elseif g:settings.plugin_manager == 'dein' + "auto install dein + if filereadable(expand(g:settings.plugin_bundle_dir) + \ . join(['repos', 'github.com', + \ 'Shougo', 'dein.vim', 'README.md'], + \ s:Fsep)) + let g:settings.dein_installed = 1 + else + if executable('git') + exec '!git clone https://github.com/Shougo/dein.vim ' + \ . g:settings.plugin_bundle_dir + \ . join(['repos', 'github.com', + \ 'Shougo', 'dein.vim'], s:Fsep) + let g:settings.dein_installed = 1 + else + echohl WarningMsg + echom "You need install git!" + echohl None + endif + endif + exec 'set runtimepath+='.g:settings.plugin_bundle_dir + \ . join(['repos', 'github.com', 'Shougo', + \ 'dein.vim'], s:Fsep) + elseif g:settings.plugin_manager == 'vim-plug' + "auto install vim-plug + if filereadable(expand('~/.cache/vim-plug/autoload/plug.vim')) + let g:settings.dein_installed = 1 + else + if executable('curl') + exec '!curl -fLo ' + \ . '~/.cache/vim-plug/autoload/plug.vim' + \ . ' --create-dirs ' + \ . 'https://raw.githubusercontent.com/' + \ . 'junegunn/vim-plug/master/plug.vim' + let g:settings.dein_installed = 1 + else + echohl WarningMsg + echom "You need install curl!" + echohl None + endif + endif + exec 'set runtimepath+=~/.cache/vim-plug/' + endif +endf + +if get(g:settings, 'enable_plugins', 1) + call s:install_manager() +endif + +function! zvim#plug#begin(path) abort + let g:unite_source_menu_menus.AddedPlugins = + \ {'description': + \ 'All the Added plugins' + \ . ' lp'} + let g:unite_source_menu_menus.AddedPlugins.command_candidates = [] + nnoremap lp :Unite -silent + \ -winheight=17 -start-insert menu:AddedPlugins + if g:settings.plugin_manager == 'neobundle' + call neobundle#begin(a:path) + elseif g:settings.plugin_manager == 'dein' + call dein#begin(a:path) + elseif g:settings.plugin_manager == 'vim-plug' + call plug#begin(a:path) + endif +endfunction + +function! zvim#plug#end() abort + if g:settings.plugin_manager == 'neobundle' + call neobundle#end() + if g:settings.checkinstall == 1 + NeoBundleCheck + endif + elseif g:settings.plugin_manager == 'dein' + call dein#end() + if g:settings.checkinstall == 1 + if dein#check_install() + call dein#install() + endif + endif + call dein#call_hook('source') + elseif g:settings.plugin_manager == 'vim-plug' + call plug#end() + endif +endfunction + +function! zvim#plug#defind_hooks(bundle) abort + if g:settings.plugin_manager == 'neobundle' + let s:hooks = neobundle#get_hooks(a:bundle) + func! s:hooks.on_source(bundle) abort + call zvim#util#source_rc('plugins/' . split(a:bundle['name'],'\.')[0] . '.vim') + endf + elseif g:settings.plugin_manager == 'dein' + call dein#config(g:dein#name, { + \ 'hook_source' : "call zvim#util#source_rc('plugins/" . split(g:dein#name,'\.')[0] . ".vim')" + \ }) + endif +endfunction + +function! zvim#plug#fetch() abort + if g:settings.plugin_manager == 'neobundle' + NeoBundleFetch 'Shougo/neobundle.vim' + elseif g:settings.plugin_manager == 'dein' + call dein#add('Shougo/dein.vim') + endif +endfunction + +let s:plugins = [] + +fu! s:parser(args) + return a:args +endf + +function! zvim#plug#add(repo,...) abort + if g:settings.plugin_manager == 'neobundle' + exec 'NeoBundle "'.a:repo.'"'.','.join(a:000,',') + elseif g:settings.plugin_manager == 'dein' + if len(a:000) > 0 + call dein#add(a:repo,s:parser(a:000[0])) + else + call dein#add(a:repo) + endif + endif + exec 'call add(g:unite_source_menu_menus' + \ . '.AddedPlugins.command_candidates, ["[' + \ . a:repo + \ . (len(a:000) > 0 ? (']' + \ . repeat(' ', 40 - len(a:repo)) + \ . '[lazy loaded] [' . string(a:000[0])) : '') + \ . ']","OpenBrowser https://github.com/' + \ . a:repo + \ . '"])' + call add(s:plugins, a:repo) +endfunction + +function! zvim#plug#tap(plugin) abort + if g:settings.plugin_manager == 'neobundle' + return neobundle#tap(a:plugin) + elseif g:settings.plugin_manager == 'dein' + return dein#tap(a:plugin) + endif +endfunction + +function! zvim#plug#enable_plug() abort + return g:settings.neobundle_installed + \ || g:settings.dein_installed + \ || g:settings.vim_plug_installed +endfunction + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/autoload/zvim/util.vim b/autoload/zvim/util.vim new file mode 100644 index 000000000..57be8060e --- /dev/null +++ b/autoload/zvim/util.vim @@ -0,0 +1,269 @@ +scriptencoding utf-8 +let s:save_cpo = &cpo +set cpo&vim +let g:unite_source_menu_menus = + \ get(g:,'unite_source_menu_menus',{}) +let g:unite_source_menu_menus.CustomKeyMaps = {'description': + \ 'Custom mapped keyboard shortcuts [unite]'} +let g:unite_source_menu_menus.CustomKeyMaps.command_candidates = + \ get(g:unite_source_menu_menus.CustomKeyMaps,'command_candidates', []) +let g:unite_source_menu_menus.MyStarredrepos = {'description': + \ 'All github repos starred by me ls'} +let g:unite_source_menu_menus.MyStarredrepos.command_candidates = + \ get(g:unite_source_menu_menus.MyStarredrepos,'command_candidates', []) +let g:unite_source_menu_menus.MpvPlayer = {'description': + \ 'Musics list lm'} +let g:unite_source_menu_menus.MpvPlayer.command_candidates = + \ get(g:unite_source_menu_menus.MpvPlayer,'command_candidates', []) +fu! zvim#util#defineMap(type,key,value,desc,...) abort + exec a:type . ' ' . a:key . ' ' . a:value + let description = '➤ ' + \. a:desc + \. repeat(' ', 80 - len(a:desc) - len(a:key)) + \. a:key + let cmd = len(a:000) > 0 ? a:000[0] : a:value + call add(g:unite_source_menu_menus.CustomKeyMaps.command_candidates, [description,cmd]) + +endf +fu! zvim#util#source_rc(file) abort + if filereadable(g:Config_Main_Home. '/' . a:file) + execute 'source ' . g:Config_Main_Home . '/' . a:file + endif +endf + +fu! zvim#util#SmartClose() abort + let ignorewin = get(g:settings,'smartcloseignorewin',[]) + let ignoreft = get(g:settings,'smartcloseignoreft',[]) + let win_count = winnr('$') + let num = win_count + for i in range(1,win_count) + if index(ignorewin , bufname(winbufnr(i))) != -1 || index(ignoreft, getbufvar(bufname(winbufnr(i)),'&filetype')) != -1 + let num = num - 1 + endif + if getbufvar(winbufnr(i),'&buftype') ==# 'quickfix' + let num = num - 1 + endif + endfor + if num == 1 + else + close + endif +endf + +fu! s:findFileInParent(what, where) abort " {{{2 + let old_suffixesadd = &suffixesadd + let &suffixesadd = '' + let file = findfile(a:what, escape(a:where, ' ') . ';') + let &suffixesadd = old_suffixesadd + return file +endf " }}}2 +fu! s:findDirInParent(what, where) abort " {{{2 + let old_suffixesadd = &suffixesadd + let &suffixesadd = '' + let dir = finddir(a:what, escape(a:where, ' ') . ';') + let &suffixesadd = old_suffixesadd + return dir +endf " }}}2 +fu! zvim#util#CopyToClipboard(...) abort + if a:0 + if executable('git') + let repo_home = fnamemodify(s:findDirInParent('.git', expand('%:p')), ':p:h:h') + if repo_home !=# '' || !isdirectory(repo_home) + let branch = split(systemlist('git -C '. repo_home. ' branch -a |grep "*"')[0],' ')[1] + let remotes = filter(systemlist('git -C '. repo_home. ' remote -v'),"match(v:val,'^origin') >= 0 && match(v:val,'fetch') > 0") + if len(remotes) > 0 + let remote = remotes[0] + if stridx(remote, '@') > -1 + let repo_url = 'https://github.com/'. split(split(remote,' ')[0],':')[1] + let repo_url = strpart(repo_url, 0, len(repo_url) - 4) + else + let repo_url = split(remote,' ')[0] + let repo_url = strpart(repo_url, stridx(repo_url, 'http'),len(repo_url) - 4 - stridx(repo_url, 'http')) + endif + let f_url =repo_url. '/blob/'. branch. '/'. strpart(expand('%:p'), len(repo_home) + 1, len(expand('%:p'))) + if WINDOWS() + let f_url = substitute(f_url, '\', '/', 'g') + endif + if a:1 == 2 + let current_line = line('.') + let f_url .= '#L' . current_line + elseif a:1 == 3 + let f_url .= '#L' . getpos("'<")[1] . '-L' . getpos("'>")[1] + endif + let @+=f_url + echo 'Copied to clipboard' + else + echohl WarningMsg | echom 'This git repo has no remote host' | echohl None + endif + else + echohl WarningMsg | echom 'This file is not in a git repo' | echohl None + endif + else + echohl WarningMsg | echom 'You need install git!' | echohl None + endif + else + let @+=expand('%:p') + echo 'Copied to clipboard' + endif +endf + +fu! zvim#util#check_if_expand_tab() abort + let has_noexpandtab = search('^\t','wn') + let has_expandtab = search('^ ','wn') + if has_noexpandtab && has_expandtab + let idx = inputlist ( ['ERROR: current file exists both expand and noexpand TAB, python can only use one of these two mode in one file.\nSelect Tab Expand Type:', + \ '1. expand (tab=space, recommended)', + \ '2. noexpand (tab=\t, currently have risk)', + \ '3. do nothing (I will handle it by myself)']) + let tab_space = printf('%*s',&tabstop,'') + if idx == 1 + let has_noexpandtab = 0 + let has_expandtab = 1 + silent exec '%s/\t/' . tab_space . '/g' + elseif idx == 2 + let has_noexpandtab = 1 + let has_expandtab = 0 + silent exec '%s/' . tab_space . '/\t/g' + else + return + endif + endif + if has_noexpandtab == 1 && has_expandtab == 0 + echomsg 'substitute space to TAB...' + set noexpandtab + echomsg 'done!' + elseif has_noexpandtab == 0 && has_expandtab == 1 + echomsg 'substitute TAB to space...' + set expandtab + echomsg 'done!' + else + " it may be a new file + " we use original vim setting + endif +endf + +function! zvim#util#BufferEmpty() abort + let l:current = bufnr('%') + if ! getbufvar(l:current, '&modified') + enew + silent! execute 'bdelete '.l:current + endif +endfunction + +function! zvim#util#loadMusics() abort + let musics = globpath('~/Musics', '*.mp3', 0, 1) + let g:unite_source_menu_menus.MpvPlayer.command_candidates = [] + for m in musics + call add(g:unite_source_menu_menus.MpvPlayer.command_candidates, + \ [fnamemodify(m, ':t'), + \ "call zvim#mpv#play('" . m . "')"]) + endfor +endfunction + +function! zvim#util#listDirs(dir) abort + let dir = fnamemodify(a:dir, ':p') + if isdirectory(dir) + let cmd = printf('ls -F %s | grep /$', dir) + return map(systemlist(cmd), 'v:val[:-2]') + endif + return [] +endfunction + +function! zvim#util#OpenVimfiler() abort + if bufnr('vimfiler') == -1 + VimFiler + AirlineRefresh + wincmd p + IndentLinesToggle + IndentLinesToggle + wincmd p + else + VimFiler + AirlineRefresh + endif +endfunction + +let s:plugins_argv = ['-update', '-openurl'] + +function! zvim#util#complete_plugs(ArgLead, CmdLine, CursorPos) abort + call zvim#debug#completion_debug(a:ArgLead, a:CmdLine, a:CursorPos) + if a:CmdLine =~# 'Plugin\s*$' || a:ArgLead =~# '^-[a-zA-Z]*' + return join(s:plugins_argv, "\n") + endif + return join(plugins#list(), "\n") +endfunction + +function! zvim#util#Plugin(...) abort + let adds = [] + let updates = [] + let flag = 0 + for a in a:000 + if flag == 1 + call add(adds, a) + elseif flag == 2 + call add(updates, a) + endif + if a ==# '-update' + let flag = 1 + elseif a ==# '-openurl' + let flag = 2 + endif + endfor + echo string(adds) . "\n" . string(updates) +endfunction + +function! zvim#util#complete_project(ArgLead, CmdLine, CursorPos) abort + call zvim#debug#completion_debug(a:ArgLead, a:CmdLine, a:CursorPos) + let dir = get(g:settings, 'src_root', '~') + "return globpath(dir, '*') + let result = split(globpath(dir, '*'), "\n") + let ps = [] + for p in result + if isdirectory(p) && isdirectory(p. '\' . '.git') + call add(ps, fnamemodify(p, ':t')) + endif + endfor + return join(ps, "\n") +endfunction + +function! zvim#util#OpenProject(p) abort + let dir = get(g:settings, 'src_root', '~') . a:p + exe 'CtrlP '. dir +endfunction + +function! zvim#util#UpdateHosts(...) abort + if len(a:000) == 0 + let url = get(g:settings, 'hosts_url', '') + else + let url = a:1 + endif + let hosts = systemlist('curl -s ' . url) + if WINDOWS() + let local_hosts = $SystemRoot . expand('\System32\drivers\etc\hosts') + else + let local_hosts = '/etc/hosts' + endif + if writefile(hosts, local_hosts, 'a') == -1 + echo 'failed!' + else + echo 'successfully!' + endif +endfunction +fu! zvim#util#Generate_ignore(ignore,tool) abort + let ignore = [] + if a:tool ==# 'ag' + for ig in split(a:ignore,',') + call add(ignore, '--ignore') + call add(ignore, ig) + endfor + elseif a:tool ==# 'rg' + for ig in split(a:ignore,',') + call add(ignore, '-g') + call add(ignore, '!' . ig) + endfor + endif + return ignore +endf + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/config/autocmds.vim b/config/autocmds.vim new file mode 100644 index 000000000..d2de4f87a --- /dev/null +++ b/config/autocmds.vim @@ -0,0 +1,78 @@ +"autocmds +augroup My_autocmds + au! + autocmd BufWinEnter quickfix nnoremap + \ q :cclose:lclose + autocmd BufEnter * if (winnr('$') == 1 && &buftype ==# 'quickfix' ) | + \ bd| + \ q | endif + autocmd FileType jsp call JspFileTypeInit() + autocmd FileType html,css,jsp EmmetInstall + autocmd FileType java call JavaFileTypeInit() + autocmd BufEnter,WinEnter,InsertLeave * set cursorline + autocmd BufLeave,WinLeave,InsertEnter * set nocursorline + autocmd BufReadPost * + \ if line("'\"") > 0 && line("'\"") <= line("$") | + \ exe "normal! g`\"" | + \ endif + autocmd BufNewFile,BufEnter * set cpoptions+=d " NOTE: ctags find the tags file from the current path instead of the path of currect file + autocmd BufEnter * :syntax sync fromstart " ensure every file does syntax highlighting (full) + autocmd BufNewFile,BufRead *.avs set syntax=avs " for avs syntax file. + autocmd FileType text setlocal textwidth=78 " for all text files set 'textwidth' to 78 characters. + autocmd FileType c,cpp,cs,swig set nomodeline " this will avoid bug in my project with namespace ex, the vim will tree ex:: as modeline. + autocmd FileType c,cpp,java,javascript set comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,f:// + autocmd FileType cs set comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,f:///,f:// + autocmd FileType vim set comments=sO:\"\ -,mO:\"\ \ ,eO:\"\",f:\" + autocmd FileType lua set comments=f:-- + autocmd FileType vim setlocal foldmethod=marker + autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS + autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS + autocmd Filetype html setlocal omnifunc=htmlcomplete#CompleteTags + autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags + autocmd FileType xml call XmlFileTypeInit() + autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags + autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS + autocmd FileType python setlocal omnifunc=pythoncomplete#Complete + autocmd FileType php setlocal omnifunc=phpcomplete_extended#CompletePHP + autocmd BufEnter * + \ if empty(&buftype)&&has('nvim') + \| nnoremap :call MyTagfunc() + \| nnoremap :call MyTagfuncBack() + \| else + \| nnoremap ] :call MyTagfunc() + \| nnoremap [ :call MyTagfuncBack() + \| endif + "}}} + autocmd FileType python,coffee call zvim#util#check_if_expand_tab() + " Instead of reverting the cursor to the last position in the buffer, we + " set it to the first line when editing a git commit message + au FileType gitcommit au! BufEnter COMMIT_EDITMSG call setpos('.', [0, 1, 1, 0]) + autocmd InsertEnter * call s:tool() + if executable('synclient') + let s:touchpadoff = 0 + autocmd InsertEnter * call s:disable_touchpad() + autocmd InsertLeave * call s:enable_touchpad() + autocmd FocusLost * call system('synclient touchpadoff=0') + autocmd FocusGained * call s:reload_touchpad_status() + endif +augroup END +function! s:reload_touchpad_status() + if s:touchpadoff + call s:disable_touchpad() + endif +endf +function! s:disable_touchpad() abort + let s:touchpadoff = 1 + call system('synclient touchpadoff=1') +endfunction +function! s:enable_touchpad() abort + let s:touchpadoff = 0 + call system('synclient touchpadoff=0') +endfunction +fu! s:tool() + if !exists('s:done') + IndentLinesToggle + IndentLinesToggle + let s:done = 1 + endif +endf diff --git a/config/commands.vim b/config/commands.vim new file mode 100644 index 000000000..804c5b58a --- /dev/null +++ b/config/commands.vim @@ -0,0 +1,8 @@ +" Convenient command to see the difference between the current buffer and the +" file it was loaded from, thus the changes you made. Only define it when not +" defined already. +command! DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis + \ | wincmd p | diffthis +command -nargs=* -complete=custom,zvim#util#complete_plugs Plugin :call zvim#util#Plugin() +"command for open project +command -nargs=+ -complete=custom,zvim#util#complete_project OpenProject :call zvim#util#OpenProject() diff --git a/config/functions.vim b/config/functions.vim new file mode 100644 index 000000000..38424ac05 --- /dev/null +++ b/config/functions.vim @@ -0,0 +1,236 @@ +"Detect OS +function! OSX() + return has('macunix') +endfunction +function! LINUX() + return has('unix') && !has('macunix') && !has('win32unix') +endfunction +function! WINDOWS() + return (has('win16') || has('win32') || has('win64')) +endfunction +function! OnmiConfigForJsp() + let pos1 = search("","nb",line("w0")) + let pos2 = search("","n",line("w$")) + let pos0 = line('.') + if pos1 < pos2 && pos2 < pos0 && pos0 < pos3 + set omnifunc=javascriptcomplete#CompleteJS + return "\a." + else + set omnifunc=javacomplete#Complete + return "\a." + endif +endf +function! ToggleNumber() + let s:isThereNumber = &nu + let s:isThereRelativeNumber = &relativenumber + if s:isThereNumber && s:isThereRelativeNumber + set paste! + set nonumber + set norelativenumber + else + set paste! + set number + set relativenumber + endif +endf +function! ToggleBG() + let s:tbg = &background + " Inversion + if s:tbg == "dark" + set background=light + else + set background=dark + endif +endfunction +function! BracketsFunc() + let line = getline('.') + let col = col('.') + if line[col - 2] == "]" + return "{}\i" + else + return "{\}\O" + endif +endf +function! XmlFileTypeInit() + set omnifunc=xmlcomplete#CompleteTags + if filereadable("AndroidManifest.xml") + set dict+=~/.vim/bundle/vim-dict/dict/android_xml.dic + endif +endf +function! JavaFileTypeInit() + set omnifunc=javacomplete#Complete + set tags +=~/others/openjdksrc/java/tags + set tags +=~/others/openjdksrc/javax/tags + inoremap UU bgUwea + inoremap uu bguwea + inoremap ua bgulea + inoremap Ua bgUlea + nmap (JavaComplete-Imports-Add) + imap (JavaComplete-Imports-Add) +endf +function! WSDAutoComplete(char) + if(getline(".")=~?'^\s*.*\/\/')==0 + let line = getline('.') + let col = col('.') + if a:char == "." + return a:char."\\\" + elseif line[col - 2] == " "||line[col -2] == "("||line[col - 2] == "," + return a:char."\\\" + elseif line[col - 3] == " "&&line[col - 2] =="@" + return a:char."\\\" + else + return a:char + endif + else + "bug exists + normal! ma + let commentcol = searchpos('//','b',line('.'))[1] + normal! `a + if commentcol == 0 + return a:char."\\\" + else + return "\".a:char + endif + endif +endf +function! ClosePair(char) + if getline('.')[col('.') - 1] == a:char + return "\" + else + return a:char + endif +endf + +function! CloseBracket() + if match(getline(line('.') + 1), '\s*}') < 0 + return "\}" + else + return "\j0f}a" + endif +endf + +function! QuoteDelim(char) + let line = getline('.') + let col = col('.') + if line[col - 2] == "\\" + "Inserting a quoted quotation mark into the string + return a:char + elseif line[col - 1] == a:char + "Escaping out of the string + return "\" + else + "Starting a string + return a:char.a:char."\i" + endif +endf +function! JspFileTypeInit() + set tags+=/home/wsdjeg/others/openjdk-8-src/tags + set omnifunc=javacomplete#Complete + inoremap . =OnmiConfigForJsp() + nnoremap :JCimportAdd + inoremap :JCimportAddI +endfunction +function! MyTagfunc() abort + mark H + let s:MyTagfunc_flag = 1 + UniteWithCursorWord -immediately tag +endfunction + +function! MyTagfuncBack() abort + if exists('s:MyTagfunc_flag')&&s:MyTagfunc_flag + exe "normal! `H" + let s:MyTagfunc_flag =0 + endif +endfunction + +function! MyEnterfunc() abort + if pumvisible() + if getline('.')[col('.') - 2]=="{" + return "\" + elseif g:settings.autocomplete_method == 'neocomplete'||g:settings.autocomplete_method == 'deoplete' + return "\" + else + return "\a" + endif + elseif getline('.')[col('.') - 2]=="{"&&getline('.')[col('.')-1]=="}" + return "\\ko" + else + return "\" + endif +endf + +function! MyLeaderTabfunc() abort + if g:settings.autocomplete_method == 'deoplete' + if g:settings.enable_javacomplete2_py + return deoplete#mappings#manual_complete(['javacomplete2']) + else + return deoplete#mappings#manual_complete(['omni']) + endif + elseif g:settings.autocomplete_method == 'neocomplete' + return neocomplete#start_manual_complete(['omni']) + endif +endfunction + +function! MyTabfunc() abort + if getline('.')[col('.')-2] =='{'&& pumvisible() + return "\" + endif + if neosnippet#expandable() && getline('.')[col('.')-2] =='(' && !pumvisible() + return "\(neosnippet_expand)" + elseif neosnippet#jumpable() && getline('.')[col('.')-2] =='(' && !pumvisible() && !neosnippet#expandable() + return "\(neosnippet_jump)" + elseif neosnippet#expandable_or_jumpable() && getline('.')[col('.')-2] !='(' + return "\(neosnippet_expand_or_jump)" + elseif pumvisible() + return "\" + else + return "\" + endif +endfunction +func! Openpluginrepo() + try + exec "normal! ".'"ayi'."'" + exec 'OpenBrowser https://github.com/'.@a + catch + echohl WarningMsg | echomsg "can not open the web of current plugin" | echohl None + endtry +endf +func! Update_current_plugin() + try + let a_save = @a + let @a='' + normal! "ayi' + let plug_name = match(@a, '/') >= 0 ? split(@a, '/')[1] : @a + finally + let @a = a_save + endtry + call dein#update([plug_name]) +endf +func! Show_Log_for_current_plugin() + try + let a_save = @a + let @a='' + normal! "ayi' + let plug = match(@a, '/') >= 0 ? @a : 'vim-scripts/'.@a + finally + let @a = a_save + endtry + call unite#start([['output/shellcmd', + \ 'git --no-pager -C ~/.cache/vimfiles/repos/github.com/' + \ . plug + \ . ' log -n 15 --oneline']], {'log': 1, 'wrap': 1,'start_insert':0}) + exe "nnoremap :call Opencommit('". plug ."', strpart(split(getline('.'),'[33m')[1],0,7))" +endf +fu! s:Opencommit(repo,commit) + exe "OpenBrowser https://github.com/" . a:repo ."/commit/". a:commit +endf + +fu! UpdateStarredRepos() + let repos = githubapi#users#GetStarred('wsdjeg') + for repo in repos + let description = repo.full_name . repeat(' ', 40 - len(repo.full_name)) . repo.description + let cmd = "OpenBrowser " . repo.html_url + call add(g:unite_source_menu_menus.MyStarredrepos.command_candidates, [description,cmd]) + endfor +endf diff --git a/config/general.vim b/config/general.vim new file mode 100644 index 000000000..bee547cef --- /dev/null +++ b/config/general.vim @@ -0,0 +1,125 @@ +scriptencoding utf-8 +" basic vim settiing +if has("gui_running") + set guioptions-=m " 隐藏菜单栏 + set guioptions-=T " 隐藏工具栏 + set guioptions-=L " 隐藏左侧滚动条 + set guioptions-=r " 隐藏右侧滚动条 + set guioptions-=b " 隐藏底部滚动条 + set showtabline=0 " 隐藏Tab栏 + if WINDOWS() + " please install the font in 'Dotfiles\font' + set guifont=DejaVu_Sans_Mono_for_Powerline:h11:cANSI:qDRAFT + else + set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 11 + endif +endif + +" indent use backspace delete indent, eol use backspace delete line at +" begining start delete the char you just typed in if you do not use set +" nocompatible ,you need this +set backspace=indent,eol,start + +"显示相对行号 +set relativenumber + +" 显示行号 +set number + +" 自动缩进,自动智能对齐 +set autoindent +set smartindent +set cindent + +" 状态栏预览命令 +set wildmenu + +"整词换行 +set linebreak + +"Tab键的宽度 +set tabstop=4 +"用空格来执行tab +set expandtab +" 统一缩进为4 +set softtabstop=4 +set shiftwidth=4 +"set nobackup +set backup +set undofile +set undolevels=1000 +let g:data_dir = $HOME . '/.data/' +let g:backup_dir = g:data_dir . 'backup' +let g:swap_dir = g:data_dir . 'swap' +let g:undo_dir = g:data_dir . 'undofile' +if finddir(g:data_dir) == '' + silent call mkdir(g:data_dir) +endif +if finddir(g:backup_dir) == '' + silent call mkdir(g:backup_dir) +endif +if finddir(g:swap_dir) == '' + silent call mkdir(g:swap_dir) +endif +if finddir(g:undo_dir) == '' + silent call mkdir(g:undo_dir) +endif +unlet g:backup_dir +unlet g:swap_dir +unlet g:data_dir +unlet g:undo_dir +set undodir=$HOME/.data/undofile +set backupdir=$HOME/.data/backup +set directory=$HOME/.data/swap +set nofoldenable "关闭自动折叠 折叠按键 'za' +set nowritebackup +set matchtime=0 +set ruler +set showcmd "命令行显示输入的命令 +set showmatch "设置匹配模式,显示匹配的括号 +set showmode "命令行显示当前vim的模式 +"menuone: show the pupmenu when only one match +set completeopt=menu,menuone,longest " disable preview scratch window, +set complete=.,w,b,u,t " h: 'complete' +set pumheight=15 " limit completion menu height +set scrolloff=7 "最低显示行数 +set incsearch +set autowrite +set hlsearch +set laststatus=2 +set completeopt=longest,menu +exe "set wildignore+=" . g:settings.wildignore +set wildignorecase +let g:markdown_fenced_languages = ['vim', 'java', 'bash=sh', 'sh', 'html', 'python'] +set mouse= +set hidden +set ttimeout +set ttimeoutlen=50 +" shell +if has('filterpipe') + set noshelltemp +endif +filetype plugin indent on +syntax on +if count(g:settings.plugin_groups, 'colorscheme')&&g:settings.colorscheme!='' "{{{ + set background=dark + try + exec 'colorscheme '. g:settings.colorscheme + catch + exec 'colorscheme '. g:settings.colorscheme_default + endtry +endif +if g:settings.enable_cursorline == 1 + set cursorline "显示当前行 +endif +if g:settings.enable_cursorcolumn == 1 + set cursorcolumn "显示当前列 +endif +if g:settings.hiddenfileinfo == 1 && has("patch-7.4.1570") + set shortmess=filnxtToOFs +endif +if exists('+termguicolors') + set termguicolors +elseif exists('+guicolors') + set guicolors +endif diff --git a/config/init.vim b/config/init.vim new file mode 100644 index 000000000..0c3a4d007 --- /dev/null +++ b/config/init.vim @@ -0,0 +1,170 @@ +scriptencoding utf-8 +" Enable nocompatible +if has('vim_starting') + if &compatible + set nocompatible + endif +endif + +" Fsep && Psep +if has('win16') || has('win32') || has('win64') + let s:Psep = ';' + let s:Fsep = '\' +else + let s:Psep = ':' + let s:Fsep = '/' +endif +"Use English for anything in vim +if WINDOWS() + silent exec 'lan mes en_US.UTF-8' +elseif OSX() + silent exec 'language en_US' +else + let s:uname = system('uname -s') + if s:uname ==# "Darwin\n" + " in mac-terminal + silent exec 'language en_US' + else + " in linux-terminal + silent exec 'language en_US.utf8' + endif +endif + +" try to set encoding to utf-8 +if WINDOWS() + " Be nice and check for multi_byte even if the config requires + " multi_byte support most of the time + if has('multi_byte') + " Windows cmd.exe still uses cp850. If Windows ever moved to + " Powershell as the primary terminal, this would be utf-8 + set termencoding=cp850 + " Let Vim use utf-8 internally, because many scripts require this + set encoding=utf-8 + setglobal fileencoding=utf-8 + " Windows has traditionally used cp1252, so it's probably wise to + " fallback into cp1252 instead of eg. iso-8859-15. + " Newer Windows files might contain utf-8 or utf-16 LE so we might + " want to try them first. + set fileencodings=ucs-bom,utf-8,utf-16le,cp1252,iso-8859-15 + endif + +else + " set default encoding to utf-8 + set encoding=utf-8 + set termencoding=utf-8 +endif + +" Enable 256 colors +if $COLORTERM ==# 'gnome-terminal' + set t_Co=256 +endif + +"Vim settings +let g:settings = get(g:, 'settings', {}) +let g:settings.default_indent = 2 +let g:settings.max_column = 120 +let g:settings.enable_googlesuggest = 0 +let g:settings.auto_download_neobundle = 0 +let g:settings.neobundle_installed = 0 +let g:settings.dein_installed = 0 +let g:settings.vim_plug_installed = 0 +let g:settings.plugin_bundle_dir = $HOME. join(['', '.cache', 'vimfiles', ''],s:Fsep) +let g:settings.autocomplete_method = '' +let g:settings.enable_cursorcolumn = 0 +let g:settings.enable_neomake = 1 +let g:settings.enable_ycm = 0 +let g:settings.enable_neocomplcache = 0 +let g:settings.enable_cursorline = 0 +let g:settings.error_symbol = '✖' +let g:settings.warning_symbol = '⚠' +let g:settings.use_colorscheme = 1 +let g:settings.vim_help_language = 'en' +let g:settings.colorscheme = 'gruvbox' +let g:settings.colorscheme_default = 'desert' +let g:settings.filemanager = 'vimfiler' +let g:settings.plugin_manager = 'dein' " neobundle or dein or vim-plug +let g:settings.checkinstall = 0 +let g:settings.hiddenfileinfo = 1 +let g:settings.plugin_groups_exclude = [] +let g:settings.smartcloseignorewin = ['__Tagbar__' , 'vimfiler:default'] +let g:settings.smartcloseignoreft = ['help'] +let g:settings.altmoveignoreft = ['Tagbar' , 'vimfiler'] +let g:settings.enable_javacomplete2_py = 0 +let g:settings.src_root = 'E:\sources\' +let g:settings.hosts_url = 'https://raw.githubusercontent.com/racaljk/hosts/master/hosts' +let g:settings.wildignore = '*/tmp/*,*.so,*.swp,*.zip,*.class,tags,*.jpg, + \*.ttf,*.TTF,*.png,*/target/*, + \.git,.svn,.hg,.DS_Store' + +"core vimrc +let g:settings.plugin_groups = [] +call add(g:settings.plugin_groups, 'web') +call add(g:settings.plugin_groups, 'javascript') +call add(g:settings.plugin_groups, 'ruby') +call add(g:settings.plugin_groups, 'python') +call add(g:settings.plugin_groups, 'scala') +call add(g:settings.plugin_groups, 'go') +call add(g:settings.plugin_groups, 'scm') +call add(g:settings.plugin_groups, 'editing') +call add(g:settings.plugin_groups, 'indents') +call add(g:settings.plugin_groups, 'navigation') +call add(g:settings.plugin_groups, 'misc') + +call add(g:settings.plugin_groups, 'core') +call add(g:settings.plugin_groups, 'unite') +if has('python3') + call add(g:settings.plugin_groups, 'denite') +endif +call add(g:settings.plugin_groups, 'ctrlp') +call add(g:settings.plugin_groups, 'autocomplete') +if ! has('nvim') + call add(g:settings.plugin_groups, 'vim') +else + call add(g:settings.plugin_groups, 'nvim') +endif + + +if g:settings.vim_help_language ==# 'cn' + call add(g:settings.plugin_groups, 'chinese') +endif +if g:settings.use_colorscheme==1 + call add(g:settings.plugin_groups, 'colorscheme') +endif +if OSX() + call add(g:settings.plugin_groups, 'osx') +endif +if WINDOWS() + call add(g:settings.plugin_groups, 'windows') +endif +if LINUX() + call add(g:settings.plugin_groups, 'linux') +endif + +if has('nvim') + let g:settings.autocomplete_method = 'deoplete' +elseif has('lua') + let g:settings.autocomplete_method = 'neocomplete' +else + let g:settings.autocomplete_method = 'neocomplcache' +endif +if g:settings.enable_ycm + let g:settings.autocomplete_method = 'ycm' +endif +if g:settings.enable_neocomplcache + let g:settings.autocomplete_method = 'neocomplcache' +endif + +for s:group in g:settings.plugin_groups_exclude + let s:i = index(g:settings.plugin_groups, s:group) + if s:i != -1 + call remove(g:settings.plugin_groups, s:i) + endif +endfor + +" python host for neovim +let g:python_host_prog = '/usr/bin/python2' +let g:python3_host_prog = '/usr/bin/python3' +if WINDOWS() + let g:python_host_prog = 'D:\Python27\python.exe' + let g:python3_host_prog = 'C:\Users\wsdjeg\AppData\Local\Programs\Python\Python35-32\python.exe' +endif diff --git a/config/main.vim b/config/main.vim new file mode 100644 index 000000000..37beeda3a --- /dev/null +++ b/config/main.vim @@ -0,0 +1,27 @@ +let g:Config_Main_Home = fnamemodify(expand(''), ':p:h:gs?\\?'.((has('win16') || has('win32') || has('win64'))?'\':'/') . '?') +try + call zvim#util#source_rc('functions.vim') +catch + execute "set rtp +=" . fnamemodify(g:Config_Main_Home, ':p:h:h') + call zvim#util#source_rc('functions.vim') +endtry + +call zvim#util#source_rc('init.vim') + +scriptencoding utf-8 + +call zvim#util#source_rc('local.vim') + +call zvim#util#source_rc('plugins.vim') + +call zvim#util#source_rc('general.vim') + +call zvim#util#source_rc('mappings.vim') + +call zvim#util#source_rc('autocmds.vim') + +if has('nvim') + call zvim#util#source_rc('neovim.vim') +endif + +call zvim#util#source_rc('commands.vim') diff --git a/config/mappings.vim b/config/mappings.vim new file mode 100644 index 000000000..8c25933c2 --- /dev/null +++ b/config/mappings.vim @@ -0,0 +1,239 @@ +scriptencoding utf-8 +"mapping +"全局映射 +"也可以通过'za'打开或者关闭折叠 +nnoremap @=((foldclosed(line('.')) < 0) ? 'zc' : 'zo') +"Super paste it does not work +"ino :set pastemui+mv'uV'v=:set nopaste +"对于没有权限的文件使用 :w!!来保存 +cnoremap w!! %!sudo tee > /dev/null % +" cmap W!! w !sudo tee % >/dev/null " I can not understand +" Save a file with sudo +" http://forrst.com/posts/Use_w_to_sudo_write_a_file_with_Vim-uAN + + +" 映射Ctrl+上下左右来切换窗口 +nnoremap :wincmd l +nnoremap :wincmd h +nnoremap :wincmd k +nnoremap :wincmd j +if has('nvim') + exe 'tnoremap :wincmd l' + exe 'tnoremap :wincmd h' + exe 'tnoremap :wincmd k' + exe 'tnoremap :wincmd j' + exe 'tnoremap ' +endif + +"for buftabs +noremap bp :bprev +noremap bn :bnext + +"Quickly add empty lines +nnoremap [ :put! =repeat(nr2char(10), v:count1) +nnoremap ] :put =repeat(nr2char(10), v:count1) + +"Use jk switch to normal model +inoremap jk + +"]e or [e move current line ,count can be useed +nnoremap [e :execute 'move -1-'. v:count1 +nnoremap ]e :execute 'move +'. v:count1 + +"] or ] move current line to the end or the begin of current buffer +nnoremap ] ddGp`` +nnoremap ] ddggP`` +vnoremap ] dGp`` +vnoremap ] dggP`` + + +"Ctrl+Shift+上下移动当前行 +nnoremap :m .+1== +nnoremap :m .-2== +inoremap :m .+1==gi +inoremap :m .-2==gi +"上下移动选中的行 +vnoremap :m '>+1gv=gv +vnoremap :m '<-2gv=gv +"background +noremap bg :call ToggleBG() +"numbers +noremap nu :call ToggleNumber() +" download gvimfullscreen.dll from github, copy gvimfullscreen.dll to +" the directory that has gvim.exe +nnoremap :call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0) +" yark and paste +vmap y "+y +vmap d "+d +nmap p "+p +nmap P "+P +vmap p "+p +vmap P "+P + +" Start new line +inoremap o + +" Improve scroll, credits: https://github.com/Shougo +nnoremap zz (winline() == (winheight(0)+1) / 2) ? + \ 'zt' : (winline() == 1) ? 'zb' : 'zz' +noremap max([winheight(0) - 2, 1]) + \ ."\".(line('w$') >= line('$') ? "L" : "H") +noremap max([winheight(0) - 2, 1]) + \ ."\".(line('w0') <= 1 ? "H" : "L") +noremap (line("w$") >= line('$') ? "j" : "3\") +noremap (line("w0") <= 1 ? "k" : "3\") + +" Select blocks after indenting +xnoremap < >gv| + +" Use tab for indenting in visual mode +xnoremap >gv| +xnoremap >>_ +nnoremap < <<_ + +" smart up and down +nnoremap gj +nnoremap gk + +" Select last paste +nnoremap gp '`['.strpart(getregtype(), 0, 1).'`]' + +" Disable Q and gQ +nnoremap Q +nnoremap gQ + +" Navigate window +nnoremap +nnoremap x + +" Navigation in command line +cnoremap +cnoremap +cnoremap + +" When pressing cd switch to the directory of the open buffer +" map cd :cd %:p:h:pwd "I use RooterChangeToRootDirectory + +" Fast saving +nnoremap w :w +vnoremap w :w +nnoremap :w +vnoremap :w +cnoremap w + +" Toggle editor visuals +nmap ts :setlocal spell! +nmap tn :setlocal nonumber! norelativenumber! +nmap tl :setlocal nolist! +nmap th :nohlsearch +nmap tw :setlocal wrap! breakindent! + +" Tabs +nnoremap g0 :tabfirst +nnoremap g$ :tablast +nnoremap gr :tabprevious + +" Remove spaces at the end of lines +nnoremap , :silent! keeppatterns %substitute/\s\+$//e + +" C-r: Easier search and replace +xnoremap :call VSetSearch('/'):%s/\V=@///gc + +" Location list movement +nmap lj :lnext +nmap lk :lprev +nmap lq :lclose + +" quickfix list movement +nmap qj :cnext +nmap qk :cprev +nmap qq :cclose + +" Duplicate lines +nnoremap d m`YP`` +vnoremap d YPgv + +fu! s:tobur(num) + if index(get(g:settings,'altmoveignoreft',[]), &filetype) == -1 + if a:num ==# 'bnext' + bnext + elseif a:num ==# 'bprev' + bprev + else + let ls = split(execute(':ls'), "\n") + let buffers = [] + for b in ls + let nr = matchstr(b, '\d\+') + call add(buffers, nr) + endfor + if len(buffers) >= a:num + exec 'buffer ' . buffers[a:num - 1] + endif + endif + endif +endf +"irssi like hot key +nnoremap :call tobur(1) +nnoremap :call tobur(2) +nnoremap :call tobur(3) +nnoremap :call tobur(4) +nnoremap :call tobur(5) +nnoremap :call tobur("bnext") +nnoremap :call tobur("bprev") + +"qqmsg hot key +nnoremap :call chat#qq#OpenMsgWin() +"weixin hot key +nnoremap :call chat#weixin#OpenMsgWin() +"chatting hot key +nnoremap :call chat#chatting#OpenMsgWin() + +"format current buffer +nnoremap g= :call zvim#format() + + +call zvim#util#defineMap('vnoremap', 'S', "y:execute @@:echo 'Sourced selection.'", + \ 'Sourced selection.', + \ "echo 'Use S to sourced selection.'") +call zvim#util#defineMap('nnoremap','S',"^vg_y:execute @@:echo 'Sourced line.'",'Source line', + \ "echo 'Use S to sourced line.'") + +call zvim#util#defineMap('nnoremap ', '', ':call zvim#util#CopyToClipboard()', + \ 'Copy buffer absolute path to X11 clipboard','call zvim#util#CopyToClipboard()') +call zvim#util#defineMap('nnoremap ', '', + \ ':call zvim#util#CopyToClipboard(1)', + \ 'Yank the github link of current file to X11 clipboard', + \ 'call zvim#util#CopyToClipboard(1)') +call zvim#util#defineMap('nnoremap ', '', + \ ':call zvim#util#CopyToClipboard(2)', + \ 'Yank the github link of current line to X11 clipboard', + \ 'call zvim#util#CopyToClipboard(2)') +call zvim#util#defineMap('vnoremap ', '', + \ ':call zvim#util#CopyToClipboard(3)', + \ 'Yank the github link of current selection to X11 clipboard', + \ 'call zvim#util#CopyToClipboard(3)') +" Window prefix +call zvim#util#defineMap('nnoremap', '[Window]', '' , 'Defind window prefix' ,'normal [Window]') +call zvim#util#defineMap('nmap' , 's' , '[Window]', 'Use s as window prefix' ,'normal s') + +call zvim#util#defineMap('nnoremap ', '', ':wincmd w', 'Switch to another buffer','wincmd w') +call zvim#util#defineMap('nnoremap ', '[Window]p', ':vsplit:wincmd w', + \'vsplit vertically,switch to next window','vsplit | wincmd w') +call zvim#util#defineMap('nnoremap ', '[Window]v', ':split', 'split window','split') +call zvim#util#defineMap('nnoremap ', '[Window]g', ':vsplit', 'vsplit window','vsplit') +call zvim#util#defineMap('nnoremap ', '[Window]t', ':tabnew', 'Create new tab','tabnew') +call zvim#util#defineMap('nnoremap ', '[Window]o', ':only', 'Close other windows','only') +call zvim#util#defineMap('nnoremap ', '[Window]x', ':call zvim#util#BufferEmpty()', + \'Empty current buffer','call zvim#util#BufferEmpty()') +call zvim#util#defineMap('nnoremap ', '[Window]\', ':b#', 'Switch to the last buffer','b#') +call zvim#util#defineMap('nnoremap ', '[Window]q', ':close', 'Close current windows','close') +call zvim#util#defineMap('nnoremap ', 'q', ':call zvim#util#SmartClose()', + \ 'Smart close windows', + \ 'call zvim#util#SmartClose()') +call zvim#util#defineMap('nnoremap ', 'qr', 'q', 'Toggle recording','') +call zvim#util#defineMap('nnoremap ', 'sv', ':split:wincmd p:e#', + \'Open previous buffer in split window' , 'split|wincmd p|e#') +call zvim#util#defineMap('nnoremap ', 'sg', ':vsplit:wincmd p:e#', + \'Open previous buffer in vsplit window' , 'vsplit|wincmd p|e#') diff --git a/config/neovim.vim b/config/neovim.vim new file mode 100644 index 000000000..6b3bab662 --- /dev/null +++ b/config/neovim.vim @@ -0,0 +1,65 @@ +function! s:GetVisual() + let [lnum1, col1] = getpos("'<")[1:2] + let [lnum2, col2] = getpos("'>")[1:2] + let lines = getline(lnum1, lnum2) + let lines[-1] = lines[-1][:col2 - 2] + let lines[0] = lines[0][col1 - 1:] + return lines +endfunction + +function! REPLSend(lines) + call jobsend(g:last_terminal_job_id, add(a:lines, '')) +endfunction +" }}} +" Commands {{{ +" REPL integration {{{ +command! -range=% REPLSendSelection call REPLSend(s:GetVisual()) +command! REPLSendLine call REPLSend([getline('.')]) +" }}} +"let $NVIM_TUI_ENABLE_TRUE_COLOR=1 +"let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1 +"silent! let &t_SI = "\]50;CursorShape=1\x7" +"silent! let &t_SR = "\]50;CursorShape=2\x7" +"silent! let &t_EI = "\]50;CursorShape=0\x7" +" dark0 + gray +let g:terminal_color_0 = "#282828" +let g:terminal_color_8 = "#928374" + +" neurtral_red + bright_red +let g:terminal_color_1 = "#cc241d" +let g:terminal_color_9 = "#fb4934" + +" neutral_green + bright_green +let g:terminal_color_2 = "#98971a" +let g:terminal_color_10 = "#b8bb26" + +" neutral_yellow + bright_yellow +let g:terminal_color_3 = "#d79921" +let g:terminal_color_11 = "#fabd2f" + +" neutral_blue + bright_blue +let g:terminal_color_4 = "#458588" +let g:terminal_color_12 = "#83a598" + +" neutral_purple + bright_purple +let g:terminal_color_5 = "#b16286" +let g:terminal_color_13 = "#d3869b" + +" neutral_aqua + faded_aqua +let g:terminal_color_6 = "#689d6a" +let g:terminal_color_14 = "#8ec07c" + +" light4 + light1 +let g:terminal_color_7 = "#a89984" +let g:terminal_color_15 = "#ebdbb2" +augroup Terminal + au! + au TermOpen * let g:last_terminal_job_id = b:terminal_job_id | IndentLinesDisable + au WinEnter term://* startinsert | IndentLinesDisable + "au TermClose * exec &buftype == 'terminal' ? 'bd!' : '' + au TermClose * exe expand('').'bd!' +augroup END +augroup nvimrc_aucmd + autocmd! + autocmd CursorHold,FocusGained,FocusLost * rshada|wshada +augroup END diff --git a/config/plugins.vim b/config/plugins.vim new file mode 100644 index 000000000..d3daa80af --- /dev/null +++ b/config/plugins.vim @@ -0,0 +1,475 @@ +scriptencoding utf-8 + +if zvim#plug#enable_plug() + call zvim#plug#begin(g:settings.plugin_bundle_dir) + call zvim#plug#fetch() + if count(g:settings.plugin_groups, 'core') "{{{ + call zvim#plug#add('Shougo/vimproc.vim', {'build': 'make'}) + endif + if count(g:settings.plugin_groups, 'denite') + call zvim#plug#add('Shougo/denite.nvim',{ 'merged' : 0}) + if zvim#plug#tap('denite.nvim') + call zvim#plug#defind_hooks('denite.nvim') + endif + endif + if count(g:settings.plugin_groups, 'unite') "{{{ + call zvim#plug#add('Shougo/unite.vim',{ 'merged' : 0}) + if zvim#plug#tap('unite.vim') + call zvim#plug#defind_hooks('unite.vim') + endif + call zvim#plug#add('Shougo/neoyank.vim') + call zvim#plug#add('soh335/unite-qflist') + call zvim#plug#add('ujihisa/unite-equery') + call zvim#plug#add('m2mdas/unite-file-vcs') + call zvim#plug#add('Shougo/neomru.vim') + call zvim#plug#add('kmnk/vim-unite-svn') + call zvim#plug#add('basyura/unite-rails') + call zvim#plug#add('nobeans/unite-grails') + call zvim#plug#add('choplin/unite-vim_hacks') + call zvim#plug#add('mattn/webapi-vim') + call zvim#plug#add('mattn/gist-vim') + if zvim#plug#tap('gist-vim') + call zvim#plug#defind_hooks('gist-vim') + endif + call zvim#plug#add('henices/unite-stock') + call zvim#plug#add('mattn/wwwrenderer-vim') + call zvim#plug#add('thinca/vim-openbuf') + call zvim#plug#add('ujihisa/unite-haskellimport') + call zvim#plug#add('oppara/vim-unite-cake') + call zvim#plug#add('thinca/vim-ref') + if zvim#plug#tap('vim-ref') + call zvim#plug#defind_hooks('vim-ref') + endif + call zvim#plug#add('heavenshell/unite-zf') + call zvim#plug#add('heavenshell/unite-sf2') + call zvim#plug#add('osyo-manga/unite-vimpatches') + call zvim#plug#add('Shougo/unite-outline') + call zvim#plug#add('hewes/unite-gtags') + if zvim#plug#tap('unite-gtags') + call zvim#plug#defind_hooks('unite-gtags') + endif + call zvim#plug#add('rafi/vim-unite-issue') + call zvim#plug#add('joker1007/unite-pull-request') + call zvim#plug#add('tsukkee/unite-tag') + call zvim#plug#add('ujihisa/unite-launch') + call zvim#plug#add('ujihisa/unite-gem') + call zvim#plug#add('osyo-manga/unite-filetype') + call zvim#plug#add('thinca/vim-unite-history') + call zvim#plug#add('Shougo/neobundle-vim-recipes') + call zvim#plug#add('Shougo/unite-help') + call zvim#plug#add('ujihisa/unite-locate') + call zvim#plug#add('kmnk/vim-unite-giti') + call zvim#plug#add('ujihisa/unite-font') + call zvim#plug#add('t9md/vim-unite-ack') + call zvim#plug#add('mileszs/ack.vim',{'on_cmd' : 'Ack'}) + call zvim#plug#add('albfan/ag.vim',{'on_cmd' : 'Ag'}) + let g:ag_prg='ag --vimgrep' + let g:ag_working_path_mode='r' + call zvim#plug#add('dyng/ctrlsf.vim',{'on_cmd' : 'CtrlSF', 'on_map' : 'CtrlSF'}) + if zvim#plug#tap('ctrlsf.vim') + call zvim#plug#defind_hooks('ctrlsf.vim') + nmap sn CtrlSFCwordExec + endif + call zvim#plug#add('daisuzu/unite-adb') + call zvim#plug#add('osyo-manga/unite-airline_themes') + call zvim#plug#add('mattn/unite-vim_advent-calendar') + call zvim#plug#add('mattn/unite-remotefile') + call zvim#plug#add('sgur/unite-everything') + call zvim#plug#add('kannokanno/unite-dwm') + call zvim#plug#add('raw1z/unite-projects') + call zvim#plug#add('voi/unite-ctags') + call zvim#plug#add('Shougo/unite-session') + call zvim#plug#add('osyo-manga/unite-quickfix') + call zvim#plug#add('Shougo/vimfiler.vim',{'on_cmd' : 'VimFiler'}) + if zvim#plug#tap('vimfiler.vim') + call zvim#plug#defind_hooks('vimfiler.vim') + noremap :call zvim#util#OpenVimfiler() + endif + if g:settings.enable_googlesuggest + call zvim#plug#add('mopp/googlesuggest-source.vim') + call zvim#plug#add('mattn/googlesuggest-complete-vim') + endif + call zvim#plug#add('ujihisa/unite-colorscheme') + call zvim#plug#add('mattn/unite-gist') + call zvim#plug#add('tacroe/unite-mark') + call zvim#plug#add('tacroe/unite-alias') + call zvim#plug#add('tex/vim-unite-id') + call zvim#plug#add('sgur/unite-qf') + call zvim#plug#add('lambdalisue/unite-grep-vcs', { + \ 'autoload': { + \ 'unite_sources': ['grep/git', 'grep/hg'], + \}}) + call zvim#plug#add('lambdalisue/vim-gista', { + \ 'on_cmd': 'Gista' + \}) + call zvim#plug#add('lambdalisue/vim-gista-unite') + call zvim#plug#add('wsdjeg/unite-radio.vim') + let g:unite_source_radio_play_cmd='mpv' + "call zvim#plug#add('ujihisa/quicklearn') + endif "}}} + + + "{{{ctrlpvim settings + if count(g:settings.plugin_groups, 'ctrlp') "{{{ + call zvim#plug#add('ctrlpvim/ctrlp.vim') + if zvim#plug#tap('ctrlp.vim') + call zvim#plug#defind_hooks('ctrlp.vim') + endif + if !has('nvim') + call zvim#plug#add('wsdjeg/ctrlp-unity3d-docs', { 'on_cmd' : 'CtrlPUnity3DDocs'}) + endif + call zvim#plug#add('voronkovich/ctrlp-nerdtree.vim', { 'on_cmd' : 'CtrlPNerdTree'}) + call zvim#plug#add('elentok/ctrlp-objects.vim', { 'on_cmd' : [ + \'CtrlPModels', + \'CtrlPViews', + \'CtrlPControllers', + \'CtrlPTemplates', + \'CtrlPPresenters']}) + call zvim#plug#add('h14i/vim-ctrlp-buftab', { 'on_cmd' : 'CtrlPBufTab'}) + call zvim#plug#add('vim-scripts/ctrlp-cmdpalette', { 'on_cmd' : 'CtrlPCmdPalette'}) + call zvim#plug#add('mattn/ctrlp-windowselector', { 'on_cmd' : 'CtrlPWindowSelector'}) + call zvim#plug#add('the9ball/ctrlp-gtags', { 'on_cmd' : ['CtrlPGtagsX','CtrlPGtagsF','CtrlPGtagsR']}) + call zvim#plug#add('thiderman/ctrlp-project', { 'on_cmd' : 'CtrlPProject'}) + call zvim#plug#add('mattn/ctrlp-google', { 'on_cmd' : 'CtrlPGoogle'}) + call zvim#plug#add('ompugao/ctrlp-history', { 'on_cmd' : ['CtrlPCmdHistory','CtrlPSearchHistory']}) + call zvim#plug#add('pielgrzym/ctrlp-sessions', { 'on_cmd' : ['CtrlPSessions','MkS']}) + call zvim#plug#add('tacahiroy/ctrlp-funky', { 'on_cmd' : 'CtrlPFunky'}) + call zvim#plug#add('mattn/ctrlp-launcher', { 'on_cmd' : 'CtrlPLauncher'}) + call zvim#plug#add('sgur/ctrlp-extensions.vim', { 'on_cmd' : ['CtrlPCmdline','CtrlPMenu','CtrlPYankring']}) + call zvim#plug#add('FelikZ/ctrlp-py-matcher') + call zvim#plug#add('lambdalisue/vim-gista-ctrlp', { 'on_cmd' : 'CtrlPGista'}) + endif "}}} + + + if count(g:settings.plugin_groups, 'autocomplete') "{{{ + call zvim#plug#add('honza/vim-snippets',{'on_i' : 1}) + imap zvim#tab() + smap neosnippet#expandable_or_jumpable() ? "\(neosnippet_expand_or_jump)" : "\" + inoremap zvim#enter() + inoremap =MyLeaderTabfunc() + inoremap pumvisible() ? "\" : "\" + inoremap pumvisible() ? "\" : "\" + inoremap pumvisible() ? "\\\" : "\" + inoremap pumvisible() ? "\\\" : "\" + imap pumvisible() ? "\" : "" + smap pumvisible() ? "\" : "" + if g:settings.autocomplete_method ==# 'ycm' "{{{ + call zvim#plug#add('SirVer/ultisnips') + let g:UltiSnipsExpandTrigger='' + let g:UltiSnipsJumpForwardTrigger='' + let g:UltiSnipsJumpBackwardTrigger='' + let g:UltiSnipsSnippetsDir='~/DotFiles/snippets' + call zvim#plug#add('ervandew/supertab') + let g:SuperTabContextDefaultCompletionType = '' + let g:SuperTabDefaultCompletionType = '' + "autocmd InsertLeave * if pumvisible() ==# 0|pclose|endif + let g:neobundle#install_process_timeout = 1500 + call zvim#plug#add('Valloric/YouCompleteMe') + "let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py' + "let g:ycm_confirm_extra_conf = 0 + let g:ycm_collect_identifiers_from_tags_files = 1 + let g:ycm_collect_identifiers_from_comments_and_strings = 1 + let g:ycm_key_list_select_completion = ['', ''] + let g:ycm_key_list_previous_completion = ['',''] + let g:ycm_seed_identifiers_with_syntax = 1 + let g:ycm_key_invoke_completion = '' + let g:ycm_semantic_triggers = { + \ 'c' : ['->', '.'], + \ 'objc' : ['->', '.'], + \ 'ocaml' : ['.', '#'], + \ 'cpp,objcpp' : ['->', '.', '::'], + \ 'perl' : ['->'], + \ 'php' : ['->', '::'], + \ 'cs,javascript,d,python,perl6,scala,vb,elixir,go' : ['.'], + \ 'java,jsp' : ['.'], + \ 'vim' : ['re![_a-zA-Z]+[_\w]*\.'], + \ 'ruby' : ['.', '::'], + \ 'lua' : ['.', ':'], + \ 'erlang' : [':'], + \ } + elseif g:settings.autocomplete_method ==# 'neocomplete' "{{{ + call zvim#plug#add('Shougo/neocomplete', { + \ 'on_i' : 1, + \ }) + if zvim#plug#tap('neocomplete') + call zvim#plug#defind_hooks('neocomplete.vim') + endif + elseif g:settings.autocomplete_method ==# 'neocomplcache' "{{{ + call zvim#plug#add('Shougo/neocomplcache.vim', { + \ 'on_i' : 1, + \ }) + if zvim#plug#tap('neocomplcache.vim') + call zvim#plug#defind_hooks('neocomplcache.vim') + endif + elseif g:settings.autocomplete_method ==# 'deoplete' + call zvim#plug#add('Shougo/deoplete.nvim', { + \ 'on_i' : 1, + \ }) + if zvim#plug#tap('deoplete.nvim') + call zvim#plug#defind_hooks('deoplete.nvim') + endif + call zvim#plug#add('zchee/deoplete-jedi', { 'on_ft' : 'python'}) + endif "}}} + call zvim#plug#add('Shougo/neco-syntax', { 'on_i' : 1}) + call zvim#plug#add('ujihisa/neco-look', { 'on_i' : 1}) + call zvim#plug#add('Shougo/neco-vim', { 'on_i' : 1}) + if !exists('g:necovim#complete_functions') + let g:necovim#complete_functions = {} + endif + let g:necovim#complete_functions.Ref = + \ 'ref#complete' + call zvim#plug#add('Shougo/context_filetype.vim', { 'on_i' : 1}) + call zvim#plug#add('Shougo/neoinclude.vim', { 'on_i' : 1}) + call zvim#plug#add('Shougo/neosnippet-snippets', { 'merged' : 0}) + call zvim#plug#add('Shougo/neosnippet.vim', { 'on_i' : 1 , 'on_ft' : 'neosnippet'}) + if zvim#plug#tap('neosnippet.vim') + call zvim#plug#defind_hooks('neosnippet.vim') + endif + call zvim#plug#add('Shougo/neopairs.vim', { 'on_i' : 1}) + endif "}}} + + if count(g:settings.plugin_groups, 'colorscheme') "{{{ + "colorscheme + call zvim#plug#add('morhetz/gruvbox') + if zvim#plug#tap('gruvbox') + call zvim#plug#defind_hooks('gruvbox') + endif + call zvim#plug#add('kabbamine/yowish.vim') + call zvim#plug#add('tomasr/molokai') + call zvim#plug#add('mhinz/vim-janah') + call zvim#plug#add('mhartington/oceanic-next') + call zvim#plug#add('nanotech/jellybeans.vim') + call zvim#plug#add('altercation/vim-colors-solarized') + call zvim#plug#add('kristijanhusak/vim-hybrid-material') + endif + + if count(g:settings.plugin_groups, 'chinese') "{{{ + call zvim#plug#add('vimcn/vimcdoc') + endif + + call zvim#plug#add('junegunn/vim-github-dashboard', { 'on_cmd':['GHD','GHA','GHActivity','GHDashboard']}) + if count(g:settings.plugin_groups, 'vim') "{{{ + call zvim#plug#add('Shougo/vimshell.vim', { 'on_cmd':['VimShell']}) + call zvim#plug#add('mattn/vim-terminal', { 'on_cmd':['Terminal']}) + call zvim#plug#add('davidhalter/jedi-vim', { 'on_ft' : 'python'}) + if zvim#plug#tap('jedi-vim') + call zvim#plug#defind_hooks('jedi-vim') + endif + endif + if count(g:settings.plugin_groups, 'nvim') "{{{ + call zvim#plug#add('m2mdas/phpcomplete-extended', { 'on_ft' : 'php'}) + if zvim#plug#tap('phpcomplete-extended') + call zvim#plug#defind_hooks('phpcomplete-extended') + endif + endif + call zvim#plug#add('tpope/vim-scriptease') + call zvim#plug#add('tpope/vim-fugitive') + call zvim#plug#add('cohama/agit.vim', { 'on_cmd':['Agit','AgitFile']}) + call zvim#plug#add('gregsexton/gitv', { 'on_cmd':['Gitv']}) + call zvim#plug#add('tpope/vim-surround') + call zvim#plug#add('terryma/vim-multiple-cursors') + let g:multi_cursor_next_key='' + let g:multi_cursor_prev_key='' + let g:multi_cursor_skip_key='' + let g:multi_cursor_quit_key='' + + "web plugins + + call zvim#plug#add('groenewege/vim-less', { 'on_ft':['less']}) + call zvim#plug#add('cakebaker/scss-syntax.vim', { 'on_ft':['scss','sass']}) + call zvim#plug#add('hail2u/vim-css3-syntax', { 'on_ft':['css','scss','sass']}) + call zvim#plug#add('ap/vim-css-color', { 'on_ft':['css','scss','sass','less','styl']}) + call zvim#plug#add('othree/html5.vim', { 'on_ft':['html']}) + call zvim#plug#add('wavded/vim-stylus', { 'on_ft':['styl']}) + call zvim#plug#add('digitaltoad/vim-jade', { 'on_ft':['jade']}) + call zvim#plug#add('juvenn/mustache.vim', { 'on_ft':['mustache']}) + call zvim#plug#add('Valloric/MatchTagAlways', { 'on_ft':['html' , 'xhtml' , 'xml' , 'jinja']}) + call zvim#plug#add('pangloss/vim-javascript', { 'on_ft':['javascript']}) + call zvim#plug#add('maksimr/vim-jsbeautify', { 'on_ft':['javascript']}) + call zvim#plug#add('leafgarland/typescript-vim', { 'on_ft':['typescript']}) + call zvim#plug#add('kchmck/vim-coffee-script', { 'on_ft':['coffee']}) + call zvim#plug#add('mmalecki/vim-node.js', { 'on_ft':['javascript']}) + call zvim#plug#add('leshill/vim-json', { 'on_ft':['javascript','json']}) + call zvim#plug#add('othree/javascript-libraries-syntax.vim', { 'on_ft':['javascript','coffee','ls','typescript']}) + if g:settings.enable_javacomplete2_py + call zvim#plug#add('wsdjeg/vim-javacomplete2', { 'on_ft' : ['java','jsp']}) + else + call zvim#plug#add('artur-shaik/vim-javacomplete2', { 'on_ft' : ['java','jsp']}) + endif + let g:JavaComplete_UseFQN = 1 + let g:JavaComplete_ServerAutoShutdownTime = 300 + let g:JavaComplete_MavenRepositoryDisable = 0 + call zvim#plug#add('wsdjeg/vim-dict', { 'on_ft' : 'java'}) + call zvim#plug#add('wsdjeg/SourceCounter.vim', { 'on_cmd' : 'SourceCounter'}) + call zvim#plug#add('wsdjeg/java_getset.vim', { 'on_ft' : 'java'}) + if zvim#plug#tap('java_getset.vim') + call zvim#plug#defind_hooks('java_getset.vim') + endif + call zvim#plug#add('wsdjeg/JavaUnit.vim', { 'on_ft' : 'java'}) + call zvim#plug#add('jaxbot/github-issues.vim', { 'on_cmd' : 'Gissues'}) + call zvim#plug#add('wsdjeg/Mysql.vim', { 'on_cmd' : 'SQLGetConnection'}) + call zvim#plug#add('wsdjeg/vim-cheat', { 'on_cmd' : 'Cheat'}) + call zvim#plug#add('wsdjeg/vim-chat', { 'merged' : 0}) + call zvim#plug#add('wsdjeg/job.vim', { 'merged' : 0}) + call zvim#plug#add('wsdjeg/GitHub-api.vim') + call zvim#plug#add('vim-jp/vim-java', { 'on_ft' : 'java'}) + call zvim#plug#add('vim-airline/vim-airline', { 'merged' : 0}) + call zvim#plug#add('vim-airline/vim-airline-themes', { 'merged' : 0}) + if zvim#plug#tap('vim-airline') + call zvim#plug#defind_hooks('vim-airline') + endif + call zvim#plug#add('mattn/emmet-vim', { 'on_cmd' : 'EmmetInstall'}) + let g:user_emmet_install_global = 0 + let g:user_emmet_leader_key='' + let g:user_emmet_mode='a' + let g:user_emmet_settings = { + \ 'jsp' : { + \ 'extends' : 'html', + \ }, + \} + " use this two command to find how long the plugin take! + "profile start vim-javacomplete2.log + "profile! file */vim-javacomplete2/* + if g:settings.enable_neomake + call zvim#plug#add('neomake/neomake',{'merged' : 0}) + if zvim#plug#tap('neomake') + call zvim#plug#defind_hooks('neomake') + augroup Neomake_wsd + au! + autocmd! BufWritePost * Neomake + augroup END + endif + else + call zvim#plug#add('wsdjeg/syntastic', {'on_event': 'WinEnter'}) + if zvim#plug#tap('syntastic') + call zvim#plug#defind_hooks('syntastic') + endif + endif + call zvim#plug#add('syngan/vim-vimlint',{'on_ft' : 'vim'}) + let g:syntastic_vimlint_options = { + \'EVL102': 1 , + \'EVL103': 1 , + \'EVL205': 1 , + \'EVL105': 1 , + \} + call zvim#plug#add('ynkdir/vim-vimlparser',{'on_ft' : 'vim'}) + call zvim#plug#add('todesking/vint-syntastic',{'on_ft' : 'vim'}) + "let g:syntastic_vim_checkers = ['vint'] + call zvim#plug#add('gcmt/wildfire.vim',{'on_map' : '(wildfire-'}) + noremap (wildfire-fuel) + vnoremap (wildfire-water) + let g:wildfire_objects = ["i'", 'i"', 'i)', 'i]', 'i}', 'ip', 'it'] + + call zvim#plug#add('scrooloose/nerdcommenter') + call zvim#plug#add('easymotion/vim-easymotion',{'on_map' : '(easymotion-prefix)'}) + if zvim#plug#tap('vim-easymotion') + map (easymotion-prefix) + endif + + call zvim#plug#add('MarcWeber/vim-addon-mw-utils') + call zvim#plug#add('mhinz/vim-startify') + if zvim#plug#tap('vim-startify') + call zvim#plug#defind_hooks('vim-startify') + endif + call zvim#plug#add('mhinz/vim-signify') + let g:signify_disable_by_default = 0 + let g:signify_line_highlight = 0 + call zvim#plug#add('mhinz/vim-grepper' , { 'on_cmd' : 'Grepper' } ) + if zvim#plug#tap('vim-grepper') + call zvim#plug#defind_hooks('vim-grepper') + endif + call zvim#plug#add('airblade/vim-rooter') + let g:rooter_silent_chdir = 1 + call zvim#plug#add('Yggdroot/indentLine') + let g:indentLine_color_term = 239 + let g:indentLine_color_gui = '#09AA08' + let g:indentLine_char = '¦' + let g:indentLine_concealcursor = 'niv' " (default 'inc') + let g:indentLine_conceallevel = 2 " (default 2) + call zvim#plug#add('godlygeek/tabular', { 'on_cmd': 'Tabularize'}) + call zvim#plug#add('benizi/vim-automkdir') + "[c ]c jump between prev or next hunk + call zvim#plug#add('airblade/vim-gitgutter',{'on_cmd' : 'GitGutterEnable'}) + call zvim#plug#add('itchyny/calendar.vim', { 'on_cmd' : 'Calendar'}) + call zvim#plug#add('lilydjwg/fcitx.vim', { 'on_i' : 1}) + call zvim#plug#add('junegunn/goyo.vim', { 'on_cmd' : 'Goyo'}) + if zvim#plug#tap('goyo.vim') + call zvim#plug#defind_hooks('goyo.vim') + endif + "vim Wimdows config + call zvim#plug#add('scrooloose/nerdtree',{'on_cmd':'NERDTreeToggle'}) + if zvim#plug#tap('nerdtree') + call zvim#plug#defind_hooks('nerdtree') + function! OpenOrCloseNERDTree() + exec 'normal! A' + endfunction + noremap :NERDTreeToggle + let g:NERDTreeWinPos='right' + let g:NERDTreeWinSize=31 + let g:NERDTreeChDirMode=1 + autocmd bufenter * if (winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree()) | q | endif + augroup nerdtree_zvim + autocmd! + autocmd FileType nerdtree nnoremap :call OpenOrCloseNERDTree() + augroup END + endif + call zvim#plug#add('tpope/vim-projectionist',{'on_cmd':['A','AS','AV','AT','AD','Cd','Lcd','ProjectDo']}) + call zvim#plug#add('Xuyuanp/nerdtree-git-plugin') + call zvim#plug#add('taglist.vim',{'on_cmd' : 'TlistToggle'}) + if zvim#plug#tap('taglist.vim') + call zvim#plug#defind_hooks('taglist.vim') + noremap :TlistToggle + endif + call zvim#plug#add('ntpeters/vim-better-whitespace',{'on_cmd' : 'StripWhitespace'}) + call zvim#plug#add('junegunn/rainbow_parentheses.vim',{'on_cmd' : 'RainbowParentheses'}) + augroup rainbow_lisp + autocmd! + autocmd FileType lisp,clojure,scheme,java RainbowParentheses + augroup END + let g:rainbow#max_level = 16 + let g:rainbow#pairs = [['(', ')'], ['[', ']'],['{','}']] + " List of colors that you do not want. ANSI code or #RRGGBB + let g:rainbow#blacklist = [233, 234] + call zvim#plug#add('majutsushi/tagbar') + if zvim#plug#tap('tagbar') + call zvim#plug#defind_hooks('tagbar') + noremap :TagbarToggle + endif + "}}} + + call zvim#plug#add('floobits/floobits-neovim', { 'on_cmd' : ['FlooJoinWorkspace','FlooShareDirPublic','FlooShareDirPrivate']}) + call zvim#plug#add('wsdjeg/MarkDown.pl', { 'on_cmd' : 'MarkDownPreview'}) + call zvim#plug#add('plasticboy/vim-markdown', { 'on_ft' : 'markdown'}) + let g:vim_markdown_conceal = 0 + let g:vim_markdown_folding_disabled = 1 + call zvim#plug#add('simnalamburt/vim-mundo', { 'on_cmd' : 'MundoToggle'}) + nnoremap :MundoToggle + call zvim#plug#add('TaskList.vim', { 'on_cmd' : 'TaskList'}) + map td TaskList + call zvim#plug#add('ianva/vim-youdao-translater', { 'on_cmd' : ['Ydv','Ydc','Yde']}) + vnoremap :Ydv + nnoremap :Ydc + call zvim#plug#add('elixir-lang/vim-elixir', { 'on_ft' : 'elixir'}) + call zvim#plug#add('editorconfig/editorconfig-vim', { 'on_cmd' : 'EditorConfigReload'}) + call zvim#plug#add('junegunn/fzf', { 'on_cmd' : 'FZF'}) + nnoremap fz :FZF + call zvim#plug#add('junegunn/gv.vim', { 'on_cmd' : 'GV'}) + call zvim#plug#add('tyru/open-browser.vim', { + \'on_cmd' : ['OpenBrowserSmartSearch','OpenBrowser','OpenBrowserSearch'], + \'on_map' : '(openbrowser-', + \}) + if zvim#plug#tap('open-brower.vim') + call zvim#plug#defind_hooks('open-brower.vim') + endif + call zvim#plug#add('racer-rust/vim-racer', {'on_ft' : 'rust'}) + let g:racer_cmd = $HOME.'/.cargo/bin/racer' + call zvim#plug#add('rust-lang/rust.vim') + call zvim#plug#add('PotatoesMaster/i3-vim-syntax', {'on_ft' : 'i3'}) + call zvim#plug#add('isundil/vim-irssi-syntax', {'on_ft' : 'irssi'}) + call zvim#plug#add('vimperator/vimperator.vim', {'on_ft' : 'vimperator'}) + call zvim#plug#add('lambdalisue/vim-gita', {'on_cmd': 'Gita'}) + call zvim#plug#add('tweekmonster/helpful.vim', {'on_cmd': 'HelpfulVersion'}) + " google plugins + call zvim#plug#add('google/vim-searchindex') + call zvim#plug#end() +endif diff --git a/config/plugins/ctrlp.vim b/config/plugins/ctrlp.vim new file mode 100644 index 000000000..74a9f0215 --- /dev/null +++ b/config/plugins/ctrlp.vim @@ -0,0 +1,54 @@ +let g:ctrlp_map = '' +let g:ctrlp_cmd = 'CtrlP' +let g:ctrlp_working_path_mode = 'ra' +let g:ctrlp_root_markers = 'pom.xml' +let g:ctrlp_match_window = 'bottom,order:btt,min:1,max:15,results:15' +let g:ctrlp_show_hidden = 1 +"for caching +let g:ctrlp_use_caching = 500 +let g:ctrlp_clear_cache_on_exit = 1 +let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp' +"let g:ctrlp_map = ',,' +"let g:ctrlp_open_multiple_files = 'v' +"if you have install ag, the g:ctrlp_custom_ignore will not work +let g:ctrlp_custom_ignore = { + \ 'dir': '\v[\/]\.(git|hg|svn)$|target', + \ 'file': '\v\.(exe|so|dll|ttf|png)$|\-rplugin\~', + \ 'link': 'some_bad_symbolic_links', + \ } +if executable('rg') + let g:ctrlp_user_command = 'rg %s --no-ignore --hidden --files -g "" ' + \ . join(zvim#util#Generate_ignore(g:settings.wildignore,'rg')) +elseif executable('ag') + let g:ctrlp_user_command = 'ag %s --hidden -i -g "" ' . join(zvim#util#Generate_ignore(g:settings.wildignore,'ag')) +endif +let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' } +"nnoremap kk :CtrlPMixed +" comment for ctrlp-funky {{{ +nnoremap fu :CtrlPFunky +" narrow the list down with a word under cursor +nnoremap fU :execute 'CtrlPFunky ' . expand('') +let g:ctrlp_funky_syntax_highlight = 1 +" }}} +"for ctrlp_nerdtree {{{ +let g:ctrlp_nerdtree_show_hidden = 1 +"}}} +"for ctrlp_sessions{{{ +let g:ctrlp_extensions = ['funky', 'sessions' , 'k' , 'tag', 'mixed', 'quickfix', 'undo', 'line', 'changes', 'cmdline', 'menu'] +"}}} +"for k.vim {{{ +nnoremap qe :CtrlPK +"}}} +" for ctrlp-launcher {{{ +nnoremap pl :CtrlPLauncher +"}}} +""for ctrlp-cmatcher {{{ +"let g:ctrlp_max_files = 0 +"let g:ctrlp_match_func = {'match' : 'matcher#cmatch' } +""}}} + +augroup Fix_command_in_help_buffer + au! + autocmd FileType help exec 'nnoremap :CtrlP ' . getcwd() .'' + au FileType help exec "nnoremap q :q" +augroup END diff --git a/config/plugins/ctrlsf.vim b/config/plugins/ctrlsf.vim new file mode 100644 index 000000000..65b879f63 --- /dev/null +++ b/config/plugins/ctrlsf.vim @@ -0,0 +1,7 @@ +nmap sf CtrlSFPrompt +vmap sf CtrlSFVwordPath +vmap sF CtrlSFVwordExec +nmap sp CtrlSFPwordPath +nnoremap so :CtrlSFOpen +nnoremap st :CtrlSFToggle +inoremap st :CtrlSFToggle diff --git a/config/plugins/denite.vim b/config/plugins/denite.vim new file mode 100644 index 000000000..65a3f3474 --- /dev/null +++ b/config/plugins/denite.vim @@ -0,0 +1 @@ +let g:denite_config_loaded = 1 diff --git a/config/plugins/deoplete.vim b/config/plugins/deoplete.vim new file mode 100644 index 000000000..c514240e0 --- /dev/null +++ b/config/plugins/deoplete.vim @@ -0,0 +1,28 @@ +let g:deoplete#enable_at_startup = 1 +let g:deoplete#enable_ignore_case = 1 +let g:deoplete#enable_smart_case = 1 +let g:deoplete#enable_camel_case = 1 +let g:deoplete#enable_refresh_always = 1 +let g:deoplete#max_abbr_width = 0 +let g:deoplete#max_menu_width = 0 +let g:deoplete#omni#input_patterns = get(g:,'deoplete#omni#input_patterns',{}) +let g:deoplete#omni#input_patterns.java = [ + \'[^. \t0-9]\.\w*', + \'[^. \t0-9]\->\w*', + \'[^. \t0-9]\::\w*', + \] +let g:deoplete#omni#input_patterns.jsp = ['[^. \t0-9]\.\w*'] +let g:deoplete#omni#input_patterns.php = '\h\w*\|[^. \t]->\%(\h\w*\)\?\|\h\w*::\%(\h\w*\)\?' +let g:deoplete#ignore_sources = {} +if g:settings.enable_javacomplete2_py + let g:deoplete#ignore_sources.java = ['omni'] + call deoplete#custom#set('javacomplete2', 'mark', '') +else + let g:deoplete#ignore_sources.java = ['javacomplete2'] + call deoplete#custom#set('omni', 'mark', '') +endif +call deoplete#custom#set('_', 'matchers', ['matcher_full_fuzzy']) +"call deoplete#custom#set('omni', 'min_pattern_length', 0) +inoremap deoplete#mappings#smart_close_popup()."\" +inoremap deoplete#mappings#smart_close_popup()."\" +set isfname-== diff --git a/config/plugins/goyo.vim b/config/plugins/goyo.vim new file mode 100644 index 000000000..6e638f3fb --- /dev/null +++ b/config/plugins/goyo.vim @@ -0,0 +1,18 @@ +function! s:goyo_enter() + silent !tmux set status off + set noshowmode + set noshowcmd + set scrolloff=999 + Limelight +endfunction + +function! s:goyo_leave() + silent !tmux set status on + set showmode + set showcmd + set scrolloff=5 +endfunction +augroup goyo_map +autocmd! User GoyoEnter nested call goyo_enter() +autocmd! User GoyoLeave nested call goyo_leave() +augroup END diff --git a/config/plugins/gruvbox.vim b/config/plugins/gruvbox.vim new file mode 100644 index 000000000..cdd874cdf --- /dev/null +++ b/config/plugins/gruvbox.vim @@ -0,0 +1 @@ +let g:gruvbox_italic = 1 diff --git a/config/plugins/java_getset.vim b/config/plugins/java_getset.vim new file mode 100644 index 000000000..cf2063f87 --- /dev/null +++ b/config/plugins/java_getset.vim @@ -0,0 +1,19 @@ +let g:java_getset_disable_map = 1 +let g:javagetset_setterTemplate = + \ "/**\n" . + \ " * Set %varname%.\n" . + \ " *\n" . + \ " * @param %varname% the value to set.\n" . + \ " */\n" . + \ "%modifiers% void %funcname%(%type% %varname%){\n" . + \ " this.%varname% = %varname%;\n" . + \ "}" +let g:javagetset_getterTemplate = + \ "/**\n" . + \ " * Get %varname%.\n" . + \ " *\n" . + \ " * @return %varname% as %type%.\n" . + \ " */\n" . + \ "%modifiers% %type% %funcname%(){\n" . + \ " return %varname%;\n" . + \ "}" diff --git a/config/plugins/jedi-vim.vim b/config/plugins/jedi-vim.vim new file mode 100644 index 000000000..e69de29bb diff --git a/config/plugins/neocomplcache.vim b/config/plugins/neocomplcache.vim new file mode 100644 index 000000000..79c9148d1 --- /dev/null +++ b/config/plugins/neocomplcache.vim @@ -0,0 +1,84 @@ +"--------------------------------------------------------------------------- +" neocomplache.vim +" +let g:neocomplcache_enable_at_startup = 1 +" Use smartcase +let g:neocomplcache_enable_smart_case = 1 +" Use camel case completion. +let g:neocomplcache_enable_camel_case_completion = 1 +" Use underbar completion. +let g:neocomplcache_enable_underbar_completion = 1 +" Use fuzzy completion. +let g:neocomplcache_enable_fuzzy_completion = 1 + +" Set minimum syntax keyword length. +let g:neocomplcache_min_syntax_length = 3 +" Set auto completion length. +let g:neocomplcache_auto_completion_start_length = 2 +" Set manual completion length. +let g:neocomplcache_manual_completion_start_length = 0 +" Set minimum keyword length. +let g:neocomplcache_min_keyword_length = 3 +" let g:neocomplcache_enable_cursor_hold_i = v:version > 703 || +" \ v:version == 703 && has('patch289') +let g:neocomplcache_enable_cursor_hold_i = 0 +let g:neocomplcache_cursor_hold_i_time = 300 +let g:neocomplcache_enable_insert_char_pre = 1 +let g:neocomplcache_enable_prefetch = 1 +let g:neocomplcache_skip_auto_completion_time = '0.6' + +" For auto select. +let g:neocomplcache_enable_auto_select = 1 + +let g:neocomplcache_enable_auto_delimiter = 1 +let g:neocomplcache_disable_auto_select_buffer_name_pattern = + \ '\[Command Line\]' +"let g:neocomplcache_disable_auto_complete = 0 +let g:neocomplcache_max_list = 100 +let g:neocomplcache_force_overwrite_completefunc = 1 +if !exists('g:neocomplcache_omni_patterns') + let g:neocomplcache_omni_patterns = {} +endif +if !exists('g:neocomplcache_omni_functions') + let g:neocomplcache_omni_functions = {} +endif +if !exists('g:neocomplcache_force_omni_patterns') + let g:neocomplcache_force_omni_patterns = {} +endif +let g:neocomplcache_enable_auto_close_preview = 1 +" let g:neocomplcache_force_omni_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::' +let g:neocomplcache_omni_patterns.ruby = '[^. *\t]\.\w*\|\h\w*::' +let g:neocomplcache_omni_patterns.java = '[^. *\t]\.\w*\|\h\w*::' +let g:neocomplcache_force_omni_patterns.java = '[^. *\t]\.\w*\|\h\w*::' + +" For clang_complete. +let g:neocomplcache_force_overwrite_completefunc = 1 +let g:neocomplcache_force_omni_patterns.c = + \ '[^.[:digit:] *\t]\%(\.\|->\)' +let g:neocomplcache_force_omni_patterns.cpp = + \ '[^.[:digit:] *\t]\%(\.\|->\)\|\h\w*::' +let g:clang_complete_auto = 0 +let g:clang_auto_select = 0 +let g:clang_use_library = 1 + +" Define keyword pattern. +if !exists('g:neocomplcache_keyword_patterns') + let g:neocomplcache_keyword_patterns = {} +endif +let g:neocomplcache_keyword_patterns['default'] = '[0-9a-zA-Z:#_]\+' +let g:neocomplcache_keyword_patterns.perl = '\h\w*->\h\w*\|\h\w*::' +let g:neocomplete#enable_multibyte_completion = 1 + +let g:neocomplcache_vim_completefuncs = { + \ 'Ref' : 'ref#complete', + \ 'Unite' : 'unite#complete_source', + \ 'VimShellExecute' : + \ 'vimshell#vimshell_execute_complete', + \ 'VimShellInteractive' : + \ 'vimshell#vimshell_execute_complete', + \ 'VimShellTerminal' : + \ 'vimshell#vimshell_execute_complete', + \ 'VimShell' : 'vimshell#complete', + \ 'VimFiler' : 'vimfiler#complete', + \ 'Vinarise' : 'vinarise#complete', + \} diff --git a/config/plugins/neocomplete.vim b/config/plugins/neocomplete.vim new file mode 100644 index 000000000..66022ea7b --- /dev/null +++ b/config/plugins/neocomplete.vim @@ -0,0 +1,46 @@ +let g:neocomplete#data_directory='~/.cache/neocomplete' +let g:acp_enableAtStartup = 0 +let g:neocomplete#enable_at_startup = 1 +" Use smartcase. +let g:neocomplete#enable_smart_case = 1 +let g:neocomplete#enable_camel_case = 1 +"let g:neocomplete#enable_ignore_case = 1 +let g:neocomplete#enable_fuzzy_completion = 1 +" Set minimum syntax keyword length. +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' : $CACHE.'/vimshell/command-history', + \ 'java' : '~/.vim/dict/java.dict', + \ 'ruby' : '~/.vim/dict/ruby.dict', + \ 'scala' : '~/.vim/dict/scala.dict', + \ } + +let g:neocomplete#enable_auto_delimiter = 1 + +" Define keyword. +if !exists('g:neocomplete#keyword_patterns') + let g:neocomplete#keyword_patterns = {} +endif +let g:neocomplete#keyword_patterns._ = '\h\k*(\?' + + +" AutoComplPop like behavior. +let g:neocomplete#enable_auto_select = 0 + +if !exists('g:neocomplete#sources#omni#input_patterns') + let g:neocomplete#sources#omni#input_patterns = {} +endif + +let g:neocomplete#sources#omni#input_patterns.perl = '\h\w*->\h\w*\|\h\w*::' +let g:neocomplete#sources#omni#input_patterns.java ='[^. \t0-9]\.\w*' +let g:neocomplete#force_omni_input_patterns = {} +"let g:neocomplete#force_omni_input_patterns.java = '^\s*' +" , : close popup and delete backword char. +inoremap neocomplete#smart_close_popup()."\" +inoremap neocomplete#smart_close_popup()."\" +inoremap neocomplete#close_popup() +inoremap neocomplete#cancel_popup() diff --git a/config/plugins/neomake.vim b/config/plugins/neomake.vim new file mode 100644 index 000000000..4989c5560 --- /dev/null +++ b/config/plugins/neomake.vim @@ -0,0 +1,12 @@ +scriptencoding utf-8 +let g:neomake_open_list = 2 " 1 open list and move cursor 2 open list without move cursor +let g:neomake_verbose = 0 +let g:neomake_java_javac_delete_output = 0 +let g:neomake_error_sign = { + \ 'text': get(g:settings, 'error_symbol', '✖'), + \ 'texthl': (g:settings.colorscheme ==# 'gruvbox' ? 'GruvboxRedSign' : 'error'), + \ } +let g:neomake_warning_sign = { + \ 'text': get(g:settings, 'warning_symbol', '➤'), + \ 'texthl': (g:settings.colorscheme ==# 'gruvbox' ? 'GruvboxYellowSign' : 'todo'), + \ } diff --git a/config/plugins/neosnippet.vim b/config/plugins/neosnippet.vim new file mode 100644 index 000000000..94fdae3f2 --- /dev/null +++ b/config/plugins/neosnippet.vim @@ -0,0 +1,24 @@ +if isdirectory(expand('~/DotFiles/snippets/')) + let g:neosnippet#snippets_directory = expand('~/DotFiles/snippets/') +endif +let g:neosnippet#enable_snipmate_compatibility=1 +let g:neosnippet#enable_complete_done = 1 +let g:neosnippet#completed_pairs= {} +let g:neosnippet#completed_pairs.java = {'(' : ')'} +if g:neosnippet#enable_complete_done + let g:neopairs#enable = 0 +endif +augroup neosnippet_complete_done + autocmd! + autocmd CompleteDone * call s:my_complete_done() +augroup END +function! s:my_complete_done() abort "{{{ + if !empty(v:completed_item) + let snippet = neosnippet#parser#_get_completed_snippet(v:completed_item,neosnippet#util#get_cur_text(), neosnippet#util#get_next_text()) + if snippet ==# '' + return + endif + let [cur_text, col, _] = neosnippet#mappings#_pre_trigger() + call neosnippet#view#_insert(snippet, {}, cur_text, col) + endif +endfunction"}}} diff --git a/config/plugins/open-brower.vim b/config/plugins/open-brower.vim new file mode 100644 index 000000000..e8eca5454 --- /dev/null +++ b/config/plugins/open-brower.vim @@ -0,0 +1,31 @@ +"for open-browser {{{ +" This is my setting. +let g:netrw_nogx = 1 " disable netrw's gx mapping. +"nmap gx (openbrowser-smart-search) +"vmap gx (openbrowser-smart-search) +"" Open URI under cursor. +nnoremap go (openbrowser-open) +"" Open selected URI. +vnoremap go (openbrowser-open) +" Search word under cursor. +nnoremap gs (openbrowser-search) +" Search selected word. +vnoremap gs (openbrowser-search) +" If it looks like URI, Open URI under cursor. +" Otherwise, Search word under cursor. +nnoremap gx (openbrowser-smart-search) +" If it looks like URI, Open selected URI. +" Otherwise, Search selected word. +vnoremap gx (openbrowser-smart-search) +vnoremap gob :OpenBrowser http://www.baidu.com/s?wd==expand("") +nnoremap gob :OpenBrowser http://www.baidu.com/s?wd==expand("") +vnoremap gog :OpenBrowser http://www.google.com/?#newwindow=1&q==expand("") +nnoremap gog :OpenBrowser http://www.google.com/?#newwindow=1&q==expand("") +vnoremap goi :OpenBrowserSmartSearch http://www.iciba.com/=expand("") +nnoremap goi :OpenBrowserSmartSearch http://www.iciba.com/=expand("") +" In command-line +":OpenBrowser http://google.com/ +":OpenBrowserSearch ggrks +":OpenBrowserSmartSearch http://google.com/ +":OpenBrowserSmartSearch ggrks +"}}} diff --git a/config/plugins/phpcomplete-extended.vim b/config/plugins/phpcomplete-extended.vim new file mode 100644 index 000000000..e69de29bb diff --git a/config/plugins/syntastic.vim b/config/plugins/syntastic.vim new file mode 100644 index 000000000..c04e8413f --- /dev/null +++ b/config/plugins/syntastic.vim @@ -0,0 +1,12 @@ +scriptencoding utf-8 +if !filereadable('pom.xml') && !filereadable('build.gradle') && isdirectory('bin') + let g:syntastic_java_javac_options = '-d bin' +endif +let g:syntastic_java_javac_config_file_enabled = 1 +let g:syntastic_java_javac_delete_output = 0 +let g:syntastic_always_populate_loc_list = 1 +let g:syntastic_auto_loc_list = 1 +let g:syntastic_check_on_open = 0 +let g:syntastic_check_on_wq = 0 +let g:syntastic_error_symbol = get(g:settings, 'error_symbol', '✖') +let g:syntastic_warning_symbol = get(g:settings, 'warning_symbol', '➤') diff --git a/config/plugins/tagbar.vim b/config/plugins/tagbar.vim new file mode 100644 index 000000000..6b95bf5d2 --- /dev/null +++ b/config/plugins/tagbar.vim @@ -0,0 +1,2 @@ +let g:tagbar_width=30 +let g:tagbar_left = 1 diff --git a/config/plugins/taglist.vim b/config/plugins/taglist.vim new file mode 100644 index 000000000..9c58cb3f3 --- /dev/null +++ b/config/plugins/taglist.vim @@ -0,0 +1,11 @@ +scriptencoding utf-8 +if !executable('ctags') + let g:Tlist_Ctags_Cmd = '/usr/bin/ctags' "设置ctags执行路径 +endif +let g:Tlist_Auto_Update=1 +let g:Tlist_Auto_Open =0 +let g:Tlist_Use_Right_Window=1 +let g:Tlist_Show_One_File=0 +let g:Tlist_File_Fold_Auto_Close=1 +let g:Tlist_Exit_OnlyWindow=1 +let g:Tlist_Show_Menu=1 diff --git a/config/plugins/unite-gtags.vim b/config/plugins/unite-gtags.vim new file mode 100644 index 000000000..bd38a3c02 --- /dev/null +++ b/config/plugins/unite-gtags.vim @@ -0,0 +1,9 @@ +nnoremap gd :execute 'Unite -auto-preview -start-insert -no-split gtags/def:'.expand('') +nnoremap gc :execute 'Unite -auto-preview -start-insert -no-split gtags/context' +nnoremap gr :execute 'Unite -auto-preview -start-insert -no-split gtags/ref' +nnoremap gg :execute 'Unite -auto-preview -start-insert -no-split gtags/grep' +nnoremap gp :execute 'Unite -auto-preview -start-insert -no-split gtags/completion' +vnoremap gd :execute 'Unite -auto-preview -start-insert -no-split gtags/def:'.GetVisualSelection() +let g:unite_source_gtags_project_config = { + \ '_': { 'treelize': 0 } + \ } diff --git a/config/plugins/unite.vim b/config/plugins/unite.vim new file mode 100644 index 000000000..d170b98db --- /dev/null +++ b/config/plugins/unite.vim @@ -0,0 +1,306 @@ +scriptencoding utf-8 +call unite#custom#source('codesearch', 'max_candidates', 30) +call unite#filters#matcher_default#use(['matcher_fuzzy']) +call unite#filters#sorter_default#use(['sorter_rank']) +call unite#custom#profile('default', 'context', { + \ 'safe': 0, + \ 'start_insert': 1, + \ 'ignorecase' : 1, + \ 'short_source_names': 1, + \ 'update_time': 200, + \ 'direction': 'rightbelow', + \ 'winwidth': 40, + \ 'winheight': 15, + \ 'max_candidates': 100, + \ 'no_auto_resize': 1, + \ 'vertical_preview': 1, + \ 'cursor_line_time': '0.10', + \ 'hide_icon': 0, + \ 'candidate-icon': ' ', + \ 'marked_icon': '✓', + \ 'prompt' : '➭ ' + \ }) +call unite#custom#profile('source/neobundle/update', 'context', { + \ 'start_insert' : 0, + \ }) +let g:unite_source_codesearch_ignore_case = 1 +let g:unite_source_buffer_time_format = '(%m-%d-%Y %H:%M:%S) ' +let g:unite_source_file_mru_time_format = '(%m-%d-%Y %H:%M:%S) ' +let g:unite_source_directory_mru_time_format = '(%m-%d-%Y %H:%M:%S) ' +let g:unite_source_directory_mru_limit = 80 +let g:unite_source_file_rec_max_depth = 6 +let g:unite_enable_ignore_case = 1 +let g:unite_enable_smart_case = 1 +let g:unite_data_directory='~/.cache/unite' +"let g:unite_enable_start_insert=1 +let g:unite_source_history_yank_enable=1 +let g:unite_split_rule = 'botright' +let g:unite_winheight=25 +let g:unite_source_grep_default_opts = '-iRHn' + \ . " --exclude='tags'" + \ . " --exclude='cscope*'" + \ . " --exclude='*.svn*'" + \ . " --exclude='*.log*'" + \ . " --exclude='*tmp*'" + \ . " --exclude-dir='**/tmp'" + \ . " --exclude-dir='CVS'" + \ . " --exclude-dir='.svn'" + \ . " --exclude-dir='.git'" + \ . " --exclude-dir='node_modules'" +let g:unite_launch_apps = [ + \ 'rake', + \ 'make', + \ 'git pull', + \ 'git push'] +let g:unite_source_menu_menus = get(g:,'unite_source_menu_menus',{}) +let g:unite_source_menu_menus.git = { + \ 'description' : ' gestionar repositorios git + \ ⌘ [espacio]g', + \} +let g:unite_source_menu_menus.git.command_candidates = [ + \['▷ tig ⌘ ,gt', + \'normal ,gt'], + \['▷ git status (Fugitive) ⌘ ,gs', + \'Gstatus'], + \['▷ git diff (Fugitive) ⌘ ,gd', + \'Gdiff'], + \['▷ git commit (Fugitive) ⌘ ,gc', + \'Gcommit'], + \['▷ git log (Fugitive) ⌘ ,gl', + \'exe "silent Glog | Unite quickfix"'], + \['▷ git blame (Fugitive) ⌘ ,gb', + \'Gblame'], + \['▷ git stage (Fugitive) ⌘ ,gw', + \'Gwrite'], + \['▷ git checkout (Fugitive) ⌘ ,go', + \'Gread'], + \['▷ git rm (Fugitive) ⌘ ,gr', + \'Gremove'], + \['▷ git mv (Fugitive) ⌘ ,gm', + \'exe "Gmove " input("destino: ")'], + \['▷ git push (Fugitive, salida por buffer) ⌘ ,gp', + \'Git! push'], + \['▷ git pull (Fugitive, salida por buffer) ⌘ ,gP', + \'Git! pull'], + \['▷ git prompt (Fugitive, salida por buffer) ⌘ ,gi', + \'exe "Git! " input("comando git: ")'], + \['▷ git cd (Fugitive)', + \'Gcd'], + \] +"=============================================================================== +" HTTP Status Code Definitions +"=============================================================================== +let g:unite_source_menu_menus.StatusCodeDefinitions = {'description': 'HTTP status code definitions sc'} +let g:unite_source_menu_menus.StatusCodeDefinitions.command_candidates = [ + \['➤ 100 Continue ', 'echo "Continue"'], + \['➤ 101 Switching Protocols ', 'echo "Switching Protocols"'], + \['➤ 200 OK ', 'echo "OK"'], + \['➤ 201 Created ', 'echo "Created"'], + \['➤ 202 Accepted ', 'echo "Accepted"'], + \['➤ 203 Non-Authoritative Information ', 'echo "Non-Authoritative Information"'], + \['➤ 204 No Content ', 'echo "No Content"'], + \['➤ 205 Reset Content ', 'echo "Reset Content"'], + \['➤ 206 Partial Content ', 'echo "Partial Content"'], + \['➤ 300 Multiple Choices ', 'echo "Multiple Choices"'], + \['➤ 301 Moved Permanently ', 'echo "Moved Permanently"'], + \['➤ 302 Found ', 'echo "Found"'], + \['➤ 303 See Other ', 'echo "See Other"'], + \['➤ 304 Not Modified ', 'echo "Not Modified"'], + \['➤ 305 Use Proxy ', 'echo "Use Proxy"'], + \['➤ 307 Temporary Redirect ', 'echo "Temporary Redirect"'], + \['➤ 400 Bad Request ', 'echo "Bad Request"'], + \['➤ 401 Unauthorized ', 'echo "Unauthorized"'], + \['➤ 402 Payment Required ', 'echo "Payment Required"'], + \['➤ 403 Forbidden ', 'echo "Forbidden"'], + \['➤ 404 Not Found ', 'echo "Not Found"'], + \['➤ 405 Method Not Allowed ', 'echo "Method Not Allowed"'], + \['➤ 406 Not Acceptable ', 'echo "Not Acceptable"'], + \['➤ 407 Proxy Authentication Required ', 'echo "Proxy Authoritative Required"'], + \['➤ 408 Request Timeout ', 'echo "Request Timeout"'], + \['➤ 409 Conflict ', 'echo "Conflict"'], + \['➤ 410 Gone ', 'echo "Gone"'], + \['➤ 411 Length Required ', 'echo "Length Required"'], + \['➤ 412 Precondition Failed ', 'echo "Precondition Failed"'], + \['➤ 413 Request Entity Too Large ', 'echo "Request Entity Too Large"'], + \['➤ 414 Request-URI Too Long ', 'echo "Request-URI Too Long"'], + \['➤ 415 Unsupported Media Type ', 'echo "Unsupported Media Type"'], + \['➤ 416 Requested Range Not Satisfiable ', 'echo "Requested Range Not Satisfiable"'], + \['➤ 417 Expectation Failed ', 'echo "Expectation Failed"'], + \['➤ 422 Unprocessable Entity ', 'echo "Unprocessable Entity"'], + \['➤ 500 Internal Server Error ', 'echo "Internal Server Error"'], + \['➤ 501 Not Implemented ', 'echo "Not Implemented"'], + \['➤ 502 Bad Gateway ', 'echo "Bad Gateway"'], + \['➤ 503 Service Unavailable ', 'echo "Service Unavailable"'], + \['➤ 504 Gateway Timeout ', 'echo "Gateway Timeout"'], + \['➤ 505 HTTP Version Not Supported ', 'echo "HTTP Version Not Supported"'], + \] +nnoremap sc :Unite -silent -winheight=17 -start-insert menu:StatusCodeDefinitions +let g:unite_source_grep_max_candidates = 200 +if executable('hw') + " Use hw (highway) + " https://github.com/tkengo/highway + let g:unite_source_grep_command = 'hw' + let g:unite_source_grep_default_opts = '--no-group --no-color' + let g:unite_source_grep_recursive_opt = '' +elseif executable('ag') + " Use ag (the silver searcher) + " https://github.com/ggreer/the_silver_searcher + let g:unite_source_grep_command = 'ag' + let g:unite_source_grep_default_opts = + \ '-i --line-numbers --nocolor --nogroup --hidden --ignore ' . + \ '''.hg'' --ignore ''.svn'' --ignore ''.git'' --ignore ''.bzr''' + let g:unite_source_grep_recursive_opt = '' +elseif executable('pt') + " Use pt (the platinum searcher) + " https://github.com/monochromegane/the_platinum_searcher + let g:unite_source_grep_command = 'pt' + let g:unite_source_grep_default_opts = '--nogroup --nocolor' + let g:unite_source_grep_recursive_opt = '' +elseif executable('ack-grep') + " Use ack + " http://beyondgrep.com/ + let g:unite_source_grep_command = 'ack-grep' + let g:unite_source_grep_default_opts = + \ '-i --no-heading --no-color -k -H' + let g:unite_source_grep_recursive_opt = '' +elseif executable('ack') + let g:unite_source_grep_command = 'ack' + let g:unite_source_grep_default_opts = '-i --no-heading --no-color -k -H' + let g:unite_source_grep_recursive_opt = '' +elseif executable('jvgrep') + " Use jvgrep + " https://github.com/mattn/jvgrep + let g:unite_source_grep_command = 'jvgrep' + let g:unite_source_grep_default_opts = '-i --exclude ''\.(git|svn|hg|bzr)''' + let g:unite_source_grep_recursive_opt = '-R' +endif +let g:unite_source_rec_async_command = + \ ['ag', '--follow', '--nocolor', '--nogroup', + \ '--hidden', '-g', ''] +nnoremap ufa :Unite -no-split -buffer-name=Mixed -start-insert file file_mru file_rec buffer +nnoremap ufr :Unite -buffer-name=files file_rec/async:! +nnoremap ufg :Unite -buffer-name=git-repo file_rec/git +call unite#custom#profile('file_rec/async,file_rec/git', 'context', { + \ 'start_insert' : 1, + \ 'quit' : 1, + \ 'split' : 1, + \ 'keep_focus' : 1, + \ 'winheight' : 20, + \ }) +call unite#custom#source('file_rec/async', 'ignore_globs',['*.png','.git/','*.ttf']) +nnoremap uf :Unite -no-split -buffer-name=files -start-insert file +nnoremap ufm :Unite -no-split -buffer-name=mru -start-insert file_mru +nnoremap ubf :Unite -buffer-name=buffer buffer +nnoremap utb :Unite -buffer-name=buffer_tab buffer_tab +call unite#custom#profile('buffer,buffer_tab', 'context', { + \ 'start_insert' : 0, + \ 'quit' : 1, + \ 'keep_focus' : 1, + \ }) +nnoremap um :Unite -start-insert mapping +nnoremap :Unite -start-insert help +nnoremap g :UniteWithCursorWord help +"" Tag search +""" For searching the word in the cursor in tag file +nnoremap f :Unite tag/include: +nnoremap ff :Unite tag/include -start-insert +"" grep dictionay +""" For searching the word in the cursor in the current directory +nnoremap v :Unite -auto-preview -no-split grep:.:: +nnoremap / :Unite -auto-preview grep:. +""" For searching the word handin +nnoremap vs :Unite -auto-preview -no-split grep:. +""" For searching the word in the cursor in the current buffer +noremap vf :Unite -auto-preview -no-split grep:%:: +""" For searching the word in the cursor in all opened buffer +noremap va :Unite -auto-preview -no-split grep:$buffers:: +nnoremap bl :Unite -start-insert -buffer-name=buffer buffer +"" outline +nnoremap o :Unite -buffer-name=outline -start-insert -auto-preview -no-split outline +"" Line search +nnoremap l :Unite line -start-insert -auto-preview -no-split +"" Yank history +nnoremap y :Unite -no-split -buffer-name=yank history/yank +" search plugin +" :Unite neobundle/search +"for Unite menu{ +nnoremap ug :Unite -silent -start-insert menu:git +" The prefix key. +nnoremap [unite] +nmap f [unite] +nnoremap [unite]c :UniteWithCurrentDir + \ -buffer-name=files buffer bookmark file +nnoremap [unite]b :UniteWithBufferDir + \ -buffer-name=files -prompt=%\ buffer bookmark file +nnoremap [unite]r :Unite + \ -buffer-name=register register +nnoremap [unite]o :Unite -buffer-name=outline -start-insert -auto-preview -split outline +nnoremap [unite]s :Unite session +nnoremap [unite]n :Unite session/new +nnoremap [unite]fr + \ :Unite -buffer-name=resume resume +nnoremap [unite]ma + \ :Unite mapping +nnoremap [unite]me + \ :Unite output:message +nnoremap [unite]f :Unite source +nnoremap [unite]w + \ :Unite -buffer-name=files -no-split + \ jump_point file_point buffer_tab + \ file_rec:! file file/new +nnoremap [unite] :Unite -silent -ignorecase -winheight=17 -start-insert menu:CustomKeyMaps +nnoremap ls :Unite -silent -ignorecase -winheight=17 -start-insert menu:MyStarredrepos +nnoremap lm :Unite -silent -ignorecase -winheight=17 -start-insert menu:MpvPlayer +call zvim#util#loadMusics() +augroup unite_buffer_feature + autocmd FileType unite call s:unite_my_settings() +augroup END +function! s:unite_my_settings() + " Overwrite settings. + + " Play nice with supertab + let b:SuperTabDisabled=1 + " Enable navigation with control-j and control-k in insert mode + imap (unite_select_next_line) + nmap (unite_select_next_line) + imap (unite_select_previous_line) + nmap (unite_select_previous_line) + + + imap jj (unite_insert_leave) + "imap (unite_delete_backward_path) + + imap j unite#smart_map('j', '') + imap (unite_select_next_line) + imap (unite_delete_backward_path) + imap ' (unite_quick_match_default_action) + nmap ' (unite_quick_match_default_action) + imap x + \ unite#smart_map('x', "\(unite_quick_match_choose_action)") + nmap x (unite_quick_match_choose_action) + nmap (unite_toggle_transpose_window) + imap (unite_toggle_transpose_window) + imap (unite_narrowing_path) + nmap (unite_narrowing_path) + nmap (unite_toggle_auto_preview) + imap (unite_toggle_auto_preview) + nmap (unite_narrowing_input_history) + imap (unite_narrowing_input_history) + nnoremap l + \ unite#smart_map('l', unite#do_action('default')) + + let unite = unite#get_current_unite() + if unite.profile_name ==# 'search' + nnoremap r unite#do_action('replace') + else + nnoremap r unite#do_action('rename') + endif + + nnoremap cd unite#do_action('lcd') + nnoremap S unite#mappings#set_current_filters( + \ empty(unite#mappings#get_current_filters()) ? + \ ['sorter_reverse'] : []) + + " Runs "split" action by . + imap unite#do_action('split') +endfunction diff --git a/config/plugins/vim-airline.vim b/config/plugins/vim-airline.vim new file mode 100644 index 000000000..498afef64 --- /dev/null +++ b/config/plugins/vim-airline.vim @@ -0,0 +1,59 @@ +scriptencoding utf-8 +let g:airline_powerline_fonts=1 +let g:airline_skip_empty_sections = 1 +let g:airline#extensions#tabline#enabled = 1 +let g:airline#extensions#tmuxline#enabled = 1 +let g:Powerline_sybols = 'unicode' +let g:airline#extensions#tabline#buffer_idx_mode = 1 +let g:airline#extensions#tabline#buffer_nr_show = 1 +let g:airline#extensions#tabline#buffer_nr_format = '%s:' +let g:airline#extensions#tabline#fnamemod = ':t' +let g:airline#extensions#tabline#fnamecollapse = 1 +let g:airline#extensions#tabline#fnametruncate = 0 +let g:airline#extensions#tabline#formatter = 'unique_tail_improved' +nmap 1 AirlineSelectTab1 +nmap 2 AirlineSelectTab2 +nmap 3 AirlineSelectTab3 +nmap 4 AirlineSelectTab4 +nmap 5 AirlineSelectTab5 +nmap 6 AirlineSelectTab6 +nmap 7 AirlineSelectTab7 +nmap 8 AirlineSelectTab8 +nmap 9 AirlineSelectTab9 +nmap - AirlineSelectPrevTab +nmap + AirlineSelectNextTab +if !exists('g:airline_symbols') + let g:airline_symbols = {} +endif + +" unicode symbols +let g:airline_left_sep = '»' +let g:airline_left_sep = '▶' +let g:airline_right_sep = '«' +let g:airline_right_sep = '◀' +let g:airline_symbols.crypt = '🔒' +let g:airline_symbols.linenr = '␊' +let g:airline_symbols.linenr = '␤' +let g:airline_symbols.linenr = '¶' +let g:airline_symbols.branch = '⎇' +let g:airline_symbols.paste = 'ρ' +let g:airline_symbols.paste = 'Þ' +let g:airline_symbols.paste = '∥' +let g:airline_symbols.notexists = '∄' +let g:airline_symbols.whitespace = 'Ξ' + +" powerline symbols +let g:airline_left_sep = '' +let g:airline_left_alt_sep = '' +let g:airline_right_sep = '' +let g:airline_right_alt_sep = '' +let g:airline_symbols.branch = '' +let g:airline_symbols.readonly = '' +let g:airline_symbols.linenr = '' +let g:airline_symbols.maxlinenr= '' + + +augroup Fix_airline_with_unite + autocmd FileType unite AirlineRefresh + autocmd FileType vimfiler AirlineRefresh +augroup END diff --git a/config/plugins/vim-grepper.vim b/config/plugins/vim-grepper.vim new file mode 100644 index 000000000..e69de29bb diff --git a/config/plugins/vim-ref.vim b/config/plugins/vim-ref.vim new file mode 100644 index 000000000..c76bd2d1d --- /dev/null +++ b/config/plugins/vim-ref.vim @@ -0,0 +1,34 @@ +let g:ref_source_webdict_sites = { + \ 'je': { + \ 'url': 'http://dictionary.infoseek.ne.jp/jeword/%s', + \ }, + \ 'ej': { + \ 'url': 'http://dictionary.infoseek.ne.jp/ejword/%s', + \ }, + \ 'wiki': { + \ 'url': 'http://ja.wikipedia.org/wiki/%s', + \ }, + \ 'cn': { + \ 'url': 'http://www.iciba.com/%s', + \ }, + \ 'wikipedia:en':{'url': 'http://en.wikipedia.org/wiki/%s', }, + \ 'bing':{'url': 'http://cn.bing.com/search?q=%s', }, + \ } +let g:ref_source_webdict_sites.default = 'cn' +"let g:ref_source_webdict_cmd='lynx -dump -nonumbers %s' +"let g:ref_source_webdict_cmd='w3m -dump %s' +"The filter on the output. Remove the first few lines +function! g:ref_source_webdict_sites.je.filter(output) + return join(split(a:output, "\n")[15 :], "\n") +endfunction +function! g:ref_source_webdict_sites.ej.filter(output) + return join(split(a:output, "\n")[15 :], "\n") +endfunction +function! g:ref_source_webdict_sites.wiki.filter(output) + return join(split(a:output, "\n")[17 :], "\n") +endfunction +nnoremap rj :Ref webdict je +nnoremap re :Ref webdict ej +nnoremap rc :Ref webdict cn +nnoremap rw :Ref webdict wikipedia:en +nnoremap rb :Ref webdict bing diff --git a/config/plugins/vim-startify.vim b/config/plugins/vim-startify.vim new file mode 100644 index 000000000..83e78b97c --- /dev/null +++ b/config/plugins/vim-startify.vim @@ -0,0 +1,33 @@ +let g:startify_session_dir = $HOME . '/.data/' . ( has('nvim') ? 'nvim' : 'vim' ) . '/session' +let g:startify_files_number = 6 +let g:startify_list_order = [ + \ [' My most recently used files in the current directory:'], + \ 'dir', + \ [' My most recently used files:'], + \ 'files', + \ [' These are my sessions:'], + \ 'sessions', + \ [' These are my bookmarks:'], + \ 'bookmarks', + \ ] +"let g:startify_bookmarks = [ {'c': '~/.vimrc'}, '~/.zshrc' ] +let g:startify_update_oldfiles = 1 +let g:startify_session_autoload = 1 +let g:startify_session_persistence = 1 +"let g:startify_session_delete_buffers = 0 +let g:startify_change_to_dir = 0 +"let g:startify_change_to_vcs_root = 0 " vim-rooter has same feature +let g:startify_skiplist = [ + \ 'COMMIT_EDITMSG', + \ escape(fnamemodify(resolve($VIMRUNTIME), ':p'), '\') .'doc', + \ 'bundle/.*/doc', + \ ] +fu! startify_mapping() + if getcwd() == $VIM || getcwd() == expand('~') + nnoremap :CtrlP ~\DotFiles + endif +endf +augroup startify_map + autocmd FileType startify nnoremap + autocmd FileType startify call startify_mapping() +augroup END diff --git a/config/plugins/vimfiler.vim b/config/plugins/vimfiler.vim new file mode 100644 index 000000000..3cd246de6 --- /dev/null +++ b/config/plugins/vimfiler.vim @@ -0,0 +1,53 @@ +scriptencoding utf-8 +let g:vimfiler_as_default_explorer = 1 +let g:vimfiler_restore_alternate_file = 1 +let g:vimfiler_tree_indentation = 1 +let g:vimfiler_tree_leaf_icon = '' +let g:vimfiler_tree_opened_icon = '▼' +let g:vimfiler_tree_closed_icon = '▷' +let g:vimfiler_file_icon = '' +let g:vimfiler_readonly_file_icon = '*' +let g:vimfiler_marked_file_icon = '√' +"let g:vimfiler_preview_action = 'auto_preview' +let g:vimfiler_ignore_pattern = [ + \ '^\.git$', + \ '^\.DS_Store$', + \ '^\.init\.vim-rplugin\~$', + \ '^\.netrwhist$', + \ '\.class$' + \] + +if has('mac') + let g:vimfiler_quick_look_command = + \ '/Applications//Sublime\ Text.app/Contents/MacOS/Sublime\ Text' +else + let g:vimfiler_quick_look_command = 'gloobus-preview' +endif + +call vimfiler#custom#profile('default', 'context', { + \ 'explorer' : 1, + \ 'winwidth' : 30, + \ 'winminwidth' : 30, + \ 'toggle' : 1, + \ 'columns' : 'type', + \ 'auto_expand': 1, + \ 'direction' : 'rightbelow', + \ 'parent': 0, + \ 'explorer_columns' : 'type', + \ 'status' : 1, + \ 'safe' : 0, + \ 'split' : 1, + \ 'hidden': 1, + \ 'no_quit' : 1, + \ 'force_hide' : 0, + \ }) +augroup vfinit +autocmd FileType vimfiler call s:vimfilerinit() +"autocmd VimEnter * if !argc() | VimFiler | endif +autocmd BufEnter * if (winnr('$') == 1 && &filetype ==# 'vimfiler') | + \ q | endif +augroup END +function! s:vimfilerinit() + set nonumber + set norelativenumber +endf diff --git a/ginit.vim b/ginit.vim new file mode 100644 index 000000000..11aa2f923 --- /dev/null +++ b/ginit.vim @@ -0,0 +1,4 @@ +if exists("g:GuiLoaded") + exe 'Guifont! DejaVu Sans Mono for Powerline:h11:cANSI:qDRAFT' +endif +