-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbashrc
109 lines (93 loc) · 3.33 KB
/
bashrc
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ]; then
PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ]; then
PATH="$HOME/.local/bin:$PATH"
fi
#History hacks#####
# Ignore duplicates, ls without options and builtin commands
HISTCONTROL=ignoredups
export HISTIGNORE="&:ls:[bf]g:exit"
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=100000
HISTFILESIZE=200000
export HISTTIMEFORMAT='%F %T '
# Combine multiline commands into one in history
shopt -s cmdhist
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
eval "`dircolors -b`"
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
fi
# MISC EXPORTS
export EDITOR=vim
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
#Autojump (https://github.com/wting/autojump)
[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && source ~/.autojump/etc/profile.d/autojump.sh
# Change the TERM environment variable (to get 256 colors) and make Vim
# connecting to X Server even if running in a terminal emulator (to get
# dynamic update of syntax highlight and Object Browser):
if [ "x$DISPLAY" != "x" ]
then
if [ "screen" = "$TERM" ]
then
export TERM=screen-256color
else
export TERM=xterm-256color
fi
if [ "x$TERM" == "xxterm" ] || [ "x$TERM" == "xxterm-256color" ]
then
function tvim(){ tmux -2 new-session "TERM=screen-256color vim --servername VIM $@" ; }
else
function tvim(){ tmux new-session "vim --servername VIM $@" ; }
fi
else
if [ "x$TERM" == "xxterm" ] || [ "x$TERM" == "xxterm-256color" ]
then
function tvim(){ tmux -2 new-session "TERM=screen-256color vim $@" ; }
else
function tvim(){ tmux new-session "vim $@" ; }
fi
fi
function __setprompt {
local BLUE="\[\033[0;34m\]"
local NO_COLOUR="\[\033[0m\]"
local SSH_IP=`echo $SSH_CLIENT | awk '{ print $1 }'`
local SSH2_IP=`echo $SSH2_CLIENT | awk '{ print $1 }'`
if [ $SSH2_IP ] || [ $SSH_IP ] ; then
local SSH_FLAG="@\h"
fi
PS1="$BLUE\u$SSH_FLAG:\W\\$ $NO_COLOUR"
PS2="$BLUE>$NO_COLOUR "
PS4='$BLUE+$NO_COLOUR '
}
__setprompt