forked from mathiasbynens/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path50_editor.sh
40 lines (33 loc) · 793 Bytes
/
50_editor.sh
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
36
37
38
39
40
# Editing
export VISUAL=vim
# If mvim is installed, use it instead of native vim
if [[ "$(which mvim)" ]]; then
VISUAL="mvim -v"
alias vim="$VISUAL"
fi
if [[ ! "$SSH_TTY" ]]; then
if [[ ! "$TMUX" ]]; then
is_osx && VISUAL=mvim || VISUAL=gvim
fi
export LESSEDIT="$VISUAL ?lm+%lm -- %f"
export GIT_EDITOR="$VISUAL -f"
fi
export EDITOR="$VISUAL"
# VS Code
if [[ "$(which code)" ]]; then
EDITOR="code --wait"
VISUAL="code --wait --new-window"
unset GIT_EDITOR
fi
function q() {
if [[ -t 0 ]]; then
$VISUAL "$@"
else
# Read from STDIN (and hide the annoying "Reading from stdin..." message)
$VISUAL - > /dev/null
fi
}
alias qv="q $DOTFILES/link/.{,g}vimrc +'cd $DOTFILES'"
alias qs="q $DOTFILES"
# For when you have vim on the brain
alias :q=exit