Last active
August 29, 2015 14:11
-
-
Save marciol/8de568f3ac3d01b18986 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'cask "~/.cask/cask.el") | |
(cask-initialize) | |
(require 'pallet) | |
(pallet-mode t) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; APPEARANCE CUSTOMIZATIONS ;;; | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Startup | |
(setq inhibit-startup-message t) | |
(setq debug-on-error t) | |
;; Theme | |
;(load-theme 'solarized-dark t) | |
;(setq solarized-termcolor 16) | |
;(load-theme 'obsidian) | |
(load-theme 'brin) | |
;; Line numbers | |
(require 'linum) | |
(global-linum-mode 1) | |
(defcustom linum-disabled-modes-list | |
'(eshell-mode wl-summary-mode compilation-mode org-mode text-mode dired-mode rcirc-mode) | |
"* List of modes disabled when global linum mode is on" | |
:type '(repeat (sexp :tag "Major mode")) | |
:tag " Major modes where linum is disabled: " | |
:group 'linum) | |
;; Fonts | |
;(set-face-font 'default "-outline-inconsolata-normal-r-normal-normal-18-*-*-*-c-*-*") | |
;(set-face-font 'bold "-outline-inconsolata-bold-r-normal-normal-18-*-*-*-c-*-*") | |
;(set-face-font 'italic "-outline-inconsolata-normal-i-normal-normal-18-*-*-*-c-*-*") | |
;(set-face-font 'bold-italic "-outline-inconsolata-bold-i-normal-normal-18-*-*-*-c-*-*") | |
;(set-face-font 'default "-*-Inconsolata-*-*-*-*-18-*-*-*-*-*-*") | |
(set-frame-font "Droid Sans Mono-16" nil t) | |
;; Indentation | |
(setq-default indent-tabs-mode t) | |
(setq-default tab-width 4) | |
;; Backup directory | |
;; Save all tempfiles in $TMPDIR/emacs$UID/ | |
(defconst emacs-tmp-dir (format "%s/%s%s/" temporary-file-directory "emacs" (user-uid))) | |
(setq backup-directory-alist | |
`((".*" . ,emacs-tmp-dir))) | |
(setq auto-save-file-name-transforms | |
`((".*" ,emacs-tmp-dir t))) | |
(setq auto-save-list-file-prefix | |
emacs-tmp-dir) | |
;; Global hooks | |
(add-hook 'before-save-hook 'delete-trailing-whitespace) | |
(require 'iso-transl) | |
(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. | |
) | |
;; Electric mode | |
(electric-indent-mode +1) | |
;;;;;;;;;;;;;;;;;;;; | |
;;; KEY BINDINGS ;;; | |
;;;;;;;;;;;;;;;;;;;; | |
;; Evil | |
(require 'evil) | |
(evil-mode 1) | |
(require 'key-chord) | |
(key-chord-mode 1) | |
(setq key-chord-two-keys-delay 0.5) | |
(key-chord-define evil-insert-state-map "jj" 'evil-normal-state) | |
(setq evil-auto-indent t) | |
(define-key evil-insert-state-map (kbd "<escape>") nil) | |
(define-key evil-normal-state-map ",sf" 'helm-ls-git-ls) | |
(define-key evil-normal-state-map ",sb" 'helm-mini) | |
(define-key evil-normal-state-map (kbd "C-u") 'evil-scroll-page-up) | |
(setq evil-emacs-state-cursor '("red" box)) | |
(setq evil-normal-state-cursor '("green" box)) | |
(setq evil-visual-state-cursor '("orange" box)) | |
(setq evil-insert-state-cursor '("red" bar)) | |
(setq evil-replace-state-cursor '("red" bar)) | |
(setq evil-operator-state-cursor '("red" hollow)) | |
;; package menu | |
(define-key package-menu-mode-map "/" 'evil-search-forward) | |
(define-key package-menu-mode-map "n" 'evil-search-next) | |
(define-key package-menu-mode-map "N" 'evil-search-previous) | |
(define-key package-menu-mode-map "j" 'next-line) | |
(define-key package-menu-mode-map "k" 'previous-line) | |
;; ibuffer | |
(eval-after-load "ibuffer" | |
'(progn (define-key ibuffer-mode-map "j" 'ibuffer-forward-line) | |
(define-key ibuffer-mode-map "k" 'ibuffer-backward-line) | |
(define-key ibuffer-mode-map "J" 'ibuffer-jump-to-buffer) | |
(define-key ibuffer-mode-map "n" 'ido-switch-buffer) | |
(define-key ibuffer-mode-map (kbd "C-k") 'ido-switch-buffer) | |
(define-key ibuffer-mode-map (kbd "C-x C-f") 'ido-find-file) | |
(define-key ibuffer-mode-map (kbd "C-x b") 'ido-switch-buffer))) | |
;; magit | |
(eval-after-load "magit" | |
'(progn | |
(define-key magit-status-mode-map "j" 'magit-goto-next-section) | |
(define-key magit-status-mode-map "k" 'magit-goto-previous-section) | |
(define-key magit-status-mode-map "n" 'magit-section-jump-map) | |
(define-key magit-status-mode-map "p" 'magit-discard-item) | |
(define-key magit-log-mode-map "j" 'magit-goto-next-section) | |
(define-key magit-log-mode-map "k" 'magit-goto-previous-section) | |
(add-hook 'magit-status-mode-hook 'magit-filenotify-mode))) | |
;; flycheck | |
(eval-after-load "flycheck" | |
'(progn | |
(define-key flycheck-error-list-mode-map "j" 'flycheck-error-list-next-error) | |
(define-key flycheck-error-list-mode-map "k" 'flycheck-error-list-previous-error))) | |
;; view | |
(require 'view) | |
(setq view-read-only t) ; enter view-mode for read-only files | |
(define-key view-mode-map "n" 'next-line) | |
(define-key view-mode-map "p" 'previous-line) | |
(define-key view-mode-map "j" 'next-line) | |
(define-key view-mode-map "k" 'previous-line) | |
;; grizzl | |
(require 'grizzl) | |
(define-key *grizzl-keymap* (kbd "C-j") 'grizzl-set-selection-1) | |
(define-key *grizzl-keymap* (kbd "C-k") 'grizzl-set-selection+1) | |
(key-chord-define *grizzl-keymap* ":q" 'exit-minibuffer) | |
(define-key evil-normal-state-map ",p" 'projectile-find-file) | |
(define-key evil-normal-state-map ",b" 'projectile-switch-to-buffer) | |
;;;;;;;;;;;;; | |
;;; MODES ;;; | |
;;;;;;;;;;;;; | |
;; Projectile | |
(projectile-global-mode) | |
(setq projectile-enable-caching t) | |
(setq projectile-completion-system 'grizzl) | |
;; web-mode | |
(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 '("\\.jsp\\'" . 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)) | |
;; mmm | |
;(require 'mmm-auto) | |
; | |
;(setq mmm-global-mode 'auto) | |
; | |
;(mmm-add-mode-ext-class 'html-erb-mode "\\.html\\.erb\\'" 'erb) | |
;(mmm-add-mode-ext-class 'html-erb-mode "\\.jst\\.ejs\\'" 'ejs) | |
;(mmm-add-mode-ext-class 'html-erb-mode nil 'html-js) | |
;(mmm-add-mode-ext-class 'html-erb-mode nil 'html-css) | |
; | |
;(add-to-list 'auto-mode-alist '("\\.html\\.erb\\'" . html-erb-mode)) | |
;(add-to-list 'auto-mode-alist '("\\.jst\\.ejs\\'" . html-erb-mode)) | |
;; smex | |
(require 'smex) | |
(smex-initialize) | |
(global-set-key (kbd "M-x") 'smex) | |
(global-set-key (kbd "M-X") 'smex-major-mode-commands) | |
;; This is your old M-x. | |
(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command) | |
;; lusty-explorer | |
(require 'lusty-explorer) | |
;; autocomplete | |
(require 'auto-complete) | |
(require 'auto-complete-config) | |
(add-to-list 'ac-dictionary-directories "~/.emacs.d/vendor/auto-complete/ac-dict") | |
(ac-config-default) | |
(ac-set-trigger-key "C-u") | |
(define-key ac-completing-map (kbd "C-p") 'ac-previous) | |
(define-key ac-completing-map (kbd "C-n") 'ac-next) | |
;; smartparens | |
(require 'smartparens-config) | |
;; Ruby | |
;; flymake | |
(require 'flymake-ruby) | |
(add-hook 'ruby-mode-hook 'flymake-ruby-load) | |
;; inf-ruby | |
(require 'inf-ruby) | |
(autoload 'inf-ruby-minor-mode "inf-ruby" "Run an inferior Ruby process" t) | |
(add-hook 'ruby-mode-hook 'inf-ruby-minor-mode) | |
(defun inf-ruby-console-zeus (dir) | |
(interactive "D") | |
(run-ruby "zeus c" "zeus")) | |
;; projectile-rails | |
;(global-set-key (kbd "C-c r r") 'inf-ruby) | |
;(global-set-key (kbd "C-c r a") 'rvm-activate-corresponding-ruby) | |
(require 'projectile-rails) | |
(add-hook 'projectile-mode-hook 'projectile-rails-on) | |
;(add-hook 'projectile-mode-hook (lambda () (projectile-rails-mode +1))) | |
;; robe | |
(require 'robe) | |
(add-hook 'ruby-mode-hook 'robe-mode) | |
(evil-define-key 'normal robe-mode-map (kbd ", g d") 'robe-jump) | |
(evil-define-key 'normal robe-mode-map (kbd ", g b") 'pop-tag-mark) | |
;; company | |
(require 'company) | |
(push 'company-robe company-backends) | |
(add-hook 'ruby-mode-hook 'company-mode-on) | |
(add-hook 'ruby-mode-hook | |
(lambda () | |
;(company-mode 1) | |
(auto-complete-mode -1) | |
)) | |
(eval-after-load 'company | |
'(add-to-list 'company-backends 'company-inf-ruby)) | |
(setq company-tooltip-limit 20) ; bigger popup window | |
(setq company-idle-delay .3) ; decrease delay before autocompletion popup shows | |
(setq company-echo-delay 0) ; remove annoying blinking | |
(setq company-begin-commands '(self-insert-command)) ; start autocompletion only after typing | |
(defadvice inf-ruby-console-auto (before activate-rvm-for-robe activate) | |
(rvm-activate-corresponding-ruby)) | |
;; haml-mode | |
(require 'haml-mode) | |
(add-hook 'haml-mode-hook | |
(lambda () | |
(setq indent-tabs-mode nil) | |
(define-key haml-mode-map "\C-m" 'newline-and-indent))) | |
;; sass-mode | |
(require 'sass-mode) | |
(add-hook 'sass-mode-hook | |
(lambda () | |
(setq indent-tabs-mode nil) | |
(define-key haml-mode-map "\C-m" 'newline-and-indent))) | |
;; coffee | |
(require 'coffee-mode) | |
(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. | |
'(coffee-tab-width 2) | |
'(custom-safe-themes (quote ("3d5ef3d7ed58c9ad321f05360ad8a6b24585b9c49abcee67bdcbb0fe583a6950" "7bde52fdac7ac54d00f3d4c559f2f7aa899311655e7eb20ec5491f3b5c533fe8" "0795e2c85394140788d72d34969be4acb305e4a54149e7237787d9df27832fbb" "fc5fcb6f1f1c1bc01305694c59a1a861b008c534cae8d0e48e4d5e81ad718bc6" "b674ccba78eb688bea71ea8a1fd2782fcd69bd462e2504008903b5b6e018b480" default)))) | |
(evil-declare-key 'normal coffee-mode-map | |
",o" '(lambda () (interactive) (evil-append count) (coffee-newline-and-indent))) | |
;; auctex | |
(require 'tex-site) | |
;(setq load-path (cons "~/.emacs.d/elpa/auctex-11.86" load-path)) | |
(and (load "auctex-autoloads.el" nil t t) (load "preview.el" nil t t)) | |
;; fsharp | |
(require 'fsharp-mode) | |
(setq inferior-fsharp-program "/usr/bin/fsharpi --readline-") | |
(setq fsharp-compiler "/usr/bin/fsharpc") | |
(add-hook 'fsharp-mode-hook | |
(lambda () | |
(define-key fsharp-mode-map (kbd "M-RET") 'fsharp-eval-region) | |
(define-key fsharp-mode-map (kbd "C-SPC") 'fsharp-ac/complete-at-point))) | |
;; Ido | |
;; Display ido results vertically, rather than horizontally | |
;(require 'flx-ido) | |
;(ido-mode 1) | |
;(ido-everywhere 1) | |
;(flx-ido-mode 1) | |
;(setq ido-enable-flex-matching t) | |
;(set ido-use-faces nil) | |
;(setq ido-decorations (quote ("\n-> " "" "\n " "\n ..." "[" "]" " [No match]" " [Matched]" " [Not readable]" " [Too big]" " [Confirm]"))) | |
;(defun ido-disable-line-truncation () (set (make-local-variable 'truncate-lines) nil)) | |
;(add-hook 'ido-minibuffer-setup-hook 'ido-disable-line-truncation) | |
;(defun ido-define-keys () ;; C-n/p is more intuitive in vertical layout | |
; (define-key ido-completion-map (kbd "C-n") 'ido-next-match) | |
; (define-key ido-completion-map (kbd "C-p") 'ido-prev-match)) | |
;(add-hook 'ido-setup-hook 'ido-define-keys) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment