summaryrefslogtreecommitdiff
path: root/user:hugues/net:foret/KeyBindings.zsh
blob: 92824b08b6e15fe87ad29cf4820da4aa3fc4c63c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
##
## Part of configuration files for Zsh 4
## by Hugues Hiegel <hugues@hiegel.fr>
## 
## NO WARRANTY PROVIDED, USE AT YOUR OWN RISKS
##
## You are encouraged to use, modify, and redistribute
## these files with or without this notice.
## 

__nproc ()
{
    echo $(( ${NPROC:-0} $@ > 0 ? ${NPROC:-0} $@ : 0 ))
}

for keymap in viins vicmd emacs
do
    bindkey -M $keymap -s '+' 'Q __up_up ; export NPROC=$(__nproc + 1)\n'
    bindkey -M $keymap -s '-' 'Q __up_up ; export NPROC=$(__nproc - 1) ; [ "$NPROC" -gt 0 ] || unset NPROC\n'
done