Added filename completer for standalone files

* Added filename completer for standalone files

* added the tikz file
This commit is contained in:
mbrunnen 2016-04-05 18:10:46 +02:00 committed by Karl Yngve Lervåg
parent 7b5e6858a7
commit e647ebe16a
3 changed files with 33 additions and 1 deletions

View File

@ -17,7 +17,7 @@ endfunction
function! vimtex#complete#init_script() " {{{1 function! vimtex#complete#init_script() " {{{1
if !g:vimtex_complete_enabled | return | endif if !g:vimtex_complete_enabled | return | endif
let s:completers = [s:bib, s:ref, s:img, s:inc, s:pdf, s:gls] let s:completers = [s:bib, s:ref, s:img, s:inc, s:pdf, s:sta, s:gls]
endfunction endfunction
" }}}1 " }}}1
@ -414,6 +414,27 @@ function! s:pdf.complete(regex) dict " {{{2
return self.candidates return self.candidates
endfunction endfunction
" }}}1
" {{{1 Filenames (\includestandalone)
let s:sta = {
\ 'patterns' : ['\v\\includestandalone%(\s*\[[^]]*\])?\s*\{[^}]*$'],
\ 'enabled' : 1,
\}
function! s:sta.complete(regex) dict " {{{2
let self.candidates = substitute(globpath(b:vimtex.root, '**/*.tex'), '\.tex', '', 'g')
let self.candidates = split(self.candidates, '\n')
let self.candidates = map(self.candidates,
\ 'strpart(v:val, len(b:vimtex.root)+1)')
let self.candidates = map(self.candidates, '{
\ ''word'' : v:val,
\ ''abbr'' : v:val,
\ ''menu'' : '' [includestandalone]'',
\}')
return self.candidates
endfunction
" }}}1 " }}}1
" {{{1 Glossary " {{{1 Glossary

View File

@ -3,6 +3,7 @@
\usepackage{cleveref} \usepackage{cleveref}
\usepackage{graphicx} \usepackage{graphicx}
\usepackage{pdfpages} \usepackage{pdfpages}
\usepackage{standalone}
\usepackage[backend=biber,style=authoryear]{biblatex} \usepackage[backend=biber,style=authoryear]{biblatex}
\addbibresource{biblatex-examples.bib} \addbibresource{biblatex-examples.bib}

View File

@ -0,0 +1,10 @@
\documentclass{standalone}
\usepackage{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw ((0, 0) node[below left]{\large Reliability} --
(0: 4) node[below right]{\large Acquisition costs} --
(60: 4) node[above]{\large Energy consumption} -- cycle;
\end{tikzpicture}
\end{document}