Skip to content

Instantly share code, notes, and snippets.

@tirkarthi
Created October 1, 2015 12:27
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 tirkarthi/9588aae1de381c83e988 to your computer and use it in GitHub Desktop.
Save tirkarthi/9588aae1de381c83e988 to your computer and use it in GitHub Desktop.
My emacs config
(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-names-vector ["#272822" "#F92672" "#A6E22E" "#E6DB74" "#66D9EF" "#FD5FF0" "#A1EFE4" "#F8F8F2"])
'(compilation-message-face (quote default))
'(css-indent-offset 2)
'(cua-prefix-override-inhibit-delay 1)
'(custom-safe-themes (quote ("a041a61c0387c57bb65150f002862ebcfe41135a3e3425268de24200b82d6ec9" "460dc689943a7603b34590b732b3f8ccc398eddb7da49bceb4f983a86db0df8f" "09fa83e024b8fd8e03a43c167b0b542424a917c260fee1883e8d3268fad47a89" "a772eafba4eda0ed57a5d651a96804487a1dacbfbf8658084bfe84546a7c7008" default)))
'(fci-rule-color "#383838")
'(highlight-changes-colors ("#FD5FF0" "#AE81FF"))
'(highlight-tail-colors (("#49483E" . 0) ("#67930F" . 20) ("#349B8D" . 30) ("#21889B" . 50) ("#968B26" . 60) ("#A45E0A" . 70) ("#A41F99" . 85) ("#49483E" . 100)))
'(inhibit-startup-screen t)
'(initial-frame-alist (quote ((fullscreen . maximized))))
'(keyfreq-mode t)
'(magit-diff-use-overlays nil)
'(org-agenda-files (quote ("~/OrgTutorial.org")))
'(send-mail-function (quote smtpmail-send-it))
'(uniquify-buffer-name-style (quote post-forward-angle-brackets) nil (uniquify))
'(vc-annotate-background "#2B2B2B")
'(vc-annotate-color-map (quote ((20 . "#BC8383") (40 . "#CC9393") (60 . "#DFAF8F") (80 . "#D0BF8F") (100 . "#E0CF9F") (120 . "#F0DFAF") (140 . "#5F7F5F") (160 . "#7F9F7F") (180 . "#8FB28F") (200 . "#9FC59F") (220 . "#AFD8AF") (240 . "#BFEBBF") (260 . "#93E0E3") (280 . "#6CA0A3") (300 . "#7CB8BB") (320 . "#8CD0D3") (340 . "#94BFF3") (360 . "#DC8CC3"))))
'(vc-annotate-very-old-color "#DC8CC3")
'(weechat-color-list (unspecified "#272822" "#49483E" "#A20C41" "#F92672" "#67930F" "#A6E22E" "#968B26" "#E6DB74" "#21889B" "#66D9EF" "#A41F99" "#FD5FF0" "#349B8D" "#A1EFE4" "#F8F8F2" "#F8F8F0")))
;; ========== Enable Line and Column Numbering ==========
;; Show line-number in the mode line
(global-linum-mode 1)
;; Show column-number in the mode line
(column-number-mode 1)
;; ========== Line by line scrolling ==========
;; This makes the buffer scroll by only a single line when the up or
;; down cursor keys push the cursor (tool-bar-mode) outside the
;; buffer. The standard emacs behaviour is to reposition the cursor in
;; the center of the screen, but this can make the scrolling confusing
(setq scroll-step 1)
;; ===== Set the highlight current line minor mode =====
;; In every buffer, the line which contains the cursor will be fully
;; highlighted
(global-hl-line-mode -1)
(tool-bar-mode -1)
;; (add-to-list 'load-path "~/.emacs.d")
;; (add-to-list 'load-path "~/.emacs.d/color-theme-6.6.0")
;; (require 'color-theme)
(menu-bar-mode -1)
(cua-mode 1)
(show-paren-mode 1)
(electric-pair-mode 1)
;;; Always do syntax highlighting
(global-font-lock-mode 1)
;;; Also highlight parens
(setq show-paren-delay 0
show-paren-style 'parenthesis)
(show-paren-mode 1)
;;; This is the binary name of my scheme implementation
(setq scheme-program-name "mit-scheme")
(setq ido-enable-flex-matching t)
(setq ido-everywhere t)
(ido-mode 1)
(windmove-default-keybindings)
;; (require 'sr-speedbar)
;; (global-set-key (kbd "C-S"))
(set-default-font "Monospace 12")
;; (require 'auto-complete-config)
;; (ac-config-default)
;;; prelude-global-keybindings.el --- Emacs Prelude: some useful keybindings.
;;
;; Copyright © 2011-2013 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar@batsov.com>
;; URL: https://github.com/bbatsov/prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Lots of useful keybindings.
;;; License:
;; 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 3
;; of the License, 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 GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
;; Align your code in a pretty way.
(global-set-key (kbd "C-x \\") 'align-regexp)
;; Font size
(global-set-key (kbd "C-+") 'text-scale-increase)
(global-set-key (kbd "C--") 'text-scale-decrease)
;; Window switching. (C-x o goes to the next window)
(global-set-key (kbd "C-x O") (lambda ()
(interactive)
(other-window -1))) ;; back one
;; Indentation help
(global-set-key (kbd "C-^") 'prelude-top-join-line)
;; Start proced in a similar manner to dired
(unless (eq system-type 'darwin)
(global-set-key (kbd "C-x p") 'proced))
;; Start eshell or switch to it if it's active.
(global-set-key (kbd "C-x m") 'eshell)
;; Start a new eshell even if one is active.
(global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t)))
;; Start a regular shell if you prefer that.
(global-set-key (kbd "C-x M-m") 'shell)
;; If you want to be able to M-x without meta
(global-set-key (kbd "C-x C-m") 'execute-extended-command)
;; A complementary binding to the apropos-command (C-h a)
(define-key 'help-command "A" 'apropos)
;; A quick major mode help with discover-my-major
(define-key 'help-command (kbd "C-m") 'discover-my-major)
(define-key 'help-command (kbd "C-f") 'find-function)
(define-key 'help-command (kbd "C-k") 'find-function-on-key)
(define-key 'help-command (kbd "C-v") 'find-variable)
(define-key 'help-command (kbd "C-l") 'find-library)
(define-key 'help-command (kbd "C-i") 'info-display-manual)
;; a complement to the zap-to-char command, that doesn't eat up the target character
(autoload 'zap-up-to-char "misc" "Kill up to, but not including ARGth occurrence of CHAR.")
(global-set-key (kbd "M-Z") 'zap-up-to-char)
;; kill lines backward
(global-set-key (kbd "C-<backspace>") (lambda ()
(interactive)
(kill-line 0)
(indent-according-to-mode)))
;; (global-set-key [remap kill-whole-line] 'prelude-kill-whole-line)
;; Activate occur easily inside isearch
(define-key isearch-mode-map (kbd "C-o")
(lambda () (interactive)
(let ((case-fold-search isearch-case-fold-search))
(occur (if isearch-regexp
isearch-string
(regexp-quote isearch-string))))))
;; use hippie-expand instead of dabbrev
(global-set-key (kbd "M-/") 'hippie-expand)
;; replace buffer-menu with ibuffer
(global-set-key (kbd "C-x C-b") 'ibuffer)
(unless (fboundp 'toggle-frame-fullscreen)
(global-set-key (kbd "<f11>") 'prelude-fullscreen))
;; toggle menu-bar visibility
(global-set-key (kbd "<f12>") 'menu-bar-mode)
(global-set-key (kbd "C-x g") 'magit-status)
(global-set-key (kbd "C-=") 'er/expand-region)
(global-set-key (kbd "C--") 'er/contract-region)
(global-set-key (kbd "C-c j") 'ace-jump-mode)
(global-set-key (kbd "s-.") 'ace-jump-mode)
(global-set-key (kbd "C-c J") 'ace-jump-buffer)
(global-set-key (kbd "s->") 'ace-jump-buffer)
(global-set-key (kbd "s-w") 'ace-window)
(global-set-key (kbd "C-c C-r") 'replace-string)
;; (provide 'prelude-global-keybindings)
;;; prelude-global-keybindings.el ends here
;; (require 'rainbow-delimiters)
;; (require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.module$" . php-mode))
(add-to-list 'auto-mode-alist '("\\.inc$\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.php$\\'" . php-mode))
(when (>= emacs-major-version 24)
(require 'package)
(package-initialize)
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
)
(load-file "~/.emacs.d/php.el")
;; (iswitchb-mode 1)
(setq iswitchb-buffer-ignore '("^ " "*Completions*" "*Shell Command Output*"
"*Messages*" "Async Shell Command"))
(global-auto-complete-mode 1)
(global-undo-tree-mode 1)
(global-set-key (kbd "M-r") 'revert-buffer)
(global-set-key (kbd "M-n") 'next-buffer)
(global-set-key (kbd "M-p") 'previous-buffer)
(global-auto-revert-mode 1)
;; (defalias 'yes-or-no-p 'y-or-no-p)
(defalias 'yes-or-no-p 'y-or-n-p)
(global-visual-line-mode 1)
(defun iswitchb-local-keys ()
(mapc (lambda (K)
(let* ((key (car K)) (fun (cdr K)))
(define-key iswitchb-mode-map (edmacro-parse-keys key) fun)))
'(("<right>" . iswitchb-next-match)
("<left>" . iswitchb-prev-match)
("<up>" . ignore )
("<down>" . ignore ))))
(add-hook 'iswitchb-define-mode-map-hook 'iswitchb-local-keys)
;; Load Gotham theme
(load-theme 'monokai t)
;; Powerline theme
(powerline-default-theme)
;; Server start for terminal access
;; (server-start)
;; smex binding
(global-set-key [(meta x)] (lambda ()
(interactive)
(or (boundp 'smex-cache)
(smex-initialize))
(global-set-key [(meta x)] 'smex)
(smex)))
(global-set-key (kbd "C-c <space>") 'ace-jump-mode)
;; Key chord bindings
(key-chord-define-global "gg" 'smex)
(key-chord-mode 1)
;; multiple cursors key bindings
(global-set-key (kbd "C-S-<mouse-1>") 'mc/add-cursor-on-click)
;; Buffer resize emacs
(global-set-key (kbd "S-C-<left>") 'shrink-window-horizontally)
(global-set-key (kbd "S-C-<right>") 'enlarge-window-horizontally)
(global-set-key (kbd "S-C-<down>") 'shrink-window)
(global-set-key (kbd "S-C-<up>") 'enlarge-window)
;; (deasktop-save-mode 1)
;; Display buffer file name in title bar
(setq frame-title-format
(list (format "%s %%S: %%j " (system-name))
'(buffer-file-name "%f" (dired-directory dired-directory "%b"))))
(flycheck-mode 1)
(flymake-mode 1)
;; Yes or no to y or n
(fset 'yes-or-no-p 'y-or-n-p)
;; Ergoemacs aliases
;; make frequently used commands short
(defalias 'qrr 'query-replace-regexp)
(defalias 'lml 'list-matching-lines)
(defalias 'dml 'delete-matching-lines)
(defalias 'dnml 'delete-non-matching-lines)
(defalias 'dtw 'delete-trailing-whitespace)
(defalias 'sl 'sort-lines)
(defalias 'rr 'reverse-region)
(defalias 'rs 'replace-string)
(defalias 'g 'grep)
(defalias 'gf 'grep-find)
(defalias 'fd 'find-dired)
(defalias 'rb 'revert-buffer)
(defalias 'sh 'shell)
(defalias 'ps 'powershell)
(defalias 'fb 'flyspell-buffer)
(defalias 'sbc 'set-background-color)
(defalias 'rof 'recentf-open-files)
(defalias 'lcd 'list-colors-display)
(defalias 'cc 'calc)
; elisp
(defalias 'eb 'eval-buffer)
(defalias 'er 'eval-region)
(defalias 'ed 'eval-defun)
(defalias 'eis 'elisp-index-search)
(defalias 'lf 'load-file)
; major modes
(defalias 'hm 'html-mode)
(defalias 'tm 'text-mode)
(defalias 'elm 'emacs-lisp-mode)
(defalias 'om 'org-mode)
(defalias 'ssm 'shell-script-mode)
(defalias 'html6-mode 'xah-html6-mode)
; minor modes
(defalias 'wsm 'whitespace-mode)
(defalias 'gwsm 'global-whitespace-mode)
(defalias 'dsm 'desktop-save-mode)
(defalias 'acm 'auto-complete-mode)
(defalias 'vlm 'visual-line-mode)
(defalias 'glm 'global-linum-mode)
(global-set-key (kbd "M-i") 'imenu)
(setq-default cursor-type 'bar)
(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.
)
(global-set-key (kbd "M-g") 'goto-line)
(put 'dired-find-alternate-file 'disabled nil)
(require 'package)
(add-to-list 'package-archives
'("elpy" . "http://jorgenschaefer.github.io/packages/"))
(package-initialize)
;; (elpy-enable)
;; (require 'expand-region)
;; jedi set-up and python key maps
(defun my-python-keys()
(local-set-key (kbd "C-;") 'jedi:goto-definition)
(local-set-key (kbd "C-'") 'jedi:goto-definition-pop-marker)
(local-set-key (kbd "C-,") 'python-nav-beginning-of-block)
(local-set-key (kbd "C-.") 'python-nav-end-of-block)
(local-set-key (kbd "C-,") 'python-nav-beginning-of-block)
(local-set-key (kbd "C-.") 'python-nav-end-of-block)
(local-set-key (kbd "C-c p") '(fset 'pp
"\C-w\C-y\C-e\C-jimport pprint\C-jpprint.pprint(\C-y"))
)
(add-hook 'python-mode-hook 'my-python-keys)
(add-hook 'python-mode-hook 'jedi:setup)
(add-hook 'python-mode-hook 'jedi:ac-setup)
(setq jedi:complete-on-dot t)
(setq jedi:get-in-function-call-delay 1000)
(setq python-shell-interpreter "ipython")
(global-set-key (kbd "M-[") 'shrink-window)
(global-set-key (kbd "M-]") 'enlarge-window)
(global-set-key (kbd "M-;") 'comment-dwim-2)
(setq linum-format "%d ")
(put 'upcase-region 'disabled nil)
(setq x-select-enable-clipboard t)
(setq-default indent-tabs-mode nil)
(defun next-code-buffer ()
(interactive)
(let (( bread-crumb (buffer-name) ))
(next-buffer)
(while
(and
(string-match-p "^\*" (buffer-name))
(not (equal bread-crumb (buffer-name))))
(next-buffer))))
(defun previous-code-buffer ()
(interactive)
(let (( bread-crumb (buffer-name) ))
(previous-buffer)
(while
(and
(string-match-p "^\*" (buffer-name))
(not (equal bread-crumb (buffer-name))))
(previous-buffer))))
(global-set-key [remap next-buffer] 'next-code-buffer)
(global-set-key [remap previous-buffer] 'previous-code-buffer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment