mirror of https://git.decapod.one/brethil/dotfiles
Compare commits
8 Commits
c5be7e7f0c
...
bef37c3601
Author | SHA1 | Date |
---|---|---|
bretello | bef37c3601 | |
bretello | 0ed9e5373c | |
bretello | d1be12fa3e | |
bretello | 492205e86b | |
bretello | 41b97a1be3 | |
bretello | 9b6494c94d | |
bretello | 2841fada0a | |
bretello | 6235cfb737 |
|
@ -0,0 +1,4 @@
|
||||||
|
# aliases
|
||||||
|
|
||||||
|
Place custom alias definitions in this folder, with a `.zsh` extension.
|
||||||
|
These files will be sourced on startup
|
|
@ -70,6 +70,7 @@
|
||||||
loop: '{{ files | dict2items }}'
|
loop: '{{ files | dict2items }}'
|
||||||
vars:
|
vars:
|
||||||
files:
|
files:
|
||||||
|
'tmux.conf': '~/.tmux.conf'
|
||||||
'vim/vimrc': '~/.vimrc'
|
'vim/vimrc': '~/.vimrc'
|
||||||
'pdbrc.py': '~/.pdbrc.py'
|
'pdbrc.py': '~/.pdbrc.py'
|
||||||
# "ipython": "~/.ipython" # FIXME: ipython config is more complex
|
# "ipython": "~/.ipython" # FIXME: ipython config is more complex
|
||||||
|
|
|
@ -20,8 +20,8 @@ robbyrussell/oh-my-zsh path:plugins/pylint
|
||||||
robbyrussell/oh-my-zsh path:plugins/sudo
|
robbyrussell/oh-my-zsh path:plugins/sudo
|
||||||
robbyrussell/oh-my-zsh path:plugins/vagrant
|
robbyrussell/oh-my-zsh path:plugins/vagrant
|
||||||
robbyrussell/oh-my-zsh path:plugins/vi-mode
|
robbyrussell/oh-my-zsh path:plugins/vi-mode
|
||||||
zdharma-continuum/fast-syntax-highlighting
|
|
||||||
zsh-users/zsh-autosuggestions
|
zsh-users/zsh-autosuggestions
|
||||||
zsh-users/zsh-completions
|
zsh-users/zsh-completions
|
||||||
|
zsh-users/zsh-syntax-highlighting
|
||||||
joshskidmore/zsh-fzf-history-search
|
joshskidmore/zsh-fzf-history-search
|
||||||
ryutok/rust-zsh-completions
|
ryutok/rust-zsh-completions
|
||||||
|
|
|
@ -26,6 +26,8 @@ elif [[ "$(command -v apt-get)" ]]; then
|
||||||
antibody bundle robbyrussell/oh-my-zsh path:plugins/debian
|
antibody bundle robbyrussell/oh-my-zsh path:plugins/debian
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ZSH_HIGHLIGHT_STYLES[comment]='fg=gray,bg=white,bold'
|
||||||
|
|
||||||
# Setup oh-my-zsh path
|
# Setup oh-my-zsh path
|
||||||
export ZSH="$(antibody path robbyrussell/oh-my-zsh)"
|
export ZSH="$(antibody path robbyrussell/oh-my-zsh)"
|
||||||
|
|
||||||
|
@ -85,15 +87,19 @@ alias esource='$EDITOR $HOME/.zshrc'
|
||||||
alias resource='source $HOME/.zshrc'
|
alias resource='source $HOME/.zshrc'
|
||||||
alias dotedit='$EDITOR $DOTFILES/brethil_dotfile.sh'
|
alias dotedit='$EDITOR $DOTFILES/brethil_dotfile.sh'
|
||||||
# Custom definitions files
|
# Custom definitions files
|
||||||
alias funedit='$EDITOR ~/.dotfiles_functions.sh'
|
alias funedit='$EDITOR ~/.dotfiles_functions'
|
||||||
alias aledit='$EDITOR ~/.dotfiles_aliases.sh'
|
alias aledit='$EDITOR ~/.dotfiles_aliases'
|
||||||
|
|
||||||
export p="${HOME}/projects"
|
export p="${HOME}/projects"
|
||||||
export g="${HOME}/git"
|
export g="${HOME}/git"
|
||||||
export w="${HOME}/work"
|
|
||||||
|
|
||||||
source $DOTFILES/functions.zsh
|
|
||||||
source $DOTFILES/aliases.zsh
|
for defname in aliases functions ; do
|
||||||
|
for def in $DOTFILES/$defname/*zsh ; do
|
||||||
|
source $def
|
||||||
|
done
|
||||||
|
done
|
||||||
|
unset def defname
|
||||||
|
|
||||||
# Extras
|
# Extras
|
||||||
functions_file=~/.dotfiles_functions
|
functions_file=~/.dotfiles_functions
|
||||||
|
|
|
@ -23,6 +23,9 @@ BCyan='\e[1;36m' # Cyan
|
||||||
BWhite='\e[1;37m' # White
|
BWhite='\e[1;37m' # White
|
||||||
|
|
||||||
# Underline
|
# Underline
|
||||||
|
if command -v tput &>/dev/null; then
|
||||||
|
UNDERLINE="$(tput smul)"
|
||||||
|
fi
|
||||||
UBlack='\e[4;30m' # Black
|
UBlack='\e[4;30m' # Black
|
||||||
URed='\e[4;31m' # Red
|
URed='\e[4;31m' # Red
|
||||||
UGreen='\e[4;32m' # Green
|
UGreen='\e[4;32m' # Green
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
# functions
|
||||||
|
|
||||||
|
Place custom functions definitions in this folder, with a `.zsh` extension.
|
||||||
|
These files will be sourced on startup
|
|
@ -0,0 +1,55 @@
|
||||||
|
function warning {
|
||||||
|
echo -e "$(color $YELLOW Warning:) $@" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
function error {
|
||||||
|
echo -e "$(color $RED Error:) $@" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
function info {
|
||||||
|
echo -e "$(color $GREEN Info:) $@"
|
||||||
|
}
|
||||||
|
|
||||||
|
function switch-asciinema-user
|
||||||
|
{
|
||||||
|
local conf_dir="$HOME/.config/asciinema"
|
||||||
|
local current_id=$(basename $(readlink -f ${conf_dir}/install-id ))
|
||||||
|
function get_ids {
|
||||||
|
find ${conf_dir} -name 'install-id-*' -exec basename {} \;
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ $1 == "-l" || $1 == "--list" ]]; then
|
||||||
|
echo "$(color $BOLD Available ids): (current = $(color $UNDERLINE ${current_id}))"
|
||||||
|
for _id in $(get_ids); do
|
||||||
|
echo " $(green ➡️) ${_id}"
|
||||||
|
done
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local ids=$(get_ids)
|
||||||
|
local query
|
||||||
|
local new_id
|
||||||
|
if [[ -n "$@" ]]; then
|
||||||
|
query="-q $@"
|
||||||
|
fi
|
||||||
|
new_id=$(echo $ids| fzf --height=$(($(wc -l <<< $ids)+2)) ${query} )
|
||||||
|
if [[ -z $new_id ]]; then
|
||||||
|
warning "Keeping curent id ($(color $UNDERLINE ${current_id}))"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$new_id" == "$current_id" ]]; then
|
||||||
|
warning "id $new_id is already set."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local id_file="${conf_dir}/${new_id}"
|
||||||
|
if [[ ! -f ${id_file} ]]; then
|
||||||
|
error "${id_file} does not exist"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
ln -sf "${id_file}" "${conf_dir}/install-id" && \
|
||||||
|
info "Set \"$new_id\"." || \
|
||||||
|
error "Could not set id \"$new_id\". (run with -l for a list of available profiles)"
|
||||||
|
}
|
|
@ -50,14 +50,12 @@ function ppath
|
||||||
echo "$PWD/$1"
|
echo "$PWD/$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
## Color string with given color. Usage: color $colorname "string", available colors in colors.sh
|
## Color string with given color. Usage: `color $NAME "string"`, available colors in `colors.sh`
|
||||||
function color
|
function color
|
||||||
{
|
{
|
||||||
color=$1
|
color=$1
|
||||||
set -x
|
|
||||||
shift 1
|
shift 1
|
||||||
echo -e "$"$color"$@${CLEAR}\n"
|
echo -e "${color}$@${CLEAR}"
|
||||||
set +x
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -277,6 +275,19 @@ __git_completion_wrapper() {
|
||||||
__completion_wrapper $1 _git
|
__completion_wrapper $1 _git
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# sort branches by latest commit
|
||||||
|
function git-sort-branch-by-usage(){
|
||||||
|
git for-each-ref --sort=committerdate refs/heads/ --format='%(refname:short)'
|
||||||
|
}
|
||||||
|
|
||||||
|
# switch to a recent branch
|
||||||
|
function git-switch-recent-branch(){
|
||||||
|
git switch $1
|
||||||
|
}
|
||||||
|
# compdef git-sort-branch-by-usage git-switch-recent-branch
|
||||||
|
compdef "__git_completion_wrapper __git_recent_branches" git-switch-recent-branch
|
||||||
|
|
||||||
# Runs git log with fzf with preview
|
# Runs git log with fzf with preview
|
||||||
function fgitlog() {
|
function fgitlog() {
|
||||||
git log --oneline $@ | fzf --multi --preview 'git -p show --color=always {+1}' --preview-window=right,60%
|
git log --oneline $@ | fzf --multi --preview 'git -p show --color=always {+1}' --preview-window=right,60%
|
||||||
|
@ -284,7 +295,7 @@ function fgitlog() {
|
||||||
compdef _git fgitlog=git-log
|
compdef _git fgitlog=git-log
|
||||||
|
|
||||||
git-commit-show() {
|
git-commit-show() {
|
||||||
git log --graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" |
|
git log --graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" $@ |
|
||||||
fzf --ansi --no-sort --reverse --tiebreak=index --preview \
|
fzf --ansi --no-sort --reverse --tiebreak=index --preview \
|
||||||
'f() {
|
'f() {
|
||||||
set -- $(echo -- "$@" | grep -o "[a-f0-9]\{7\}")
|
set -- $(echo -- "$@" | grep -o "[a-f0-9]\{7\}")
|
||||||
|
@ -342,7 +353,7 @@ make_backup() {
|
||||||
echo "done"
|
echo "done"
|
||||||
}
|
}
|
||||||
|
|
||||||
make_venv(){
|
mkvenv(){
|
||||||
python -m venv .venv && echo "created venv: .venv"
|
python -m venv .venv && echo "created venv: .venv"
|
||||||
|
|
||||||
read -q source_venv
|
read -q source_venv
|
|
@ -51,7 +51,7 @@ map <leader>ss :setlocal spell!<CR>
|
||||||
nnoremap <leader>M :bel copen<bar>silent make <bar>redraw!<CR>
|
nnoremap <leader>M :bel copen<bar>silent make <bar>redraw!<CR>
|
||||||
nnoremap <leader>wz :call WinZoomToggle()<CR>
|
nnoremap <leader>wz :call WinZoomToggle()<CR>
|
||||||
|
|
||||||
nnoremap <leader>C :close<CR>
|
nnoremap <leader>q :close<CR>
|
||||||
nnoremap <leader>B :Bclose<CR>
|
nnoremap <leader>B :Bclose<CR>
|
||||||
nnoremap <leader>k :Rg<CR>
|
nnoremap <leader>k :Rg<CR>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue