From 3635c58129ba8c218b9ce48484a181cceb2c0924 Mon Sep 17 00:00:00 2001 From: wsdjeg Date: Sun, 1 Apr 2018 13:16:14 +0800 Subject: [PATCH] Fix key bindings --- autoload/SpaceVim/autocmds.vim | 11 ----------- autoload/SpaceVim/layers/tags.vim | 23 +++++++++++++++++++++++ config/functions.vim | 13 ------------- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/autoload/SpaceVim/autocmds.vim b/autoload/SpaceVim/autocmds.vim index 165fb4b1f..4af1c8f80 100644 --- a/autoload/SpaceVim/autocmds.vim +++ b/autoload/SpaceVim/autocmds.vim @@ -45,17 +45,6 @@ function! SpaceVim#autocmds#init() abort autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS 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() au StdinReadPost * call s:disable_welcome() autocmd InsertEnter * call s:fixindentline() 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'