mirror of
https://github.com/foo-dogsquared/dotfiles.git
synced 2025-02-07 06:18:59 +00:00
Update Vim and UltiSnips config
This commit is contained in:
parent
662418a51f
commit
fdb035c6e0
@ -13,6 +13,23 @@ def smart_space(next_str, auto_str=" "):
|
|||||||
snip.rv = auto_str
|
snip.rv = auto_str
|
||||||
else:
|
else:
|
||||||
snip.rv = ""
|
snip.rv = ""
|
||||||
|
|
||||||
|
def add_variable_numbers(*inputs, **kwargs):
|
||||||
|
absolute = kwargs.pop("absolute", False)
|
||||||
|
total = 0
|
||||||
|
|
||||||
|
for t in inputs:
|
||||||
|
try:
|
||||||
|
i = int(t)
|
||||||
|
if absolute is True:
|
||||||
|
total += abs(i)
|
||||||
|
else:
|
||||||
|
total += i
|
||||||
|
except ValueError:
|
||||||
|
continue
|
||||||
|
|
||||||
|
return total
|
||||||
|
|
||||||
endglobal
|
endglobal
|
||||||
|
|
||||||
snippet template "Main template (that should work without relying with style files)" bi
|
snippet template "Main template (that should work without relying with style files)" bi
|
||||||
@ -179,13 +196,17 @@ snippet plot "Quickly plot a graph" bi
|
|||||||
\centering
|
\centering
|
||||||
\begin{tikzpicture}
|
\begin{tikzpicture}
|
||||||
\begin{axis}[
|
\begin{axis}[
|
||||||
xlabel=$x$,
|
xlabel=$x$,
|
||||||
ylabel=$y$,
|
ylabel=$y$,
|
||||||
xmin= ${2:-10}, xmax= ${3:10},
|
xmin= ${2:-10}, xmax= ${3:10},
|
||||||
ymin= ${4:-10}, ymax = ${5:10},
|
ymin= ${4:-10}, ymax = ${5:10},
|
||||||
axis lines = middle,
|
axis lines = middle,
|
||||||
|
grid=major,
|
||||||
|
axis equal=false,
|
||||||
|
major tick style=thick,
|
||||||
|
scale only axis,
|
||||||
]
|
]
|
||||||
\addplot[domain=$2:$3, samples=${6:100}]{$7};
|
\addplot[domain=$2:$3, samples=${6: `!p snip.rv = add_variable_numbers(t[2], t[3], absolute=True)`}]{$7};
|
||||||
\end{axis}
|
\end{axis}
|
||||||
\end{tikzpicture}
|
\end{tikzpicture}
|
||||||
\caption{$8}
|
\caption{$8}
|
||||||
@ -199,11 +220,11 @@ snippet iplot "Quickly plot a graph with integers" bi
|
|||||||
\centering
|
\centering
|
||||||
\begin{tikzpicture}
|
\begin{tikzpicture}
|
||||||
\begin{axis}[
|
\begin{axis}[
|
||||||
xlabel=$x$,
|
xlabel=$x$,
|
||||||
ylabel=$y$,
|
ylabel=$y$,
|
||||||
axis lines = middle,
|
axis lines = middle,
|
||||||
]
|
]
|
||||||
\addplot[domain=$2:$3, samples=`!p snip.rv=abs(t[2]) + abs(t[3]) + 1`]{$4};
|
\addplot[domain=$2:$3, samples=`!p snip.rv=abs(t[2]) + abs(t[3]) + 1`]{$4};
|
||||||
\end{axis}
|
\end{axis}
|
||||||
\end{tikzpicture}
|
\end{tikzpicture}
|
||||||
\caption{$5}
|
\caption{$5}
|
||||||
|
@ -5,8 +5,8 @@ Plug 'sirver/ultisnips'
|
|||||||
" setting my private snippets in a consistent home directory
|
" setting my private snippets in a consistent home directory
|
||||||
let g:UltiSnipsSnippetDirectories = [$HOME . "/.vim/own-snippets"]
|
let g:UltiSnipsSnippetDirectories = [$HOME . "/.vim/own-snippets"]
|
||||||
let g:UltiSnipsExpandTrigger="<tab>"
|
let g:UltiSnipsExpandTrigger="<tab>"
|
||||||
let g:UltiSnipsJumpForwardTrigger="<c-b>"
|
let g:UltiSnipsJumpForwardTrigger="<tab>"
|
||||||
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
|
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
|
||||||
|
|
||||||
Plug 'scrooloose/nerdtree'
|
Plug 'scrooloose/nerdtree'
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ set number relativenumber
|
|||||||
set cursorline
|
set cursorline
|
||||||
|
|
||||||
" set tab to enter spaces, instead
|
" set tab to enter spaces, instead
|
||||||
set expandtab
|
set expandtab tabstop=4 shiftwidth=4
|
||||||
|
|
||||||
let template_list = [
|
let template_list = [
|
||||||
\ ["_minted-", ""],
|
\ ["_minted-", ""],
|
||||||
|
Loading…
Reference in New Issue
Block a user