-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenvironment.sh
executable file
·52 lines (43 loc) · 1.41 KB
/
environment.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
41
42
43
44
45
46
47
48
49
50
51
52
# Setup environment
# Common to both bash and zsh
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# Check if a command exists
command_exists () {
type $1 &> /dev/null
}
export TERM=xterm-256color
# Aliases
[ -f $DOTFILES/aliases.sh ] && . $DOTFILES/aliases.sh
[ -f $DOTFILES/path_var.sh ] && . $DOTFILES/path_var.sh
[ -f $DOTFILES/git-completion.bash ] && source $DOTFILES/git-completion.bash
# Device specific settings should be in .bashrc_local
#[ -f ~/.bashrc_local ] && . ~/.bashrc_local
# Work related settings should be in .bashrc_work
#[ -f ~/.bashrc_work ] && . ~/.bashrc_work
# Git
git config --global diff.tool vimdiff
git config --global merge.tool vimdiff
git config --global difftool.prompt false
# Editor
if command_exists nvim; then
export EDITOR=nvim
export VISUAL=nvim
export CSCOPE_EDITOR=nvim
git config --global mergetool.vimdiff.path nvim
else
export EDITOR=vim
export VISUAL=vim
export CSCOPE_EDITOR=vim
fi
# FZF
#export FZF_DEFAULT_COMMAND='ag -g "" --hidden --ignore .git'
#export FZF_DEFAULT_COMMAND='find . -path '*/\.*' -prune -o -type f -print -o -type l -print 2> /dev/null | sed s/^..//'
export FZF_DEFAULT_OPTS='--reverse --color=fg+:221,hl+:1,hl:202'
# cdf - change directory to selected file
cdf() {
local file
local dir
file=$(fzf --reverse --height=50 -q "$1") && dir=$(if [ -d $file ]; then
echo $file; else echo `dirname $file`; fi) && cd "$dir"
}