aboutsummaryrefslogtreecommitdiff
path: root/.functions
blob: 2145451ba99bb952f9321083bc30752f98c47a24 (plain)
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
34
35
#!/usr/bin/env bash

open () {
    if [ -f /usr/bin/xdg-open ]; then
        nohup xdg-open "$*" > /dev/null 2>&1 &
    elif [ -f /usr/bin/open ]; then
        /usr/bin/open "$*"
    else
        echo "No usable program is found"
    fi
}

greview () {
    usage='usage: greview <base_branch>'
    if [ $# -lt 1 ]; then
        echo $usage
        return
    fi

    base_branch=$1
    # vim -p $(git diff --merge-base --name-only $base_branch) \
    #     "+tabdo Gvdiff $base_branch" \
    #     "+nmap <C-j> :tabnext<CR>" \
    #     "+nmap <C-k> :tabpreivous<CR>"

    vim $(git diff --merge-base --name-only $base_branch) \
        "+nmap <leader>gd :Gvdiffsplit $base_branch<CR>" 

}

magit () {
    emacs -nw \
        -f magit-status \
        -f delete-other-windows
}