Skip to content

Commit 3939edd

Browse files
authored
Merge pull request #27 from Konfekt/patch-2
fix undo mapping commands
2 parents d93bcd5 + 2ce3a7e commit 3939edd

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

ftplugin/svelte.vim

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
if exists("b:did_ftplugin") | finish | endif
22
let b:did_ftplugin = 1
33

4-
let b:undo_ftplugin = get(b:, 'undo_ftplugin', '')
4+
" Indent correctly with template string for vim-javascript/builtin
5+
" indentexpr
6+
let b:syng_str = '^\%(.*template\)\@!.*string\|special'
7+
let b:syng_strcom = '^\%(.*template\)\@!.*string\|comment\|regex\|special\|doc'
8+
9+
let b:undo_ftplugin = (exists('b:undo_ftplugin') ? b:undo_ftplugin . " | " : "") .
10+
\ "unlet! b:syng_str b:syng_strcom"
511

612
if !has('nvim')
713
setlocal matchpairs+=<:>
8-
let b:undo_ftplugin .= "| setlocal matchpairs<"
14+
let b:undo_ftplugin .= " | setlocal matchpairs<"
915
endif
1016

1117
if exists("loaded_matchit")
@@ -16,24 +22,19 @@ if exists("loaded_matchit")
1622
\ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>,' .
1723
\ '{#\(if\|each\)[^}]*}:{\:else[^}]*}:{\/\(if\|each\)},' .
1824
\ '{#await[^}]*}:{\:then[^}]*}:{\/await},'
19-
let b:undo_ftplugin .= "| unlet b:match_ignorecase b:match_words"
25+
let b:undo_ftplugin .= " | unlet! b:match_ignorecase b:match_words"
2026
endif
2127

22-
" Indent correctly with template string for vim-javascript/builtin
23-
" indentexpr
24-
let b:syng_str = '^\%(.*template\)\@!.*string\|special'
25-
let b:syng_strcom = '^\%(.*template\)\@!.*string\|comment\|regex\|special\|doc'
26-
let b:undo_ftplugin .= "| unlet b:syng_str b:syng_strcom"
27-
2828
if executable('npx') && !empty(globpath(&runtimepath, 'compiler/svelte-check.vim'))
2929
compiler svelte-check
30-
let b:undo_ftplugin .= "| compiler make"
30+
let b:undo_ftplugin .= " | compiler make"
3131
endif
3232
if exists(':Open') == 2
3333
" let &keywordprg = ':Open https://devdocs.io/\#q='..&filetype
3434
nnoremap <buffer> <expr> <F1> '<cmd>Open https://devdocs.io/\#q='..&filetype..' '..expand('<cword>')..'<CR>'
35+
let b:undo_ftplugin .= " | exe 'nunmap <buffer> <F1>'"
3536
if exists('*getregion')
3637
vnoremap <buffer> <expr> <F1> '<cmd>Open https://devdocs.io/\#q='..&filetype..' '..join(getregion(getpos('v'), getpos('.')))..'<CR>'
38+
let b:undo_ftplugin .= " | exe 'vunmap <buffer> <F1>'"
3739
endif
38-
let b:undo_ftplugin .= "| nunmap <buffer> <F1> | vnunmap <buffer> <F1>"
3940
endif

0 commit comments

Comments
 (0)