Skip to content

Instantly share code, notes, and snippets.

View cibinmathew's full-sized avatar
🎯
Focusing

Cibin Mathew cibinmathew

🎯
Focusing
View GitHub Profile
@cibinmathew
cibinmathew / fco_advanced_preview.sh
Created August 27, 2022 05:51
fco_preview - checkout git branch/tag, with a preview showing the commits between the tag/branch and HEAD
# fco_preview - checkout git branch/tag, with a preview showing the commits between the tag/branch and HEAD
fco_preview() {
# https://github.com/junegunn/fzf/wiki/Examples
local tags branches target
branches=$(
git for-each-ref --color=always --count=30 --sort=-committerdate --format="%(color:green)local \t| %(color:red) %(committerdate:relative) %(color:magenta) |%(refname:short)\t\t|%(color:reset) %(authorname) %09 %(color:red) |%(subject) %(color:reset)" refs/heads/
git for-each-ref --color=always --count=30 --sort=-committerdate --format="%(color:green)remote \t| %(color:red) %(committerdate:relative) %(color:magenta) |%(refname:short)\t\t|%(color:reset) %(authorname) %09 %(color:red) |%(subject) %(color:reset)" refs/remotes/ # refs/remotes/origin
`# git --no-pager branch --all --sort=-committerdate ` \
`# --format="%(if)%(HEAD)%(then)%(else)%(if:equals=HEAD)%(refname:strip=3)%(then)%(else)%1B[0;34;1mbranch%09%1B[m%(refname:short)%(end)%(end)" ` \
@cibinmathew
cibinmathew / fco_preview.sh
Last active August 27, 2022 05:51
fco_preview - checkout git branch/tag, with a preview showing the commits between the tag/branch and HEAD
# https://github.com/junegunn/fzf/wiki/Examples#git
# fco_preview - checkout git branch/tag, with a preview showing the commits between the tag/branch and HEAD
fco_preview() {
local tags branches target
branches=$(
git --no-pager branch --all \
--format="%(if)%(HEAD)%(then)%(else)%(if:equals=HEAD)%(refname:strip=3)%(then)%(else)%1B[0;34;1mbranch%09%1B[m%(refname:short)%(end)%(end)" \
| sed '/^$/d') || return
tags=$(
@cibinmathew
cibinmathew / plugins.tmux.conf
Last active November 17, 2022 16:30
tmux plugins
# Enable below tmux plugins to load
set -g @tpm_plugins ' \
tmux-plugins/tpm \
tmux-plugins/tmux-sensible \
tmux-plugins/tmux-logging \
tmux-plugins/tmux-resurrect \
tmux-plugins/tmux-sidebar \
roosta/tmux-fuzzback \
tmux-plugins/tmux-yank \
@cibinmathew
cibinmathew / alias.sh
Last active August 26, 2022 12:15
Bash/Zsh aliases
# changing permissions
alias chown='chown --preserve-root'
alias chmod='chmod --preserve-root'
alias chgrp='chgrp --preserve-root'
alias chx='chmod --preserve-root +x'
# show recent
alias lt='ls -lhGgotr | tail -10'