More youtube dl stuff, updates, using ZDOTDIR, smarter manual completions

This commit is contained in:
caskd 2019-12-31 22:02:41 +01:00
parent 3f5d9cf367
commit 4091206c79
No known key found for this signature in database
GPG Key ID: 79DB21404E300A27
5 changed files with 18 additions and 31 deletions

9
.zshrc
View File

@ -1,4 +1,3 @@
ZSHBASECFG=/home/caskd/.zsh
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
@ -7,7 +6,7 @@ if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/tty1 ]]; then
logout
fi
source "${ZSHBASECFG}/completions.zsh"
source "${ZSHBASECFG}/preferences.zsh"
source "${ZSHBASECFG}/bindings.zsh"
source "${ZSHBASECFG}/custom.zsh"
source "${ZDOTDIR}/completions.zsh"
source "${ZDOTDIR}/preferences.zsh"
source "${ZDOTDIR}/bindings.zsh"
source "${ZDOTDIR}/custom.zsh"

View File

@ -1,5 +1,7 @@
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zshcompcache
zstyle ':completion:*:manuals' separate-sections true
zstyle ':completion:*:manuals.*' insert-sections true
zstyle ':completion:*' expand prefix suffix
zstyle ':completion:*' file-sort modification
zstyle ':completion:*' list-suffixes true
@ -12,6 +14,6 @@ zstyle ':completion:*:approximate:*' max-errors 1 numeric
zstyle ':completion:*:functions' ignored-patterns '_*'
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'
zstyle :compinstall filename '${ZSHBASECFG}/completions.zsh'
zstyle :compinstall filename '${ZDOTDIR}/completions.zsh'
autoload -Uz compinit
compinit

View File

@ -1,4 +1,3 @@
ZSHCUSTOMDIR="${ZSHBASECFG}/custom"
source "${ZSHCUSTOMDIR}/dirstack.zsh"
source "${ZSHCUSTOMDIR}/prependsudo.zsh"
source "${ZSHCUSTOMDIR}/others.zsh"
source "${ZDOTDIR}/custom/dirstack.zsh"
source "${ZDOTDIR}/custom/prependsudo.zsh"
source "${ZDOTDIR}/custom/others.zsh"

View File

@ -19,23 +19,12 @@ function docker-all {
function build-n-push {
docker build ${1} --tag=localhost:5000/${2} --force-rm=true --compress=true && docker push localhost:5000/${2}
}
function manpdf {
man -Tpdf $1 | okular - &
disown
}
function gitsubrepo {
find . -maxdepth 1 -mindepth 1 -type d -exec sh -c '(echo {} && cd {} && git status -s && echo)' \;
}
function gitcom {
git add -A && git commit -am "$1" && git push
# git diff HEAD^ --compact-summary | while read LINE; do echo "$LINE"; done
}
function osutab {
xinput set-prop 'UGTABLET 6 inch PenTablet Pen (0)' --type=float 153 3.5 0 -0.5 0 2.9 0 0 0 1
}
function ignorekate {
printf ".*~\n*.kate-swp" >> .gitignore
}
function tonullpointer {
if [ -z ${1} ]; then
RANDFN=${RANDOM}
@ -50,16 +39,14 @@ function convert2gif {
ffmpeg -hwaccel vdpau -i $1 -r 60 -vf "scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 ${1%.*}.gif
}
function youtube2gif {
if [ -z ${1} ] || [ -z ${2} ] || [ -z ${3} ]; then
echo "Usage: youtube2gif <url> <start position> <lenght> [resolution] [framerate] [bitrate]";
else
ffmpeg -ss ${2} -t ${3} -hwaccel vdpau -i $(youtube-dl -gf "bestvideo[height<=${4-360}]" ${1}) -r ${5-60} -vf "scale=${4-360}:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -b:v ${6-1000} -loop 0 -f gif -;
fi
ffmpeg -ss ${2} -t ${3} -hwaccel vdpau -i $(youtube-dl -gf "bestvideo[height<=${4-360}]" ${1}) -r ${5-60} -vf "scale=${4-360}:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 -f gif -;
}
function youtubecrop {
ffmpeg -ss $2 -t $3 -hwaccel vdpau -i $(youtube-dl -gf "best[height<=360]" "${1}") -r 60 -loop 0 $4
}
alias recordscreen='ffmpeg -video_size 1920x1080 -framerate 60 -f x11grab -i :0 -c:v libx264 -crf 0 -preset ultrafast'
alias ytdldown='youtube-dl -xcw --audio-format best --add-metadata --embed-thumbnail -o "/home/caskd/Media/Music/%(artist)s/%(album)s/%(title)s.%(ext)s"'
alias ytdldown='youtube-dl --no-part --newline -xcw --audio-format best --add-metadata --embed-thumbnail -o "/home/caskd/Media/Music/%(album)s/%(artist)s/%(track)s.%(ext)s"'
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias diff='diff --color=auto'

View File

@ -4,7 +4,7 @@ SAVEHIST=1000
setopt appendhistory autocd extendedglob nomatch notify hist_ignore_all_dups hist_ignore_space nobeep
if [ -z "$SSH_CONNECTION" ] && ! [ -z "$DISPLAY" ]; then
source ${ZSHBASECFG}/powerlevel10k/powerlevel10k.zsh-theme
source ${ZDOTDIR}/powerlevel10k/powerlevel10k.zsh-theme
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
os_icon
@ -44,8 +44,8 @@ else
prompt clint
fi
source ${ZSHBASECFG}/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
source ${ZDOTDIR}/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
source ${ZSHBASECFG}/zsh-autosuggestions/zsh-autosuggestions.zsh
source ${ZDOTDIR}/zsh-autosuggestions/zsh-autosuggestions.zsh
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
ZSH_AUTOSUGGEST_USE_ASYNC=true