diff --git a/vim/.vim/own-snippets/asciidoc.snippets b/vim/.vim/own-snippets/asciidoc.snippets new file mode 100644 index 0000000..c3c9dc4 --- /dev/null +++ b/vim/.vim/own-snippets/asciidoc.snippets @@ -0,0 +1,112 @@ +# Text formatting +snippet "h(\d)" "Quick header snippet" biw +`!p +header_level = int(match.group(1)) +legit_header_level = True if header_level >= 1 and header_level <= 6 else False + +snip.rv = "#" * header_level if legit_header_level else "" +` +$0 +endsnippet + +snippet dt "Definition term" bi +${1:}:: +${2:} +$0 +endsnippet + +snippet ul "Unordered list item" bi +* ${1:} +$0 +endsnippet + +snippet ol "Ordered list item" bi +. ${1:} +$0 +endsnippet + +snippet -ol "Reversed ordered list (use it only once in a list)" bi +[%reversed] +. ${1:} +endsnippet + +snippet bquote "Blockquote" bi +---- +$1 +---- +$0 +endsnippet + +snippet src "Source code listings" bi +[source,${1:}] +---- +${2:} +---- +$0 +endsnippet + +snippet "-table (\d+)-" "Make a quick table" bir +[cols="`!p snip.rv = match.group(1)`*"] +|=== + +$1 + +|=== +$0 +endsnippet + +# Images +snippet figure "Image block with caption" bi +.${2:} +image::${1:}[${3:width=100%,height=100%}] +$0 +endsnippet + +snippet -figure "Inline image" i +image:${1:}[${2}] $0 +endsnippet + +# Video blocks +snippet video "Video block" bi +video::${1:}[$2] +$0 +endsnippet + +snippet youtube "YouTube video block" bi +video::${1:}[youtube] +$0 +endsnippet + +snippet vimeo "Vimeo video block" bi +video::${1:}[vimeo] +$0 +endsnippet + +# Other features +snippet incl "Include document" bi +include::${1:}[${2:}] +$0 +endsnippet + +snippet oblock "Open block" bi +-- +$1 +-- +$0 +endsnippet + +snippet sidebar "Sidebar as an open block" bi +[sidebar] +.${1:} +-- +$2 +-- +$0 +endsnippet + +snippet abstract "Abstract block" bi +[abstract] +== ${1:Summary} +$0 +endsnippet + diff --git a/vim/.vim/own-snippets/tex.snippets b/vim/.vim/own-snippets/tex.snippets index 87dabc7..e0a1ecb 100644 --- a/vim/.vim/own-snippets/tex.snippets +++ b/vim/.vim/own-snippets/tex.snippets @@ -199,12 +199,11 @@ snippet plot "Quickly plot a graph" bi xlabel=$x$, ylabel=$y$, xmin= ${2:-10}, xmax= ${3:10}, - ymin= ${4:-10}, ymax = ${5:10}, axis lines = middle, grid=major, axis equal=false, - major tick style=thick, - scale only axis, + tick style={very thick}, + major tick style=thick,`!p snip.rv = smart_space(t[4], "\n\t")`$4 ] \addplot[domain=$2:$3, samples=${6: `!p snip.rv = add_variable_numbers(t[2], t[3], absolute=True)`}]{$7}; \end{axis} diff --git a/vim/.vimrc b/vim/.vimrc index d33aa48..19bd976 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -51,7 +51,7 @@ set number relativenumber set cursorline " set tab to enter spaces, instead -set expandtab tabstop=4 shiftwidth=4 +set expandtab tabstop=4 shiftwidth=4 smartindent let template_list = [ \ ["_minted-", ""], @@ -75,7 +75,7 @@ augroup vimtex_events " auto-clean au User VimtexEventQuit call vimtex#compiler#clean(1) au User VimtexEventQuit call VimtexAdditionalCleanup(template_list) - + " auto-compile au User VimtexEventInitPost call vimtex#compiler#compile() augroup END @@ -83,6 +83,17 @@ augroup END " open nerd-tree at the start of each file opening autocmd vimenter * NERDTree +" set list and other listing characters (:h listchars) +set list listchars=tab:→\ ,trail:· + +" show leading spaces +" SOURCE: https://www.reddit.com/r/vim/comments/5fxsfy/show_leading_spaces/ +hi Conceal guibg=NONE ctermbg=NONE ctermfg=DarkGrey +autocmd BufWinEnter * setl conceallevel=2 concealcursor=nv +autocmd BufWinEnter * syn match LeadingSpace /\(^ *\)\@<= / containedin=ALL conceal cchar=· +autocmd BufReadPre * setl conceallevel=2 concealcursor=nv +autocmd BufReadPre * syn match LeadingSpace /\(^ *\)\@<= / containedin=ALL conceal cchar=· + " spell checker (for your local language, anyway) setlocal spell set spelllang=en_gb