Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 64 additions & 1 deletion autoload/vimtex/complete.vim
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function! vimtex#complete#omnifunc(findstart, base) " {{{1
if l:line =~# l:pattern
let s:completer = l:completer
while l:pos > 0
if l:line[l:pos - 1] =~# '{\|,\|\['
if l:line[l:pos - 1] =~# '{\|,\|\[\|\\'
\ || l:line[l:pos-2:l:pos-1] ==# ', '
let s:completer.context = matchstr(l:line, '\S*$')
return l:pos
Expand Down Expand Up @@ -354,6 +354,69 @@ function! s:completer_ref.parse_number(num_tree) dict " {{{2
endif
endfunction

" }}}1
" {{{1 Commands

let s:completer_cmd = {
\ 'patterns' : [
\ '\v\\\a*$',
\ ],
\ 'candidates' : [],
\ 'complete_dir' : fnamemodify(expand('<sfile>'), ':r') . '/',
\}

function! s:completer_cmd.complete(regex) dict " {{{2
call self.gather_candidates()

let l:candidates = deepcopy(self.candidates)
let l:mode = vimtex#util#in_mathzone() ? 'm' : 'n'

call filter(l:candidates, 'v:val.word =~# ''^'' . a:regex')
call filter(l:candidates, 'l:mode =~# v:val.mode')

return l:candidates
endfunction

function! s:completer_cmd.gather_candidates() dict " {{{2
if !empty(self.candidates) | return | endif

let l:save_pwd = getcwd()
execute 'lcd' fnameescape(self.complete_dir)

let l:packages = [
\ 'default',
\ 'class-' . get(b:vimtex, 'documentclass', ''),
\] + keys(b:vimtex.packages)
call filter(l:packages, 'filereadable(v:val)')

let l:queue = copy(l:packages)
while !empty(l:queue)
let l:current = remove(l:queue, 0)
let l:includes = filter(readfile(l:current), 'v:val =~# ''^\#\s*include:''')
if empty(l:includes) | continue | endif

call map(l:includes, 'matchstr(v:val, ''include:\s*\zs.*\ze\s*$'')')
call filter(l:includes, 'filereadable(v:val)')
call filter(l:includes, 'index(l:packages, v:val) < 0')

let l:packages += l:includes
let l:queue += l:includes
endwhile

