Skip to content

Instantly share code, notes, and snippets.

@prashmohan
Created September 28, 2010 18:56
Show Gist options
  • Save prashmohan/601557 to your computer and use it in GitHub Desktop.
Save prashmohan/601557 to your computer and use it in GitHub Desktop.
(add-to-list 'load-path (expand-file-name "~/.emacs.d"))
(tool-bar-mode -1) ;; No Toolbar!
(menu-bar-mode 1) ;; Yes Menubar!
(tooltip-mode 1)
(setq tramp-default-method "ssh")
(global-set-key "\C-m" 'newline-and-indent)
(setq x-select-enable-clipboard t)
(setq mac-command-modifier 'meta)
(setq mac-option-modifier 'meta)
(fset 'yes-or-no-p 'y-or-n-p)
;; See what you are typing.
(setq echo-keystrokes 0.1)
;; Open compressed files within emacs
(auto-compression-mode 1)
(server-start)
(set-default-font "-*-Monaco-normal-r-*-*-13-102-120-120-c-*-iso8859-1")
;; ***************************************************************
;; ido
;; ***************************************************************
(require 'ido)
(ido-mode t)
(ido-mode 'buffer)
(setq ido-enable-flex-matching t)
(setq ibuffer-shrink-to-minimum-size t)
(setq ibuffer-always-show-last-buffer nil)
(setq ibuffer-sorting-mode 'recency)
(setq ibuffer-use-header-line t)
(global-set-key [(f12)] 'ibuffer)
;; ***************************************************************
;; recentf -- For easy access to recently visited files
;; ***************************************************************
(require 'recentf)
(recentf-mode 1)
(setq recentf-max-saved-items 500)
(setq recentf-max-menu-items 60)
(global-set-key [(meta f12)] 'recentf-open-files)
;; ***************************************************************
;; windmove - for easy navigation between frames
;; ***************************************************************
(windmove-default-keybindings)
;; ***************************************************************
;; Show line and column number
;; ***************************************************************
(require 'linum)
(line-number-mode 1)
(column-number-mode 1)
;; Line numbers on left most column
(global-linum-mode 1)
;; ***************************************************************
;;======= Code folding =======
;; ***************************************************************
(add-hook 'python-mode-hook 'my-python-outline-hook)
; this gets called by outline to deteremine the level. Just use the length of the whitespace
(defun py-outline-level ()
(let (buffer-invisibility-spec)
(save-excursion
(skip-chars-forward " ")
(current-column))))
; this get called after python mode is enabled
(defun my-python-outline-hook ()
; outline uses this regexp to find headers. I match lines with no indent and indented "class"
; and "def" lines.
(setq outline-regexp "[^ \t]\\|[ \t]*\\(def\\|class\\) ")
; enable our level computation
(setq outline-level 'py-outline-level)
; do not use their \C-c@ prefix, too hard to type. Note this overides some bindings.
(setq outline-minor-mode-prefix "\C-t")
; turn on outline mode
(outline-minor-mode t)
; initially hide all but the headers
;(hide-body)
; make paren matches visible
(show-paren-mode 1)
)
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq-default py-indent-offset 4)
(add-hook 'python-mode-hook '(lambda () (require 'virtualenv)))
;; ***************************************************************
;; yasnippet
;; ***************************************************************
(add-to-list 'load-path (expand-file-name "~/.emacs.d/yasnippet-0.6.1c"))
(require 'yasnippet) ;; not yasnippet-bundle
(yas/initialize)
(yas/load-directory "~/.emacs.d/yasnippet-0.6.1c/snippets")
;; ***************************************************************
;; Auto completion
;; ***************************************************************
;; To make sure the case is preserved in a completion, you probably
;; have to set variables dabbrev-case-fold-search and
;; dabbrev-case-replace to nil.
(setq dabbrev-case-fold-search nil)
(setq dabbrev-case-replace nil)
(eval-after-load "dabbrev" '(defalias 'dabbrev-expand 'hippie-expand))
;; (add-to-list 'load-path (expand-file-name "~/.emacs.d/auto-complete"))
;; (require 'auto-complete)
;; (global-auto-complete-mode t)
;; (when (require 'auto-complete nil t)
;; (require 'auto-complete-yasnippet)
;; (require 'auto-complete-python)
;; ;; (require 'auto-complete-cpp)
;; (global-auto-complete-mode t)
;; (setq ac-auto-start 3)
;; (setq ac-dwim t)
;; (set-default 'ac-sources '(ac-source-yasnippet ac-source-abbrev ac-source-words-in-buffer ac-source-files-in-current-dir ac-source-symbols)))
;; (require 'gccsense)
;; (add-hook 'c-mode-common-hook
;; (lambda ()
;; (local-set-key (kbd "C-c .") 'gccsense-complete)
;; ;; or
;; (local-set-key (kbd "C-c .") 'ac-complete-gccsense)))
;; (add-hook 'c-mode-common-hook
;; (lambda ()
;; (flymake-mode)
;; (gccsense-flymake-setup)))
;; ***************************************************************
;; Theme
;; ***************************************************************
(require 'color-theme)
(color-theme-initialize)
(color-theme-clarity)
;; (require 'zenburn)
;; (zenburn)
;; ***************************************************************
;; Dired configuration
;; ***************************************************************
;; (define-key dired-mode-map (kbd "RET") 'dired-find-alternate-file)
;; (setq dired-recursive-deletes 'top)
;; ***************************************************************
;; highlight the current line; set a custom face, so we can
;; recognize from the normal marking (selection)
;; ***************************************************************
(defface hl-line '((t (:background "DarkSlateGrey")))
"Face to use for `hl-line-face'." :group 'hl-line)
(setq hl-line-face 'hl-line)
(global-hl-line-mode t) ; turn it on for all modes by default
;; ***************************************************************
;; isearch is a useful navigation mechanism. This works a little
;; better if isearch puts you at the start of the search, not the end:
;; ***************************************************************
(add-hook 'isearch-mode-end-hook 'my-goto-match-beginning)
(defun my-goto-match-beginning ()
(when isearch-forward (goto-char isearch-other-end)))
;; makes some movement and text commands recognize case-change as a word boundary
(add-hook 'c-mode-common-hook
(lambda () (subword-mode 1)))
;; ***************************************************************
;; Templates
;; ***************************************************************
(require 'template)
(template-initialize)
(auto-insert-mode t)
;; ***************************************************************
;; LaTeX
;; ***************************************************************
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)
(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.
'(TeX-modes (quote (tex-mode plain-tex-mode texinfo-mode latex-mode doctex-mode))))
;; ***************************************************************
;; org-mode
;; ***************************************************************
(require 'prash-org)
;; ***************************************************************
;; Emacs-Git set up
;; ***************************************************************
(add-to-list 'load-path "~/.emacs.d/git-emacs/")
(require 'git-emacs)
(require 'git-status)
;; ***************************************************************
;; Gist Configuration
;; ***************************************************************
(add-to-list 'load-path "~/.emacs.d/gist.el/")
(require 'gist)
;; ***************************************************************
;; Custom functions
;; ***************************************************************
(require 'prash-fns)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment