about summary refs log tree commit diff
path: root/emacs/index.sh
blob: d8dbe954b2b3d46987693499609fb94ca679c905 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env zsh


if [ -n "$INSIDE_EMACS" ]; then
    export PAGER="create-shell-pager.sh"
else
    export PAGER="less"
fi


if [ -n "$INSIDE_EMACS" ]; then
    export EDITOR="edit-file-in-emacs.sh"
else
    export EDITOR=$(which vim)
fi


vim () {
    if [ -n "$INSIDE_EMACS" ]; then
        emacsclient -e "(find-file-other-window \"$1\")"
    else
        eval "$EDITOR \"$1\""
    fi
}


man () {
    if [ -n "$INSIDE_EMACS" ]; then
        emacsclient -e  "(man \"$1\")"
    else
        command man "$1"
    fi
}