mirror of
https://github.com/tiyn/dotfiles.git
synced 2025-03-31 16:37:45 +02:00
enhancing tex feeling in vim
This commit is contained in:
parent
cc85e466e4
commit
74652652fa
@ -26,9 +26,9 @@ sc() { find ~/.config/* ~/.local/bin/* -type f | fzf | xargs -r $EDITOR ;}
|
|||||||
sd() { find ~/ownCloud/* -type f | grep ".pdf" | fzf | xargs -r $READER ;}
|
sd() { find ~/ownCloud/* -type f | grep ".pdf" | fzf | xargs -r $READER ;}
|
||||||
|
|
||||||
# git
|
# git
|
||||||
texhandout() {
|
texhandout() {
|
||||||
[[ -z $1 ]] && echo "missing argument: filename (no ending)" && return 1
|
[[ -z $1 ]] && echo "missing argument: filename (no ending)" && return 1
|
||||||
cp ~/gitrepos/Tools/LaTeX\ Templates/LaTeX\ Handout/Handout.tex $1.tex && xelatex $1.tex
|
cp ~/gitrepos/Tools/LaTeX\ Templates/LaTeX\ Handout/Handout.tex $1.tex && compile $1.tex
|
||||||
}
|
}
|
||||||
|
|
||||||
# grep
|
# grep
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
let mapleader =","
|
||||||
|
|
||||||
if ! filereadable(expand('~/.config/nvim/autoload/plug.vim'))
|
if ! filereadable(expand('~/.config/nvim/autoload/plug.vim'))
|
||||||
echo "Downloading junegunn/vim-plug to manage plugins..."
|
echo "Downloading junegunn/vim-plug to manage plugins..."
|
||||||
silent !mkdir -p ~/.config/nvim/autoload/
|
silent !mkdir -p ~/.config/nvim/autoload/
|
||||||
@ -11,21 +13,33 @@ set nohlsearch
|
|||||||
set clipboard=unnamedplus
|
set clipboard=unnamedplus
|
||||||
|
|
||||||
" Some basics:
|
" Some basics:
|
||||||
nnoremap c "_c
|
nnoremap c "_c
|
||||||
set nocompatible
|
set nocompatible
|
||||||
filetype plugin on
|
filetype plugin on
|
||||||
syntax on
|
syntax on
|
||||||
set encoding=utf-8
|
set encoding=utf-8
|
||||||
set number relativenumber
|
set number relativenumber
|
||||||
" Disables automatic commenting on newline:
|
" Disables automatic commenting on newline:
|
||||||
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
|
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
|
||||||
|
|
||||||
" Splits open at the bottom and right, which is non-retarded, unlike vim defaults.
|
" Splits open at the bottom and right, which is non-retarded, unlike vim defaults.
|
||||||
set splitbelow splitright
|
set splitbelow splitright
|
||||||
|
|
||||||
" Copy selected text to system clipboard (requires gvim/nvim/vim-x11 installed):
|
" Copy selected text to system clipboard (requires gvim/nvim/vim-x11 installed):
|
||||||
vnoremap <C-c> "+y
|
vnoremap <C-c> "+y
|
||||||
map <C-p> "+P
|
map <C-p> "+P
|
||||||
|
|
||||||
|
" Read files correctly
|
||||||
|
autocmd BufRead,BufNewFile *.tex set filetype=tex
|
||||||
|
|
||||||
|
" Compiler for languages
|
||||||
|
map <leader>c :w! \| !compiler <c-r>%<CR>
|
||||||
|
|
||||||
|
" Clean LaTex build files
|
||||||
|
autocmd VimLeave *.tex !texclear %
|
||||||
|
|
||||||
|
" Delete trailing whitespaces on save
|
||||||
|
autocmd BufWritePre * %s/\s\+$//e
|
||||||
|
|
||||||
" Plugin section
|
" Plugin section
|
||||||
call plug#begin('~/.config/nvim/plugged')
|
call plug#begin('~/.config/nvim/plugged')
|
||||||
@ -34,12 +48,7 @@ Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
|
|||||||
Plug 'lervag/vimtex', {'for': 'tex'}
|
Plug 'lervag/vimtex', {'for': 'tex'}
|
||||||
Plug 'artur-shaik/vim-javacomplete2'
|
Plug 'artur-shaik/vim-javacomplete2'
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
" neotex
|
|
||||||
let g:neotex_enabled = 2
|
let g:neotex_enabled = 2
|
||||||
let g:neotex_pdflatex_alternative = 'xelatex'
|
|
||||||
|
|
||||||
" deoplete
|
|
||||||
let g:deoplete#enable_at_startup = 1
|
let g:deoplete#enable_at_startup = 1
|
||||||
let g:deoplete#enable_smart_case = 1
|
let g:deoplete#enable_smart_case = 1
|
||||||
let g:deoplete#sources = {}
|
let g:deoplete#sources = {}
|
||||||
@ -47,7 +56,6 @@ let g:deoplete#sources.java = ['jc', 'javacomplete2', 'file', 'buffer']
|
|||||||
call deoplete#custom#var('omni', 'input_patterns', {
|
call deoplete#custom#var('omni', 'input_patterns', {
|
||||||
\ 'tex': g:vimtex#re#deoplete
|
\ 'tex': g:vimtex#re#deoplete
|
||||||
\})
|
\})
|
||||||
|
|
||||||
"tab as remapping for deoplete
|
"tab as remapping for deoplete
|
||||||
inoremap <silent><expr> <TAB>
|
inoremap <silent><expr> <TAB>
|
||||||
\ pumvisible() ? "\<C-n>" :
|
\ pumvisible() ? "\<C-n>" :
|
||||||
@ -57,6 +65,5 @@ function! s:check_back_space() abort "" {{{
|
|||||||
let col = col('.') - 1
|
let col = col('.') - 1
|
||||||
return !col || getline('.')[col - 1] =~ '\s'
|
return !col || getline('.')[col - 1] =~ '\s'
|
||||||
endfunction "" }}}
|
endfunction "" }}}
|
||||||
|
|
||||||
" javacomplete2
|
" javacomplete2
|
||||||
autocmd FileType java setlocal omnifunc=javacomplete#Complete
|
autocmd FileType java setlocal omnifunc=javacomplete#Complete
|
||||||
|
38
.local/bin/tools/compiler
Executable file
38
.local/bin/tools/compiler
Executable file
@ -0,0 +1,38 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# This script will compile or run another finishing operation on a document. I
|
||||||
|
# have this script run via vim.
|
||||||
|
#
|
||||||
|
# Compiles .tex. groff (.mom, .ms), .rmd, .md. Opens .sent files as sent
|
||||||
|
# presentations. Runs scripts based on extention or shebang
|
||||||
|
|
||||||
|
file=$(readlink -f "$1")
|
||||||
|
dir=$(dirname "$file")
|
||||||
|
base="${file%.*}"
|
||||||
|
|
||||||
|
cd "$dir" || exit
|
||||||
|
|
||||||
|
textype() { \
|
||||||
|
command="pdflatex"
|
||||||
|
( sed 5q "$file" | grep -i -q 'xelatex' ) && command="xelatex"
|
||||||
|
$command --output-directory="$dir" "$base" &&
|
||||||
|
grep -i addbibresource "$file" >/dev/null &&
|
||||||
|
biber --input-directory "$dir" "$base" &&
|
||||||
|
$command --output-directory="$dir" "$base" &&
|
||||||
|
$command --output-directory="$dir" "$base"
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$file" in
|
||||||
|
*\.ms) refer -PS -e "$file" | groff -me -ms -kept -T pdf > "$base".pdf ;;
|
||||||
|
*\.mom) refer -PS -e "$file" | groff -mom -kept -T pdf > "$base".pdf ;;
|
||||||
|
*\.[0-9]) refer -PS -e "$file" | groff -mandoc -T pdf > "$base".pdf ;;
|
||||||
|
*\.rmd) echo "require(rmarkdown); render('$file')" | R -q --vanilla ;;
|
||||||
|
*\.tex) textype "$file" ;;
|
||||||
|
*\.md) pandoc "$file" --pdf-engine=xelatex -o "$base".pdf ;;
|
||||||
|
*config.h) sudo make install ;;
|
||||||
|
*\.c) cc "$file" -o "$base" && "$base" ;;
|
||||||
|
*\.py) python "$file" ;;
|
||||||
|
*\.go) go run "$file" ;;
|
||||||
|
*\.sent) setsid sent "$file" 2>/dev/null & ;;
|
||||||
|
*) sed 1q "$file" | grep "^#!/" | sed "s/^#!//" | xargs -r -I % "$file" ;;
|
||||||
|
esac
|
14
.local/bin/tools/texclear
Executable file
14
.local/bin/tools/texclear
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Clears the build files of a LaTeX/XeLaTeX build.
|
||||||
|
# I have vim run this file whenever I exit a .tex file.
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
*.tex)
|
||||||
|
file=$(readlink -f "$1")
|
||||||
|
dir=$(dirname "$file")
|
||||||
|
base="${file%.*}"
|
||||||
|
find "$dir" -maxdepth 1 -type f -regextype gnu-awk -regex "^$base\\.(4tc|xref|tmp|pyc|pyo|fls|vrb|fdb_latexmk|bak|swp|aux|log|synctex\\(busy\\)|lof|lot|maf|idx|mtc|mtc0|nav|out|snm|toc|bcf|run\\.xml|synctex\\.gz|blg|bbl)" -delete ;;
|
||||||
|
*) printf "Give .tex file as argument.\\n" ;;
|
||||||
|
esac
|
||||||
|
|
@ -1,25 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#original artwork by http://www.sanderfocus.nl/#/portfolio/tech-heroes
|
|
||||||
#converted to shell by #nixers @ irc.unix.chat
|
|
||||||
|
|
||||||
cat << 'eof'
|
|
||||||
[38;5;255m,_ ,_==▄▂[0m
|
|
||||||
[38;5;255m, ▂▃▄▄▅▅[48;5;240m▅[48;5;20m▂[48;5;240m▅¾[0m. [38;5;199m/ [38;5;20m/[0m
|
|
||||||
[38;5;255m[48;5;20m▄[0m[38;5;255m[48;5;199m▆[38;5;16m[48;5;255m<´ [38;5;32m"[38;5;34m»[38;5;255m▓▓[48;5;32m▓[48;5;240m%[0m\ [38;5;199m/ [38;5;20m/ [38;5;45m/ [38;5;118m/[0m
|
|
||||||
[38;5;255m,[38;5;255m[48;5;240m▅[38;5;16m[48;5;255m7" [38;5;160m´[38;5;34m>[38;5;255m[48;5;39m▓▓[38;5;199m[48;5;255m▓[0m[38;5;255m% [38;5;20m/ [38;5;118m/ [38;5;199m> [38;5;118m/ [38;5;199m>[38;5;255m/[38;5;45m%[0m
|
|
||||||
[38;5;255m▐[48;5;240m[38;5;255m¶[48;5;240m[38;5;255m▓[48;5;255m [38;5;196m,[38;5;34m»[48;5;201m[38;5;255m▓▓[0m[38;5;255m¾´[0m [38;5;199m/[38;5;255m> %[38;5;199m/[38;5;118m%[38;5;255m/[38;5;199m/ [38;5;45m/ [38;5;199m/[0m
|
|
||||||
[38;5;255m[48;5;240m▓[48;5;255m[38;5;16m▃[48;5;16m[38;5;255m▅▅[38;5;16m[48;5;255m▅▃,,[38;5;32m▄[38;5;16m▅[38;5;255m[48;5;16m▅▅[38;5;255m[48;5;20mÆ[0m[38;5;255m\[0m[38;5;20m/[38;5;118m/[38;5;255m /[38;5;118m/[38;5;199m/[38;5;255m>[38;5;45m// [38;5;255m/[38;5;118m>[38;5;199m/ [38;5;20m/[0m
|
|
||||||
[48;5;20m[38;5;255mV[48;5;255m[38;5;16m║[48;5;20m[38;5;255m«[0m[38;5;255m¼.;[48;5;240m[38;5;255m→[48;5;255m[38;5;16m ║[0m[38;5;255m<«.,[48;5;25m[38;5;255m`[48;5;240m=[0m[38;5;20m/[38;5;199m/ [38;5;255m/>[38;5;45m/[38;5;118m/[38;5;255m%/[38;5;199m% / [38;5;20m/[0m
|
|
||||||
[38;5;20m//[48;5;255m[38;5;16m╠<´ -²,)[48;5;16m[38;5;255m(▓[48;5;255m[38;5;16m~"-[38;5;199m╝/[0m[38;5;255m¾[0m[38;5;199m/ [38;5;118m%[38;5;255m/[38;5;118m>[38;5;45m/ [38;5;118m/[38;5;199m>[0m
|
|
||||||
[38;5;20m/ / [38;5;118m/ [48;5;20m[38;5;255m▐[48;5;240m[38;5;16m%[48;5;255m -./▄▃▄[48;5;16m[38;5;255m▅[48;5;255m[38;5;16m▐[48;5;255m[38;5;16m, [38;5;199m/[48;5;199m[38;5;255m7[0m[38;5;20m/[38;5;199m/[38;5;255m;/[38;5;199m/[38;5;118m% [38;5;20m/ /[0m
|
|
||||||
[38;5;20m/ [38;5;199m/[38;5;255m/[38;5;45m/[38;5;118m/[38;5;255m[48;5;240m`[48;5;20m[38;5;255m▌[48;5;20m[38;5;255m▐[48;5;255m[38;5;16m %z[0m[38;5;255mWv xX[48;5;20m[38;5;255m▓[48;5;34m[38;5;255m▇[48;5;199m[38;255m▌[0m[38;5;20m/[38;5;199m/[38;5;255m&;[38;5;20m% [38;5;199m/ [38;5;20m/[0m
|
|
||||||
[38;5;20m/ / [38;5;255m/ [38;5;118m%[38;5;199m/[38;5;255m/%/[48;5;240m[38;5;255m¾[48;5;255m[38;5;16m½´[38;5;255m[48;5;16m▌[0m[38;5;246m▃▄[38;5;255m▄▄[38;5;246m▄▃▃[0m[48;5;16m[38;5;255m▐[38;5;255m[48;5;199m¶[48;5;20m[38;5;255m\[0m[38;5;20m/[0m[48;5;255m[38;5;240m&[0m [38;5;20m/[0m
|
|
||||||
[38;5;199m<[38;5;118m/ [38;5;45m/[38;5;255m</[38;5;118m%[38;5;255m/[38;5;45m/[38;5;255m`[48;5;16m▓[48;5;255m[38;5;16m![48;5;240m[38;5;255m%[48;5;16m[38;5;255m▓[0m[38;5;255m%[48;5;240m[38;5;255m╣[48;5;240m[38;5;255;╣[0m[38;5;255mW[0m[38;5;250mY<Y)[48;5;255m[38;5;16my&[0m[38;5;255m/`[48;5;240m\[0m
|
|
||||||
[38;5;20m/ [38;5;199m/ [38;5;199m%[38;5;255m/%[38;5;118m/[38;5;45m/[38;5;255m<[38;5;118m/[38;5;199m%[38;5;45m/[38;5;20m/[48;5;240m[38;5;255m\[38;5;16m[48;5;255mi7; ╠N[0m[38;5;246m>[38;5;255m)VY>[48;5;240m[38;5;255m7[0m[38;5;255m; [38;5;255m[48;5;240m\[0m[38;5;255m_[0m [38;5;255mUNIX IS VERY SIMPLE [38;5;45mIT JUST NEEDS A[0m
|
|
||||||
[38;5;20m/ [38;5;255m/[38;5;118m<[38;5;255m/ [38;5;45m/[38;5;255m/<[38;5;199m/[38;5;20m/[38;5;199m/[38;5;20m<[38;5;255m_/%\[38;5;255m[48;5;16m▓[48;5;255m[38;5;16m V[0m[38;5;255m%[48;5;255m[38;5;16mW[0m[38;5;255m%£)XY[0m [38;5;240m_/%[38;5;255m‾\_,[0m [38;5;45mGENIUS TO UNDERSTAND ITS SIMPLICITY[38;5;255m[0m
|
|
||||||
[38;5;199m/ [38;5;255m/ [38;5;199m/[38;5;255m/[38;5;118m%[38;5;199m/[48;5;240m[38;5;255m_,=-[48;5;20m-^[0m[38;5;255m/%/%%[48;5;255m[38;5;16m\¾%[0m[38;5;255m¶[0m[48;5;255m[38;5;16m%[0m[38;5;255m%}[0m [38;5;240m/%%%[38;5;20m%%[38;5;240m%;\,[0m
|
|
||||||
[38;5;45m%[38;5;20m/[38;5;199m< [38;5;20m/[48;5;20m[38;5;255m_/[48;5;240m [0m[38;5;255m%%%[38;5;240m%%[38;5;20m;[38;5;255mX[38;5;240m%[38;5;20m%[38;5;255m\%[38;5;240m%;, _/%%%;[38;5;20m,[38;5;240m \[0m
|
|
||||||
[38;5;118m/ [38;5;20m/ [38;5;240m%[38;5;20m%%%%[38;5;240m%;, [38;5;255m\[38;5;240m%[38;5;20m%[38;5;255ml[38;5;240m%%;// _/[38;5;20m%;,[0m [38;5;234mdmr[0m
|
|
||||||
[38;5;20m/ [38;5;240m%[38;5;20m%%;,[0m [38;5;255m<[38;5;20m;[38;5;240m\-=-/ /[0m
|
|
||||||
[38;5;20m;,[0m [38;5;240ml[0m
|
|
||||||
eof
|
|
Loading…
x
Reference in New Issue
Block a user