Skip to content

Instantly share code, notes, and snippets.

@cesalazar
Last active April 23, 2024 08:06
Show Gist options
  • Save cesalazar/aea6c4970612d9b4a1bdfcb7509440d0 to your computer and use it in GitHub Desktop.
Save cesalazar/aea6c4970612d9b4a1bdfcb7509440d0 to your computer and use it in GitHub Desktop.
My github-cli config with aliases
# The current version of the config schema
version: 1
# What protocol to use when performing git operations.
# Supported values: ssh, https
git_protocol: https
# What editor gh should run when creating issues, pull requests, etc.
# If blank, will refer to environment.
editor:
# When to interactively prompt. This is a global config that cannot be
# overridden by hostname. Supported values: enabled, disabled
prompt: enabled
# A pager program to send command output to, e.g. "less".
# Set the value to "cat" to disable the pager.
# pager: less -FgiMRwXz-4
pager: bat
# Aliases allow you to create nicknames for gh commands
aliases:
# (c)heck(o)ut
co: pr checkout
# (e)dit (c)onfig
ec: '!${EDITOR:-vim} $HOME/.config/gh/config.yml'
# (g)ist (e)dit
ge: gist edit
# Returns a gist id
# get-gist-id: '!gh gl | fzf | cut -f1'
#
# TODO: is it really worth this spaghetti?
get-gist-id: "!gh gl | awk -F'\\t' -v width=$(tput cols) \
'{printf \"%-.40s\\t%-.\" width-40 \"s\\n\", $1, $2}' \
| column -s $'\\t' -t | fzf | cut -f1 -d' '"
# (p)ullrequest (c)heck(o)ut (alias of co)
pco: co
# (p)ullrequest (l)ist
pl: pr list
# (g)ist (l)ist
gl: gist list --limit 100
# (g)ist (v)iew
gv: gist view --raw
# (o)pen (p)r
op: pr view
# (o)pen (p)r (in) (b)rowser
opb: pr view -w
# All the fuzzy commands require fzf
# https://github.com/junegunn/fzf
# (f)uzzy (g)ist (e)dit
fge: '!gh ge $(gh get-gist-id)'
# (f)uzzy (g)ist (v)iew
fgv: '!gh gv $(gh get-gist-id)'
# (f)uzzy (g)et (g)ist (id)
fgg: '!gh get-gist-id|(xsel -ib||xclip -selection clipboard -in) 2>/dev/null'
# (f)uzzy (c)heck(o)ut
fco: '!gh co $(gh get-gist-id)'
# The path to a unix socket through which send HTTP connections.
# If blank, HTTP traffic will be handled by net/http.DefaultTransport.
http_unix_socket:
# What web browser gh should use when opening URLs.
# If blank, will refer to environment.
browser:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment