Compare commits
No commits in common. "bf8d6fb8a36f8c67eb3ab8fab0c805a3495b60b0" and "d3d13b3083f55a26e4fefb8f0ec353620cf277b2" have entirely different histories.
bf8d6fb8a3
...
d3d13b3083
8 changed files with 151 additions and 64 deletions
|
|
@ -198,14 +198,22 @@ map.i.nore.silent['@@'] = '<c-g>u<c-o>:CiteRef<cr>'
|
||||||
-- map <leader>cc to insert a complete citation at cursor
|
-- map <leader>cc to insert a complete citation at cursor
|
||||||
|
|
||||||
-- SPELL CHECKING
|
-- SPELL CHECKING
|
||||||
|
-- Spell check set to <leader>O, 'o' for 'orthography':
|
||||||
-- Move to the prev/next spelling error with [S ]S
|
-- Move to the prev/next spelling error with [S ]S
|
||||||
-- Move to the prev/next spelling error or suggestion with [s ]s
|
-- Move to the prev/next spelling error or suggestion with [s ]s
|
||||||
map.n.nore['<localleader>ZZ'] = ':setlocal spell! spelllang=en_us,de_de<cr>'
|
map.n.nore['<leader>ZZ'] = ':setlocal spell! spelllang=en_us,de_de<cr>'
|
||||||
map.n.nore['<localleader>ZE'] = ':setlocal spell! spelllang=en_us<cr>'
|
map.n.nore['<leader>ZE'] = ':setlocal spell! spelllang=en_us<cr>'
|
||||||
map.n.nore['<localleader>ZG'] = ':setlocal spell! spelllang=de_de<cr>'
|
map.n.nore['<leader>ZG'] = ':setlocal spell! spelllang=en_us<cr>'
|
||||||
-- undo last spelling mistake from insert and normal mode
|
map.n.nore['<leader>zz'] = '1z='
|
||||||
map.i.nore['<c-s>'] = '<C-G>u<Esc>[s1z=`]a<C-G>u'
|
|
||||||
map.n.nore['<localleader>s'] = 'ms[s1z=`s'
|
-- pp to comPile a document (or file, works for some languages like go/python/c)
|
||||||
|
-- o to open the resulting document (mostly for pdfs)
|
||||||
|
-- po to comPile *and* open a doc
|
||||||
|
-- and all the same in uppercase for verbose output
|
||||||
|
map.n.nore['<leader>dp'] = ':DocCompile<cr>'
|
||||||
|
map.n.nore['<leader>dP'] = ':DocCompile!<cr>'
|
||||||
|
map.n.nore['<leader>do'] = ':DocOpen<cr>'
|
||||||
|
map.n.nore['<leader>dO'] = ':DocOpen!<cr>'
|
||||||
|
|
||||||
-- PLUGIN: easy-align
|
-- PLUGIN: easy-align
|
||||||
-- Start interactive EasyAlign in visual mode (e.g. vipga)
|
-- Start interactive EasyAlign in visual mode (e.g. vipga)
|
||||||
|
|
|
||||||
25
nvim/.config/nvim/plugin/personal/doccompile.vim
Normal file
25
nvim/.config/nvim/plugin/personal/doccompile.vim
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
function s:_compile(verbose, ...)
|
||||||
|
:execute(":w!")
|
||||||
|
if a:verbose
|
||||||
|
execute "!" . "compile" . " " . "\"%:p\"" . " " . join(a:000)
|
||||||
|
else
|
||||||
|
silent execute "!" . "compile" . " " . "\"%:p\"" . " " . join(a:000)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function s:_open(verbose, ...)
|
||||||
|
if a:verbose
|
||||||
|
execute "!" . "open-compiled" . " " . "\"%\"" . " " . join(a:000)
|
||||||
|
else
|
||||||
|
silent execute "!" . "open-compiled" . " " . "\"%\"" . " " . join(a:000)
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function s:_compileopen(verbose, ...)
|
||||||
|
call s:_compile(a:verbose, join(a:000))
|
||||||
|
call s:_open(a:verbose, join(a:000))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
command -bang -nargs=* DocCompile call s:_compile(<bang>0, <f-args>)
|
||||||
|
command -bang -nargs=* DocCompileOpen call s:_compileopen(<bang>0, <f-args>)
|
||||||
|
command -bang -nargs=* DocOpen call s:_open(<bang>0, <f-args>)
|
||||||
|
|
@ -14,7 +14,7 @@ t() {
|
||||||
# copy the `task` zsh completions over to my little alias 😉
|
# copy the `task` zsh completions over to my little alias 😉
|
||||||
# this is not very pretty and not super portable (needs ps) but
|
# this is not very pretty and not super portable (needs ps) but
|
||||||
# works for now. from here: https://unix.stackexchange.com/a/72564/414758
|
# works for now. from here: https://unix.stackexchange.com/a/72564/414758
|
||||||
if exist task && [ "$(ps -p $$ -o comm --no-headers)" = "zsh" ]; then compdef t=task; fi
|
if [ "$(ps -p $$ -o comm --no-headers)" = "zsh" ]; then compdef t=task; fi
|
||||||
|
|
||||||
# Make taskopen XDG conforming. If changing here, also change in taskrc alias.
|
# Make taskopen XDG conforming. If changing here, also change in taskrc alias.
|
||||||
alias taskopen='taskopen --config=${XDG_CONFIG_HOME:-~/.config}/task/taskopenrc'
|
alias taskopen='taskopen --config=${XDG_CONFIG_HOME:-~/.config}/task/taskopenrc'
|
||||||
|
|
@ -26,11 +26,7 @@ alias tan="task annotate"
|
||||||
alias tn="task next +READY"
|
alias tn="task next +READY"
|
||||||
alias tun="task next urgency \> 4"
|
alias tun="task next urgency \> 4"
|
||||||
|
|
||||||
if exist timew; then
|
|
||||||
alias tra="task active && timew"
|
|
||||||
else
|
|
||||||
alias tra="task active"
|
alias tra="task active"
|
||||||
fi
|
|
||||||
alias trw="task end.after:today-1wk completed"
|
alias trw="task end.after:today-1wk completed"
|
||||||
|
|
||||||
alias tad="task +ACTIVE done"
|
alias tad="task +ACTIVE done"
|
||||||
|
|
|
||||||
70
scripts/.local/bin/compile
Executable file
70
scripts/.local/bin/compile
Executable file
|
|
@ -0,0 +1,70 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# from https://github.com/LukeSmithxyz/voidrice/blob/master/.local/bin/compiler
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
# Expects the file to compile as first argument.
|
||||||
|
# Desired output format(s) can be specified in optional arguments following.
|
||||||
|
|
||||||
|
file=$1
|
||||||
|
if [ ! -f "$file" ]; then
|
||||||
|
echo "File does not exist."
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
printf "file: %s\n" "$file"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$#" -gt 1 ]; then
|
||||||
|
shift
|
||||||
|
formats="$*"
|
||||||
|
fi
|
||||||
|
|
||||||
|
dir=$(dirname "$file")
|
||||||
|
base="${file%.*}"
|
||||||
|
|
||||||
|
cd "$dir" || exit
|
||||||
|
|
||||||
|
textype() {
|
||||||
|
if (sed 5q "$file" | grep -i -q 'xelatex') && exist xelatex; then
|
||||||
|
command="xelatex"
|
||||||
|
elif exist pdflatex; then
|
||||||
|
command="pdflatex"
|
||||||
|
fi
|
||||||
|
$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"
|
||||||
|
}
|
||||||
|
|
||||||
|
sendtoRmd() {
|
||||||
|
printf "formats: %s\n" "$formats"
|
||||||
|
## FIXME this is horribly inefficient, should just pass all formats to R
|
||||||
|
# but R expects them as "strings" and I don't know how to quote the individual words
|
||||||
|
if [ -n "$formats" ]; then
|
||||||
|
for fmt in $formats; do
|
||||||
|
exist R critical && echo "require(rmarkdown); render('$1', c(\"$fmt\"))" | R -q --vanilla
|
||||||
|
done
|
||||||
|
else
|
||||||
|
exist R critical && echo "require(rmarkdown); render('$1')" | R -q --vanilla
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
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 ;;
|
||||||
|
*\.[Rr]md | *\.md | *\.mkd | *\.markdown) sendtoRmd "$file" "$formats" ;;
|
||||||
|
*\.tex) textype "$file" ;;
|
||||||
|
*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
|
||||||
28
scripts/.local/bin/open-compiled
Executable file
28
scripts/.local/bin/open-compiled
Executable file
|
|
@ -0,0 +1,28 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# opout: "open output": A general handler for opening a file's intended output,
|
||||||
|
# usually the pdf of a compiled document. I find this useful especially
|
||||||
|
# running from vim.
|
||||||
|
#
|
||||||
|
# from https://github.com/LukeSmithxyz/voidrice/tree/master/.local/bin
|
||||||
|
|
||||||
|
basename="$(echo "$1" | sed 's/\.[^\/.]*$//')"
|
||||||
|
|
||||||
|
openCompiledDoc() {
|
||||||
|
if [ -f "$basename".pdf ]; then
|
||||||
|
setsid "$FILEREADER" "$basename.pdf"
|
||||||
|
elif [ -f "$(echo "$basename" | sed 's/ /-/g')".pdf ]; then
|
||||||
|
setsid "$FILEREADER" "$(echo "$basename" | sed 's/ /-/g').pdf"
|
||||||
|
elif [ -f "$(echo "$basename" | sed 's/ /_/g')".pdf ]; then
|
||||||
|
setsid "$FILEREADER" "$(echo "$basename" | sed 's/ /_/g').pdf"
|
||||||
|
elif [ -f "$basename".html ]; then
|
||||||
|
setsid "$BROWSER" "$basename.html"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
# *.tex|*.md|*.rmd|*.ms|*.me|*.mom) setsid "$FILEREADER" "$basename".pdf >/dev/null 2>&1 & ;;
|
||||||
|
*.tex|*.md|*.[Rr]md|*.ms|*.me|*.mom) openCompiledDoc >/dev/null 2>&1 & ;;
|
||||||
|
*.[0-9]) openCompiledDoc >/dev/null 2>&1 & ;;
|
||||||
|
*.html) openCompiledDoc >/dev/null 2>&1 & ;;
|
||||||
|
esac
|
||||||
|
|
@ -2,59 +2,28 @@
|
||||||
|
|
||||||
The scripts module contains several small shell scripts which did not fit under any specific module.
|
The scripts module contains several small shell scripts which did not fit under any specific module.
|
||||||
Many of these modules are older and either 'legacy' in that they work but should be restructured at some point,
|
Many of these modules are older and either 'legacy' in that they work but should be restructured at some point,
|
||||||
or perhaps not working at all anymore. It's a bit of a messy module.
|
or perhaps not working at all anymore.
|
||||||
|
|
||||||
Some will work for others without needing changes, some are very personalized to me.
|
Some will work for others without needing changes, some are very personalized to me.
|
||||||
|
|
||||||
## archive
|
|
||||||
|
|
||||||
An 'archiving' script, but not intended for backups. It will instead hardlink all files you give it in a single 'archive' directory, so even if you delete the original file from your directories, the hardlinked copy will remain.
|
|
||||||
|
|
||||||
I use it to build a small archive of (mostly youtube videos) that I can delete from my normal folders but always quickly search through and grab again whenever I need them. Will probably not be too useful for most other purposes.
|
|
||||||
|
|
||||||
## benchmark
|
## benchmark
|
||||||
|
|
||||||
`benchmark` allows you to take the time another commands needs to run.
|
`benchmark` allows you to take the time another commands needs to run.
|
||||||
It will simply output the time taken, and can be run repeatedly or averaged to get more accurate readings.
|
It will simply output the time taken, and can be run repeatedly or averaged to get more accurate readings.
|
||||||
|
|
||||||
## bemenu-translate
|
## compile
|
||||||
|
|
||||||
`bemenu-translate` is a pretty useful tool if you are often writing in a non-native language, doing translation work or similar. In effect, it's a simple wrapper around `trans`, allowing you to use bemenu to input what you want translated and showing the output through the menu as well.
|
`compile` is somewhat of a left-over script.
|
||||||
|
It should be refactored and moved into the `bibtex` module at some point.
|
||||||
Very useful to have as a little dropdown which you can call via global shortcut.
|
It takes a filename and tries to invoke the corresponding compiler and is mainly used by my `pandoc` (or `rmarkdown`) workflow.
|
||||||
|
`open-compiled` is somewhat of a companion script which attempts to open the resulting file for the user.
|
||||||
|
|
||||||
## lockscreen
|
## lockscreen
|
||||||
|
|
||||||
`lockscreen` does just that, invoking i3lock/waylock program with some simple defaults and a color, as well as stopping any running media and muting the audio.
|
`lockscreen` does just that, invoke the i3 lock-screen program with some simple defaults and a color.
|
||||||
|
|
||||||
|
|
||||||
## nomie
|
## nomie
|
||||||
|
|
||||||
`nomie` logs a simple journal entry in the open source habit-tracking app [nomie](https://nomie.app).
|
`nomie` logs a simple journal entry in the open source habit-tracking app [nomie](https://nomie.app).
|
||||||
To do this it needs an api key, which is, as of now, hard-coded to be sourced from my pass app.
|
To do this it needs an api key, which is, as of now, hard-coded to be sourced from my pass app.
|
||||||
|
|
||||||
## powermenu
|
|
||||||
|
|
||||||
A menu to invoke power-related commands: Shut down your PC, reboot, log out, sleep and suspend. Very simple, very useful.
|
|
||||||
|
|
||||||
## sharefile
|
|
||||||
|
|
||||||
This one could be useful to many: Quickly upload any file to `http://0x0.st` and get the link on your clipboard.
|
|
||||||
Can take the file to upload through stdin, as an argument, or be chosen interactively with fzf.
|
|
||||||
|
|
||||||
## uoeia
|
|
||||||
|
|
||||||
Helps you open images, especially remote ones, in your favorite image viewer. Point it at a link and it will open many different kinds of pictures, galleries, and so on.
|
|
||||||
|
|
||||||
## vidl
|
|
||||||
|
|
||||||
Helps you download videos (mostly from youtube) and archive them using the archive script above.
|
|
||||||
I use it to download interesting looking videos into an inbox for later viewing.
|
|
||||||
|
|
||||||
## wallcrop.sh
|
|
||||||
|
|
||||||
Probably not too useful for most: Takes an image that is exactly 3840x1080 pixels and cuts it in half,
|
|
||||||
naming the resulting images `xy_l.png` and `xy_r.png`. I use it to quickly cut multi-monitor wallpapers to a good display size.
|
|
||||||
|
|
||||||
## wallr
|
|
||||||
|
|
||||||
Allows you to read articles from your wallabag instance in the terminal. Pretty simple wrapper for the wallabag-cli python library (which is a requirement). Lists your articles using fzf by default and can mark them read if you wish.
|
|
||||||
|
|
|
||||||
|
|
@ -119,8 +119,3 @@ elif exist ipython; then
|
||||||
elif exist python; then
|
elif exist python; then
|
||||||
alias py=python
|
alias py=python
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# distrobox
|
|
||||||
if exist distrobox; then
|
|
||||||
alias db=distrobox
|
|
||||||
fi
|
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,12 @@ compinit
|
||||||
# End of lines added by compinstall
|
# End of lines added by compinstall
|
||||||
|
|
||||||
# load plugins
|
# load plugins
|
||||||
[ -e /usr/share/oh-my-zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh ] && source /usr/share/oh-my-zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh
|
PLUG_FOLDER="/usr/share/zsh/plugins"
|
||||||
[ -e /usr/share/oh-my-zsh/plugins/command-not-found/command-not-found.plugin.zsh ] && source /usr/share/oh-my-zsh/plugins/command-not-found/command-not-found.plugin.zsh
|
source /usr/share/oh-my-zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh
|
||||||
[ -e /usr/share/fzf/key-bindings.zsh ] && source /usr/share/fzf/key-bindings.zsh
|
source /usr/share/oh-my-zsh/plugins/command-not-found/command-not-found.plugin.zsh
|
||||||
|
source /usr/share/fzf/key-bindings.zsh
|
||||||
#source /usr/share/nvm/init-nvm.sh
|
#source /usr/share/nvm/init-nvm.sh
|
||||||
## find the correct installed tab-completion version
|
## find the correct installed tab-completion version
|
||||||
PLUG_FOLDER="/usr/share/zsh/plugins"
|
|
||||||
[ -e $PLUG_FOLDER/fzf-tab/fzf-tab.plugin.zsh ] && source $PLUG_FOLDER/fzf-tab/fzf-tab.plugin.zsh
|
[ -e $PLUG_FOLDER/fzf-tab/fzf-tab.plugin.zsh ] && source $PLUG_FOLDER/fzf-tab/fzf-tab.plugin.zsh
|
||||||
[ -e $PLUG_FOLDER/fzf-tab-bin-git/fzf-tab.plugin.zsh ] && source $PLUG_FOLDER/fzf-tab-bin-git/fzf-tab.plugin.zsh
|
[ -e $PLUG_FOLDER/fzf-tab-bin-git/fzf-tab.plugin.zsh ] && source $PLUG_FOLDER/fzf-tab-bin-git/fzf-tab.plugin.zsh
|
||||||
# these need to be sourced after fzf-tab
|
# these need to be sourced after fzf-tab
|
||||||
|
|
@ -66,10 +66,6 @@ promptinit
|
||||||
prompt_newline='%666v'
|
prompt_newline='%666v'
|
||||||
# show git stash status as a ≡
|
# show git stash status as a ≡
|
||||||
zstyle :prompt:pure:git:stash show yes
|
zstyle :prompt:pure:git:stash show yes
|
||||||
# show hostname if we are in a distrobox environment
|
|
||||||
if [ -n "$DISTROBOX_ENTER_PATH" ] && [ -f /run/.containerenv ]; then
|
|
||||||
local container=lxc
|
|
||||||
fi
|
|
||||||
prompt pure
|
prompt pure
|
||||||
|
|
||||||
# shellcheck source=alias
|
# shellcheck source=alias
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue