Skip to content

Instantly share code, notes, and snippets.

@rchatterjee
Last active August 5, 2020 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rchatterjee/38744b6bec1b830cafaa79a34e5b107e to your computer and use it in GitHub Desktop.
Save rchatterjee/38744b6bec1b830cafaa79a34e5b107e to your computer and use it in GitHub Desktop.
This is my git/bash/emacs dot files. Just for educational purposes. The way to install them is putting them on `$HOME` (or `~/`) folder. I use Ubuntu OS with Emacs 24.6. WARNING: These files might have some dependencies that are not met in your machine. Use at your own risk.
# common shell commands
alias emacs="emacsclient -t" # used to be "emacs -nw"
alias semac="sudo emacsclient -t" # used to be "sudo emacs -nw"
alias emacsgui="emacsclient -c -a emacs" # new - opens the GUI with alternate non-daemon
alias em="emacs"
alias eamcs="em"
alias emac="emacs"
alias wl="wc -l"
alias la="ls -a"
alias p="pwd"
alias lh="ls -ltrh"
alias ll="ls -ltrF"
alias la="ls -altrh"
# tmux shortcuts
alias tmls="tmux ls"
alias tjoin="tmux a -t"
alias tnew="tmux new -s"
# git shortcuts
alias gpull="git pull"
alias gpu="git pull --rebase"
alias gpush="git push"
alias glog="git log"
alias gst="git status"
alias gl="git stash list"
alias gdf="git diff"
alias gct="git checkout"
alias ggrep="git grep"
# docker shortcuts
alias di="docker images"
alias dps="docker ps"
alias docker="sudo docker"
# copy paste
alias c="xclip -sel clip"
alias v="xclip -o"
# Aptitude shortcuts
alias ud="sudo apt update"
alias ug="sudo apt upgrade"
alias ins="sudo apt install"
alias remove="sudo apt autoremove"
alias sear="apt search"
alias pins="pip install -U"
# load source file
alias load="source ~/.bashrc"
alias speed="speedometer -r wlan0"
alias nautilus="nautilus --no-desktop"
# Reset
Color_Off='\e[0m' # Text Reset
# Regular Colors
Black='\e[0;30m' # Black
Red='\e[0;31m' # Red
Green='\e[0;32m' # Green
Yellow='\e[0;33m' # Yellow
Blue='\e[0;34m' # Blue
Purple='\e[0;35m' # Purple
Cyan='\e[0;36m' # Cyan
White='\e[0;37m' # White
# Bold
BBlack='\e[1;30m' # Black
BRed='\e[1;31m' # Red
BGreen='\e[1;32m' # Green
BYellow='\e[1;33m' # Yellow
BBlue='\e[1;34m' # Blue
BPurple='\e[1;35m' # Purple
BCyan='\e[1;36m' # Cyan
BWhite='\e[1;37m' # White
# Underline
UBlack='\e[4;30m' # Black
URed='\e[4;31m' # Red
UGreen='\e[4;32m' # Green
UYellow='\e[4;33m' # Yellow
UBlue='\e[4;34m' # Blue
UPurple='\e[4;35m' # Purple
UCyan='\e[4;36m' # Cyan
UWhite='\e[4;37m' # White
# Background
On_Black='\e[40m' # Black
On_Red='\e[41m' # Red
On_Green='\e[42m' # Green
On_Yellow='\e[43m' # Yellow
On_Blue='\e[44m' # Blue
On_Purple='\e[45m' # Purple
On_Cyan='\e[46m' # Cyan
On_White='\e[47m' # White
# High Intensity
IBlack='\e[0;90m' # Black
IRed='\e[0;91m' # Red
IGreen='\e[0;92m' # Green
IYellow='\e[0;93m' # Yellow
IBlue='\e[0;94m' # Blue
IPurple='\e[0;95m' # Purple
ICyan='\e[0;96m' # Cyan
IWhite='\e[0;97m' # White
# Bold High Intensity
BIBlack='\e[1;90m' # Black
BIRed='\e[1;91m' # Red
BIGreen='\e[1;92m' # Green
BIYellow='\e[1;93m' # Yellow
BIBlue='\e[1;94m' # Blue
BIPurple='\e[1;95m' # Purple
BICyan='\e[1;96m' # Cyan
BIWhite='\e[1;97m' # White
# High Intensity backgrounds
On_IBlack='\e[0;100m' # Black
On_IRed='\e[0;101m' # Red
On_IGreen='\e[0;102m' # Green
On_IYellow='\e[0;103m' # Yellow
On_IBlue='\e[0;104m' # Blue
On_IPurple='\e[0;105m' # Purple
On_ICyan='\e[0;106m' # Cyan
On_IWhite='\e[0;107m' # White
#
# default .bashrc for users for computer sciences users
#
# $Id: .bashrc,v 1.7 2013/07/16 14:58:44 pdickey Exp $
#
# The following line should be removed for security, but too
# many people get confused if it isn't there. If you remove it, "." (the
# current directory will not be in your path, and you will have to type
# (for example)
# "./a.out" instead of "a.out" in order to run the a.out program
# PATH=$PATH:.
PATH=$HOME/localbin/:$PATH
export PATH
function git-branch-name {
git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3
}
function git-branch-prompt {
local branch=`git-branch-name`
if [ $branch ]; then printf " [%s]" $branch; fi
}
export PYTHONPATH;
# remove domain name (.cs.wisc.edu in our case) from hostname, if domain name
# is in hostname (otherwise, just hostname).
export HOSTNAME=`hostname | sed -e 's/\\..\*//'`
#export LD_LIBRARY_PATH=/u/r/c/rchat/local/lib:$LD_LIBRARY_PATH
# Add aliases to the .bashrc.local file.
#
# For more information on aliases, and shell commands in general,
# type "man bash"
alias rm="rm -i" # always ask before removing a file
alias mv="mv -i" # always ask before moving a file onto another file
alias cp="cp -i" # always ask before copying a file onto another file
alias logout="exit" # make "logout" work
if [ `uname` = "Linux" ]; then
alias ls="ls -bhF --color"
# "b" will show control characters as '?'
# "F" will show a trailing "/" after directories
# and a "*" after executables
# --color will do color coding for different file types
alias grep="grep --color=auto" # default to a colorful grep output.
# this alias is safe to remove if you prefer plaintext.
fi
source ~/.bash_aliases
function PWD {
pwd | awk -F\/ '{print $(NF-1)"/"$(NF)}'
}
red="\[\033[01;31m\]"
green="\[\033[01;32m\]"
resetcolor="\[\033[00m\]"
if [ "$PS1" ]; then
# set -o ignoreeof # ignore ^D (^D Will not exit the shell)
#set -o noclobber # prevent > to existing files
set -o notify # Report change in job status
export PS2="---> "
# export PS1="[\u@\h] (\#)\$ " # Set our prompt (man bash for more info)
# the line below will generate a very colorful prompt for those who
# like such things
#export PS1="\[\033[01;33m\][\u@\h: \$(PWD)]\[\033[01;33m\] \[\033[0;32m\]\$(git-branch-prompt)(\#)\$ \[\033[00m\]\n"
export PS1="\[\033[01;32m\][\u@\h: \[\033[1;33m\]\$(PWD)]\[\033[0;32m\]\$(git-branch-prompt)\$ \[\033[00m\]"
if [ -n "$TERM" ]; then
if [ "$TERM" = "xterm" ]; then
# define 'name', 'icon', and 'title' to allow the user to give
# xterm windows names by hand.
function name() { echo -en "\033]0;$@\007"; }
function icon() { echo -en "\033]1;$@\007"; }
function title() { echo -en "\033]2;$@\007"; }
# use xrs (resize) to reset window size after
# resizing an xterm
alias xrs='set -o noglob; eval `resize`; unset noglob'
fi
fi
fi;
export ALTERNATE_EDITOR=""
export EDITOR=emacs
xset -b
if [ -f ~/.bashrc.local ]; then
source ~/.bashrc.local
fi
export PATH=$PATH:$HOME/genymotion/tools:
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/
#PS1="\u@\h \[\033[0;36m\]\W\[\033[0m\]\[\033[0;32m\]\$(git-branch-prompt)\[\033[0m\] \$ "
# source /usr/local/bin/activate.sh
export PATH="$HOME/.pyenv/bin:~/go/bin/:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
;; CSL UNIX .emacs
;;
;; .emacs file
;; $Id: .emacs,v 1.18 2004/01/15 19:54:44 john Exp $
;;
;; This file contains customization information for the text editor
;; emacs. The language that is used is called elisp, which is a emacs
;; version of lisp.
(setq package-list '(auto-complete web-mode saveplace ace-jump-mode auctex-latexmk))
(setq package-archives
'(("gnu" . "http://elpa.gnu.org/packages/")
;; ("marmalade" . "https://marmalade-repo.org/packages/")
;; ("melpa" . "http://melpa.org/packages/")
("melpa-stable" . "https://stable.melpa.org/packages/"))
)
(package-initialize)
; fetch the list of packages available
(unless package-archive-contents
(package-refresh-contents))
; install the missing packages
(dolist (package package-list)
(unless (package-installed-p package)
(package-install package)))
;; Autocomplete the C/C++ file :
;; (add-to-list 'load-path "~/.emacs.d")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(ac-config-default)
;; Python Hook
(add-hook 'python-mode-hook
(function (lambda ()
(setq indent-tabs-mode nil
tab-width 4))))
;; For python linting
(defun flycheck-python-setup ()
(flycheck-mode))
(add-hook 'python-mode-hook #'flycheck-python-setup)
;; C Hook
(add-hook 'c-mode-hook
(function (lambda ()
(setq indent-tabs-mode nil
tab-width 4))))
(setq-default c-basic-offset 4)
(setq indent-tabs-mode nil
tab-width 4)
;; ????
;; (add-to-list 'load-path "~/.emacs.d/predictive")
;; (require 'predictive)
;; (autoload 'predictive-mode "predictive" "predictive" t)
;; (set-default 'predictive-auto-add-to-dict t)
;; (setq predictive-main-dict 'rpg-dictionary
;; predictive-auto-learn t
;; predictive-add-to-dict-ask nil
;; predictive-use-auto-learn-cache nil
;; predictive-which-dict t)
;; auto save list
(setq backup-directory-alist `(("." . "~/.emacs.d/saves")))
(setq delete-old-versions t
kept-new-versions 2
kept-old-versions 2
version-control t)
;; ido mode
(setq ido-enable-flex-matching t)
(setq ido-everywhere t)
(ido-mode t)
(setq ido-file-extensions-order '(".tex" ".c" ".h" ".py" ".cpp"))
(setq ido-ignore-extensions t)
;; ###########################################################################
;; The following two lines fix a problem that some people have. The original
;; emacs mapped C-h to be the help screen. Unfortunately, this is the same
;; as backspace. So, attempting to press backspace would bring up a help
;; screen. The new key-binding for help is C-x h.
(global-set-key "\^xh" 'help-for-help)
(global-set-key "\^h" 'backward-delete-char-untabify)
;;
;; require-final-newline ensures that every line of a text file ends with a
;; "newline" characted. Many unix utilities need a final newline in order to
;; read the last line of the file. You probably don't want to change this.
;; (setq require-final-newline t)
;; Uncomment the following to see the line number, column number and time
(line-number-mode t)
(column-number-mode t)
(display-time)
;; If you would like smooth scrolling, uncomment this line
(setq scroll-step 1)
;; For a much better buffer list:
(global-set-key "\C-x\C-b" 'electric-buffer-list)
;; ###########################################################################
;; The following is an example of how to customize the c-mode. There are
;; also different modes for asm, c++, lisp, perl, tcl, tex, etc...
;; you can have GNU, K&R, BSD, C++, Whitesmith
(setq default-c-style 'K&R)
;; another useful option
;(setq c-auto-newline t)
;;; Re-enable from "novice"
(put 'eval-expression 'disabled nil)
(put 'downcase-region 'disabled t) ;; It's very annoying to do this
(put 'upcase-region 'disabled t) ;; by accident!
;; ###########################################################################
;; add some colors to your emacs (not xemacs) session
(cond ((and (not (string-match "XEmacs" emacs-version)) window-system)
(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)
(setq-default indent-tabs-mode nil)
(setq-default tab-width 8)
;(setq indent-line-function 'insert-tab)
; some other font-lock stuff you can set
; (setq font-lock-maximum-decoration 2)
; (font-lock-make-faces t)
; (setq font-lock-face-attributes
; '((font-lock-comment-face "Firebrick")
; (font-lock-string-face "RosyBrown")
; (font-lock-keyword-face "Purple")
; (font-lock-function-name-face "Blue")
; (font-lock-variable-name-face "DarkGoldenrod")
; (font-lock-type-face "DarkOliveGreen")
; (font-lock-reference-face "CadetBlue")))
))
;; android-mode
;;(add-to-list 'load-path "~/android/android-mode/")
;;(require 'android-mode)
;; (defcustom android-mode-sdk-dir "~/android/android-sdk-linux/")
;; CakePHP
;; (add-to-list 'load-path "./emacs-cake2")
;; (require 'cake2)
;; (require 'cl)
;;(require 'anything)
;; (require 'cake)
(global-auto-revert-mode t)
;; For multimode, embedding php/javascript inside html,
(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.[gj]sp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
;; AucTeX settings
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
(add-hook 'LaTeX-mode-hook 'visual-line-mode)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(setq flyspell-issue-message-flag nil)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
(setq-default TeX-master "main")
;; compile to pdf
(setq TeX-PDF-mode t)
;; easy spell check
(global-set-key (kbd "<f8>") 'ispell-word)
(global-set-key (kbd "C-S-<f8>") 'flyspell-mode)
(global-set-key (kbd "C-M-<f8>") 'flyspell-buffer)
(global-set-key (kbd "C-<f8>") 'flyspell-check-previous-highlighted-word)
(defun flyspell-check-next-highlighted-word ()
"Custom function to spell check next highlighted word"
(interactive)
(flyspell-goto-next-error)
(ispell-word)
)
(global-set-key (kbd "M-<f8>") 'flyspell-check-next-highlighted-word)
;; fill-column
(setq fill-column 100)
;;(desktop-save-mode 1)
(require 'saveplace)
(setq-default save-place t)
(add-to-list 'load-path "which-folder-ace-jump-mode-file-in/")
(require 'ace-jump-mode)
(define-key global-map (kbd "C-c j") 'ace-jump-word-mode)
(define-key global-map (kbd "C-c k") 'ace-jump-line-mode)
;; AucTE, latex helper for emacs
;(load "auctex.el" nil t t)
;(load "preview-latex.el" nil t t)
(require 'auctex-latexmk)
(auctex-latexmk-setup)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(ansi-color-faces-vector
[default default default italic underline success warning error])
'(ansi-color-names-vector
["#212526" "#ff4b4b" "#b4fa70" "#fce94f" "#729fcf" "#e090d7" "#8cc4ff" "#eeeeec"])
'(c-basic-offset 4)
'(completion-ignored-extensions
(quote
(".pdf" ".o" "~" ".bin" ".lbin" ".so" ".a" ".ln" ".blg" ".bbl" ".elc" ".lof" ".glo" ".idx" ".lot" ".svn/" ".hg/" ".git/" ".bzr/" "CVS/" "_darcs/" "_MTN/" ".fmt" ".tfm" ".class" ".fas" ".lib" ".mem" ".x86f" ".sparcf" ".dfsl" ".pfsl" ".d64fsl" ".p64fsl" ".lx64fsl" ".lx32fsl" ".dx64fsl" ".dx32fsl" ".fx64fsl" ".fx32fsl" ".sx64fsl" ".sx32fsl" ".wx64fsl" ".wx32fsl" ".fasl" ".ufsl" ".fsl" ".dxl" ".lo" ".la" ".gmo" ".mo" ".toc" ".aux" ".cp" ".fn" ".ky" ".pg" ".tp" ".vr" ".cps" ".fns" ".kys" ".pgs" ".tps" ".vrs" ".pyc" ".pyo")))
'(custom-enabled-themes (quote (wheatgrass)))
'(custom-safe-themes
(quote
("ce81cd22cb3dd415429b734bfaab431af0d4ab694b93f3f7308cd51ebec57def" default)))
'(fill-column 80)
'(indent-tabs-mode nil)
'(inhibit-startup-screen t)
'(latex-run-command "late")
'(package-selected-packages
(quote
(jinja2-mode cython-mode web-mode multi-web-mode markdown-mode+ jekyll-modes gscholar-bibtex gh-md flyspell-correct flymd ebib bibretrieve auto-complete-c-headers auto-complete-auctex auctex-latexmk ace-jump-mode ace-isearch ace-flyspell)))
'(safe-local-variable-values (quote ((encoding . utf-8)))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
;; Set the theme
(if (display-graphic-p)
(enable-theme 'wheatgrass))
;; gscholar
(setq gscholar-bibtex-default-source "Google Scholar")
[user]
email = rahul@dell-large
name = Rahul Chatterjee
[push]
default = matching
[alias]
co = checkout
ci = commit
st = status
br = branch
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
type = cat-file -t
dump = cat-file -p
deleted = log --diff-filter=D --summary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment