This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# skim-tab: Replace zsh's default completion selection menu with skim! | |
# Based on fzf-tab by Aloxaf | |
# temporarily change options | |
'builtin' 'local' '-a' '_stb_opts' | |
[[ ! -o 'aliases' ]] || _stb_opts+=('aliases') | |
[[ ! -o 'sh_glob' ]] || _stb_opts+=('sh_glob') | |
[[ ! -o 'no_brace_expand' ]] || _stb_opts+=('no_brace_expand') | |
'builtin' 'setopt' 'no_aliases' 'no_sh_glob' 'brace_expand' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Text Style Converter - Convert plain text to Unicode styled text | |
Similar to PlainStyle (https://www.shapoco.net/plainstyle/) | |
""" | |
import sys | |
import argparse | |
from typing import Dict, Callable, Optional, List, Tuple |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function skim-nerdfont() { | |
(( $+commands[ascii2uni] )) || { echo "ascii2uni is not installed"; return 1; } | |
(( $+commands[rg] )) || { echo "rg is not installed"; return 1; } | |
local list=$(curl -s https://www.nerdfonts.com/cheat-sheet | rg '^ *\"(.+)\"\: ?\"([a-f0-9]{4})\",?$' --color=never --replace '\u$2 $1' | ascii2uni -a U -q) | |
local select=$(echo $list | sk --query="$1" --multi) | |
echo $select | awk '{print $1}' | tr '\n' ' ' | pbcopy | |
zle reset-prompt; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
# helper functions for https://github.com/Aloxaf/gencomp | |
clean-gencomp() { | |
for file in $GENCOMP_DIR/*; do | |
local cmd=$(basename $file | sed 's/^_//') | |
command -v $cmd &>/dev/null && continue | |
echo "Remove completion for $cmd? [y/N]" | |
read -q |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
keybind_as_widget() { | |
local hash=$(echo $2 | md5) | |
local widget_name="__widget_$hash" | |
eval "function $widget_name() { $2; }" | |
zle -N $widget_name | |
bindkey $1 $widget_name | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function skim-gitignore() { | |
local api="https://www.toptal.com/developers/gitignore/api" | |
local gi=$(curl -sfL $api/list | tr "," "\n" | sk --query="$1" -m --preview "curl -sfLw '\n' $api/{} | bat --style=numbers --color=always --language='Git Ignore'") | |
if [[ $gi ]]; then | |
for prog in $(echo $gi); do; | |
curl -sfLw '\n' "$api/$prog" >> .gitignore; | |
echo "Added $prog to .gitignore"; | |
done; | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
# functions | |
function skim-brew-install() { | |
local inst=$(brew formulae | sk --query="$1" -m --preview 'brew info {}' --bind 'ctrl-space:execute-silent(brew home {})') | |
if [[ $inst ]]; then | |
for prog in $(echo $inst); do; brew install $prog; done; | |
fi | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
skim_browser_bookmark_search() { | |
bookmarks_path=`\ls ~/Library/Application\ Support/*/*/Default/Bookmarks -t1 | head -n 1` | |
jq_script=' | |
def ancestors: while(. | length >= 2; del(.[-1,-2])); | |
. as $in | paths(.url?) as $key | $in | getpath($key) | {name,url, path: [$key[0:-2] | ancestors as $a | $in | getpath($a) | .name?] | reverse | join("/") } | .path + "/" + .name + "\t" + .url' | |
(( $+commands[w3m] )) && local fetch="w3m -dump" || local fetch="curl -sfL" | |
jq -r "$jq_script" < "$bookmarks_path" \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zstyle ':filter-select' case-insensitive yes | |
zstyle ':filter-select' extended-search yes | |
zstyle ':filter-select' hist-find-no-dups yes | |
zstyle ':filter-select' rotate-list yes | |
bindkey '^z1' zaw-git-branches | |
bindkey '^z2' zaw-git-files | |
bindkey '^z3' zaw-git-files-legacy | |
bindkey '^z4' zaw-git-log | |
bindkey '^z5' zaw-git-recent-all-branches |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type op &>/dev/null && { | |
eval "$(op completion zsh)" && compdef _op op | |
[ -f ~/.config/op/plugins.sh ] && source ~/.config/op/plugins.sh | |
# enable auto-completion through op plugins | |
local plugins=($(\ls -1 ~/.config/op/plugins/used_items | sed 's/.[^.]*$//')) | |
for plugin in $plugins; do | |
eval " | |
function _${plugin}_wrapped() { | |
op plugin run -- $plugin \$@ |
NewerOlder