Void Linux workstation powered by niri, Fish and NeoVim. Contains scripts, browser extensions, custom XBPS packages, and typst plugins. git.anhgelus.world/anhgelus/dotfiles
void niri fish neovim nvim vim dotfiles linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(nvim): better support of latex

+687 -4
+673
config/nvim/UltiSnips/tex.snippets
··· 1 + global !p 2 + texMathZones = ['texMathZone'+x for x in ['A', 'AS', 'B', 'BS', 'C', 'CS', 'D', 'DS', 'E', 'ES', 'F', 'FS', 'G', 'GS', 'H', 'HS', 'I', 'IS', 'J', 'JS', 'K', 'KS', 'L', 'LS', 'DS', 'V', 'W', 'X', 'Y', 'Z']] 3 + 4 + texIgnoreMathZones = ['texMathText'] 5 + 6 + texMathZoneIds = vim.eval('map('+str(texMathZones)+", 'hlID(v:val)')") 7 + texIgnoreMathZoneIds = vim.eval('map('+str(texIgnoreMathZones)+", 'hlID(v:val)')") 8 + 9 + ignore = texIgnoreMathZoneIds[0] 10 + 11 + def math(): 12 + synstackids = vim.eval("synstack(line('.'), col('.') - (col('.')>=2 ? 1 : 0))") 13 + try: 14 + first = next(i for i in reversed(synstackids) if i in texIgnoreMathZoneIds or i in texMathZoneIds) 15 + return first != ignore 16 + except StopIteration: 17 + return False 18 + endglobal 19 + 20 + snippet template "Basic template" b 21 + \documentclass[a4paper]{article} 22 + 23 + \usepackage[utf8]{inputenc} 24 + \usepackage[T1]{fontenc} 25 + \usepackage{textcomp} 26 + \usepackage[dutch]{babel} 27 + \usepackage{amsmath, amssymb} 28 + 29 + 30 + % figure support 31 + \usepackage{import} 32 + \usepackage{xifthen} 33 + \pdfminorversion=7 34 + \usepackage{pdfpages} 35 + \usepackage{transparent} 36 + \newcommand{\incfig}[1]{% 37 + \def\svgwidth{\columnwidth} 38 + \import{./figures/}{#1.pdf_tex} 39 + } 40 + 41 + \pdfsuppresswarningpagegroup=1 42 + 43 + \begin{document} 44 + $0 45 + \end{document} 46 + endsnippet 47 + 48 + snippet beg "begin{} / end{}" bA 49 + \\begin{$1} 50 + $0 51 + \\end{$1} 52 + endsnippet 53 + 54 + priority 100 55 + snippet ... "ldots" iA 56 + \ldots 57 + endsnippet 58 + 59 + snippet table "Table environment" b 60 + \begin{table}[${1:htpb}] 61 + \centering 62 + \caption{${2:caption}} 63 + \label{tab:${3:label}} 64 + \begin{tabular}{${5:c}} 65 + $0${5/((?<=.)c|l|r)|./(?1: & )/g} 66 + \end{tabular} 67 + \end{table} 68 + endsnippet 69 + 70 + snippet fig "Figure environment" b 71 + \begin{figure}[${1:htpb}] 72 + \centering 73 + ${2:\includegraphics[width=0.8\textwidth]{$3}} 74 + \caption{${4:$3}} 75 + \label{fig:${5:${3/\W+/-/g}}} 76 + \end{figure} 77 + endsnippet 78 + 79 + snippet enum "Enumerate" bA 80 + \begin{enumerate} 81 + \item $0 82 + \end{enumerate} 83 + endsnippet 84 + 85 + snippet item "Itemize" bA 86 + \begin{itemize} 87 + \item $0 88 + \end{itemize} 89 + endsnippet 90 + 91 + snippet desc "Description" b 92 + \begin{description} 93 + \item[$1] $0 94 + \end{description} 95 + endsnippet 96 + 97 + snippet pac "Package" b 98 + \usepackage[${1:options}]{${2:package}}$0 99 + endsnippet 100 + 101 + snippet => "implies" Ai 102 + \implies 103 + endsnippet 104 + 105 + snippet <=> "equivalent" Ai 106 + \iff 107 + endsnippet 108 + 109 + snippet =< "implied by" Ai 110 + \impliedby 111 + endsnippet 112 + 113 + context "math()" 114 + snippet iff "iff" Ai 115 + \iff 116 + endsnippet 117 + 118 + snippet mk "Math" wA 119 + $${1}$`!p 120 + if t[2] and t[2][0] not in [',', '.', '?', '-', ' ']: 121 + snip.rv = ' ' 122 + else: 123 + snip.rv = '' 124 + `$2 125 + endsnippet 126 + 127 + snippet dm "Math" wA 128 + \[ 129 + ${1:${VISUAL}} 130 + \] $0 131 + endsnippet 132 + 133 + snippet ali "Align" bA 134 + \begin{align*} 135 + ${1:${VISUAL}} 136 + .\end{align*} 137 + endsnippet 138 + 139 + 140 + context "math()" 141 + snippet // "Fraction" iA 142 + \\frac{$1}{$2}$0 143 + endsnippet 144 + 145 + snippet / "Fraction" i 146 + \\frac{${VISUAL}}{$1}$0 147 + endsnippet 148 + 149 + context "math()" 150 + snippet '((\d+)|(\d*)(\\)?([A-Za-z]+)((\^|_)(\{\d+\}|\d))*)/' "symbol frac" wrA 151 + \\frac{`!p snip.rv = match.group(1)`}{$1}$0 152 + endsnippet 153 + 154 + priority 1000 155 + context "math()" 156 + snippet '^.*\)/' "() frac" wrA 157 + `!p 158 + stripped = match.string[:-1] 159 + depth = 0 160 + i = len(stripped) - 1 161 + while True: 162 + if stripped[i] == ')': depth += 1 163 + if stripped[i] == '(': depth -= 1 164 + if depth == 0: break; 165 + i-=1 166 + snip.rv = stripped[0:i] + "\\frac{" + stripped[i+1:-1] + "}" 167 + `{$1}$0 168 + endsnippet 169 + 170 + context "math()" 171 + snippet '([A-Za-z])(\d)' "auto subscript" wrA 172 + `!p snip.rv = match.group(1)`_`!p snip.rv = match.group(2)` 173 + endsnippet 174 + 175 + context "math()" 176 + snippet '([A-Za-z])_(\d|[a-z]|\\)' "auto subscript2" wrA 177 + `!p snip.rv = match.group(1)`_{`!p snip.rv = match.group(2)`$0} 178 + endsnippet 179 + 180 + 181 + snippet sympy "sympyblock " w 182 + sympy $1 sympy$0 183 + endsnippet 184 + 185 + priority 10000 186 + snippet 'sympy(.*)sympy' "sympy" wr 187 + `!p 188 + from sympy import * 189 + x, y, z, t = symbols('x y z t') 190 + k, m, n = symbols('k m n', integer=True) 191 + f, g, h = symbols('f g h', cls=Function) 192 + init_printing() 193 + snip.rv = eval('latex(' + match.group(1).replace('\\', '').replace('^', '**').replace('{', '(').replace('}', ')') + ')') 194 + ` 195 + endsnippet 196 + 197 + priority 1000 198 + snippet math "mathematicablock" w 199 + math $1 math$0 200 + endsnippet 201 + 202 + priority 10000 203 + snippet 'math(.*)math' "math" wr 204 + `!p 205 + import subprocess 206 + code = match.group(1) 207 + code = 'ToString[' + code + ', TeXForm]' 208 + snip.rv = subprocess.check_output(['wolframscript', '-code', code]) 209 + ` 210 + endsnippet 211 + 212 + snippet == "equals" iA 213 + &= $1 \\\\ 214 + endsnippet 215 + 216 + snippet != "equals" iA 217 + \neq 218 + endsnippet 219 + 220 + context "math()" 221 + snippet ceil "ceil" iA 222 + \left\lceil $1 \right\rceil $0 223 + endsnippet 224 + 225 + context "math()" 226 + snippet floor "floor" iA 227 + \left\lfloor $1 \right\rfloor$0 228 + endsnippet 229 + 230 + snippet pmat "pmat" iA 231 + \begin{pmatrix} $1 \end{pmatrix} $0 232 + endsnippet 233 + 234 + snippet bmat "bmat" iA 235 + \begin{bmatrix} $1 \end{bmatrix} $0 236 + endsnippet 237 + 238 + snippet ( "parens ()" iA 239 + ($0) 240 + endsnippet 241 + 242 + snippet lr "left( right)" i 243 + \left( ${1:${VISUAL}} \right) $0 244 + endsnippet 245 + 246 + snippet lr( "left( right)" i 247 + \left( ${1:${VISUAL}} \right) $0 248 + endsnippet 249 + 250 + snippet lr| "left| right|" i 251 + \left| ${1:${VISUAL}} \right| $0 252 + endsnippet 253 + 254 + snippet lr{ "left\{ right\}" i 255 + \left\\{ ${1:${VISUAL}} \right\\} $0 256 + endsnippet 257 + 258 + snippet lrb "left\{ right\}" i 259 + \left\\{ ${1:${VISUAL}} \right\\} $0 260 + endsnippet 261 + 262 + snippet lr[ "left[ right]" i 263 + \left[ ${1:${VISUAL}} \right] $0 264 + endsnippet 265 + 266 + snippet lra "leftangle rightangle" iA 267 + \left<${1:${VISUAL}} \right>$0 268 + endsnippet 269 + 270 + context "math()" 271 + snippet conj "conjugate" iA 272 + \overline{$1}$0 273 + endsnippet 274 + 275 + snippet sum "sum" w 276 + \sum_{${1:i=1}}^{${2:\infty}} ${3:a_n z^n} 277 + endsnippet 278 + 279 + snippet taylor "taylor" w 280 + \sum_{${1:k}=${2:0}}^{${3:\infty}} ${4:c_$1} (x-a)^$1 $0 281 + endsnippet 282 + 283 + snippet lim "limit" w 284 + \lim_{${1:n} \to ${2:\infty}} 285 + endsnippet 286 + 287 + snippet limsup "limsup" w 288 + \limsup_{${1:n} \to ${2:\infty}} 289 + endsnippet 290 + 291 + snippet prod "product" w 292 + \prod_{${1:n=${2:1}}}^{${3:\infty}} ${4:${VISUAL}} $0 293 + endsnippet 294 + 295 + snippet part "d/dx" w 296 + \frac{\partial ${1:V}}{\partial ${2:x}} $0 297 + endsnippet 298 + 299 + context "math()" 300 + snippet sq "\sqrt{}" iA 301 + \sqrt{${1:${VISUAL}}} $0 302 + endsnippet 303 + 304 + context "math()" 305 + snippet sr "^2" iA 306 + ^2 307 + endsnippet 308 + 309 + context "math()" 310 + snippet cb "^3" iA 311 + ^3 312 + endsnippet 313 + 314 + context "math()" 315 + snippet td "to the ... power" iA 316 + ^{$1}$0 317 + endsnippet 318 + 319 + context "math()" 320 + snippet rd "to the ... power" iA 321 + ^{($1)}$0 322 + endsnippet 323 + 324 + snippet __ "subscript" iA 325 + _{$1}$0 326 + endsnippet 327 + 328 + snippet ooo "\infty" iA 329 + \infty 330 + endsnippet 331 + 332 + snippet rij "mrij" i 333 + (${1:x}_${2:n})_{${3:$2}\\in${4:\\N}}$0 334 + endsnippet 335 + 336 + snippet <= "leq" iA 337 + \le 338 + endsnippet 339 + 340 + snippet >= "geq" iA 341 + \ge 342 + endsnippet 343 + 344 + context "math()" 345 + snippet EE "geq" iA 346 + \exists 347 + endsnippet 348 + 349 + context "math()" 350 + snippet AA "forall" iA 351 + \forall 352 + endsnippet 353 + 354 + context "math()" 355 + snippet xnn "xn" iA 356 + x_{n} 357 + endsnippet 358 + 359 + context "math()" 360 + snippet ynn "yn" iA 361 + y_{n} 362 + endsnippet 363 + 364 + 365 + context "math()" 366 + snippet xii "xi" iA 367 + x_{i} 368 + endsnippet 369 + 370 + context "math()" 371 + snippet yii "yi" iA 372 + y_{i} 373 + endsnippet 374 + 375 + context "math()" 376 + snippet xjj "xj" iA 377 + x_{j} 378 + endsnippet 379 + 380 + context "math()" 381 + snippet yjj "yj" iA 382 + y_{j} 383 + endsnippet 384 + 385 + context "math()" 386 + snippet xp1 "x" iA 387 + x_{n+1} 388 + endsnippet 389 + 390 + context "math()" 391 + snippet xmm "x" iA 392 + x_{m} 393 + endsnippet 394 + 395 + snippet R0+ "R0+" iA 396 + \\R_0^+ 397 + endsnippet 398 + 399 + snippet plot "Plot" w 400 + \begin{figure}[$1] 401 + \centering 402 + \begin{tikzpicture} 403 + \begin{axis}[ 404 + xmin= ${2:-10}, xmax= ${3:10}, 405 + ymin= ${4:-10}, ymax = ${5:10}, 406 + axis lines = middle, 407 + ] 408 + \addplot[domain=$2:$3, samples=${6:100}]{$7}; 409 + \end{axis} 410 + \end{tikzpicture} 411 + \caption{$8} 412 + \label{${9:$8}} 413 + \end{figure} 414 + endsnippet 415 + 416 + snippet nn "Tikz node" w 417 + \node[$5] (${1/[^0-9a-zA-Z]//g}${2}) ${3:at (${4:0,0}) }{$${1}$}; 418 + $0 419 + endsnippet 420 + 421 + context "math()" 422 + snippet mcal "mathcal" iA 423 + \mathcal{$1}$0 424 + endsnippet 425 + 426 + snippet lll "l" iA 427 + \ell 428 + endsnippet 429 + 430 + context "math()" 431 + snippet nabl "nabla" iA 432 + \nabla 433 + endsnippet 434 + 435 + context "math()" 436 + snippet xx "cross" iA 437 + \times 438 + endsnippet 439 + 440 + priority 100 441 + snippet ** "cdot" iA 442 + \cdot 443 + endsnippet 444 + 445 + context "math()" 446 + snippet norm "norm" iA 447 + \|$1\|$0 448 + endsnippet 449 + 450 + priority 100 451 + context "math()" 452 + snippet '(?<!\\)(sin|cos|arccot|cot|csc|ln|log|exp|star|perp)' "ln" rwA 453 + \\`!p snip.rv = match.group(1)` 454 + endsnippet 455 + 456 + priority 300 457 + context "math()" 458 + snippet dint "integral" wA 459 + \int_{${1:-\infty}}^{${2:\infty}} ${3:${VISUAL}} $0 460 + endsnippet 461 + 462 + priority 200 463 + context "math()" 464 + snippet '(?<!\\)(arcsin|arccos|arctan|arccot|arccsc|arcsec|pi|zeta|int)' "ln" rwA 465 + \\`!p snip.rv = match.group(1)` 466 + endsnippet 467 + 468 + 469 + priority 100 470 + context "math()" 471 + snippet -> "to" iA 472 + \to 473 + endsnippet 474 + 475 + priority 200 476 + context "math()" 477 + snippet <-> "leftrightarrow" iA 478 + \leftrightarrow 479 + endsnippet 480 + 481 + context "math()" 482 + snippet !> "mapsto" iA 483 + \mapsto 484 + endsnippet 485 + 486 + context "math()" 487 + snippet invs "inverse" iA 488 + ^{-1} 489 + endsnippet 490 + 491 + context "math()" 492 + snippet compl "complement" iA 493 + ^{c} 494 + endsnippet 495 + 496 + context "math()" 497 + snippet \\\ "setminus" iA 498 + \setminus 499 + endsnippet 500 + 501 + snippet >> ">>" iA 502 + \gg 503 + endsnippet 504 + 505 + snippet << "<<" iA 506 + \ll 507 + endsnippet 508 + 509 + 510 + snippet ~~ "~" iA 511 + \sim 512 + endsnippet 513 + 514 + context "math()" 515 + snippet set "set" wA 516 + \\{$1\\} $0 517 + endsnippet 518 + 519 + snippet || "mid" iA 520 + \mid 521 + endsnippet 522 + 523 + 524 + context "math()" 525 + snippet cc "subset" Ai 526 + \subset 527 + endsnippet 528 + 529 + snippet notin "not in " iA 530 + \not\in 531 + endsnippet 532 + 533 + context "math()" 534 + snippet inn "in " iA 535 + \in 536 + endsnippet 537 + 538 + snippet NN "n" iA 539 + \N 540 + endsnippet 541 + 542 + snippet Nn "cap" iA 543 + \cap 544 + endsnippet 545 + 546 + snippet UU "cup" iA 547 + \cup 548 + endsnippet 549 + 550 + snippet uuu "bigcup" iA 551 + \bigcup_{${1:i \in ${2: I}}} $0 552 + endsnippet 553 + 554 + snippet nnn "bigcap" iA 555 + \bigcap_{${1:i \in ${2: I}}} $0 556 + endsnippet 557 + 558 + snippet OO "emptyset" iA 559 + \O 560 + endsnippet 561 + 562 + snippet RR "real" iA 563 + \R 564 + endsnippet 565 + 566 + snippet QQ "Q" iA 567 + \Q 568 + endsnippet 569 + 570 + snippet ZZ "Z" iA 571 + \Z 572 + endsnippet 573 + 574 + snippet <! "normal" iA 575 + \triangleleft 576 + endsnippet 577 + 578 + snippet <> "hokje" iA 579 + \diamond 580 + endsnippet 581 + 582 + 583 + context "math()" 584 + snippet '(?<!i)sts' "text subscript" irA 585 + _\text{$1} $0 586 + endsnippet 587 + 588 + context "math()" 589 + snippet tt "text" iA 590 + \text{$1}$0 591 + endsnippet 592 + 593 + context "math()" 594 + snippet case "cases" wA 595 + \begin{cases} 596 + $1 597 + \end{cases} 598 + endsnippet 599 + 600 + snippet SI "SI" iA 601 + \SI{$1}{$2} 602 + endsnippet 603 + 604 + snippet bigfun "Big function" iA 605 + \begin{align*} 606 + $1: $2 &\longrightarrow $3 \\\\ 607 + $4 &\longmapsto $1($4) = $0 608 + .\end{align*} 609 + endsnippet 610 + 611 + snippet cvec "column vector" iA 612 + \begin{pmatrix} ${1:x}_${2:1}\\\\ \vdots\\\\ $1_${2:n} \end{pmatrix} 613 + endsnippet 614 + 615 + priority 10 616 + context "math()" 617 + snippet "bar" "bar" riA 618 + \overline{$1}$0 619 + endsnippet 620 + 621 + priority 100 622 + context "math()" 623 + snippet "([a-zA-Z])bar" "bar" riA 624 + \overline{`!p snip.rv=match.group(1)`} 625 + endsnippet 626 + 627 + priority 10 628 + context "math()" 629 + snippet "hat" "hat" riA 630 + \hat{$1}$0 631 + endsnippet 632 + 633 + priority 100 634 + context "math()" 635 + snippet "([a-zA-Z])hat" "hat" riA 636 + \hat{`!p snip.rv=match.group(1)`} 637 + endsnippet 638 + 639 + context "math()" 640 + snippet "dot" "dot" riA 641 + \dot{$1}$0 642 + endsnippet 643 + 644 + context "math()" 645 + snippet "arw" "arw" riA 646 + \overrightarrow{$1}$0 647 + endsnippet 648 + 649 + snippet letw "let omega" iA 650 + Let $\Omega \subset \C$ be open. 651 + endsnippet 652 + 653 + 654 + snippet HH "H" iA 655 + \mathbb{H} 656 + endsnippet 657 + 658 + snippet DD "D" iA 659 + \mathbb{D} 660 + endsnippet 661 + 662 + snippet box "Box" 663 + `!p snip.rv = '┌' + '─' * (len(t[1]) + 2) + '┐'` 664 + │ $1 │ 665 + `!p snip.rv = '└' + '─' * (len(t[1]) + 2) + '┘'` 666 + $0 667 + endsnippet 668 + 669 + snippet today "Date" 670 + `date +%F` 671 + endsnippet 672 + 673 + # vim:ft=snippets
+14 -4
config/nvim/init.vim
··· 29 29 " Plugin 'https://github.com/terryma/vim-multiple-cursors' " CTRL + N for multiple cursors 30 30 Plugin 'https://github.com/mattn/emmet-vim' " Emmet support 31 31 Plugin 'rubixninja314/vim-mcfunction' " mcfunction 32 + Plugin 'sirver/ultisnips' 33 + let g:UltiSnipsExpandTrigger = '<tab>' 34 + let g:UltiSnipsJumpForwardTrigger = '<tab>' 35 + let g:UltiSnipsJumpBackwardTrigger = '<s-tab>' 36 + Plugin 'lervag/vimtex' 37 + let g:tex_flavor='latex' 38 + let g:vimtex_view_method='zathura' 39 + let g:vimtex_quickfix_mode=0 40 + set conceallevel=1 41 + let g:tex_conceal='abdmg' 32 42 33 43 call vundle#end() " required 34 44 filetype plugin indent on " required 35 45 36 - :colorscheme onedark 46 + :colorscheme purify 37 47 38 48 :set number relativenumber 39 49 :set autoindent ··· 80 90 :command Ttp !pdflatex %:t 81 91 82 92 "" JS/TS/Node 83 - :command NpmInstall !pnpm i 93 + :command NpmInstall !npm install 94 + :command TscWatch !npm run ts-watch 95 + :command NodemonStart !npm run start 84 96 85 97 "" Git 86 98 :command -nargs=1 -bar GitignoreCreate !curl https://www.toptal.com/developers/gitignore/api/<args> | tee -a .gitignore ··· 94 106 95 107 set shell=/bin/bash 96 108 97 - 98 109 " Highlight 99 110 augroup twig_ft 100 111 au! 101 112 autocmd BufNewFile,BufRead *.mcfunction set syntax=mcfunction 102 113 augroup END 103 -