Skip to content

Instantly share code, notes, and snippets.

@pawelztef
Created February 24, 2019 20:06
Show Gist options
  • Select an option

  • Save pawelztef/f91304f561aa9c74068b6f5d913bd2f8 to your computer and use it in GitHub Desktop.

Select an option

Save pawelztef/f91304f561aa9c74068b6f5d913bd2f8 to your computer and use it in GitHub Desktop.
bashrc config inspiron
# set show-mode-in-prompt off
# set vi-ins-mode-string \1\2  \1\2
# set vi-cmd-mode-string \1\2  \1\2
export HISTCONTROL=ignoreboth:erasedups
export HISTSIZE=1000
export HISTFILESIZE=20000
# append to the history file, don't overwrite it
shopt -s histappend
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
if [ -d $HOME/bin ]; then
PATH=$PATH:$HOME/bin
fi
ranger() {
if [ -z "$RANGER_LEVEL" ]; then
/usr/bin/ranger "$@"
else
exit
fi
}
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color) color_prompt=yes;;
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[1;31m\]\u@\h\[\033[1;31m\]:\[\033[1;31m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\  '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# some more ls aliases
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# 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 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 ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
export FZF_DEFAULT_COMMAND='ag --ignore *.pyc -g ""'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
# Press F1 to open the file with less without leaving fzf
# Press CTRL-Y to copy the line to clipboard and aborts fzf (requires pbcopy)
export FZF_DEFAULT_OPTS='--height 75%'
export FZF_ALT_C_OPTS="--preview 'tree -C {} | head -200'"
# export FZF_CTRL_T_OPTS="--preview '(highlight -O ansi -l {} 2> /dev/null || cat {} || tree -C {}) 2> /dev/null | head -200'"
export FZF_CTRL_R_OPTS="--preview 'echo {}' --preview-window down:3:hidden:wrap --bind '?:toggle-preview'"
export RANGER_LOAD_DEFAULT_RC='false'
export PATH="/usr/local/heroku/bin:$PATH"
export EDITOR=/usr/bin/nvim
export VTE_VERSION="100"
export PROMPT_COMMAND="pwd > /tmp/whereami"
if [ -d $HOME/bin ]; then
PATH=$PATH:$HOME/bin
fi
# Aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
# Applications
alias fiddler="mono Fiddler.exe"
alias apacher="sudo service apache2 restart"
alias chrm="google-chrome"
alias ytd="youtube-dl "
alias g="xdg-open"
alias nv="nvim"
alias snv="sudo nvim"
alias xclip="xclip -selection clipboard"
pretty_curl() {
curl "$1" | jq
}
# Configuration files
alias phpini="sudo nvim /etc/php/7.0/apache2/php.ini"
alias apacheconf="sudo nvim /etc/apache2/apache2.conf"
alias bashrc="sudo nvim ~/.bashrc"
alias vi3="sudo nvim /home/pawelztef/.config/i3/config"
# Folders
alias railsdr="cd ~/Projects/rails_projects"
alias javadr="cd ~/Projects/java_projects/classes && s"
alias ref="cd ~/Projects/rails_projects/refinery && s"
alias lohodr="cd /var/www/html"
alias htmldr="cd /home/pawelztef/Projects/htmlcss_projects"
alias wordpress="cd /var/www"
# Applications
alias myblog="cd /home/pawelztef/Projects/rails_projects/MyBlog"
alias resume="cd /home/pawelztef/Projects/htmlcss_projects/resume && s"
alias simple_cms="cd /home/pawelztef/Projects/rails_projects/simple_cms"
alias bt="cd /home/pawelztef/Projects/rails_projects/klienci/Roman/bt/bettertogether && s"
alias mb="cd /home/pawelztef/Projects/htmlcss_projects/devjournal_static && s"
alias ft="cd /home/pawelztef/Projects/rails_projects/klienci/Foodtrack/foodtrack-v1.0 && s"
alias gra="cd /home/pawelztef/Projects/rails_projects/grazyna && s"
alias art="cd /home/pawelztef/Projects/rails_projects/grazyna/my_art && s"
# Terminal
alias s="export PS1='\[\033[1;31m\]\W \e[0m '"
alias long="export PS1='${debian_chroot:+($debian_chroot)}\[\033[1;31m\]\u \w \e[0m '"
alias sra='sudo ranger --choosedir=$HOME/rangerdir; LASTDIR=`cat $HOME/rangerdir`; cd "$LASTDIR"'
alias ra='ranger --choosedir=$HOME/rangerdir; LASTDIR=`cat $HOME/rangerdir`; cd "$LASTDIR"'
# GIT
alias g="git "
alias ginit='git init'
alias gb='git br'
alias ga='git add'
alias gai='git aa && git ci'
alias gaa='git aa'
alias gs='git s'
alias gstash='git stash'
alias gc='git co'
alias gi='git ci'
alias gr='git rebase'
alias gl='git l'
alias gm='git merge'
alias gcommit='git commit'
alias greset='git reset'
alias gpush='git push'
alias gpull='git pull'
# RAILS
alias rg='rails generate'
alias rcs='rails console --sandbox'
alias rc='rails console'
alias rd='rails db'
alias rs='rails s'
alias rr='rails restart'
alias rakedm='rake db:migrate'
alias rakedms='rake db:migrate:status'
alias rakedr='rake db:reset'
alias rakedrb='rake db:rollback'
alias raker='rake routes'
alias rakedd='rake db:drop'
alias rakedc='rake db:create'
alias rakeds='rake db:seed'
alias b='bundle exec'
rakedmd() {
rake db:migrate:down VERSION="$1"
}
# RAILS CAPISTRANO
alias bcp='bundle exec cap production'
alias bcs='bundle exec cap staging'
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment