Skip to content

Instantly share code, notes, and snippets.

View Osse's full-sized avatar

Øystein Walle Osse

View GitHub Profile
@Osse
Osse / gist:4037147
Created November 8, 2012 06:10 — forked from dahu/gist:3986511
Vim Motions
Large Object Motions:
( ) { }
[[ [] ][ ]]
[m [M ]m ]M
[( ]) [{ ]}
Word Motions:
w W e E
b B ge gE
@Osse
Osse / .zshrc
Created November 10, 2012 14:36
My own backward-kill-word widget
function osse-backward-kill-word {
if [[ $LBUFFER[-1] = ' ' ]]
then
LBUFFER=${LBUFFER%%[\ ]#}
zle osse-backward-kill-word
elif [[ $LBUFFER[-1] = [^a-zA-Z0-9_] ]]
then
LBUFFER=${LBUFFER%%[^a-zA-Z0-9_\ ]#}
else
LBUFFER=${LBUFFER%%[a-zA-Z0-9_]#}
@Osse
Osse / .zshrc
Created November 16, 2012 23:50
man wrapper you can use patterns with
if (( ${#@} == 1 ))
then
command man $1
else
command man --pager="pager -s -p ${(q)*[2,-1]}" $1
fi
# vim: ft=zsh
@Osse
Osse / stdout
Created November 25, 2012 16:13
Terminal transcript
osse@osse-w760:~[master•]$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 5 commits.
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: .gitconfig
# modified: .zfunctions/man
@Osse
Osse / version.sh
Created November 30, 2012 09:34
Version number insertion
sed "/^:build:/ s/$/ $version/;
/^:foover:/ s/$/ $fooversion/;
/^:barver:/ s/$/ $barversion/;
/^:md5:/ s/$/ $md5/" readme.txt |
asciidoc -o readme.html -
@Osse
Osse / weechat.conf
Last active December 11, 2015 00:09
chat_nick_colors = "1,2,3,4,5,6,9,10,11,12,13,14,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,56,57,58,61,62,63,64,65,66 ,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,104,105,106,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,1 25,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,146,147,148,149,150,151,152,153,154,155,156,157,160,161,162,163,164,165,166,167,168,169,170,171,172,173,17 4,175,176,177,178,179,180,181,182,183,184,185,186,190,191,192,193,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,226,227,228,229"
@Osse
Osse / .zshrc
Created January 15, 2013 12:08
Copy the current contents of the ZLE buffer to the clipboard
bindkey '^X' copy-command
function copy-command() {
xsel -ib <<< $BUFFER
}
zle -N copy-command
@Osse
Osse / vdwrap
Last active October 18, 2022 18:06
Vimdiff wrapper for use with git difftool --dir-diff
#!/usr/bin/env zsh
# Configuration:
# $ git config --global diff.tool vdwrap
# If you don't put vdwrap somewhere in $PATH then either:
# $ git config --global difftool.vdwrap.cmd '/full/path/vdwrap $LOCAL $REMOTE'
# or:
# $ git config --global difftool.vdwrap.cmd 'vdwrap $LOCAL $REMOTE'
# $ git config --global difftool.vdwrap.path '/full/path'
#
@Osse
Osse / gist:5280101
Last active December 15, 2015 15:09 — forked from anonymous/gist:5280097
command=( /sbin/iptables -A allowed-connection -i wlan0 -m limit -j LOG --log-prefix "Bad packet from wlan0:" )
"${command[@]}"
command=( '/sbin/iptables' '-A' 'allowed-connection' '-i' 'wlan0' '-m' 'limit' '-j' 'LOG' '--log-prefix' 'Bad packet from wlan0:' )
"${command[@]}"