Skip to content

Instantly share code, notes, and snippets.

@jcarsique
Last active January 12, 2024 11:33
Show Gist options
  • Save jcarsique/8581743 to your computer and use it in GitHub Desktop.
Save jcarsique/8581743 to your computer and use it in GitHub Desktop.
Bash config
alias cd..="cd .."
alias md="mkdir"
alias rd="rmdir"
alias mvni="mvn install -DskipTests=true"
alias mvnci="mvn clean install -DskipTests=true"
alias mvnecl='mvn eclipse:clean eclipse:eclipse -Declipse.useProjectReferences=true -fae -nsu ; ~/workspace/nuxeo/fixeclipse'
alias mvn2ecl="mvn eclipse:clean eclipse:m2eclipse -Declipse.useProjectReferences=true && ~/workspace/nuxeo/fixeclipse"
alias mvneclj="mvn eclipse:clean eclipse:eclipse -DdownloadJavadocs=true -Declipse.useProjectReferences=true && ~/workspace/nuxeo/fixeclipse"
alias mvnecls="mvn eclipse:clean eclipse:eclipse -DdownloadSources=true -Declipse.useProjectReferences=true && ~/workspace/nuxeo/fixeclipse"
alias hgl='hg glog|less'
alias hgi="hg id -nibt"
alias hgmerge="hg resolve --all -t fmmerge"
alias mvnpurge="mvn dependency:purge-local-repository -DresolutionFuzziness=version -DactTransitively=false"
alias hgfpup="hgf pull && hgf up"
alias hgpup="hg pull && hg up"
alias jfrog="jf"
# git clone https://github.com/lvv/git-prompt ~/git-prompt
alias git-prompt="source ~/git-prompt/git-prompt.sh"
alias gitconflicts="git diff --name-only --diff-filter=U | xargs $EDITOR"
alias git="LANG=en_US git"
eval "$(hub alias -s)"
alias ghsync='gh tidy $@ && hub sync'
# git clone https://github.com/jcarsique/git-achievements ~/workspace/git-achievements
#export PATH="$PATH:~/workspace/git-achievements"
#alias git="git-achievements"
alias myip='dig +short myip.opendns.com @resolver1.opendns.com'
alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'
alias gitf-st='gitf st|egrep -B2 "^\s?[ACDMRTUXB]"'
alias gitfa-st='gitfa st|egrep -B2 "^\s?[ACDMRTUXB]"'
alias rscreen="gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval 'Meta.restart(_(\"Restarting…\"))'"
alias bat='batcat'
alias cirrus-validate='CIRRUS_REPO_NAME=$(basename $(git rev-parse --show-toplevel)); cirrus validate -f .cirrus.star -p -e CIRRUS_REPO_CLONE_TOKEN=$(gh auth token) -e CIRRUS_BRANCH=$(git branch --show-current) -e CIRRUS_REPO_OWNER=SonarSource -e CIRRUS_REPO_NAME=$CIRRUS_REPO_NAME -e CIRRUS_REPO_FULL_NAME=SonarSource/$CIRRUS_REPO_NAME'
alias cirrus-test='cirrus internal test -e CIRRUS_REPO_CLONE_TOKEN=$(gh auth token)'
alias sonar-scan='sonar-scanner -Dsonar.branch.name=$(git branch --show-current) -Dsonar.branch.target=main'
# see ~/bin/bash_completion_update.sh
complete -F __start_kubectl k
complete -C '/usr/local/bin/aws_completer' aws
complete -C /usr/bin/terraform terraform
complete -C /usr/bin/vault vault
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# synchronized clean history file between terminals/sessions
shopt -s histappend
HISTSIZE=10000
HISTFILESIZE=20000
HISTCONTROL="ignoreboth:erasedups"
HISTIGNORE="history:exit"
# HISTTIMEFORMAT="%F %T "
function historyclean {
if [[ -e "$HISTFILE" ]]; then
exec {history_lock}<"$HISTFILE" && flock --timeout 3 -x $history_lock
history -a
#tac "$HISTFILE" | awk '!x[$0]++' | tac > "$HISTFILE.tmp$$"
# cat "$HISTFILE" | awk '!x[$0]++' > "$HISTFILE.tmp$$"
# mv -f "$HISTFILE.tmp$$" "$HISTFILE"
history -c
history -r
flock --timeout 3 -u $history_lock && unset history_lock
fi
}
function historymerge {
history -n; history -w; history -c; history -r;
}
#trap historymerge EXIT
HISTTIMEFORMAT='' # Save the timestamp, but don't output it
#HISTTIMEFORMAT='%F %T ' # output the time in 'history' see "ht" alias
# History Aliases...
h() { history 30; } # last few history commands
ht() { HISTTIMEFORMAT='%F %T ' history 30;} # history with time stamps
# merge and write history
hm() { source ~/bin/history_merge.bash; }
# Replace in-memory history with written history
hr() { if [[ -n $HISTFILE ]]
then history -c; history -r; echo "history read (replace)";
else echo "history is disabled";
fi }
# Just write the in-memory history to the history file
hw() { if [[ -n $HISTFILE ]]
then history -w; echo "history write (no merge)";
else echo "history is disabled";
fi }
# disable history file save
hd() { unset HISTFILE; }
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
export PATH=${PATH}:~/bin/
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias rgrep='rgrep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
export PATH=${PATH}:/opt/adt-bundle-linux-x86_64/sdk/tools
export PATH=${PATH}:/opt/adt-bundle-linux-x86_64/sdk/platform-tools
export ANDROID_HOME=/opt/adt-bundle-linux-x86_64/sdk/
export MAVEN_OPTS="-Xmx4g -Xms512m -XX:MaxPermSize=1g"
#export MAVEN_OPTS="-Xmx4g -Xms512m -XX:MaxPermSize=1g -XX:+UseParNewGC"
#export MAVEN_OPTS="-Xmx4g -Xms512m -XX:MaxPermSize=1g -XX:+UseG1GC"
export PATH=${PATH}:/usr/lib/dart/bin/
# better find
function f {
find . -path '*/.svn' -prune -o \( -name "$1" -a -type f \) -print
}
# hg and git functions
#. $HOME/workspace/nuxeo-tools-parent/mercurial/.hgfunctions
#. $HOME/workspace/nuxeo/scripts/hgfunctions.sh
#. $HOME/workspace/nuxeo/scripts/gitfunctions.sh
pf() {
find . -type d \( -name '.hg' -o -name '.svn' -o -name target -o -name bin -o -name '.git' \) -prune -o -name 'pom*.xml' \
-print0 | xargs -0 grep -HnE "$1" \{\} \; 2> /dev/null
}
pf0() {
find . -type d \( -name '.hg' -o -name '.svn' -o -name target -o -name bin -o -name '.git' \) -prune -o -name 'pom*.xml' \
-print0 | xargs -0 grep -HlnE "$1" \{\} \; 2> /dev/null
}
pf2() {
find . -type d \( -name '.hg' -o -name '.svn' -o -name target -o -name bin -o -name '.git' \) -prune -o -name 'pom*.xml' \
-print0 | xargs -0 grep -C2 -HnE "$1" \{\} \; 2> /dev/null
}
jf() {
find . -type d \( -name '.hg' -o -name '.svn' -o -name 'target' -o -name bin -o -name '.git' \) -prune -or \( -name '*.xml' -or -name '*.java' -or -name 'MANIFEST.MF' -or \
-name '*.properties' -or -name '*.xhtml' -or -name '*.js' -or -name '*.ftl' -o -name '*.jsp' -o -name '*.txt' -o -name '*.md' -o -name '*.sh' -o -name '*.defaults' -o -name '*.html' \) -type f -print0 \
| xargs -0 grep -HnE "$1" \{\} \; 2> /dev/null
}
jf0() {
find . -type d \( -name '.hg' -o -name '.svn' -o -name 'target' -o -name bin -o -name '.git' \) -prune -or \( -name '*.xml' -or -name '*.java' -or -name 'MANIFEST.MF' -or \
-name '*.properties' -or -name '*.xhtml' -or -name '*.js' -or -name '*.ftl' -o -name '*.jsp' -o -name '*.txt' -o -name '*.md' -o -name '*.sh' -o -name '*.defaults' -o -name '*.html' \) -type f -print0 \
| xargs -0 grep -HlnE "$1" \{\} \; 2> /dev/null
}
jf2() {
find . -type d \( -name '.hg' -o -name '.svn' -o -name 'target' -o -name bin -o -name '.git' \) -prune -or \( -name '*.xml' -or -name '*.java' -or -name 'MANIFEST.MF' -or \
-name '*.properties' -or -name '*.xhtml' -or -name '*.js' -or -name '*.ftl' -o -name '*.jsp' -o -name '*.txt' -o -name '*.md' -o -name '*.sh' -o -name '*.defaults' -o -name '*.html' \) -type f -print0 \
| xargs -0 grep -C2 -HnE "$1" \{\} \; 2> /dev/null
}
xf() {
find . -type d \( -name '.hg' -o -name '.svn' -o -name 'target' -o -name bin -o -name '.git' \) -prune -o \( -name '*.xml' \) -type f -print0 \
| xargs -0 grep -HnE "$1" \{\} \; 2> /dev/null
}
xf0() {
find . -type d \( -name '.hg' -o -name '.svn' -o -name 'target' -o -name bin -o -name '.git' \) -prune -o \( -name '*.xml' \) -type f -print0 \
| xargs -0 grep -HlnE "$1" \{\} \; 2> /dev/null
}
xf2() {
find . -type d \( -name '.hg' -o -name '.svn' -o -name 'target' -o -name bin -o -name '.git' \) -prune -o \( -name '*.xml' \) -type f -print0 \
| xargs -0 grep -C2 -HnE "$1" \{\} \; 2> /dev/null
}
rmrootprojects() {
for dir in $(find . -name pom.xml | xargs grep -Hl '<module>' | sed 's/pom.xml//'); do (
cd $dir
[ -e .project ] && (
[ -e .project.ok ] && (diff -q .project .project.ok || cp .project.ok .project.ok.bak)
) && mv .project .project.ok
); done
}
setrootprojects() {
for dir in $(find . -name pom.xml | xargs grep -Hl '<module>' | sed 's/pom.xml//'); do (
cd $dir
[ -e .project.ok ] && (
[ -e .project ] && (diff -q .project .project.ok || cp .project .project.bak)
) && cp .project.ok .project
); done
}
[ -z "$PS1" ] && return
set_path_and_prompt() {
if [ -z "$_OLD_DEFAULT_PATH" ]; then
_OLD_DEFAULT_PATH=$PATH
fi
if [ -n "M2_HOME" ]; then
PATH="${M2_HOME}/bin:${_OLD_DEFAULT_PATH}"
fi
export PATH
}
set_maven2() {
M2_HOME='/opt/maven'
MAVEN_PROMPT='\[\033[1;31m\]m2 \[\033[0m\]'
export M2_HOME MAVEN_PROMPT
set_path_and_prompt
}
set_maven3() {
M2_HOME="$HOME/.sdkman/candidates/maven/3.8.4"
MAVEN_PROMPT='\[\033[1;33m\]m3 \[\033[0m\]'
export M2_HOME MAVEN_PROMPT
set_path_and_prompt
}
unset_maven() {
unset M2_HOME
unset M2_REPO
unset MAVEN_PROMPT
set_path_and_prompt
}
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# https://github.com/kepkin/dev-shell-essentials
source $HOME/workspace/dev-shell-essentials/dev-shell-essentials.sh
# [email protected]:jcarsique/git.git
source ~/workspace/git/contrib/completion/git-prompt.sh
#__git_complete gitf __git_main
#__git_complete gitfa __git_main
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWUNTRACKEDFILES=1
GIT_PS1_SHOWSTASHSTATE=1
GIT_PS1_SHOWUPSTREAM="auto verbose" # name
#GIT_PS1_SHOWCOLORHINTS=true
# Reduce PWD in prompt to last 30 chars of PWD
function truncate_pwd
{
newPWD="${PWD/#$HOME/~}"
local pwdmaxlen=50
if [ ${#newPWD} -gt $pwdmaxlen ]
then
newPWD="...${newPWD: -$pwdmaxlen}"
fi
}
PROMPT_COMMAND="truncate_pwd;history -a; history -n"
PS1='$? [\[\033[1;35m\]$newPWD$(__git_ps1 " \[\033[1;34m\](%s)")\[\033[0m\]]\$ '
#export PATH=/opt/eclipse/:$PATH
#export PATH=/opt/node/bin/:$PATH
export PATH=$HOME/workspace/fast-export/:$PATH
export PATH=/opt/build/tools/gradle-1.11/bin:$PATH
export PATH=$HOME/workspace/p4v-2014.2.951414/bin:$PATH
PATH=/media/julien/1To/workspace/cov-analysis-linux64-7.5.0/bin:$PATH
if [ -f ~/.wrap_alias ]; then
. ~/.wrap_alias
fi
# https://github.com/github-tools/github-release-notes
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"
export VISUAL=vi
export EDITOR="$VISUAL"
export PATH="$HOME/.poetry/bin:$PATH"
# Generated for envman. Do not edit.
[ -s "$HOME/.config/envman/load.sh" ] && source "$HOME/.config/envman/load.sh"
export PATH="$HOME/.local/bin:$PATH"
sethelm2() {
sudo ln -sf /usr/local/bin/helm2 /usr/local/bin/helm
}
sethelm3() {
sudo ln -sf /usr/local/bin/helm3 /usr/local/bin/helm
}
export PATH=$PATH:/usr/local/go/bin
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
set_maven3
### GIT-PROMPT.SH CONFIG
###
### lines commented-out with single '#' are default values
### lines commented-out with double '##' are examples
###
### NOTE: this is bash syntax - no spaces around "="
###########################################################
# error_bell=off # sound terminal bell when command return code is not zero. (use setterm to set pitch and duration)
# max_file_list_length=100 # in characters
max_file_list_length=0 # in characters
############################################################ MODULES
# git_module=on
svn_module=on
# hg_module=on
# vim_module=on
########################################################### DEFAULT OBJECTS
### Default objects are not displayed. Example:
## default_user=lvv
default_user=julien
## default_host="ahp" # remote host is always shown
default_host="Julianito-2.local" # remote host is always shown
## default_domain="lvvnet"
########################################################### Current Working Dir display
# cwd_cmd='\w' # display full path
## cwd_cmd='\W' # display only last dir of path
## cwd_cmd='cwd_truncate 40' # display only last N chars of path
########################################################### ETC
# Some don't like hostname in uppercase
# upcase_hostname=on # =off
upcase_hostname=off
# Do not do VCS parsing for listed directories
# useful for directories for which it is difficult to maintain .gitignore so
# they are always dirty (ex: home, /etc) or directory with huge repo (ex: linux src)
## vcs_ignore_dir_list=" /etc $HOME /usr/src/linux.git "
########################################################### COLOR
### directory, exit code, root color
# cols=`tput colors`
# if [[ -n "$cols" && $cols -ge 8 ]]; then # if terminal supports colors
# dir_color=CYAN
# rc_color=red
# user_id_color=blue
# root_id_color=magenta
# else # B/W terminal
# dir_color=bw_bold
# rc_color=bw_bold
# fi
### prompt character for root/non-root, default '>' for both
# prompt_char='>'
# root_prompt_char='>'
## prompt_char='$'
## root_prompt_char='#'
prompt_char='$'
root_prompt_char='#'
##### Per host color
### Per host color. If not set, color will be derived from name of host checksum).
### Variable name is uppercase-short-hostname with appended "_host_color"
### Example per-host-color config:
## TASHA_host_color=cyan
## AL_host_color=green
## AHP_host_color=white
##### VCS (version control system) state colors
# init_vcs_color=WHITE # initial
# clean_vcs_color=blue # nothing to commit (working directory clean)
# modified_vcs_color=red # Changed but not updated:
# added_vcs_color=green # Changes to be committed:
# mixed_vcs_color=yellow #
# untracked_vcs_color=BLUE # Untracked files:
# op_vcs_color=MAGENTA
# detached_vcs_color=RED
# :vim:ft=sh ts=8 sw=8 et:
$include /etc/inputrc
$if Bash
#do history expansion when space entered
Space: magic-space
$endif
# Custom
"\e[A": history-search-backward
"\e[B": history-search-forward
set show-all-if-ambiguous on
set completion-ignore-case on
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
"use docx2txt.pl to allow VIm to view the text content of a .docx file directly.
autocmd BufReadPre *.docx set ro
autocmd BufReadPost *.docx %!docx2txt.pl
set number
" size of a hard tabstop
set tabstop=4
" size of an "indent"
set shiftwidth=4
" a combination of spaces and tabs are used to simulate tab stops at a width other than the (hard)tabstop
set softtabstop=4
" make "tab" insert indents instead of tabs at the beginning of a line
set smarttab
" always uses spaces instead of tab characters
set expandtab
" packadd! matchit
" Press Space to turn off highlighting and clear any message already displayed.
":nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
:set hlsearch
" Press F4 to toggle highlighting on/off, and show current value.
:noremap <F4> :set hlsearch! hlsearch?<CR>
# wrap_alias takes three arguments:
# $1: The name of the alias
# $2: The command used in the alias
# $3: The arguments in the alias all in one string
# Generate a wrapper completion function (completer) for an alias
# based on the command and the given arguments, if there is a
# completer for the command, and set the wrapper as the completer for
# the alias.
function wrap_alias() {
[[ "$#" == 3 ]] || return 1
local alias_name="$1"
local aliased_command="$2"
local alias_arguments="$3"
local num_alias_arguments=$(echo "$alias_arguments" | wc -w)
# The completion currently being used for the aliased command.
local completion=$(complete -p $aliased_command 2> /dev/null)
# Only a completer based on a function can be wrapped so look for -F
# in the current completion. This check will also catch commands
# with no completer for which $completion will be empty.
echo $completion | grep -q -- -F || return 0
local namespace=alias_completion::
# Extract the name of the completion function from a string that
# looks like: something -F function_name something
# First strip the beginning of the string up to the function name by
# removing "* -F " from the front.
local completion_function=${completion##* -F }
# Then strip " *" from the end, leaving only the function name.
completion_function=${completion_function%% *}
# Try to prevent an infinite loop by not wrapping a function
# generated by this function. This can happen when the user runs
# this twice for an alias like ls='ls --color=auto' or alias l='ls'
# and alias ls='l foo'
[[ "${completion_function#$namespace}" != $completion_function ]] && return 0
[[ "_longopt" = $completion_function ]] && return 0
# echo DEBUG: Wrapped $alias_name $completion_function
local wrapper_name="${namespace}${alias_name}"
eval "
function ${wrapper_name}() {
let COMP_CWORD+=$num_alias_arguments
args=( \"${alias_arguments}\" )
COMP_WORDS=( $aliased_command \${args[@]} \"\${COMP_WORDS[@]:1}\" )
$completion_function
}
"
# To create the new completion we use the old one with two
# replacements:
# 1) Replace the function with the wrapper.
local new_completion=${completion/-F * /-F $wrapper_name }
# 2) Replace the command being completed with the alias.
new_completion="${new_completion% *} $alias_name"
eval "$new_completion"
}
# For each defined alias, extract the necessary elements and use them
# to call wrap_alias.
eval "$(alias -p | grep -v '[\";|&]' | sed -e 's/alias \([^=][^=]*\)='\''\([^ ][^ ]*\) *\(.*\)'\''/wrap_alias \1 \2 '\''\3'\'' /')"
unset wrap_alias
###########################
# xbindkeys configuration #
###########################
#
# Version: 0.1.3
#
# If you edit this, do not forget to uncomment any lines that you change.
# The pound(#) symbol may be used anywhere for comments.
#
# A list of keys is in /usr/include/X11/keysym.h and in
# /usr/include/X11/keysymdef.h
# The XK_ is not needed.
#
# List of modifier (on my keyboard):
# Control, Shift, Mod1 (Alt), Mod2 (NumLock),
# Mod3 (CapsLock), Mod4, Mod5 (Scroll).
#
# Another way to specifie a key is to use 'xev' and set the
# keycode with c:nnn or the modifier with m:nnn where nnn is
# the keycode or the state returned by xev
#
# This file is created by xbindkey_config
# The structure is :
# # Remark
# "command"
# m:xxx + c:xxx
# Shift+...
#keystate_numlock = enable
#keystate_scrolllock = enable
#keystate_capslock = enable
#"xbindkeys_show"
# control+shift + q
# horizontal scroll to the left
"xte 'mouseclick 6'"
Shift + b:4
# horizontal scroll to the right
"xte 'mouseclick 7'"
Shift + b:5
/bin/bash: q : commande introuvable
# End of xbindkeys configuration
; bind shift + vertical scroll to horizontal scroll events
;(xbindkey '(shift "b:4") "xte 'mouseclick 6'")
;(xbindkey '(shift "b:5") "xte 'mouseclick 7'")
#!/usr/bin/env bash
## Better completion system than /etc/bash_completion.d/: loaded on need only
set -euo pipefail
sudo true
comp_dir=$(pkg-config --variable=completionsdir bash-completion)
# /usr/share/bash-completion/completions
sudo mkdir -p "$comp_dir.bak"
function backup_comp_script() {
local name="$1"
if [ -f "$comp_dir/$name" ]; then
sudo cp "$comp_dir/$name" "$comp_dir.bak/$name"
fi
}
function installComp() {
local comp_file="$1"
local name="$2"
if [ -f "$comp_file" ]; then
if diff -q "$comp_file" "$comp_dir/$name" >/dev/null 2>&1; then
echo "$name is already installed as $comp_dir/$name"
return
fi
backup_comp_script "$name"
sudo install -C "$comp_file" "$comp_dir/$name"
echo "Installed $name as $comp_dir/$name"
else
echo "Missing $comp_file" >&2
fi
}
function writeComp() {
local comp_command="$1"
local name="$2"
local comp_content
if comp_content=$(eval "$comp_command"); then
if diff -q <(echo "$comp_content") "$comp_dir/$name" >/dev/null 2>&1; then
echo "$name is already installed as $comp_dir/$name"
return
fi
backup_comp_script "$name"
echo "$comp_content" | sudo tee "$comp_dir/$name" >/dev/null
echo "Installed $name as $comp_dir/$name"
else
echo "Cannot execute $comp_command"
fi
}
# [email protected]:jcarsique/git.git
installComp "$HOME/workspace/git/contrib/completion/git-completion.bash" git
# Hub https://github.com/github/hub/
installComp "$HOME/workspace/hub/etc/hub.bash_completion.sh" hub
writeComp "gh completion -s bash" gh
#writeComp "jx completion bash" jx
writeComp "kubectl completion bash" kubectl
writeComp "skaffold completion bash" skaffold
#installComp "$HOME/.jfrog/jfrog_bash_completion" jfrog
writeComp "jf completion bash" jf
installComp "$NVM_DIR/bash_completion" nvm
writeComp "npm completion" npm
writeComp "terraform-docs completion bash" terraform-docs
writeComp "yq shell-completion bash" yq
writeComp "op completion bash" op
writeComp "pip completion --bash" pip
#writeComp "poetry completions bash" poetry
writeComp "curl -ksL https://raw.github.com/juven/maven-bash-completion/master/bash_completion.bash" mvn
#writeComp "curl -ksL https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/bash/docker" docker
#writeComp "curl -ksL https://raw.githubusercontent.com/docker/docker/v$(docker version --format '{{.Server.Version}}')/contrib/completion/bash/docker" docker
writeComp "curl -ksL https://raw.githubusercontent.com/docker/cli/v$(docker version --format '{{.Server.Version}}' | sed 's/-.*//')/contrib/completion/bash/docker" docker
writeComp "curl -ksL https://raw.githubusercontent.com/docker/compose/1.29.2/contrib/completion/bash/docker-compose" docker-compose
writeComp "syft completion bash" syft
writeComp "k9s completion bash" k9s
writeComp "cirrus completion bash" cirrus
writeComp "regctl completion bash" regctl
writeComp "eksctl completion bash" eksctl
installComp "$HOME/.asdf/completions/asdf.bash" asdf
writeComp "vkv completion bash" vkv
writeComp "crictl completion" crictl
writeComp "mise completion bash" mise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment