Last active
August 29, 2015 14:13
-
-
Save mahmoudimus/8dd8b8d384b2fa484eeb to your computer and use it in GitHub Desktop.
mahmoudimus dotfiles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bashrc | |
if [ -e ${HOME}/.git-completion.bash ]; then | |
source ${HOME}/.git-completion.bash | |
git_branch () { | |
__git_ps1 "(%s)" | |
} | |
else | |
git_branch () { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
fi | |
# set a fancy prompt (non-color, unless we know we "want" color) | |
case "$TERM" in | |
xterm-color) | |
color_prompt=yes | |
;; | |
*) | |
PS1='[${debian_chroot:+($debian_chroot)}\u@\h:\w]\$(git_branch)\n% ' | |
;; | |
esac | |
# uncomment for a colored prompt, if the terminal has the capability; turned | |
# off by default to not distract the user: the focus in a terminal window | |
# should be on the output of commands, not on the prompt | |
force_color_prompt=yes | |
if [ -n "$force_color_prompt" ]; then | |
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then | |
# We have color support; assume it's compliant with Ecma-48 | |
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such | |
# a case would tend to support setf rather than setaf.) | |
color_prompt=yes | |
else | |
color_prompt= | |
fi | |
fi | |
if [ "$color_prompt" = yes ]; then | |
PS1="[${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\[\033[01;31m\]\h\[\033[00m\]\[\033[01;32m\]@\D{%y/%m/%d,%H:%M}:\[\033[00m\]" | |
PS1="${PS1}\[\033[01;36m\]\w\[\033[00m\]]\$(git_branch)\n% " | |
else | |
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' | |
fi | |
export PS1; | |
unset color_prompt force_color_prompt | |
# If this is an xterm set the title to user@host:dir | |
case "$TERM" in | |
xterm*|rxvt*) | |
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"' | |
;; | |
*) | |
;; | |
esac | |
# functions | |
pushd() | |
{ | |
if [ $# -eq 0 ]; then | |
DIR="${HOME}" | |
else | |
DIR="$1" | |
fi | |
builtin pushd "${DIR}" > /dev/null | |
echo -n "DIRSTACK: " | |
dirs | |
} | |
pushd_builtin() | |
{ | |
builtin pushd > /dev/null | |
echo -n "DIRSTACK: " | |
dirs | |
} | |
popd() | |
{ | |
builtin popd > /dev/null | |
echo -n "DIRSTACK: " | |
dirs | |
} | |
function .. (){ | |
local arg=${1:-1}; | |
local dir="" | |
while [ $arg -gt 0 ]; do | |
dir="../$dir" | |
arg=$(($arg - 1)); | |
done | |
cd $dir >&/dev/null | |
} | |
# aliases | |
alias cd='pushd' | |
alias back='popd' | |
alias flip='pushd_builtin' | |
# emacs keybindings | |
set -o emacs | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set editing-mode emacs | |
set keymap emacs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
RELEASE=$(awk -F= '/^NAME/{print $2}' /etc/os-release) | |
cp -p tmux.conf ~/.tmux.conf | |
cp -p inputrc ~/.inputrc | |
cp -p bash_customizations.bash ~/.bash_customizations | |
if [[ ${RELEASE} =~ '"Ubuntu"' ]]; then | |
echo -n | |
fi | |
if ! grep -q "\. ~/.bash_customizations" .bashrc; then | |
echo ". ~/.bash_customizations # added by install.bash" >> ~/.bashrc | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tmux conf | |
# ~/.tmux.conf -- tmux terminal multiplexer config | |
set -g history-limit 100000 | |
# emacs mode | |
set-option -g status-keys emacs | |
set-window-option -g mode-keys emacs | |
# @mjallday, you win - going to use C-a | |
set -g prefix C-a | |
unbind C-b | |
bind C-a send-prefix | |
# shorten delay when sending cmds | |
# set -sg escape-time 1 | |
# let's me bind $PREFIX r to reload | |
bind r source-file ~/.tmux.conf \; display "Reloaded tmux.conf!" | |
# screen splitting helpers | |
# - windows act like stacks, so when splitting horizontally, you're | |
# STACKING windows horizontally. Same with vertical. This keybinding | |
# just helps put visual cues | |
bind | split-window -h | |
bind - split-window -v | |
# movement | |
bind h select-pane -L | |
bind j select-pane -D | |
bind k select-pane -U | |
bind l select-pane -R | |
# cycle through C-a C-h | |
bind -r C-p select-window -t :- | |
bind -r C-n select-window -t :+ | |
# The default repeat limit is 500 milliseconds, and we can | |
# change that by setting the `repeat-time` option to a | |
# higher value. | |
bind -r H resize-pane -L 5 | |
bind -r J resize-pane -D 5 | |
bind -r K resize-pane -U 5 | |
bind -r L resize-pane -R 5 | |
# color | |
set -g default-terminal "screen-256color" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment