Skip to content

Commit

Permalink
Fix for Next.js file pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
hrsh7th committed Nov 12, 2023
1 parent be27746 commit 8eebdf6
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 10 deletions.
4 changes: 2 additions & 2 deletions autoload/vital/_vsnip/VS/LSP/TextEdit.vim
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ endfunction
"
function! s:_switch(path) abort
let l:curr = bufnr('%')
let l:next = bufnr(a:path)
let l:next = filereadable(a:path) ? bufnr(fnameescape(a:path)) : bufnr(a:path)
if l:next >= 0
if l:curr != l:next
execute printf('noautocmd keepalt keepjumps %sbuffer!', bufnr(a:path))
execute printf('noautocmd keepalt keepjumps %sbuffer!', l:next)
endif
else
execute printf('noautocmd keepalt keepjumps edit! %s', fnameescape(a:path))
Expand Down
18 changes: 16 additions & 2 deletions autoload/vital/_vsnip/VS/Vim/Buffer.vim
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
function! s:_SID() abort
return matchstr(expand('<sfile>'), '<SNR>\zs\d\+\ze__SID$')
endfunction
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")
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")
delfunction s:_SID
" ___vital___
let s:Do = { -> {} }
Expand Down Expand Up @@ -51,11 +51,25 @@ function! s:ensure(expr) abort
if type(a:expr) == type(0)
throw printf('VS.Vim.Buffer: `%s` is not valid expr.', a:expr)
endif
badd `=a:expr`
call s:add(a:expr)
endif
return bufnr(a:expr)
endfunction

"
" add
"
if exists('*bufadd')
function! s:add(name) abort
let l:bufnr = bufadd(a:name)
call setbufvar(l:bufnr, '&buflisted', 1)
endfunction
else
function! s:add(name) abort
badd `=a:name`
endfunction
endif

"
" load
"
Expand Down
6 changes: 5 additions & 1 deletion autoload/vital/vsnip.vim
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ function! s:_format_throwpoint(throwpoint) abort
return join(funcs, "\n")
endfunction

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

" s:_get_module() returns module object wihch has all script local functions.
" s:_get_module() returns module object which has all script local functions.
function! s:_get_module(name) abort dict
let funcname = s:_import_func_name(self.plugin_name(), a:name)
try
Expand Down
2 changes: 1 addition & 1 deletion autoload/vital/vsnip.vital
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vsnip
2755f0c8fbd3442bcb7f567832e4d1455b57f9a2
f28b0d147b702686817da56eef47e0736f425233

VS.LSP.TextEdit
VS.LSP.Diff
Expand Down
4 changes: 2 additions & 2 deletions ftplugin/snippets.vim
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@

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

if exists("b:did_ftplugin")
if exists('b:did_ftplugin')
finish
endif
let b:did_ftplugin = 1

let b:undo_ftplugin = "setl et< sts< cms< fdm< fde<"
let b:undo_ftplugin = 'setl et< sts< cms< fdm< fde<'

" Use hard tabs
setlocal noexpandtab softtabstop=0
Expand Down
4 changes: 2 additions & 2 deletions indent/snippets.vim
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ setlocal nosmartindent
setlocal indentkeys=!^F,o,O,=snippet,=extends
setlocal indentexpr=GetSnippetIndent()

if exists("*GetSnippetIndent")
if exists('*GetSnippetIndent')
finish
endif

function! GetSnippetIndent()
let line = getline(v:lnum)
let prev_lnum = v:lnum - 1
let prev_line = prev_lnum != 0 ? getline(prev_lnum) : ""
let prev_line = prev_lnum != 0 ? getline(prev_lnum) : ''

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

0 comments on commit 8eebdf6

Please sign in to comment.