update and clean

This commit is contained in:
Jeff Lance 2021-02-19 21:34:24 +01:00
parent 8330cac11b
commit 26353475af
23 changed files with 456 additions and 14 deletions

View File

@ -0,0 +1,2 @@
fpath+="${0:h}/src"

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,53 @@
#compdef buku
#
# Completion definition for buku.
#
# Author:
# Arun Prakash Jana <engineerarun@gmail.com>
#
setopt localoptions noshwordsplit noksharrays
local -a args
args=(
'(-a --add)'{-a,--add}'[add bookmark]:URL tags'
'(--ai)--ai[auto-import bookmarks]'
'(-c --comment)'{-c,--comment}'[comment on bookmark]'
'(--cached)--cached[visit Wayback Machine cached version]:index/url'
'(--colors)--colors[set output colors in 5-letter string]:color string'
'(-d --delete)'{-d,--delete}'[delete bookmark]'
'(--deep)--deep[search matching substrings]'
'(-e --export)'{-e,--export}'[export bookmarks]:html/md/db output file'
'(--expand)--expand[expand a tny.im shortened URL]:index/shorturl'
'(-f --format)'{-f,--format}'[limit fields in print and JSON output]:value'
'(-h --help)'{-h,--help}'[show help]'
'(-i --import)'{-i,--import}'[import bookmarks]:html/md/db input file'
'(--immutable)--immutable[disable title update from web]:value'
'(-j --json)'{-j,--json}'[show JSON output for print and search]:file'
'(-k --unlock)'{-k,--unlock}'[decrypt database]'
'(-l --lock)'{-l,--lock}'[encrypt database]'
'(-n --count)'{-n,--count}'[results per page]:value'
'(--nc)--nc[disable color output]'
'(--np)--np[noninteractive mode]'
'(-o --open)'{-o,--open}'[open bookmarks in browser]'
'(--oa)--oa[browse all search results immediately]'
'(-p --print)'{-p,--print}'[show bookmark details]'
'(-r --sreg)'{-r,--sreg}'[match a regular exression]:regex'
'(--replace)--replace[replace a tag]:tag to replace'
'(-s --sany)'{-s,--sany}'[match any keyword]:keyword(s)'
'(-s --sall)'{-s,--sall}'[match all keywords]:keyword(s)'
'(--shorten)--shorten[shorten a URL using tny.im]:index/url'
'(--suggest)--suggest[show a list of similar tags]'
'(-t --stag)'{-t,--stag}'[search by tag or show tags]'
'(--tacit)--tacit[reduce verbosity]'
'(--tag)--tag[set tags, use + to append, - to remove]'
'(--threads)--threads[max connections for full refresh]:value'
'(--title)--title[set custom title]'
'(-u --update)'{-u,--update}'[update bookmark]'
'(--url)--url[set url]:url'
'(-V)-V[check latest upstream release]'
'(-v --version)'{-v,--version}'[show program version]'
'(-w --write)'{-w,--write}'[open editor]'
'(-x --exclude)'{-x,--exclude}'[exclude keywords]:keyword(s)'
'(-g --debug)'{-g,--debug}'[enable debugging mode]'
)
_arguments -S -s $args

View File

@ -0,0 +1,3 @@
debian
=======

View File

@ -0,0 +1 @@
wget -q -O - "${1}" | sudo apt-key add -

View File

@ -0,0 +1,7 @@
# List packages by size
function apt-list-packages() {
dpkg-query -W --showformat='${Installed-Size} ${Package} ${Status}\n' | \
grep -v deinstall | \
sort -n | \
awk '{print $1" "$2}'
}

View File

