Skip to content

Commit d93bcd5

Browse files
authored
Merge pull request #26 from Konfekt/patch-1
use devdocs and svelte-check
2 parents e0f65b7 + 493ff13 commit d93bcd5

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

ftplugin/svelte.vim

+18
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
if exists("b:did_ftplugin") | finish | endif
22
let b:did_ftplugin = 1
33

4+
let b:undo_ftplugin = get(b:, 'undo_ftplugin', '')
5+
46
if !has('nvim')
57
setlocal matchpairs+=<:>
8+
let b:undo_ftplugin .= "| setlocal matchpairs<"
69
endif
710

811
if exists("loaded_matchit")
@@ -13,9 +16,24 @@ if exists("loaded_matchit")
1316
\ '<\@<=\([^/][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>,' .
1417
\ '{#\(if\|each\)[^}]*}:{\:else[^}]*}:{\/\(if\|each\)},' .
1518
\ '{#await[^}]*}:{\:then[^}]*}:{\/await},'
19+
let b:undo_ftplugin .= "| unlet b:match_ignorecase b:match_words"
1620
endif
1721

1822
" Indent correctly with template string for vim-javascript/builtin
1923
" indentexpr
2024
let b:syng_str = '^\%(.*template\)\@!.*string\|special'
2125
let b:syng_strcom = '^\%(.*template\)\@!.*string\|comment\|regex\|special\|doc'
26+
let b:undo_ftplugin .= "| unlet b:syng_str b:syng_strcom"
27+
28+
if executable('npx') && !empty(globpath(&runtimepath, 'compiler/svelte-check.vim'))
29+
compiler svelte-check
30+
let b:undo_ftplugin .= "| compiler make"
31+
endif
32+
if exists(':Open') == 2
33+
" let &keywordprg = ':Open https://devdocs.io/\#q='..&filetype
34+
nnoremap <buffer> <expr> <F1> '<cmd>Open https://devdocs.io/\#q='..&filetype..' '..expand('<cword>')..'<CR>'
35+
if exists('*getregion')
36+
vnoremap <buffer> <expr> <F1> '<cmd>Open https://devdocs.io/\#q='..&filetype..' '..join(getregion(getpos('v'), getpos('.')))..'<CR>'
37+
endif
38+
let b:undo_ftplugin .= "| nunmap <buffer> <F1> | vnunmap <buffer> <F1>"
39+
endif

0 commit comments

Comments
 (0)