Stolen shamelessly from this site.
map <c -J> </c><c -W>j</c><c -W>_
map </c><c -K> </c><c -W>k</c><c -W>_
set wmh=0
</c>
The first two lines allow you to switch between splits much more smoothly — just press to open and maximize the split below the current one and to open and maximize the split above the current one. I chose these mappings because they correspond to vi’s default up and down keys, you might want to use different key combinations if you’ve ever used an editor that had hotkeys for moving from one open file to another.
The last line allows splits to reduce their size to a single line (which includes the filename and position); this saves a lot of space when you have many splits open. By default, vim forces splits to include an additional line that contains the line of text the cursor was on in that file.
This gives you some sort of stacking functionality like in wmii
for a while i was trying to get the latest snapshot compiled on an old linux box. (running dapper).
while running make, i got the following error:
MAKE all cmd/
CC cmd/util.o
cc: '-b' must come at the start of the command line
make[1]: *** [util.o] Error 1
make: *** [dall] Error 2
but i couldn’t find the -b option anywhere grepping through the (make)files:
$ grep -w -r -- -b *
rc/sh.wmii: dmenu -b -fn $WMII_FONT
rc/sh.wmii: os -b -d ${hostenv HOME} $* &
eventuall it turned to be a very funky thing. namely, an older version of mercurial!
the command to generate the snapshot version was wonky, and thus returned the help output of hg, giving a -b option to the compiler….
after this was fixed, i got the following error:
CC cmd/menu/menu.o
cmd/menu/menu.c:228: error: 'XK_KP_Space' undeclared
cmd/menu/menu.c:228: error: 'XK_KP_Equal' undeclared
cmd/menu/menu.c:229: error: 'XK_KP_Enter' undeclared
cmd/menu/menu.c:230: error: 'XK_Return' undeclared
which lookes like missing a X11 include, and yes the following fixes that:
happy wmii-3.6′ing!
access named tags by their position in the list:
for i in 1 2 3 4 5 6 7 8 9; do
sed 's/^ //' <<!
Key $MODKEY-$i
wmiir xwrite /ctl view "\$(wi_tags | sed -n "${i}p")"
Key $MODKEY-Shift-$i
wmiir xwrite /client/sel/tags "-sel+\$(wi_tags | sed -n "${i}p")"
!
done
my current wmiirc
#!/bin/sh -f
# Configure wmii
wmiiscript=wmiirc # For wmii.sh
. wmii.sh
# Configuration Variables
MODKEY=Mod4
UP=k
DOWN=j
LEFT=h
RIGHT=l
# Bars
noticetimeout=5
noticebar=/rbar/!notice
WMII_NORMCOLORS='#bbbbbb #2c2c2c #3d3d3d'
WMII_FOCUSCOLORS='#A0FF00 #686363 #A0FF00'
WMII_RBARCOLORS='#A0FF00 #2c2c2c #3d3d3d'
WMII_BACKGROUND='#304050'
WMII_FONT='6x10'
#WMII_FONT='-artwiz-snap-*-*-*-*-*-*-*-*-*-*-*-*'
# Foreground, background, border
#WMII_FOCUSCOLORS='#fefefe #307080 #5090a0'
#WMII_BACKGROUND='#333333'
#WMII_NORMCOLORS='#cccccc #004050 #002030'
#WMII_FOCUSCOLORS='#000000 #9acd32 #556b2f'
#WMII_BACKGROUND='#333333'
#WMII_NORMCOLORS='#cccccc #2f4f4f #002030'
set -- $(echo $WMII_NORMCOLORS $WMII_FOCUSCOLORS)
WMII_MENU='dmenu -b -fn "$WMII_FONT" -nf '"'$1' -nb '$2' -sf '$4' -sb '$5'"
WMII_9MENU='wmii9menu -font "$WMII_FONT" -nf '"'$1' -nb '$2' -sf '$4' -sb '$5' -br '$6'"
WMII_TERM="uxterm"
WMII_BROWSER="firefox2"
# Column Rules
wmiir write /colrules <<!
/gimp/ -> 17+83+41
/.*/ -> 50+50 # Golden Ratio
!
# Tagging Rules
wmiir write /tagrules <<!
/MPlayer|VLC/ -> ~
/.*trayer.*/ -> t
/.*firefox*/ -> web
!
# Status Bar Info
status() {
echo -n $(uptime | sed 's/.*://; s/,//g') '||' $(date) \
"||" $(wmiir ls /lbar | xargs | wc -w) "tags" \
# "||" $(wmiir cat /client/sel/label)
}
echo $WMII_NORMCOLORS | wmiir create $noticebar
# Event processing
wi_events -s ' ' <<'!'
# Events
Event CreateTag
echo "$WMII_NORMCOLORS" "$@" | wmiir create "/lbar/$@"
Event DestroyTag
wmiir remove "/lbar/$@"
Event FocusTag
wmiir xwrite "/lbar/$@" "$WMII_FOCUSCOLORS" "$@"
Event UnfocusTag
wmiir xwrite "/lbar/$@" "$WMII_NORMCOLORS" "$@"
Event UrgentTag
shift
wmiir xwrite "/lbar/$@" "*$@"
Event NotUrgentTag
shift
wmiir xwrite "/lbar/$@" "$@"
Event LeftBarClick LeftBarDND
shift
wmiir xwrite /ctl view "$@"
Event ClientMouseDown
client=$1; button=$2
case "$button" in
3)
do=$(wi_9menu -initial "$menulast" Stack Default Max Fullscreen Delete Nop)
case "$do" in
Delete)
wmiir xwrite /client/$client/ctl kill;;
Fullscreen)
wmiir xwrite /client/$client/ctl Fullscreen on;;
Stack)
wmiir xwrite /tag/sel/ctl colmode sel stack;;
Max)
wmiir xwrite /tag/sel/ctl colmode sel max;;
Default)
wmiir xwrite /tag/sel/ctl colmode sel default;;
esac
menulast=${do:-"$menulast"}
esac
Event Unresponsive
{
client=$1; shift
msg="The following client is not responding. What would you like to do?$wi_nl"
resp=$(wihack -transient $client \
xmessage -nearmouse -buttons Kill,Wait -print \
"$msg $(wmiir read /client/sel/label)")
if [ "$resp" = Kill ]; then
wmiir xwrite /client/$client/ctl slay &
fi
}&
Event Notice
wmiir xwrite $noticebar $wi_arg
kill $xpid 2>/dev/null # Let's hope this isn't reused...
{ sleep $noticetimeout; wmiir xwrite $noticebar ' '; }&
xpid = $!
# Actions
Action quit
wmiir xwrite /ctl quit
Action exec
wmiir xwrite /ctl exec "$@"
Action rehash
proglist $PATH >$progsfile
Action status
set +xv
if wmiir remove /rbar/status 2>/dev/null; then
sleep 2
fi
echo "$WMII_RBARCOLORS" | wmiir create /rbar/status
while status | wmiir write /rbar/status; do
sleep 1
done
# Key Bindings
Key $MODKEY-Control-t
case $(wmiir read /keys | wc -l | tr -d ' \t\n') in
0|1)
echo -n "$Keys" | wmiir write /keys
wmiir xwrite /ctl grabmod $MODKEY;;
*)
wmiir xwrite /keys $MODKEY-Control-t
wmiir xwrite /ctl grabmod Mod3;;
esac
Key $MODKEY-v
wmiir xwrite $noticebar $wi_ar
Key $MODKEY-space
wmiir xwrite /tag/sel/ctl select toggle
Key $MODKEY-d
wmiir xwrite /tag/sel/ctl colmode sel default
Key $MODKEY-s
wmiir xwrite /tag/sel/ctl colmode sel stack
Key $MODKEY-m
wmiir xwrite /tag/sel/ctl colmode sel max
Key $MODKEY-a
Action $(wi_actions | wi_menu) &
Key $MODKEY-p
eval wmiir setsid "$(wi_menu <$progsfile)" &
Key $MODKEY-t
wmiir xwrite /ctl view $(wi_tags | wi_menu) &
Key $MODKEY-Return
eval $WMII_TERM &
Key $MODKEY-w
wmiir xwrite /ctl view www
Key $MODKEY-x
wmiir xwrite /ctl view dev
Key $MODKEY-o
wmiir xwrite /ctl view "$(read_tags | next_tag)"
Key $MODKEY-i
wmiir xwrite /ctl view "$(read_tags | tac | next_tag)"
Key $MODKEY-Shift-space
wmiir xwrite /tag/sel/ctl send sel toggle
Key $MODKEY-f
wmiir xwrite /client/sel/ctl Fullscreen toggle
Key $MODKEY-Shift-c
wmiir xwrite /client/sel/ctl kill
Key $MODKEY-Shift-t
wmiir xwrite "/client/$(wmiir read /client/sel/ctl)/tags" $(wi_tags | wi_menu) &
Key $MODKEY-$LEFT
wmiir xwrite /tag/sel/ctl select left
Key $MODKEY-$RIGHT
wmiir xwrite /tag/sel/ctl select right
Key $MODKEY-$DOWN
wmiir xwrite /tag/sel/ctl select down
Key $MODKEY-$UP
wmiir xwrite /tag/sel/ctl select up
Key $MODKEY-Shift-$LEFT
wmiir xwrite /tag/sel/ctl send sel left
Key $MODKEY-Shift-$RIGHT
wmiir xwrite /tag/sel/ctl send sel right
Key $MODKEY-Shift-$DOWN
wmiir xwrite /tag/sel/ctl send sel down
Key $MODKEY-Shift-$UP
wmiir xwrite /tag/sel/ctl send sel up
!
# used by others of my functions as well by now
cur_tag() {
wmiir read /tag/sel/ctl | head -n 1
}
read_tags() {
wmiir ls /tag | sed '\,^sel/$,d;s,/,,'
}
next_tag() {
awk -v 'curtag='"$(wmiir read /tag/sel/ctl | head -n 1)" '
NR==1 {first = $0}
$0==curtag {if (getline) print $0; else print first; exit}'
}
switch_tags() {
CURTAG="$(cur_tag)"
if [ "$CURTAG" = "t" ]; then
PREVTAG="$(cat ~/.wmii-3.5/prevtag)"
wmiir xwrite /ctl view "$PREVTAG"
else
echo "$CURTAG" > ~/.wmii-3.5/prevtag
wmiir xwrite /ctl view t
fi
}
# WM Configuration
wmiir write /ctl <<!
view 1
font $WMII_FONT
focuscolors $WMII_FOCUSCOLORS
normcolors $WMII_NORMCOLORS
grabmod $MODKEY
border 1
!
xsetroot -solid "$WMII_BACKGROUND" &
# xloadimage -onroot ~/wallpaper/field.png
export WMII_MENU WMII_9MENU WMII_FONT WMII_TERM WMII_BROWSER
export WMII_FOCUSCOLORS WMII_SELCOLORS WMII_NORMCOLORS
# Misc
progsfile="$(wmiir namespace)/.proglist"
Action status &
wi_proglist $PATH >$progsfile &
# Setup Tag Bar
OIFS="$IFS"; IFS="$wi_nl"
wmiir rm $(wmiir ls /lbar | sed 's,^,/lbar/,')
seltag=$(wmiir read /tag/sel/ctl | sed 1q)
IFS="$OIFS"
wi_tags | while read tag
do
if [ "$tag" = "$seltag" ]; then
echo "$WMII_FOCUSCOLORS" "$tag"
else
echo "$WMII_NORMCOLORS" "$tag"
fi | wmiir create "/lbar/$tag"
done
wi_eventloop
it seems that when I connect to my nx server instance, that from the mac you need a different setting then on linux.
on the mac, you need to select “new floating layer”, where as on linux this isn’t an issue.
Code snippets, Unix, Programming.