Skip to content

Commit 5ae1399

Browse files
authored
Merge branch 'lervag:master' into parse-docclass-and-pkg-options
2 parents 36c83ff + 22d9ae5 commit 5ae1399

File tree

5 files changed

+93
-2
lines changed

5 files changed

+93
-2
lines changed

autoload/vimtex/env.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ function! vimtex#env#change(open, close, new) abort
142142
endif
143143

144144
let l:coming_from_inline = a:open.match ==# '$'
145-
\ || (
145+
\ || (a:open.match ==# '\(' && !(
146146
\ trim(getline(a:open.lnum)) ==# '\('
147147
\ && trim(getline(a:close.lnum)) ==# '\)'
148-
\ )
148+
\ ))
149149

150150
return l:coming_from_inline
151151
\ ? vimtex#env#change_to_indented(a:open, a:close, l:new)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
" VimTeX - LaTeX plugin for Vim
2+
"
3+
" Maintainer: Karl Yngve Lervåg
4+
" Email: karl.yngve@gmail.com
5+
"
6+
7+
function! vimtex#syntax#p#zref_clever#load(cfg) abort " {{{1
8+
syntax match texCmdZRef "\v\\zc?ref>"
9+
\ skipwhite skipnl
10+
\ nextgroup=texZRefArg
11+
12+
syntax match texCmdZRef "\\zlabel\>"
13+
\ skipwhite skipnl
14+
\ nextgroup=texZRefOpt,texRefArg
15+
16+
call vimtex#syntax#core#new_arg('texZRefArg', {
17+
\ 'contains': 'texComment,@NoSpell',
18+
\})
19+
call vimtex#syntax#core#new_opt('texZRefOpt', {
20+
\ 'next': 'texRefArg',
21+
\ 'opts': 'oneline',
22+
\})
23+
24+
highlight def link texZRefArg texRefArg
25+
highlight def link texZRefOpt texRefOpt
26+
highlight def link texCmdZRef texCmdRef
27+
endfunction
28+
29+
" }}}1
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
\documentclass{minimal}
2+
\usepackage{tkz-euclide}
3+
4+
\begin{document}
5+
\begin{tikzpicture}[scale=.5]
6+
% fixed points
7+
\tkzDefPoint(0,0){A}
8+
\tkzDefPoint(5,2){B}
9+
% calculus
10+
\tkzInterCC(A,B)(B,A)
11+
\tkzGetPoints{C}{D}
12+
% drawings
13+
\tkzDrawCircles(A,B B,A)
14+
\tkzDrawPolygon(A,B,C)
15+
\tkzDrawPoints(A,...,D)
16+
% marking
17+
\tkzMarkSegments[mark=s||](A,B B,C C,A)
18+
% labelling
19+
\tkzLabelSegments[swap](A,B){$c$}
20+
\tkzLabelPoints(A,B,D)
21+
\tkzLabelPoints[above](C)
22+
\end{tikzpicture}
23+
\end{document}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
set nocompatible
2+
set runtimepath^=~/.local/plugged/vimtex
3+
set runtimepath+=~/.local/plugged/vimtex/after
4+
filetype plugin indent on
5+
syntax enable
6+
7+
nnoremap q :qall!<cr>
8+
9+
let g:vimtex_view_method = "zathura"
10+
let g:vimtex_cache_persistent = v:false
11+
12+
silent edit test-tkz-euclide.tex
13+
14+
if empty($INMAKE) | finish | endif
15+
16+
let s:candidates = vimtex#test#completion('\', 'tkz')
17+
call assert_true(len(s:candidates) > 0)
18+
call assert_equal(s:candidates[0].word, 'tkzAutoLabelPoints')
19+
20+
call vimtex#test#finished()

test/test-syntax/test-zref.tex

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
\documentclass{scrartcl}
2+
\usepackage{amsmath}
3+
\usepackage{hyperref}
4+
\usepackage{zref-user}
5+
\usepackage{zref-clever}
6+
7+
\begin{document}
8+
9+
\section{sub3 with spaces}\zlabel{sec:sub3 with spaces}
10+
11+
\begin{equation}
12+
f(x) = 42
13+
\label{eq:sub3 with spaces}
14+
\end{equation}
15+
16+
This is \zcref{sec:sub3 with spaces}, and \zcref{eq:sub3 with spaces} is up top.
17+
The same here, but without anything clever done to it: \zref{eq:sub3 with spaces}.
18+
19+
\end{document}

0 commit comments

Comments
 (0)