Skip to content

Commit

Permalink
Added initial dotfiles repo.
Browse files Browse the repository at this point in the history
  • Loading branch information
balajis committed Jul 1, 2013
1 parent d50f4a3 commit 63cf158
Show file tree
Hide file tree
Showing 18 changed files with 4,259 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .bash_profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# .bash_profile file
# By Balaji S. Srinivasan ([email protected])
#
# Concepts:
# http://www.joshstaiger.org/archives/2005/07/bash_profile_vs.html
#
# 1) .bashrc is the *non-login* config for bash, run in scripts and after
# first connection.
#
# 2) .bash_profile is the *login* config for bash, launched upon first
# connection (in Ubuntu)
#
# 3) .bash_profile imports .bashrc in our script, but not vice versa.
#
# 4) .bashrc imports .bashrc_custom in our script, which can be used to
# override variables specified here.
#
# When using GNU screen:
#
# 1) .bash_profile is loaded the first time you login, and should be used
# only for paths and environmental settings

# 2) .bashrc is loaded in each subsequent screen, and should be used for
# aliases and things like writing to .bash_eternal_history (see below)
#
# Do 'man bashrc' for the long version or see here:
# http://en.wikipedia.org/wiki/Bash#Startup_scripts
#
# When Bash starts, it executes the commands in a variety of different scripts.
#
# 1) When Bash is invoked as an interactive login shell, it first reads
# and executes commands from the file /etc/profile, if that file
# exists. After reading that file, it looks for ~/.bash_profile,
# ~/.bash_login, and ~/.profile, in that order, and reads and executes
# commands from the first one that exists and is readable.
#
# 2) When a login shell exits, Bash reads and executes commands from the
# file ~/.bash_logout, if it exists.
#
# 3) When an interactive shell that is not a login shell is started
# (e.g. a GNU screen session), Bash reads and executes commands from
# ~/.bashrc, if that file exists. This may be inhibited by using the
# --norc option. The --rcfile file option will force Bash to read and
# execute commands from file instead of ~/.bashrc.

## -----------------------
## -- 1) Import .bashrc --
## -----------------------

# Factor out all repeated profile initialization into .bashrc
# - All non-login shell parameters go there
# - All declarations repeated for each screen session go there
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi

# Configure PATH
# - These are line by line so that you can kill one without affecting the others.
# - Lowest priority first, highest priority last.
export PATH=$PATH
export PATH=$HOME/bin:$PATH
export PATH=/usr/bin:$PATH
export PATH=/usr/local/bin:$PATH
export PATH=/usr/local/sbin:$PATH
export PATH=/usr/local/heroku/bin:$PATH # Heroku: https://toolbelt.heroku.com/standalone
1 change: 1 addition & 0 deletions .bashrc_custom
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

