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

fix(plugin): Fix key binding error E225

problem: when save file, always get error
         `E225: global mapping already exists for (`
solution: remvoe unique when defind mappings

close https://github.com/SpaceVim/SpaceVim/issues/4109
This commit is contained in:
Shidong Wang 2021-09-21 22:41:23 +08:00
parent bdc0101b9a
commit b8eae5e4f7
No known key found for this signature in database
GPG Key ID: 41BB7053E835C848
4 changed files with 25 additions and 12 deletions

View File

@ -60,6 +60,7 @@ function! SpaceVim#autocmds#init() abort
autocmd FocusLost * call system('synclient touchpadoff=0')
autocmd FocusGained * call s:reload_touchpad_status()
endif
" @fixme this autocmd should also support `:w foo/test.vim`
autocmd BufWritePre * call SpaceVim#plugins#mkdir#CreateCurrent()
autocmd ColorScheme * call SpaceVim#api#import('vim#highlight').hide_in_normal('EndOfBuffer')
autocmd ColorScheme gruvbox,jellybeans,nord,srcery,NeoSolarized call s:fix_colorschem_in_SpaceVim()

View File

@ -126,7 +126,7 @@ endfunction
function! SpaceVim#layers#autocomplete#config() abort
if g:spacevim_autocomplete_parens
imap <expr>(
imap <expr> (
\ pumvisible() ?
\ has('patch-7.4.744') ?
\ complete_parameter#pre_complete("()") : '(' :

View File

@ -939,6 +939,18 @@ function! s:save_current_file() abort
endif
endfunction
" the `SPC f a` key binding cause many erros:
" E212: Can't open file for writing: no such file or directory
" E216: No such group or event: FileExplorer
"
" Fix E216: No such group or event: FileExplorer
" which is called in bundle/nerdtree/plugin/NERD_tree.vim:184
augroup FileExplorer
autocmd!
augroup END
function! s:save_as_new_file() abort
let current_fname = bufname()
if !empty(current_fname)

View File

@ -275,7 +275,7 @@ function! s:NoAutoClose() "{{{
let delim = '<Bar>'
endif
exec 'inoremap <silent> <Plug>delimitMate' . delim . ' <C-R>=<SID>TriggerAbb().delimitMate#SkipDelim("' . escape(delim,'"') . '")<CR>'
exec 'silent! imap <unique> <buffer> '.delim.' <Plug>delimitMate'.delim
exec 'silent! imap <buffer> '.delim.' <Plug>delimitMate'.delim
endfor
endfunction "}}}
@ -288,7 +288,7 @@ function! s:AutoClose() "{{{
let rd = s:get('right_delims')[i] == '|' ? '<bar>' : s:get('right_delims')[i]
exec 'inoremap <expr><silent> <Plug>delimitMate' . ld
\. ' <SID>TriggerAbb().delimitMate#ParenDelim("' . escape(rd, '|') . '")'
exec 'silent! imap <unique> <buffer> '.ld
exec 'silent! imap <buffer> '.ld
\.' <Plug>delimitMate'.ld
let i += 1
endwhile
@ -298,7 +298,7 @@ function! s:AutoClose() "{{{
let delim = delim == '|' ? '<bar>' : delim
exec 'inoremap <expr><silent> <Plug>delimitMate' . delim
\. ' <SID>TriggerAbb().delimitMate#JumpOut("\' . delim . '")'
exec 'silent! imap <unique> <buffer> ' . delim
exec 'silent! imap <buffer> ' . delim
\. ' <Plug>delimitMate'. delim
endfor
@ -310,7 +310,7 @@ function! s:AutoClose() "{{{
endif
exec 'inoremap <expr><silent> <Plug>delimitMate' . delim
\. ' <SID>TriggerAbb()."<C-R>=delimitMate#QuoteDelim(\"\\\' . delim . '\")<CR>"'
exec 'silent! imap <unique> <buffer> ' . delim
exec 'silent! imap <buffer> ' . delim
\. ' <Plug>delimitMate' . delim
endfor
@ -318,7 +318,7 @@ function! s:AutoClose() "{{{
" inoremap <silent> <buffer> n't n't
for map in s:get('apostrophes_list')
exec "inoremap <silent> " . map . " " . map
exec 'silent! imap <unique> <buffer> ' . map . ' <Plug>delimitMate' . map
exec 'silent! imap <buffer> ' . map . ' <Plug>delimitMate' . map
endfor
endfunction "}}}
@ -327,31 +327,31 @@ function! s:ExtraMappings() "{{{
inoremap <silent> <Plug>delimitMateBS <C-R>=delimitMate#BS()<CR>
if !hasmapto('<Plug>delimitMateBS','i')
if empty(maparg('<BS>', 'i'))
silent! imap <unique> <buffer> <BS> <Plug>delimitMateBS
silent! imap <buffer> <BS> <Plug>delimitMateBS
endif
if empty(maparg('<C-H>', 'i'))
silent! imap <unique> <buffer> <C-h> <Plug>delimitMateBS
silent! imap <buffer> <C-h> <Plug>delimitMateBS
endif
endif
" If pair is empty, delete closing delimiter:
inoremap <silent> <expr> <Plug>delimitMateS-BS delimitMate#WithinEmptyPair() ? "\<Del>" : "\<S-BS>"
if !hasmapto('<Plug>delimitMateS-BS','i') && maparg('<S-BS>', 'i') == ''
silent! imap <unique> <buffer> <S-BS> <Plug>delimitMateS-BS
silent! imap <buffer> <S-BS> <Plug>delimitMateS-BS
endif
" Expand return if inside an empty pair:
inoremap <expr><silent> <Plug>delimitMateCR <SID>TriggerAbb()."\<C-R>=delimitMate#ExpandReturn()\<CR>"
if s:get('expand_cr') && !hasmapto('<Plug>delimitMateCR', 'i') && maparg('<CR>', 'i') == ''
silent! imap <unique> <buffer> <CR> <Plug>delimitMateCR
silent! imap <buffer> <CR> <Plug>delimitMateCR
endif
" Expand space if inside an empty pair:
inoremap <expr><silent> <Plug>delimitMateSpace <SID>TriggerAbb()."\<C-R>=delimitMate#ExpandSpace()\<CR>"
if s:get('expand_space') && !hasmapto('<Plug>delimitMateSpace', 'i') && maparg('<Space>', 'i') == ''
silent! imap <unique> <buffer> <Space> <Plug>delimitMateSpace
silent! imap <buffer> <Space> <Plug>delimitMateSpace
endif
" Jump over any delimiter:
inoremap <expr><silent> <Plug>delimitMateS-Tab <SID>TriggerAbb()."\<C-R>=delimitMate#JumpAny()\<CR>"
if s:get('tab2exit') && !hasmapto('<Plug>delimitMateS-Tab', 'i') && maparg('<S-Tab>', 'i') == ''
silent! imap <unique> <buffer> <S-Tab> <Plug>delimitMateS-Tab
silent! imap <buffer> <S-Tab> <Plug>delimitMateS-Tab
endif
" Jump over next delimiters
inoremap <expr><buffer> <Plug>delimitMateJumpMany <SID>TriggerAbb()."\<C-R>=delimitMate#JumpMany()\<CR>"