mirror of https://git.decapod.one/brethil/dotfiles
Compare commits
No commits in common. "bef37c36017cab3828fd7d0d9cfd31b5c615f27d" and "c5be7e7f0cddd3971a34bd003c3356eaf9bb3eb3" have entirely different histories.
bef37c3601
...
c5be7e7f0c
|
@ -1,4 +0,0 @@
|
||||||
# aliases
|
|
||||||
|
|
||||||
Place custom alias definitions in this folder, with a `.zsh` extension.
|
|
||||||
These files will be sourced on startup
|
|
|
@ -70,7 +70,6 @@
|
||||||
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,8 +26,6 @@ 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)"
|
||||||
|
|
||||||
|
@ -87,19 +85,15 @@ 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'
|
alias funedit='$EDITOR ~/.dotfiles_functions.sh'
|
||||||
alias aledit='$EDITOR ~/.dotfiles_aliases'
|
alias aledit='$EDITOR ~/.dotfiles_aliases.sh'
|
||||||
|
|
||||||
export p="${HOME}/projects"
|
export p="${HOME}/projects"
|
||||||
export g="${HOME}/git"
|
export g="${HOME}/git"
|
||||||
|
export w="${HOME}/work"
|
||||||
|
|
||||||
|
source $DOTFILES/functions.zsh
|
||||||
for defname in aliases functions ; do
|
source $DOTFILES/aliases.zsh
|
||||||
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,9 +23,6 @@ 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
|
||||||
|
|
|
@ -50,12 +50,14 @@ function ppath
|
||||||
echo "$PWD/$1"
|
echo "$PWD/$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
## Color string with given color. Usage: `color $NAME "string"`, available colors in `colors.sh`
|
## Color string with given color. Usage: color $colorname "string", available colors in colors.sh
|
||||||
function color
|
function color
|
||||||
{
|
{
|
||||||
color=$1
|
color=$1
|
||||||
|
set -x
|
||||||
shift 1
|
shift 1
|
||||||
echo -e "${color}$@${CLEAR}"
|
echo -e "$"$color"$@${CLEAR}\n"
|
||||||
|
set +x
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -275,19 +277,6 @@ __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%
|
||||||
|
@ -295,7 +284,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\}")
|
||||||
|
@ -353,7 +342,7 @@ make_backup() {
|
||||||
echo "done"
|
echo "done"
|
||||||
}
|
}
|
||||||
|
|
||||||
mkvenv(){
|
make_venv(){
|
||||||
python -m venv .venv && echo "created venv: .venv"
|
python -m venv .venv && echo "created venv: .venv"
|
||||||
|
|
||||||
read -q source_venv
|
read -q source_venv
|
|
@ -1,4 +0,0 @@
|
||||||
# functions
|
|
||||||
|
|
||||||
Place custom functions definitions in this folder, with a `.zsh` extension.
|
|
||||||
These files will be sourced on startup
|
|
|
@ -1,55 +0,0 @@
|
||||||
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)"
|
|
||||||
}
|
|
|
@ -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>q :close<CR>
|
nnoremap <leader>C :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