Compare commits
6 commits
d3d13b3083
...
bf8d6fb8a3
Author | SHA1 | Date | |
---|---|---|---|
bf8d6fb8a3 | |||
d09584e690 | |||
0a867ee992 | |||
369345880d | |||
274cc8026a | |||
99a3c0d314 |
8 changed files with 64 additions and 151 deletions
|
@ -198,22 +198,14 @@ map.i.nore.silent['@@'] = '<c-g>u<c-o>:CiteRef<cr>'
|
|||
-- map <leader>cc to insert a complete citation at cursor
|
||||
|
||||
-- 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 or suggestion with [s ]s
|
||||
map.n.nore['<leader>ZZ'] = ':setlocal spell! spelllang=en_us,de_de<cr>'
|
||||
map.n.nore['<leader>ZE'] = ':setlocal spell! spelllang=en_us<cr>'
|
||||
map.n.nore['<leader>ZG'] = ':setlocal spell! spelllang=en_us<cr>'
|
||||
map.n.nore['<leader>zz'] = '1z='
|
||||
|
||||
-- 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>'
|
||||
map.n.nore['<localleader>ZZ'] = ':setlocal spell! spelllang=en_us,de_de<cr>'
|
||||
map.n.nore['<localleader>ZE'] = ':setlocal spell! spelllang=en_us<cr>'
|
||||
map.n.nore['<localleader>ZG'] = ':setlocal spell! spelllang=de_de<cr>'
|
||||
-- undo last spelling mistake from insert and normal mode
|
||||
map.i.nore['<c-s>'] = '<C-G>u<Esc>[s1z=`]a<C-G>u'
|
||||
map.n.nore['<localleader>s'] = 'ms[s1z=`s'
|
||||
|
||||
-- PLUGIN: easy-align
|
||||
-- Start interactive EasyAlign in visual mode (e.g. vipga)
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
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 😉
|
||||
# this is not very pretty and not super portable (needs ps) but
|
||||
# works for now. from here: https://unix.stackexchange.com/a/72564/414758
|
||||
if [ "$(ps -p $$ -o comm --no-headers)" = "zsh" ]; then compdef t=task; fi
|
||||
if exist task && [ "$(ps -p $$ -o comm --no-headers)" = "zsh" ]; then compdef t=task; fi
|
||||
|
||||
# Make taskopen XDG conforming. If changing here, also change in taskrc alias.
|
||||
alias taskopen='taskopen --config=${XDG_CONFIG_HOME:-~/.config}/task/taskopenrc'
|
||||
|
@ -26,7 +26,11 @@ alias tan="task annotate"
|
|||
alias tn="task next +READY"
|
||||
alias tun="task next urgency \> 4"
|
||||
|
||||
if exist timew; then
|
||||
alias tra="task active && timew"
|
||||
else
|
||||
alias tra="task active"
|
||||
fi
|
||||
alias trw="task end.after:today-1wk completed"
|
||||
|
||||
alias tad="task +ACTIVE done"
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
#!/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
|
|
@ -1,28 +0,0 @@
|
|||
#!/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,28 +2,59 @@
|
|||
|
||||
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,
|
||||
or perhaps not working at all anymore.
|
||||
or perhaps not working at all anymore. It's a bit of a messy module.
|
||||
|
||||
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` 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.
|
||||
|
||||
## compile
|
||||
## bemenu-translate
|
||||
|
||||
`compile` is somewhat of a left-over script.
|
||||
It should be refactored and moved into the `bibtex` module at some point.
|
||||
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.
|
||||
`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.
|
||||
|
||||
Very useful to have as a little dropdown which you can call via global shortcut.
|
||||
|
||||
## lockscreen
|
||||
|
||||
`lockscreen` does just that, invoke the i3 lock-screen program with some simple defaults and a color.
|
||||
|
||||
`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.
|
||||
|
||||
## nomie
|
||||
|
||||
`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.
|
||||
|
||||
## 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,3 +119,8 @@ elif exist ipython; then
|
|||
elif exist python; then
|
||||
alias py=python
|
||||
fi
|
||||
|
||||
# distrobox
|
||||
if exist distrobox; then
|
||||
alias db=distrobox
|
||||
fi
|
||||
|
|
|
@ -18,12 +18,12 @@ compinit
|
|||
# End of lines added by compinstall
|
||||
|
||||
# load plugins
|
||||
PLUG_FOLDER="/usr/share/zsh/plugins"
|
||||
source /usr/share/oh-my-zsh/plugins/colored-man-pages/colored-man-pages.plugin.zsh
|
||||
source /usr/share/oh-my-zsh/plugins/command-not-found/command-not-found.plugin.zsh
|
||||
source /usr/share/fzf/key-bindings.zsh
|
||||
[ -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
|
||||
[ -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
|
||||
[ -e /usr/share/fzf/key-bindings.zsh ] && source /usr/share/fzf/key-bindings.zsh
|
||||
#source /usr/share/nvm/init-nvm.sh
|
||||
## 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-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
|
||||
|
@ -66,6 +66,10 @@ promptinit
|
|||
prompt_newline='%666v'
|
||||
# show git stash status as a ≡
|
||||
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
|
||||
|
||||
# shellcheck source=alias
|
||||
|
|
Loading…
Reference in a new issue