249 changes: 249 additions & 0 deletions .emacs.d/column-marker.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
;;; column-marker.el --- Highlight certain character columns
;;
;; Filename: column-marker.el
;; Description: Highlight certain character columns
;; Author: Rick Bielawski <[email protected]>
;; Maintainer: Rick Bielawski <[email protected]>
;; Created: Tue Nov 22 10:26:03 2005
;; Version:
;; Last-Updated: Mon Jan 21 09:51:45 2008 (Pacific Standard Time)
;; By: dradams
;; Update #: 278
;; Keywords: tools convenience highlight
;; Compatibility: GNU Emacs 21, GNU Emacs 22
;;
;; Features that might be required by this library:
;;
;; None
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; Highlights the background at a given character column.
;;
;; Commands `column-marker-1', `column-marker-2', and
;; `column-marker-3' each highlight a given column (using different
;; background colors, by default).
;;
;; - With no prefix argument, each highlights the current column
;; (where the cursor is).
;;
;; - With a non-negative numeric prefix argument, each highlights that
;; column.
;;
;; - With plain `C-u' (no number), each turns off its highlighting.
;;
;; - With `C-u C-u', each turns off all column highlighting.
;;
;; If two commands highlight the same column, the last-issued
;; highlighting command shadows the other - only the last-issued
;; highlighting is seen. If that "topmost" highlighting is then
;; turned off, the other highlighting for that column then shows
;; through.
;;
;; Examples:
;;
;; M-x column-marker-1 highlights the column where the cursor is, in
;; face `column-marker-1'.
;;
;; C-u 70 M-x column-marker-2 highlights column 70 in face
;; `column-marker-2'.
;;
;; C-u 70 M-x column-marker-3 highlights column 70 in face
;; `column-marker-3'. The face `column-marker-2' highlighting no
;; longer shows.
;;
;; C-u M-x column-marker-3 turns off highlighting for column-marker-3,
;; so face `column-marker-2' highlighting shows again for column 70.
;;
;; C-u C-u M-x column-marker-1 (or -2 or -3) erases all column
;; highlighting.
;;
;; These commands use `font-lock-fontify-buffer', so syntax
;; highlighting (`font-lock-mode') must be turned on. There might be
;; a performance impact during refontification.
;;
;;
;; Installation: Place this file on your load path, and put this in
;; your init file (`.emacs'):
;;
;; (require 'column-marker)
;;
;; Other init file suggestions (examples):
;;
;; ;; Highlight column 80 in foo mode.
;; (add-hook foo-mode-hook (lambda () (interactive) (column-marker-1 80)))
;;
;; ;; Use `C-c m' interactively to highlight with face `column-marker-1'.
;; (global-set-key [?\C-c ?m] 'column-marker-1)
;;
;;
;; Please report any bugs!
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Change log:
;;
;; 2008/01/21 dadams
;; Renamed faces by dropping suffix "-face".
;; 2006/08/18 dadams
;; column-marker-create: Add newlines to doc-string sentences.
;; 2005/12/31 dadams
;; column-marker-create: Add marker to column-marker-vars inside the defun,
;; so it is done in the right buffer, updating column-marker-vars buffer-locally.
;; column-marker-find: Corrected comment. Changed or to progn for clarity.
;; 2005/12/29 dadams
;; Updated wrt new version of column-marker.el (mulit-column characters).
;; Corrected stray occurrences of column-marker-here to column-marker-1.
;; column-marker-vars: Added make-local-variable.
;; column-marker-create: Changed positive to non-negative.
;; column-marker-internal: Turn off marker when col is negative, not < 1.
;; 2005-12-29 RGB
;; column-marker.el now supports multi-column characters.
;; 2005/11/21 dadams
;; Combined static and dynamic.
;; Use separate faces for each marker. Different interactive spec.
;; 2005/10/19 RGB
;; Initial release of column-marker.el.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
;; Floor, Boston, MA 02110-1301, USA.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:

;;;;;;;;;;;;;;;;;;;;;;


(defface column-marker-1 '((t (:background "black")))
"Face used for a column marker. Usually a background color."
:group 'faces)

(defvar column-marker-1-face 'column-marker-1
"Face used for a column marker. Usually a background color.
Changing this directly affects only new markers.")

(defface column-marker-2 '((t (:background "cyan3")))
"Face used for a column marker. Usually a background color."
:group 'faces)

(defvar column-marker-2-face 'column-marker-2
"Face used for a column marker. Usually a background color.
Changing this directly affects only new markers." )

(defface column-marker-3 '((t (:background "orchid3")))
"Face used for a column marker. Usually a background color."
:group 'faces)

(defvar column-marker-3-face 'column-marker-3
"Face used for a column marker. Usually a background color.
Changing this directly affects only new markers." )

(defvar column-marker-vars nil
"List of all internal column-marker variables")
(make-variable-buffer-local 'column-marker-vars) ; Buffer local in all buffers.

(defmacro column-marker-create (var &optional face)
"Define a column marker named %%colmark%%-VAR.
FACE is the face to use. If nil, then face `column-marker-1' is used."
(setq face (or face 'column-marker-1))
`(progn
;; define context variable ,VAR so marker can be removed if desired
(defvar ,var ()
"Buffer local. Used internally to store column marker spec.")
;; context must be buffer local since font-lock is
(make-variable-buffer-local ',var)
;; Define wrapper function named ,VAR to call `column-marker-internal'
(defun ,var (arg)
,(concat "Highlight column with face `" (symbol-name face)
"'.\nWith no prefix argument, highlight current column.\n"
"With non-negative numeric prefix arg, highlight that column number.\n"
"With plain `C-u' (no number), turn off this column marker.\n"
"With `C-u C-u' or negative prefix arg, turn off all column-marker highlighting.")
(interactive "P")
(unless (memq ',var column-marker-vars) (push ',var column-marker-vars))
(cond ((null arg) ; Default: highlight current column.
(column-marker-internal ',var (1+ (current-column)) ,face))
((consp arg)
(if (= 4 (car arg))
(column-marker-internal ',var nil) ; `C-u': Remove this column highlighting.
(dolist (var column-marker-vars)
(column-marker-internal var nil)))) ; `C-u C-u': Remove all column highlighting.
((and (integerp arg) (>= arg 0)) ; `C-u 70': Highlight that column.
(column-marker-internal ',var (1+ (prefix-numeric-value arg)) ,face))
(t ; `C-u -40': Remove all column highlighting.
(dolist (var column-marker-vars)
(column-marker-internal var nil)))))))

(defun column-marker-find (col)
"Creates a function to locate a character in column COL."
`(lambda (end)
(let* ((start (point)))
(when (> end (point-max)) (setq end (point-max)))

;; Try to keep `move-to-column' from going backward, though it still can.
(unless (< (current-column) ,col) (forward-line 1))

;; Again, don't go backward. Try to move to correct column.
(when (< (current-column) ,col) (move-to-column ,col))

;; If not at target column, try to move to it.
(while (and (< (current-column) ,col) (< (point) end)
(= 0 (+ (forward-line 1) (current-column)))) ; Should be bol.
(move-to-column ,col))

;; If at target column, not past end, and not prior to start,
;; then set match data and return t. Otherwise go to start
;; and return nil.
(if (and (= ,col (current-column)) (<= (point) end) (> (point) start))
(progn (set-match-data (list (1- (point)) (point))) t) ; Return t.
(goto-char start) nil)))) ; Return nil.

(defun column-marker-internal (sym col &optional face)
"SYM is the symbol for holding the column marker context.
COL is the column in which a marker should be set.
Supplying nil or 0 for COL turns off the marker.
FACE is the face to use. If nil, then face `column-marker-1' is used."
(setq face (or face 'column-marker-1))
(when (symbol-value sym) ; Remove any previously set column marker
(font-lock-remove-keywords nil (symbol-value sym))
(set sym nil))
(when (or (listp col) (< col 0)) (setq col nil)) ; Allow nonsense stuff to turn off the marker
(when col ; Generate a new column marker
(set sym `((,(column-marker-find col) (0 ,face prepend t))))
(font-lock-add-keywords nil (symbol-value sym) t))
(font-lock-fontify-buffer))

;; If you need more markers you can create your own similarly.
;; All markers can be in use at once, and each is buffer-local,
;; so there is no good reason to define more unless you need more
;; markers in a single buffer.
(column-marker-create column-marker-1 column-marker-1-face)
(column-marker-create column-marker-2 column-marker-2-face)
(column-marker-create column-marker-3 column-marker-3-face)

;;;###autoload
(autoload 'column-marker-1 "column-marker" "Highlight a column." t)

;;;;;;;;;;;;;;;;;;

(provide 'column-marker)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; column-marker.el ends here
59 changes: 59 additions & 0 deletions .emacs.d/defuns-config.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
;; --------------------
;; -- Global defuns ---
;; --------------------
(defun next5()
(interactive)
(next-line 5))

(defun prev5()
(interactive)
(previous-line 5))

(defun delete-word (arg)
"Delete characters forward until encountering the end of a word.
With argument, do this that many times."
(interactive "p")
(delete-region (point) (progn (forward-word arg) (point))))

(defun backward-delete-word (arg)
"Delete characters backward until encountering the end of a word.
With argument, do this that many times.
http://www.emacswiki.org/emacs/BackwardDeleteWord
"
(interactive "p")
(delete-word (- arg)))

(defun back-window ()
(interactive)
(other-window -1))

(defun whitespace-cleanup-all ()
(interactive)
(setq indent-tab-mode nil)
(whitespace-cleanup))

(defun whitespace-clean-and-compile ()
"Cleans up whitespace and compiles. The compile-command is a
varies with the active mode."
(interactive)
(whitespace-cleanup-all)
(compile compile-command))

(defvar real-keyboard-keys
'(("M-<up>" . "\M-[1;3A")
("M-<down>" . "\M-[1;3B")
("M-<right>" . "\M-[1;3C")
("M-<left>" . "\M-[1;3D")
("C-<return>" . "\C-j")
("C-<delete>" . "\M-[3;5~")
("C-<up>" . "\M-[1;5A")
("C-<down>" . "\M-[1;5B")
("C-<right>" . "\M-[1;5C")
("C-<left>" . "\M-[1;5D"))
"An assoc list of pretty key strings
and their terminal equivalents.")

(defun key (desc)
(or (and window-system (read-kbd-macro desc))
(or (cdr (assoc desc real-keyboard-keys))
(read-kbd-macro desc))))
Loading

0 comments on commit 63cf158

Please sign in to comment.