Skip to content

Commit 8eebdf6

Browse files
committed
Fix for Next.js file pattern
1 parent be27746 commit 8eebdf6

File tree

6 files changed

+28
-10
lines changed

6 files changed

+28
-10
lines changed

autoload/vital/_vsnip/VS/LSP/TextEdit.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ endfunction
172172
"
173173
function! s:_switch(path) abort
174174
let l:curr = bufnr('%')
175-
let l:next = bufnr(a:path)
175+
let l:next = filereadable(a:path) ? bufnr(fnameescape(a:path)) : bufnr(a:path)
176176
if l:next >= 0
177177
if l:curr != l:next
178-
execute printf('noautocmd keepalt keepjumps %sbuffer!', bufnr(a:path))
178+
execute printf('noautocmd keepalt keepjumps %sbuffer!', l:next)
179179
endif
180180
else
181181
execute printf('noautocmd keepalt keepjumps edit! %s', fnameescape(a:path))

autoload/vital/_vsnip/VS/Vim/Buffer.vim

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
function! s:_SID() abort
55
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
66
endfunction
7-
execute join(['function! vital#_vsnip#VS#Vim#Buffer#import() abort', printf("return map({'get_line_count': '', 'do': '', 'create': '', 'pseudo': '', 'ensure': '', 'load': ''}, \"vital#_vsnip#function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n")
7+
execute join(['function! vital#_vsnip#VS#Vim#Buffer#import() abort', printf("return map({'add': '', 'do': '', 'create': '', 'get_line_count': '', 'pseudo': '', 'ensure': '', 'load': ''}, \"vital#_vsnip#function('<SNR>%s_' . v:key)\")", s:_SID()), 'endfunction'], "\n")
88
delfunction s:_SID
99
" ___vital___
1010
let s:Do = { -> {} }
@@ -51,11 +51,25 @@ function! s:ensure(expr) abort
5151
if type(a:expr) == type(0)
5252
throw printf('VS.Vim.Buffer: `%s` is not valid expr.', a:expr)
5353
endif
54-
badd `=a:expr`
54+
call s:add(a:expr)
5555
endif
5656
return bufnr(a:expr)
5757
endfunction
5858

59+
"
60+
" add
61+
"
62+
if exists('*bufadd')
63+
function! s:add(name) abort
64+
let l:bufnr = bufadd(a:name)
65+
call setbufvar(l:bufnr, '&buflisted', 1)
66+
endfunction
67+
else
68+
function! s:add(name) abort
69+
badd `=a:name`
70+
endfunction
71+
endif
72+
5973
"
6074
" load
6175
"

autoload/vital/vsnip.vim

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,8 @@ function! s:_format_throwpoint(throwpoint) abort
190190
return join(funcs, "\n")
191191
endfunction
192192

193+
" @vimlint(EVL102, 1, l:_)
194+
" @vimlint(EVL102, 1, l:__)
193195
function! s:_get_func_info(name) abort
194196
let name = a:name
195197
if a:name =~# '^\d\+$' " is anonymous-function
@@ -213,8 +215,10 @@ function! s:_get_func_info(name) abort
213215
\ 'attrs': filter(['dict', 'abort', 'range', 'closure'], 'signature =~# (").*" . v:val)'),
214216
\ }
215217
endfunction
218+
" @vimlint(EVL102, 0, l:__)
219+
" @vimlint(EVL102, 0, l:_)
216220

217-
" s:_get_module() returns module object wihch has all script local functions.
221+
" s:_get_module() returns module object which has all script local functions.
218222
function! s:_get_module(name) abort dict
219223
let funcname = s:_import_func_name(self.plugin_name(), a:name)
220224
try

autoload/vital/vsnip.vital

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
vsnip
2-
2755f0c8fbd3442bcb7f567832e4d1455b57f9a2
2+
f28b0d147b702686817da56eef47e0736f425233
33

44
VS.LSP.TextEdit
55
VS.LSP.Diff

ftplugin/snippets.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323

2424
" Vim filetype plugin for SnipMate snippets (.snippets and .snippet files)
2525

26-
if exists("b:did_ftplugin")
26+
if exists('b:did_ftplugin')
2727
finish
2828
endif
2929
let b:did_ftplugin = 1
3030

31-
let b:undo_ftplugin = "setl et< sts< cms< fdm< fde<"
31+
let b:undo_ftplugin = 'setl et< sts< cms< fdm< fde<'
3232

3333
" Use hard tabs
3434
setlocal noexpandtab softtabstop=0

indent/snippets.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ setlocal nosmartindent
3232
setlocal indentkeys=!^F,o,O,=snippet,=extends
3333
setlocal indentexpr=GetSnippetIndent()
3434

35-
if exists("*GetSnippetIndent")
35+
if exists('*GetSnippetIndent')
3636
finish
3737
endif
3838

3939
function! GetSnippetIndent()
4040
let line = getline(v:lnum)
4141
let prev_lnum = v:lnum - 1
42-
let prev_line = prev_lnum != 0 ? getline(prev_lnum) : ""
42+
let prev_line = prev_lnum != 0 ? getline(prev_lnum) : ''
4343

4444
if line =~# '\v^(snippet|extends) '
4545
return 0

0 commit comments

Comments
 (0)