1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 05:50:05 +08:00

Merge pull request #1587 from wsdjeg/c-esc

Fix autocmd
This commit is contained in:
Wang Shidong 2018-04-01 13:45:28 +08:00 committed by GitHub
commit 94691e8b0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 39 additions and 35 deletions

View File

@ -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 <silent><buffer> <C-]> :call MyTagfunc()<CR>
\| nnoremap <silent><buffer> <C-[> :call MyTagfuncBack()<CR>
\| else
\| if empty(maparg('<leader>[', 'n', 0, 1)) && empty(maparg('<leader>]', 'n', 0, 1))
\| nnoremap <silent><buffer> <leader>] :call MyTagfunc()<CR>
\| nnoremap <silent><buffer> <leader>[ :call MyTagfuncBack()<CR>
\| 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()

View File

@ -45,6 +45,9 @@ function! SpaceVim#layers#git#config() abort
autocmd FileType diff nnoremap <buffer><silent> q :bd!<CR>
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')) . ', [])',

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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("<cword>")', 'find definitions', 1)
call SpaceVim#mapping#space#def('nnoremap', ['m', 'g', 'r'], 'exe "Gtags -r " . expand("<cword>")', 'find references', 1)
endif
augroup spacevim_layer_tags
autocmd!
autocmd BufEnter *
\ if empty(&buftype) && &filetype != 'help'
\| nnoremap <silent><buffer> <C-]> :call MyTagfunc()<CR>
\| nnoremap <silent><buffer> <C-[> :call MyTagfuncBack()<CR>
\| 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

View File

@ -120,19 +120,6 @@ function! JspFileTypeInit()
nnoremap <F4> :JCimportAdd<cr>
inoremap <F4> <esc>:JCimportAddI<cr>
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'