diff --git a/ftplugin/svelte.vim b/ftplugin/svelte.vim index 2a6e763..4260ba2 100644 --- a/ftplugin/svelte.vim +++ b/ftplugin/svelte.vim @@ -1,8 +1,11 @@ if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 +let b:undo_ftplugin = get(b:, 'undo_ftplugin', '') + if !has('nvim') setlocal matchpairs+=<:> + let b:undo_ftplugin .= "| setlocal matchpairs<" endif if exists("loaded_matchit") @@ -13,9 +16,24 @@ if exists("loaded_matchit") \ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>,' . \ '{#\(if\|each\)[^}]*}:{\:else[^}]*}:{\/\(if\|each\)},' . \ '{#await[^}]*}:{\:then[^}]*}:{\/await},' + let b:undo_ftplugin .= "| unlet b:match_ignorecase b:match_words" endif " Indent correctly with template string for vim-javascript/builtin " indentexpr let b:syng_str = '^\%(.*template\)\@!.*string\|special' let b:syng_strcom = '^\%(.*template\)\@!.*string\|comment\|regex\|special\|doc' +let b:undo_ftplugin .= "| unlet b:syng_str b:syng_strcom" + +if executable('npx') && !empty(globpath(&runtimepath, 'compiler/svelte-check.vim')) + compiler svelte-check + let b:undo_ftplugin .= "| compiler make" +endif +if exists(':Open') == 2 + " let &keywordprg = ':Open https://devdocs.io/\#q='..&filetype + nnoremap 'Open https://devdocs.io/\#q='..&filetype..' '..expand('')..'' + if exists('*getregion') + vnoremap 'Open https://devdocs.io/\#q='..&filetype..' '..join(getregion(getpos('v'), getpos('.')))..'' + endif + let b:undo_ftplugin .= "| nunmap | vnunmap " +endif