diff --git a/autoload/SpaceVim/autocmds.vim b/autoload/SpaceVim/autocmds.vim index d49a42cec..4af1c8f80 100644 --- a/autoload/SpaceVim/autocmds.vim +++ b/autoload/SpaceVim/autocmds.vim @@ -41,31 +41,11 @@ function! SpaceVim#autocmds#init() abort 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 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 sh setlocal omnifunc=SpaceVim#plugins#bashcomplete#omnicomplete 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 qf setlocal nobuflisted - autocmd BufEnter * - \ if empty(&buftype) && has('nvim') && &filetype != 'help' - \| nnoremap :call MyTagfunc() - \| nnoremap :call MyTagfuncBack() - \| else - \| if empty(maparg('[', 'n', 0, 1)) && empty(maparg(']', 'n', 0, 1)) - \| nnoremap ] :call MyTagfunc() - \| nnoremap [ :call MyTagfuncBack() - \| endif - \| 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]) au StdinReadPost * call s:disable_welcome() autocmd InsertEnter * call s:fixindentline() autocmd BufEnter,FileType * call SpaceVim#mapping#space#refrashLSPC() diff --git a/autoload/SpaceVim/layers/git.vim b/autoload/SpaceVim/layers/git.vim index daece697a..08843d038 100644 --- a/autoload/SpaceVim/layers/git.vim +++ b/autoload/SpaceVim/layers/git.vim @@ -45,6 +45,9 @@ function! SpaceVim#layers#git#config() abort autocmd FileType diff nnoremap q :bd! autocmd FileType gitcommit setl omnifunc=SpaceVim#plugins#gitcommit#complete autocmd User GitGutter let &l:statusline = SpaceVim#layers#core#statusline#get(1) + " 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]) augroup END call SpaceVim#mapping#space#def('nnoremap', ['g', 'M'], 'call call(' \ . string(function('s:display_last_commit_of_current_line')) . ', [])', diff --git a/autoload/SpaceVim/layers/lang/html.vim b/autoload/SpaceVim/layers/lang/html.vim index f5ffd7a3e..87f687b78 100644 --- a/autoload/SpaceVim/layers/lang/html.vim +++ b/autoload/SpaceVim/layers/lang/html.vim @@ -24,6 +24,7 @@ function! SpaceVim#layers#lang#html#config() abort augroup spacevim_lang_html autocmd! autocmd FileType html,css,scss,sass,less,javascript,jsp,vue,eex call s:install_emmet() + autocmd Filetype html setlocal omnifunc=htmlcomplete#CompleteTags augroup END endfunction diff --git a/autoload/SpaceVim/layers/lang/javascript.vim b/autoload/SpaceVim/layers/lang/javascript.vim index 0d2e21478..450321786 100644 --- a/autoload/SpaceVim/layers/lang/javascript.vim +++ b/autoload/SpaceVim/layers/lang/javascript.vim @@ -66,6 +66,7 @@ function! SpaceVim#layers#lang#javascript#config() abort augroup SpaceVim_lang_javascript autocmd! autocmd User NeomakeFinished checktime + autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS autocmd FocusGained * checktime augroup END endif diff --git a/autoload/SpaceVim/layers/lang/markdown.vim b/autoload/SpaceVim/layers/lang/markdown.vim index 9f8171834..47d9d080d 100644 --- a/autoload/SpaceVim/layers/lang/markdown.vim +++ b/autoload/SpaceVim/layers/lang/markdown.vim @@ -50,6 +50,10 @@ function! SpaceVim#layers#lang#markdown#config() abort let g:mkdp_browserfunc = 'openbrowser#open' " }}} call SpaceVim#mapping#space#regesit_lang_mappings('markdown', function('s:mappings')) + augroup spacevim_layer_lang_markdown + autocmd! + autocmd FileType markdown setlocal omnifunc=htmlcomplete#CompleteTags + augroup END endfunction function! s:mappings() abort diff --git a/autoload/SpaceVim/layers/lang/sh.vim b/autoload/SpaceVim/layers/lang/sh.vim index a10134793..f3ce724a7 100644 --- a/autoload/SpaceVim/layers/lang/sh.vim +++ b/autoload/SpaceVim/layers/lang/sh.vim @@ -30,4 +30,8 @@ function! SpaceVim#layers#lang#sh#config() \ '#!/usr/bin/env zsh', \ '' \ ]) + augroup spacevim_layer_lang_sh + autocmd! + autocmd FileType sh setlocal omnifunc=SpaceVim#plugins#bashcomplete#omnicomplete + augroup END endfunction diff --git a/autoload/SpaceVim/layers/lang/vim.vim b/autoload/SpaceVim/layers/lang/vim.vim index 1253d542b..ee9898209 100644 --- a/autoload/SpaceVim/layers/lang/vim.vim +++ b/autoload/SpaceVim/layers/lang/vim.vim @@ -13,8 +13,8 @@ function! SpaceVim#layers#lang#vim#plugins() abort \ ['ynkdir/vim-vimlparser', { 'on_ft' : 'vim'}], \ ['todesking/vint-syntastic', { 'on_ft' : 'vim'}], \ ] - call add(plugins,['tweekmonster/exception.vim']) - call add(plugins,['mhinz/vim-lookup']) + call add(plugins,['tweekmonster/exception.vim', {'merged' : 0}]) + call add(plugins,['mhinz/vim-lookup', {'merged' : 0}]) call add(plugins,['Shougo/neco-vim', { 'on_event' : 'InsertEnter', 'loadconf_before' : 1}]) if g:spacevim_autocomplete_method == 'asyncomplete' call add(plugins, ['prabirshrestha/asyncomplete-necovim.vim', { @@ -39,6 +39,7 @@ function! s:language_specified_mappings() abort call SpaceVim#mapping#space#langSPC('nmap', ['l','v'], 'call call(' \ . string(function('s:helpversion_cursor')) . ', [])', \ 'echo helpversion under cursor', 1) + call SpaceVim#mapping#space#langSPC('nmap', ['l','f'], 'call exception#trace()', 'tracing exceptions', 1) endfunction function! s:eval_cursor() abort diff --git a/autoload/SpaceVim/layers/tags.vim b/autoload/SpaceVim/layers/tags.vim index 4f9b13975..1b6529528 100644 --- a/autoload/SpaceVim/layers/tags.vim +++ b/autoload/SpaceVim/layers/tags.vim @@ -10,6 +10,7 @@ function! SpaceVim#layers#tags#plugins() abort return [ \ ['ludovicchabant/vim-gutentags', {'merged' : 0}], \ ['SpaceVim/gtags.vim', {'merged' : 0}], + \ ['tsukkee/unite-tag', {'merged' : 0}], \ ] endfunction @@ -30,4 +31,26 @@ function! SpaceVim#layers#tags#config() abort call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'd'], 'exe "Gtags -d " . expand("")', 'find definitions', 1) call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'r'], 'exe "Gtags -r " . expand("")', 'find references', 1) endif + augroup spacevim_layer_tags + autocmd! + autocmd BufEnter * + \ if empty(&buftype) && &filetype != 'help' + \| nnoremap :call MyTagfunc() + \| nnoremap :call MyTagfuncBack() + \| endif + augroup END 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 + diff --git a/config/functions.vim b/config/functions.vim index 61f9ccee3..c2603099e 100644 --- a/config/functions.vim +++ b/config/functions.vim @@ -120,19 +120,6 @@ function! JspFileTypeInit() 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! MyLeaderTabfunc() abort if g:spacevim_autocomplete_method == 'deoplete'