for l:package in l:packages
let l:candidates = filter(readfile(l:package), 'v:val =~# ''^\a''')
call map(l:candidates, 'split(v:val)')
call map(l:candidates, '{
\ ''word'' : v:val[0],
\ ''mode'' : ''.'',
\ ''menu'' : ''[cmd: '' . l:package . ''] '' . (get(v:val, 1, '''')),
\}')
let self.candidates += l:candidates
endfor

execute 'lcd' fnameescape(l:save_pwd)
endfunction

" }}}1
" {{{1 Filenames (\includegraphics)

Expand Down
8 changes: 8 additions & 0 deletions autoload/vimtex/complete/abntcite
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
bibtextitlecommand
citeauthor
citeauthoronline
citeonline
citeoptions
citeyear
leftovercite
rightovercite
33 changes: 33 additions & 0 deletions autoload/vimtex/complete/acro
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
aca*
acap
acap*
Acf*
acf*
acfirstupper
acflike
acflike*
acfp
Acfp
acfp*
Acfp*
acfplike
acfplike*
acifused
Acl*
acl*
aclp
Aclp
Aclp*
aclp*
Acp*
acp*
acreset
acresetall
acs*
acsetup
acsp
acsp*
acuse
acuseall
DeclareAcronym
printacronyms
28 changes: 28 additions & 0 deletions autoload/vimtex/complete/acronym
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
acf*
acffont
acfi
acfi*
acfp
acfp*
acfsfont
acl*
aclp
aclp*
aclu
aclu*
acp*
acresetall
acro
acrodef
acrodefplural
acroextra
acroplural
acs*
acsfont
acsp
acsp*
acsu
acsu*
acused
newacro
newacroplural
1 change: 1 addition & 0 deletions autoload/vimtex/complete/afterpage
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
afterpage
198 changes: 198 additions & 0 deletions autoload/vimtex/complete/algorithm2e
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
#include:color
#include:endfloat
#include:ifthen
#include:relsize
#include:tocbibind
#include:xspace
AlCapFnt
AlCapNameFnt
AlCapNameSty
AlCapSty
AlFnt
algocfautorefname
algocffuncautorefname
algocfprocautorefname
algoendfloat
algoheightrule
algoheightruledefault
AlgoLineautorefname
algoplace
algorithmautorefname
algorithmcflinename
algorithmcfname
algotitleheightrule
algotitleheightruledefault
AlTitleFnt
AlTitleSty
ArgSty
Begin
BlankLine
Case
CommentSty
DataSty
decmargin
DecMargin
dontprintsemicolon
DontPrintSemicolon
Else
ElseIf
ForAll
ForEach
FuncSty
functionautorefname
Hlne
incmargin
IncMargin
Indentp
Indm
Indmm
Indp
Indpp
InOutSizeDefined
KwData
KwIn
KwOut
KwResult
KwRet
KwSty
KwTo
lCase
leIf
lElse
lElseIf
lElseif
lFor
lForAll
lForEach
linesnotnumbered
LinesNotNumbered
linesnumbered
LinesNumbered
linesnumberedhidden
LinesNumberedHidden
listalgorithmcfname
listofalgocfs
lnlset
lOther
lRepeat
lWhile
next
nllabel
nlset
nlSty
NlSty
NoCaptionOfAlgo
nocaptionofalgo
Other
PrintSemicolon
printsemicolon
ProcArgFnt
ProcArgSty
procedureautorefname
ProcFnt
ProcNameFnt
ProcNameSty
ProcSty
relsize
Repeat
ResetInOut
restorecaptionofalgo
RestoreCaptionOfAlgo
restylealgo
RestyleAlgo
Return
SetAlCapFnt
setalcaphskip
SetAlCapHSkip
SetAlCapNameFnt
SetAlCapNameSty
setalcapskip
SetAlCapSkip
SetAlCapSty
SetAlFnt
SetAlgoCaptionLayout
SetAlgoCaptionSeparator
SetAlgoFuncName
SetAlgoInsideSkip
SetAlgoLined
SetAlgoLongEnd
SetAlgoNlRelativeSize
SetAlgoNoEnd
SetAlgoNoLine
SetAlgoProcName
SetAlgoRefName
SetAlgoRefRelativeSize
SetAlgorithmName
SetAlgoShortEnd
SetAlgoSkip
SetAlgoVlined
SetAlTitleFnt
SetAlTitleSty
SetArgSty
SetCommentSty
SetDataSty
SetEndCharOfAlgoLine
SetFillComment
SetFuncSty
SetInd
SetKw
SetKwArray
SetKwBlock
SetKwComment
SetKwData
SetKwFor
SetKwFunction
SetKwHangingKw
SetKwIF
SetKwInOut
SetKwInput
SetKwRepeat
SetKwSty
SetKwSwitch
setLeftLinesNumbers
SetLine
setnlskip
SetNlSkip
Setnlskip
SetNlSty
Setnlsty
SetNoFillComment
SetNoLine
SetNothing
SetProcArgFnt
SetProcArgSty
SetProcFnt
SetProcNameFnt
SetProcNameSty
SetProcSty
setRightLinesNumbers
SetSideCommentLeft
SetSideCommentRight
SetTitleSty
SetVline
SetVlineSkip
showln
ShowLn
showlnlabel
ShowLnLabel
Switch
tcc*
tcp*
test
thealgocf
thealgocfline
thealgocfproc
theAlgoLine
theHalgocf
theHalgocffunc
theHalgocfproc
theHAlgoLine
thepostalgo
Titleofalgo
TitleOfAlgo
TitleSty
uCase
uElse
uElseIf
vespace
While
31 changes: 31 additions & 0 deletions autoload/vimtex/complete/allrunes
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
arafamily
arcfamily
arlfamily
armfamily
arnfamily
artfamily
curvedtwigs
hflip
hightwigs
lfseries
lowtwigs
roundedtwigs
straighttwigs
textara
textarc
textarl
textarm
textarn
textart
textcu
texthi
textlf
textlo
textro
textst
textwil
textwol
turn
vflip
withlines
withoutlines
1 change: 1 addition & 0 deletions autoload/vimtex/complete/amsbsy
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
boldsymbol
Loading