@ -0,0 +1,45 @@
#
# Debian Shortcuts and Aliases
#
#
# Common Operations
#
alias acs='apt-cache search' # search through apt software package
# cache
alias aps='apt search' # search through packages list
alias acS='apt-cache show' # show info about a package
alias afs='apt-file search' # search file in packages
alias ags='apt-get source' # fetch source packages through apt-get
alias acp='apt-cache policy' # displays priority of package sources
alias alp='apt-list-packages' # list packages by size
alias aka='apt-key-add' # retrieve and add key to keyring
alias alu="apt list --upgradable" # list upgradable packages
#
# Superuser apt-get Operations
#
alias aga='sudo apt-get autoremove' # autoremove unecessary packages
alias agu='sudo apt-get update' # update packages database
alias agU='sudo apt-get upgrade' # upgrade packages
alias agd='sudo apt-get dist-upgrade' # upgrade dist
alias agc='sudo apt-get clean' # clears out the local repository of
# retrieved package files except lock
# files
alias agi='sudo apt-get install' # install package
alias agp='sudo apt-get purge' # Removes packages along with
# configuration files
alias agr='sudo apt-get remove' # Removes packages, keeps the
# configuration files
alias aguu='agu && agU'
#
# Superuser dpkg Operations
#
alias di='sudo dpkg -i' # install local .deb file

Binary file not shown.

View File

@ -0,0 +1,3 @@
jl-helper
=======

View File

@ -0,0 +1,5 @@
cpv() {
rsync -pogbr -hhh --backup-dir=/tmp/rsync -e /dev/null --progress "$@"
}
compdef _files cpv

View File

@ -0,0 +1,10 @@
# vim:et sts=2 sw=2 ft=zsh
#
# Get .gitignore from distant api
#
function gi() {
curl -sLw "\n" https://www.toptal.com/developers/gitignore/api/"$@" ;
}
compdef _files gi

View File

@ -0,0 +1,23 @@
# vim:et sts=2 sw=2 ft=zsh
#
# Display public ip information
#
URL="ipinfo.io?token=2a605445c3e4fe"
case "${1}" in
(-a)
curl --silent -L ${URL} > /dev/null | jq ;;
(-c)
curl --silent -L ${URL} > /dev/null | jq '.city';;
(-C)
curl --silent -L ${URL} > /dev/null | jq '.country';;
(-i)
curl --silent -L ${URL} > /dev/null | jq '.ip';;
(-r)
curl --silent -L ${URL} > /dev/null | jq '.region';;
(*)
curl --silent -L ${URL} > /dev/null | jq ;;
esac
compdef _files gip

View File

@ -0,0 +1,37 @@
#
# Personal aliases
#
#
# Editors
#
alias vim='nvim' # redirect vim to nvim
#
# Utilities
#
alias md='mkdir -p' # mkdir alias
alias open='xdg-open' # open files
alias ls='lsd' # pretty ls
alias youtube-dl='youtube-dl -f best' # youtube-dl best download
#
# Shortcuts
#
hash -d crs="${HOME}/Cours" # cours
hash -d doc="${HOME}/Documents" # documents
#
# Environment
#
# interactive comments
setopt interactivecomments
bindkey '^R' history-incremental-search-backward

Binary file not shown.

Binary file not shown.

50
conf.d/zim/zimrc Normal file
View File

@ -0,0 +1,50 @@
# Start configuration added by Zim install {{{
# -------
# Modules
# -------
# Sets sane Zsh built-in environment options.
zmodule environment
# Provides handy git aliases and functions.
zmodule git
# Applies correct bindkeys for input events.
zmodule input
# Sets a custom terminal title.
zmodule termtitle
# Utility aliases and functions. Adds colour to ls, grep and less.
zmodule utility
# Provides archive and unarchive functions for easy archive manipulation.
zmodule archive
# Debian aliases and functions.
zmodule debian
# Personal aliases
zmodule jl-helper
# sudo module
zmodule sudo
# z module
zmodule https://github.com/rupa/z.git
#
# Prompt
#
# Exposes git repository status information to prompts.
zmodule git-info
# A customizable version of steeef's prompt theme.
zmodule steeef
# Additional completion definitions for Zsh.
zmodule zsh-users/zsh-completions
# Buku completions modules
zmodule buku
# Enables and configures smart and extensive tab completion.
# completion must be sourced after zsh-users/zsh-completions
zmodule completion
# Fish-like autosuggestions for Zsh.
zmodule zsh-users/zsh-autosuggestions
# Fish-like syntax highlighting for Zsh.
# zsh-users/zsh-syntax-highlighting must be sourced after completion
zmodule zsh-users/zsh-syntax-highlighting
# Fish-like history search (up arrow) for Zsh.
# zsh-users/zsh-history-substring-search must be sourced after zsh-users/zsh-syntax-highlighting
zmodule zsh-users/zsh-history-substring-search
# }}} End configuration added by Zim install

