Skip to content

Instantly share code, notes, and snippets.

@tucq88
Last active May 8, 2017 07:35
Show Gist options
  • Save tucq88/8440cb4da08178a604fe10227b4ee6e5 to your computer and use it in GitHub Desktop.
Save tucq88/8440cb4da08178a604fe10227b4ee6e5 to your computer and use it in GitHub Desktop.
Dotfiles for server
.bash_rc
.inputrc
.gitconfig
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Sudo as normal
alias sudo='sudo '
# User specific aliases and functions
alias g="git" ## If g alias not has autocomplete, check https://gist.github.com/tucq88/241fd5482fb2fe8541367301466a86f4
alias v="vim"
alias vi='vim'
# Easier navigation: .., ..., ~ and -
alias ..="cd .."
alias cd..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ~="cd ~" # `cd` is probably faster to type though
alias -- -="cd -"
alias ll='ls -llhX'
alias la='ls -lahX'
# mv, rm, cp
alias mv='mv -v'
alias rm='rm -i -v'
alias cp='cp -v'
alias mvu='mv * .[^.]* ..' # Move all to upper dir
export HISTSIZE=1000000
export HISTFILESIZE=1000000000
# Git branch - https://coderwall.com/p/fasnya/add-git-branch-name-to-bash-prompt
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
[alias]
c = commit -am
cm = commit -m
ca = commit -am
up = pull
p = push
s = status -s
st = status
sclone = clone --depth=1
df = diff --color --color-words --abbrev
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --
co = checkout
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"
reup = rebase-update
[color]
ui = always
[core]
excludesfile = ~/.gitignore
attributesfile = ~/.gitattributes
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
commit = green bold
frag = magenta bold
old = red bold
new = green bold
whitespace = red reverse
[color "status"]
added = yellow
changed = green
untracked = cyan
[merge]
tool = opendiff
[user]
name = "Tucq"
email = "[email protected]"
[credential]
helper = cache --timeout=3600000
useHttpPath = true
[url "https://github.com/"]
insteadOf = git://github.com/
# .inputrc
# Make Tab autocomplete regardless of filename case
set completion-ignore-case on
# List all matches in case multiple possible completions are possible
set show-all-if-ambiguous on
# Immediately add a trailing slash when autocompleting symlinks to directories
set mark-symlinked-directories on
# Use the text that has already been typed as the prefix for searching through
# commands (basically more intelligent Up/Down behavior)
"\e[B": history-search-forward
"\e[A": history-search-backward
# ctrl left, ctrl right for moving on the readline by word
"\e[1;5C": forward-word
"\e[1;5D": backward-word
# Do not autocomplete hidden files unless the pattern explicitly begins with a dot
set match-hidden-files off
# Show all autocomplete results at once
set page-completions off
# If there are more than 200 possible completions for a word, ask to show them all
set completion-query-items 200
# Show extra file information when completing, like `ls -F` does
set visible-stats on
# Be more intelligent when autocompleting by also looking at the text after
# the cursor. For example, when the current line is "cd ~/src/mozil", and
# the cursor is on the "z", pressing Tab will not autocomplete it to "cd
# ~/src/mozillail", but to "cd ~/src/mozilla". (This is supported by the
# Readline used by Bash 4.)
set skip-completed-text on
# Allow UTF-8 input and output, instead of showing stuff like $'\0123\0456'
set input-meta on
set output-meta on
set convert-meta off
# Use Alt/Meta + Delete to delete the preceding word
"\e[3;3~": kill-word
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment