-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.bashrc
More file actions
64 lines (53 loc) · 1.75 KB
/
.bashrc
File metadata and controls
64 lines (53 loc) · 1.75 KB
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
#!/bin/bash
export EDITOR=vim
export PS1='RatoX:\W$ '
export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"
alias st='git status'
alias g='git'
alias codigos='cd $HOME/codigos/'
alias up="python -m SimpleHTTPServer"
alias mongod="mongod --dbpath ~/db"
alias ctags='$(brew --prefix)/bin/ctags -R .'
alias ravim="vim"
alias my-diff="git --no-pager diff HEAD..master --stat"
alias be="bundle exec"
# Yes, I use mutt
alias mutt="torify mutt 2>/dev/null"
# This function is a find/replace in all documents
# e.g: replace rodrigo r_o_d_r_i_g_o
# all files with the string rodrigo will be replaced
function replace {
ag -0 -l "$1" | xargs -0 sed -i "" -E "s/$1/$2/g"
}
# TMUX
# https://gist.github.com/febrianrendak/9578240
function tmux_web {
SESSION_NAME=$1
tmux new -s "$SESSION_NAME" -n editor -d
tmux send-keys -t "$SESSION_NAME" 'vim .' C-m
tmux new-window -n console -t "$SESSION_NAME"
tmux split-window -v -t "$SESSION_NAME:2"
tmux send-keys -t "$SESSION_NAME:2.1" C-m
tmux send-keys -t "$SESSION_NAME:2.2" C-m
tmux attach -t "$SESSION_NAME:1"
}
# This function will open two panels, the first one with VIM on the current directory
# and the second one with two Terminal opens
function t {
DIR_NAME=${PWD##*/}
echo "Trying to create new Tmux session with name '$DIR_NAME'."
tmux has-session -t "$DIR_NAME" 2>/dev/null
if [ $? -eq 1 ]
then
echo "Session not found. Create Session '$DIR_NAME'."
tmux_web "$DIR_NAME"
else
#random string as new session suffix
RAND_NUMB=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 2 | head -n 1)
echo "Session found. Create session with name '$DIR_NAME$RAND_NUMB'"
tmux_web "$DIR_NAME$RAND_NUMB"
fi
echo "Start tmux session $DIR_NAME."
}
# Enable vi-mode on bash when press ESC
set -o vi