Skip to content

Instantly share code, notes, and snippets.

View opennomad's full-sized avatar

Matthias Johnson opennomad

View GitHub Profile
if [[ "$(command -v peco)" ]]; then
# Search shell history with peco: https://github.com/peco/peco
# Adapted from: https://github.com/mooz/percol#zsh-history-search
function peco_select_history() {
BUFFER=$(fc -lnr 1 | peco --initial-filter Regexp --query "$LBUFFER")
CURSOR=$#BUFFER # move cursor
zle -R -c # refresh
}
zle -N peco_select_history
@opennomad
opennomad / snippy.sh
Last active November 5, 2019 15:59 — forked from coderofsalvation/snippy.sh
Snippy text expander
#!/usr/bin/env bash
# video demo at: http://www.youtube.com/watch?v=90xoathBYfk
# augmented by "opennomad": https://gist.github.com/opennomad/15c4d624dce99066a82d
# originally written by "mhwombat": https://bbs.archlinux.org/viewtopic.php?id=71938&p=2
# Based on "snippy" by "sessy"
# (https://bbs.archlinux.org/viewtopic.php?id=71938)
#
# You will also need "dmenu", "zenity", "xsel" and "xdotool". Get them from your linux
# distro in the usual way.
@opennomad
opennomad / 0_reuse_code.js
Last active August 29, 2015 14:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console