diff --git a/home/.bashrc-bloated b/home/.bashrc-bloated index f497bd9..a813585 100644 --- a/home/.bashrc-bloated +++ b/home/.bashrc-bloated @@ -396,7 +396,7 @@ alias ncdu="ncdu --color=dark" alias ip="ip -color=always" # vim alias v="nvim" -alias vi='nvim -o "$(fzf)"' +alias vi='fzf | xargs nvim -o' # emacs alias doom="$HOME/.config/emacs/bin/doom" alias e="emacs -nw" diff --git a/home/.config/fish/conf.d/aliases.fish b/home/.config/fish/conf.d/aliases.fish index ce18e32..20c94eb 100644 --- a/home/.config/fish/conf.d/aliases.fish +++ b/home/.config/fish/conf.d/aliases.fish @@ -29,7 +29,7 @@ alias ncdu='ncdu --color=dark' alias ip='ip -color=always' # vim abbr v nvim -abbr vi 'nvim -o (fzf)' +abbr vi 'fzf | xargs nvim -o' # emacs alias doom='$HOME/.config/emacs/bin/doom' abbr e 'emacs -nw' @@ -43,8 +43,49 @@ abbr youflac 'youtube-dl --extract-audio --audio-format flac' abbr youbest 'youtube-dl -f bestvideo+bestaudio' abbr youlist 'youtube-dl -f bestvideo+bestaudio --yes-playlist' # nnn -abbr nnn 'nnn -Hc' -alias ncp="cat $XDG_CONFIG_HOME/nnn/.selection | tr '\0' '\n'" +if command -v nnn >/dev/null + abbr nnn 'nnn -Hc' + alias ncp="cat $XDG_CONFIG_HOME/nnn/.selection | tr '\0' '\n'" + + function n --wraps nnn --description 'support nnn quit and change directory' + # Block nesting of nnn in subshells + if test -n "$NNNLVL" + if [ (expr $NNNLVL + 0) -ge 1 ] + echo "nnn is already running" + return + end + end + + # The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set) + # To cd on quit only on ^G, remove the "-x" as in: + # set NNN_TMPFILE "$XDG_CONFIG_HOME/nnn/.lastd" + # NOTE: NNN_TMPFILE is fixed, should not be modified + if test -n "$XDG_CONFIG_HOME" + set -x NNN_TMPFILE "$XDG_CONFIG_HOME/nnn/.lastd" + else + set -x NNN_TMPFILE "$HOME/.config/nnn/.lastd" + end + + # Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn + # stty start undef + # stty stop undef + # stty lwrap undef + # stty lnext undef + + nnn $argv + + if test -e $NNN_TMPFILE + source $NNN_TMPFILE + rm $NNN_TMPFILE + end + end + + function n2 -d "Start nnn in dual pane (tmux)" + tmux new-session -d -s nnn -n nnn "nnn -Hc" + tmux split-window -h "nnn -Hc" + TERM=screen-256color command tmux attach -t nnn:nnn + end +end # Lazy cd-ing function .. ; cd .. ; end diff --git a/home/.config/fish/functions/n.fish b/home/.config/fish/functions/n.fish deleted file mode 100644 index 47cda35..0000000 --- a/home/.config/fish/functions/n.fish +++ /dev/null @@ -1,36 +0,0 @@ -# Rename this file to match the name of the function -# e.g. ~/.config/fish/functions/n.fish -# or, add the lines to the 'config.fish' file. - -function n --wraps nnn --description 'support nnn quit and change directory' - # Block nesting of nnn in subshells - if test -n "$NNNLVL" - if [ (expr $NNNLVL + 0) -ge 1 ] - echo "nnn is already running" - return - end - end - - # The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set) - # To cd on quit only on ^G, remove the "-x" as in: - # set NNN_TMPFILE "$XDG_CONFIG_HOME/nnn/.lastd" - # NOTE: NNN_TMPFILE is fixed, should not be modified - if test -n "$XDG_CONFIG_HOME" - set -x NNN_TMPFILE "$XDG_CONFIG_HOME/nnn/.lastd" - else - set -x NNN_TMPFILE "$HOME/.config/nnn/.lastd" - end - - # Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn - # stty start undef - # stty stop undef - # stty lwrap undef - # stty lnext undef - - nnn $argv - - if test -e $NNN_TMPFILE - source $NNN_TMPFILE - rm $NNN_TMPFILE - end -end diff --git a/home/.config/fish/functions/n2.fish b/home/.config/fish/functions/n2.fish deleted file mode 100644 index d652d11..0000000 --- a/home/.config/fish/functions/n2.fish +++ /dev/null @@ -1,5 +0,0 @@ -function n2 -d "Start nnn in dual pane (tmux)" - tmux new-session -d -s nnn -n nnn "nnn -Hc" - tmux split-window -h "nnn -Hc" - TERM=screen-256color command tmux attach -t nnn:nnn -end diff --git a/home/.config/zsh/aliases.zsh b/home/.config/zsh/aliases.zsh index 8212434..33f23a4 100644 --- a/home/.config/zsh/aliases.zsh +++ b/home/.config/zsh/aliases.zsh @@ -23,7 +23,7 @@ alias ncdu="ncdu --color=dark" alias ip="ip -color=always" # vim alias v="nvim" -alias vi='nvim -o "$(fzf)"' +alias vi='fzf | xargs nvim -o' # emacs alias doom="$HOME/.config/emacs/bin/doom" alias e="emacs -nw" diff --git a/home/.local/bin/fzf/fzopen b/home/.local/bin/fzf/fzopen index bf3fed8..4ab9d9a 100755 --- a/home/.local/bin/fzf/fzopen +++ b/home/.local/bin/fzf/fzopen @@ -5,7 +5,7 @@ mimetype=$(file -b --mime-type "$selected") case "$mimetype" in *.doc|*.docx|*.odt|*.ott|*.xls|*.xlsx|*.xlsmx|*.ods|*.odp|*.sxc|*.ppt|*.pptx) libreoffice "$selected" & ;; - *.pdf) zathura "$selected" & ;; + *.pdf|*.cbz|*.cbr|*.cbt|*.cba|*.djvu) zathura "$selected" & ;; text/* | */xml) $EDITOR "$selected" ;; *) xdg-open "$selected" >/dev/null 2>&1 & ;; esac diff --git a/home/.local/bin/pancomp b/home/.local/bin/pancomp new file mode 100755 index 0000000..d57c04a --- /dev/null +++ b/home/.local/bin/pancomp @@ -0,0 +1,20 @@ +#!/bin/sh + +if [ "$1" = "-h" ]; then + echo "Usage: pancomp [input_format] [input_file] [output_format] [output_file]" + exit 0 +fi + +if [ $# -ne 4 ]; then + echo "Bruh, I need 4 arguments." + exit 1 +fi + +pandoc \ + --pdf-engine=xelatex \ + -V 'mainfont:Iosevka Slab' \ + -V 'sansfont:Iosevka Aile' \ + -V 'monofont:Iosevka' \ + -V 'geometry:margin=1in' \ + -f "$1" -t "$3" \ + -o "$4" "$2"