8
conf.d/zim/zlogin Normal file
View File

@ -0,0 +1,8 @@
# Start configuration added by Zim install {{{
#
# User configuration sourced by login shells
#
# Initialize Zim
source ${ZIM_HOME}/login_init.zsh -q &!
# }}} End configuration added by Zim install

28
conf.d/zim/zshenv Normal file
View File

@ -0,0 +1,28 @@
# Start configuration added by Zim install {{{
#
# User configuration sourced by all invocations of the shell
#
# Define Zim location
: ${ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim}
# }}} End configuration added by Zim install
#
# Personnal configuration directives
#
typeset -U path
# >>> set PATH so it includes user's private bin if it exists >>>
path=(~/bin ~/.local/bin $path[@])
# <<< set PATH so it includes user's private bin if it exists <<<
# >>> environment variables >>>
export EDITOR=nvim
export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow --glob "!.git/*"'
export MYVIMRC="${HOME}/.vimrc"
export PASSWORD_STORE_DIR="${HOME}/Private/.password-store"
export PASSWORD_STORE_ENABLE_EXTENSIONS=True
# <<< environment variables <<<
# }}} End personnal configuration directives

153
conf.d/zim/zshrc Normal file
View File

@ -0,0 +1,153 @@
# Start configuration added by Zim install {{{
#
# User configuration sourced by interactive shells
#
# -----------------
# Zsh configuration
# -----------------
#
# History
#
# Remove older command from the history if a duplicate is to be added.
setopt HIST_IGNORE_ALL_DUPS
#
# Input/output
#
# Set editor default keymap to emacs (`-e`) or vi (`-v`)
bindkey -e
# Prompt for spelling correction of commands.
setopt CORRECT
# Customize spelling correction prompt.
#SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '
# Remove path separator from WORDCHARS.
WORDCHARS=${WORDCHARS//[\/]}
# --------------------
# Module configuration
# --------------------
#
# completion
#
# Set a custom path for the completion dump file.
# If none is provided, the default ${ZDOTDIR:-${HOME}}/.zcompdump is used.
#zstyle ':zim:completion' dumpfile "${ZDOTDIR:-${HOME}}/.zcompdump-${ZSH_VERSION}"
#
# git
#
# Set a custom prefix for the generated aliases. The default prefix is 'G'.
#zstyle ':zim:git' aliases-prefix 'g'
#
# input
#
# Append `../` to your input for each `.` you type after an initial `..`
zstyle ':zim:input' double-dot-expand yes
#
# termtitle
#
# Set a custom terminal title format using prompt expansion escape sequences.
# See http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Simple-Prompt-Escapes
# If none is provided, the default '%n@%m: %~' is used.
#zstyle ':zim:termtitle' format '%1~'
#
# zsh-autosuggestions
#
# Customize the style that the suggestions are shown with.
# See https://github.com/zsh-users/zsh-autosuggestions/blob/master/README.md#suggestion-highlight-style
#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=10'
#
# zsh-syntax-highlighting
#
# Set what highlighters will be used.
# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
# Customize the main highlighter styles.
# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/main.md#how-to-tweak-it
#typeset -A ZSH_HIGHLIGHT_STYLES
#ZSH_HIGHLIGHT_STYLES[comment]='fg=10'
# ------------------
# Initialize modules
# ------------------
if [[ ${ZIM_HOME}/init.zsh -ot ${ZDOTDIR:-${HOME}}/.zimrc ]]; then
# Update static initialization script if it's outdated, before sourcing it
source ${ZIM_HOME}/zimfw.zsh init -q
fi
source ${ZIM_HOME}/init.zsh
# ------------------------------
# Post-init module configuration
# ------------------------------
#
# zsh-history-substring-search
#
# Bind ^[[A/^[[B manually so up/down works both before and after zle-line-init
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
# Bind up and down keys
zmodload -F zsh/terminfo +p:terminfo
if [[ -n ${terminfo[kcuu1]} && -n ${terminfo[kcud1]} ]]; then
bindkey ${terminfo[kcuu1]} history-substring-search-up
bindkey ${terminfo[kcud1]} history-substring-search-down
fi
bindkey '^P' history-substring-search-up
bindkey '^N' history-substring-search-down
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
# }}} End configuration added by Zim install
#
# tmux
#
# >>> tmux initialization >>>
#
if [[ $DISPLAY ]]; then
# If not running interactively, do not do anything
[[ $- != *i* ]] && return
if [[ -z "$TMUX" ]] ;then
ID="$( tmux ls | grep -vm1 attached | cut -d: -f1 )" # get the id of a deattached session
if [[ -z "$ID" ]] ;then # if not available create a new one
tmux new-session
else
tmux attach-session -t "$ID" # if available attach to it
fi
fi
fi
# <<< tmux initialization <<<
#
# fuzzy file search
#
# >>> fzf initialization >>>
#
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# <<< fzf initialization <<<

View File

@ -18,3 +18,4 @@ ncmpcpp
nvim
polybar
x
zim

View File

@ -1,12 +1,13 @@
- shell:
-
command: if [ ! -d ${HOME}/.config/aacs ]; then mkdir ${HOME}/.config/aacs; fi
command: '[[ ! -d ${HOME}/.config/aacs ]] && mkdir ${HOME}/.config/aacs'
stdout: true
stderr: true
description: Testing directory
-
command: if [ ! -f ${HOME}/.config/aacs/KEYDB.cfg ]; then wget --no-check-certificate -O ${HOME}/.config/aacs/KEYDB.cfg http://vlc-bluray.whoknowsmy.name/files/KEYDB.cfg; fi
command: '[[ ! -f ${HOME}/.config/aacs/KEYDB.cfg ]] && /bin/bash -c "curl -fsSL http://vlc-bluray.whoknowsmy.name/files/KEYDB.cfg -o ${HOME}/.config/aacs/KEYDB.cfg"'
stdout: true
stderr: true
description: Downloading AACS db keys

View File

@ -1,14 +1,26 @@
- shell:
- command: '/bin/bash -c "curl -fsSL https://raw.githubusercontent.com/zimfw/install/master/src/templates/zshenv https://raw.githubusercontent.com/zimfw/install/master/src/templates/zshrc https://raw.githubusercontent.com/zimfw/install/master/src/templates/zlogin https://raw.githubusercontent.com/zimfw/install/master/src/templates/zimrc -o $HOME/.zshenv -o $HOME/.zshrc -o $HOME/.zlogin -o $HOME/.zimrc"'
# stdout: true
description: Getting dotfiles for Zsh IMproved FrameWork
- defaults:
link:
relink: true
- command: '[[ ! -d "$HOME/.zim" ]] && mkdir "$HOME/.zim" ; /bin/bash -c "curl -fsSL https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh -o $HOME/.zim/zimfw.zsh"'
# stdout: true
- shell:
#- command: '/bin/bash -c "curl -fsSL https://raw.githubusercontent.com/zimfw/install/master/src/templates/zshenv https://raw.githubusercontent.com/zimfw/install/master/src/templates/zshrc https://raw.githubusercontent.com/zimfw/install/master/src/templates/zlogin https://raw.githubusercontent.com/zimfw/install/master/src/templates/zimrc -o $HOME/.zshenv -o $HOME/.zshrc -o $HOME/.zlogin -o $HOME/.zimrc"'
# description: Getting dotfiles for Zsh IMproved FrameWork
- command: '[[ ! -d "${HOME}/.zim" ]] && mkdir "${HOME}/.zim" ; /bin/bash -c "curl -fsSL https://github.com/zimfw/zimfw/releases/latest/download/zimfw.zsh -o ${HOME}/.zim/zimfw.zsh"'
description: Creating and getting zim dir and installation file
- command: '/bin/bash -c "$(which zsh) $HOME/.zim/zimfw.zsh install"'
# stdin: true
# stdout: true
# stderr: true
- link:
${HOME}/.zimrc:
path: conf.d/zim/zimrc
${HOME}/.zshenv:
path: conf.d/zim/zshenv
${HOME}/.zlogin:
path: conf.d/zim/zlogin
${HOME}/.zshrc:
path: conf.d/zim/zshrc
${HOME}/.zim/modules/:
glob: true
path: conf.d/zim/modules/*
- shell:
- command: '/bin/bash -c "$(which zsh) ${HOME}/.zim/zimfw.zsh install"'
description: Installing the Zsh IMproved FrameWork