2015-04-06 21:35:55 +00:00
|
|
|
;;; BalkEmacs --- My emacs configuration
|
2015-02-21 00:40:31 +00:00
|
|
|
;;; Commentary:
|
|
|
|
|
2015-04-06 21:35:55 +00:00
|
|
|
;;; Config that needs to be loaded before require
|
2015-03-24 21:58:59 +00:00
|
|
|
(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.
|
2015-04-06 21:35:55 +00:00
|
|
|
'(custom-safe-themes (quote ("8db4b03b9ae654d4a57804286eb3e332725c84d7cdab38463cb6b97d5762ad26" "31a01668c84d03862a970c471edbd377b2430868eccf5e8a9aec6831f1a0908d" "1297a022df4228b81bc0436230f211bad168a117282c20ddcba2db8c6a200743" "c3c0a3702e1d6c0373a0f6a557788dfd49ec9e66e753fb24493579859c8e95ab" "3c83b3676d796422704082049fc38b6966bcad960f896669dfc21a7a37a748fa" default))))
|
2015-03-24 21:58:59 +00:00
|
|
|
(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.
|
|
|
|
)
|
|
|
|
|
|
|
|
(setq evil-want-C-u-scroll t)
|
|
|
|
|
2015-02-21 00:40:31 +00:00
|
|
|
;;; Code:
|
|
|
|
(require 'package)
|
|
|
|
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
|
|
|
|
|
|
|
|
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
|
|
|
|
|
|
|
|
(setq package-enable-at-startup nil)
|
|
|
|
|
|
|
|
(unless (require 'el-get nil 'noerror)
|
|
|
|
(with-current-buffer
|
|
|
|
(url-retrieve-synchronously
|
|
|
|
"https://raw.github.com/dimitri/el-get/master/el-get-install.el")
|
|
|
|
(goto-char (point-max))
|
|
|
|
(eval-print-last-sexp)))
|
|
|
|
|
|
|
|
(add-to-list 'el-get-recipe-path "~/.emacs.d/el-get-user/recipes")
|
|
|
|
|
|
|
|
(setq el-get-sources
|
|
|
|
'((:name molokai-theme
|
|
|
|
:type github
|
|
|
|
:pkgname "hbin/molokai-theme"
|
|
|
|
:load "molokai-theme.el")))
|
|
|
|
|
|
|
|
(setq
|
|
|
|
my:el-get-packages
|
|
|
|
'(el-get ; el-get is self-hosting
|
|
|
|
ace-jump-mode
|
2015-02-23 06:07:14 +00:00
|
|
|
auctex
|
|
|
|
auctex-latexmk
|
2015-02-21 00:40:31 +00:00
|
|
|
auto-complete ; complete as you type with overlays
|
2015-02-23 06:07:14 +00:00
|
|
|
ein
|
2015-02-21 00:40:31 +00:00
|
|
|
emmet-mode
|
2015-02-23 06:07:14 +00:00
|
|
|
; escreen ; screen for emacs, C-\ C-h
|
2015-02-21 00:40:31 +00:00
|
|
|
evil
|
|
|
|
evil-jumper
|
2015-04-06 21:35:55 +00:00
|
|
|
evil-leader
|
2015-02-21 00:40:31 +00:00
|
|
|
evil-matchit
|
|
|
|
evil-nerd-commenter
|
2015-03-24 21:58:59 +00:00
|
|
|
evil-numbers
|
2015-04-06 21:35:55 +00:00
|
|
|
evil-org-mode
|
2015-02-21 00:40:31 +00:00
|
|
|
evil-surround
|
2015-04-06 21:35:55 +00:00
|
|
|
exec-path-from-shell
|
2015-02-23 06:07:14 +00:00
|
|
|
fill-column-indicator
|
2015-02-21 00:40:31 +00:00
|
|
|
flycheck
|
2015-02-23 06:07:14 +00:00
|
|
|
gist
|
2015-04-06 21:35:55 +00:00
|
|
|
git-gutter-fringe
|
|
|
|
guide-key
|
2015-02-21 00:40:31 +00:00
|
|
|
helm
|
2015-02-23 06:07:14 +00:00
|
|
|
helm-ag
|
2015-02-21 00:40:31 +00:00
|
|
|
helm-projectile
|
2015-03-20 20:21:18 +00:00
|
|
|
helm-pydoc
|
2015-04-06 21:35:55 +00:00
|
|
|
helm-swoop
|
2015-02-23 06:07:14 +00:00
|
|
|
jedi
|
|
|
|
magit
|
2015-02-21 00:40:31 +00:00
|
|
|
markdown-mode
|
2015-03-24 21:58:59 +00:00
|
|
|
neotree
|
2015-02-23 06:07:14 +00:00
|
|
|
nxhtml
|
2015-03-10 16:30:06 +00:00
|
|
|
nose
|
2015-02-23 06:07:14 +00:00
|
|
|
pivotal-tracker
|
2015-03-24 21:58:59 +00:00
|
|
|
popwin
|
2015-02-23 06:07:14 +00:00
|
|
|
pretty-mode
|
|
|
|
projectile
|
|
|
|
;; smex
|
2015-03-24 21:58:59 +00:00
|
|
|
smart-mode-line
|
2015-02-23 06:07:14 +00:00
|
|
|
switch-window ; takes over C-x o
|
2015-03-24 21:58:59 +00:00
|
|
|
undo-tree
|
2015-04-06 21:35:55 +00:00
|
|
|
vimrc-mode
|
|
|
|
volatile-highlights
|
|
|
|
yaml-mode
|
2015-02-23 06:07:14 +00:00
|
|
|
yasnippet
|
2015-04-06 21:35:55 +00:00
|
|
|
zygospore
|
2015-02-23 06:07:14 +00:00
|
|
|
; zencoding-mode ; http://www.emacswiki.org/emacs/ZenCoding
|
2015-02-21 00:40:31 +00:00
|
|
|
;; color-theme-solarized
|
|
|
|
;; color-theme-tango)) ; check out color-theme-olarized
|
|
|
|
|
|
|
|
;; install new packages and init already installed packages
|
|
|
|
))
|
|
|
|
|
|
|
|
(setq my:el-get-packages
|
|
|
|
(append my:el-get-packages
|
|
|
|
(mapcar #'el-get-source-name el-get-sources)))
|
|
|
|
|
|
|
|
(require 'el-get-elpa)
|
|
|
|
(unless (file-directory-p el-get-recipe-path-elpa)
|
|
|
|
(el-get-elpa-build-local-recipes))
|
|
|
|
|
|
|
|
(el-get 'sync my:el-get-packages)
|
|
|
|
|
|
|
|
|
|
|
|
;;(color-theme-solarized-dark)
|
|
|
|
;(load-theme 'soothe t)
|
|
|
|
;;(require 'monokai-theme)
|
|
|
|
(load-theme 'molokai t)
|
|
|
|
|
|
|
|
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
|
|
|
|
;;(setq completion-cycle-threshold t)
|
|
|
|
|
2015-04-06 21:35:55 +00:00
|
|
|
;;; Neotree
|
|
|
|
(require 'neotree)
|
|
|
|
(setq projectile-switch-project-action 'neotree-projectile-action)
|
|
|
|
(when neo-persist-show
|
|
|
|
(add-hook 'popwin:before-popup-hook
|
|
|
|
(lambda () (setq neo-persist-show nil)))
|
|
|
|
(add-hook 'popwin:after-popup-hook
|
|
|
|
(lambda () (setq neo-persist-show t))))
|
2015-02-21 00:40:31 +00:00
|
|
|
|
2015-04-06 21:35:55 +00:00
|
|
|
;;; Popwin
|
|
|
|
(require 'popwin)
|
|
|
|
(popwin-mode)
|
2015-02-21 00:40:31 +00:00
|
|
|
|
2015-03-24 21:58:59 +00:00
|
|
|
;;; Linum
|
2015-02-21 00:40:31 +00:00
|
|
|
(require 'linum)
|
2015-04-06 21:35:55 +00:00
|
|
|
(add-hook 'prog-mode-hook 'linum-mode)
|
|
|
|
(setq linum-format 'dynamic)
|
|
|
|
(set-face-attribute 'linum nil :height 90)
|
|
|
|
|
|
|
|
(setq highlight-color "#232323")
|
|
|
|
|
|
|
|
;;; Show column number
|
|
|
|
(column-number-mode)
|
|
|
|
|
|
|
|
;;; Highlight line
|
|
|
|
(global-hl-line-mode)
|
|
|
|
(set-face-background 'hl-line highlight-color)
|
|
|
|
|
|
|
|
;;; Flycheck
|
|
|
|
(add-hook 'after-init-hook #'global-flycheck-mode)
|
|
|
|
(setq flycheck-temp-prefix ".flycheck")
|
2015-02-21 00:40:31 +00:00
|
|
|
|
2015-03-24 21:58:59 +00:00
|
|
|
;; (global-linum-mode 1)
|
|
|
|
;; (setq linum-mode-inhibit-modes-list '(eshell-mode
|
|
|
|
;; helm-buffer
|
|
|
|
;; shell-mode
|
|
|
|
;; ein:notebook-bg-mode
|
|
|
|
;; ein:bg/ein:notebook
|
|
|
|
;; ein:bg
|
|
|
|
;; ein:notebook
|
|
|
|
;; ))
|
|
|
|
;; (defadvice linum-on (around linum-on-inhibit-for-modes)
|
|
|
|
;; "Stop the load of linum-mode for some major modes."
|
|
|
|
;; (unless (member major-mode linum-mode-inhibit-modes-list)
|
|
|
|
;; ad-do-it))
|
|
|
|
;; (ad-activate 'linum-on)
|
2015-04-06 21:35:55 +00:00
|
|
|
(add-hook 'prog-mode-hook 'fci-mode)
|
2015-03-24 21:58:59 +00:00
|
|
|
|
|
|
|
;; (require 'powerline)
|
|
|
|
;; (powerline-center-evil-theme)
|
|
|
|
|
|
|
|
(sml/setup)
|
|
|
|
(sml/apply-theme 'dark)
|
2015-02-23 06:07:14 +00:00
|
|
|
|
2015-02-21 00:40:31 +00:00
|
|
|
(display-time-mode t)
|
|
|
|
|
2015-03-24 21:58:59 +00:00
|
|
|
;;; Global emacs settings
|
2015-04-06 21:35:55 +00:00
|
|
|
;; disable splash screen
|
2015-03-24 21:58:59 +00:00
|
|
|
(setq inhibit-splash-screen t)
|
|
|
|
(setq truncate-partial-width-windows nil)
|
|
|
|
(set-default 'truncate-lines nil)
|
2015-02-21 00:40:31 +00:00
|
|
|
;; No tabs, only 4 spaces, as default
|
|
|
|
(setq-default indent-tabs-mode nil)
|
|
|
|
(setq tab-width 4)
|
2015-03-20 20:21:18 +00:00
|
|
|
(setq default-tab-width 4);
|
2015-04-06 21:35:55 +00:00
|
|
|
;; Show info about available commands
|
|
|
|
(setq guide-key/guide-key-sequence '("SPC" ","))
|
2015-02-21 00:40:31 +00:00
|
|
|
|
2015-03-24 21:58:59 +00:00
|
|
|
;; Separate Configs
|
2015-02-21 00:40:31 +00:00
|
|
|
(add-to-list 'load-path (concat user-emacs-directory "config"))
|
2015-03-24 21:58:59 +00:00
|
|
|
(require 'config-latex)
|
|
|
|
(require 'config-python)
|
2015-02-21 00:40:31 +00:00
|
|
|
(eval-after-load 'ein-notebooklist
|
|
|
|
'(require 'config-ein))
|
2015-03-24 21:58:59 +00:00
|
|
|
(require 'config-helm)
|
|
|
|
(require 'config-evil)
|
|
|
|
(require 'config-org)
|
|
|
|
(require 'config-secret)
|
2015-04-06 21:35:55 +00:00
|
|
|
(require 'config-dired)
|
2015-02-21 00:40:31 +00:00
|
|
|
|
2015-03-24 21:58:59 +00:00
|
|
|
;;; Global modes
|
2015-04-06 21:35:55 +00:00
|
|
|
(tool-bar-mode 0)
|
2015-03-24 21:58:59 +00:00
|
|
|
(savehist-mode 1)
|
|
|
|
(show-paren-mode t)
|
|
|
|
(yas-global-mode 1)
|
2015-04-06 21:35:55 +00:00
|
|
|
(guide-key-mode 1)
|
2015-04-13 08:47:46 +00:00
|
|
|
(scroll-bar-mode 0)
|
2015-02-21 00:40:31 +00:00
|
|
|
|
2015-03-24 21:58:59 +00:00
|
|
|
;;; Specific modes
|
|
|
|
;; (autoload 'markdown-mode "markdown-mode"
|
|
|
|
;; "Major mode for editing Markdown files" t)
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.text\\'" . markdown-mode))
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.markdown\\'" . markdown-mode))
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
|
2015-02-21 00:40:31 +00:00
|
|
|
|
2015-03-24 21:58:59 +00:00
|
|
|
;;
|
|
|
|
;; Global Keybindings
|
|
|
|
;;
|
2015-02-21 00:40:31 +00:00
|
|
|
(global-set-key "\C-w" 'backward-kill-word)
|
|
|
|
(global-set-key "\C-x\C-k" 'kill-region)
|
2015-03-24 21:58:59 +00:00
|
|
|
(global-set-key [escape] 'keyboard-escape-quit)
|
|
|
|
(define-key helm-map (kbd "C-w") 'backward-kill-word)
|
2015-04-06 21:35:55 +00:00
|
|
|
(global-set-key (kbd "C-x 1") 'zygospore-toggle-delete-other-windows)
|
2015-02-21 00:40:31 +00:00
|
|
|
|
|
|
|
;; Don't clover my folders
|
|
|
|
(setq
|
|
|
|
backup-by-copying t ; don't clobber symlinks
|
|
|
|
delete-old-versions t
|
|
|
|
kept-new-versions 6
|
|
|
|
kept-old-versions 2
|
|
|
|
version-control t) ; use versioned backups
|
|
|
|
|
|
|
|
(setq backup-directory-alist
|
|
|
|
`((".*" . ,temporary-file-directory)))
|
|
|
|
(setq auto-save-file-name-transforms
|
|
|
|
`((".*" , temporary-file-directory t)))
|
2015-03-24 21:58:59 +00:00
|
|
|
;; Preven #file#.txt files
|
|
|
|
(setq create-lockfiles nil)
|
2015-02-21 00:40:31 +00:00
|
|
|
|
|
|
|
(setq inhibit-startup-message t)
|
2015-03-24 21:58:59 +00:00
|
|
|
|
2015-02-21 00:40:31 +00:00
|
|
|
(toggle-indicate-empty-lines)
|
|
|
|
|
2015-03-24 21:58:59 +00:00
|
|
|
;;; Columns
|
2015-02-21 00:40:31 +00:00
|
|
|
(require 'fill-column-indicator)
|
|
|
|
(setq fci-rule-column 79)
|
2015-04-06 21:35:55 +00:00
|
|
|
(setq fci-rule-color highlight-color)
|
|
|
|
(setq fci-rule-width 3)
|
|
|
|
|
|
|
|
(fringe-mode '(5 . 5))
|
2015-02-21 00:40:31 +00:00
|
|
|
|
2015-02-23 06:07:14 +00:00
|
|
|
(eval-after-load 'magit
|
|
|
|
'(progn
|
|
|
|
(set-face-foreground 'magit-diff-add "green3")
|
|
|
|
(set-face-foreground 'magit-diff-del "red3")
|
|
|
|
(set-face-background 'magit-item-highlight "black")))
|
|
|
|
|
2015-03-24 21:58:59 +00:00
|
|
|
;; Fix Scrolling in tmux
|
2015-04-06 21:35:55 +00:00
|
|
|
;; Set the default font too
|
|
|
|
(defun client-config (&optional frame)
|
2015-03-10 16:30:06 +00:00
|
|
|
"Establish settings for the current terminal."
|
|
|
|
(if (not frame) ;; The initial call.
|
|
|
|
(xterm-mouse-mode 1)
|
|
|
|
;; Otherwise called via after-make-frame-functions.
|
|
|
|
(if xterm-mouse-mode
|
|
|
|
;; Re-initialise the mode in case of a new terminal.
|
|
|
|
(xterm-mouse-mode 1))))
|
|
|
|
;; Evaluate both now (for non-daemon emacs) and upon frame creation
|
|
|
|
;; (for new terminals via emacsclient).
|
2015-04-06 21:35:55 +00:00
|
|
|
(client-config)
|
|
|
|
(add-hook 'after-make-frame-functions 'client-config)
|
|
|
|
|
|
|
|
(defun toggle-current-window-dedication ()
|
|
|
|
(interactive)
|
|
|
|
(let* ((window (selected-window))
|
|
|
|
(dedicated (window-dedicated-p window)))
|
|
|
|
(set-window-dedicated-p window (not dedicated))
|
|
|
|
(message "Window %sdedicated to %s"
|
|
|
|
(if dedicated "no longer " "")
|
|
|
|
(buffer-name))))
|
|
|
|
|
|
|
|
(global-set-key [insert] 'toggle-current-window-dedication)
|
|
|
|
|
2015-03-10 16:30:06 +00:00
|
|
|
|
|
|
|
;; Disable copying to the clipboard
|
|
|
|
;; (setq x-select-enable-clipboard nil)
|
|
|
|
;; (setq x-select-enable-primary t)
|
|
|
|
|
2015-04-06 21:35:55 +00:00
|
|
|
;;; Show human sizes in dired
|
2015-03-24 21:58:59 +00:00
|
|
|
(setq-default dired-listing-switches "-alhv")
|
|
|
|
|
2015-04-06 21:35:55 +00:00
|
|
|
(defalias 'yes-or-no-p 'y-or-n-p)
|
|
|
|
|
|
|
|
;;; Winner
|
|
|
|
;;; History of visited windows
|
|
|
|
;;; C-<left>, C-<right>
|
|
|
|
(when (fboundp 'winner-mode)
|
|
|
|
(winner-mode 1))
|
|
|
|
|
|
|
|
(exec-path-from-shell-initialize)
|
|
|
|
|
|
|
|
(require 'git-gutter-fringe)
|
|
|
|
(setq git-gutter-fr:side 'right-fringe)
|
|
|
|
|
|
|
|
;; set a default font
|
|
|
|
(add-to-list 'default-frame-alist '(font . "DejaVu Sans Mono-10"))
|
|
|
|
;; emacs doesn't actually save undo history with revert-buffer
|
|
|
|
;; see http://lists.gnu.org/archive/html/bug-gnu-emacs/2011-04/msg00151.html
|
|
|
|
;; fix that.
|
|
|
|
(defun revert-buffer-keep-history (&optional IGNORE-AUTO NOCONFIRM PRESERVE-MODES)
|
|
|
|
(interactive)
|
|
|
|
|
|
|
|
(setq tmp (point))
|
|
|
|
;; tell Emacs the modtime is fine, so we can edit the buffer
|
|
|
|
(clear-visited-file-modtime)
|
|
|
|
|
|
|
|
;; insert the current contents of the file on disk
|
|
|
|
(widen)
|
|
|
|
(delete-region (point-min) (point-max))
|
|
|
|
(insert-file-contents (buffer-file-name))
|
|
|
|
|
|
|
|
;; mark the buffer as not modified
|
|
|
|
(not-modified)
|
|
|
|
(set-visited-file-modtime)
|
|
|
|
(goto-char tmp)
|
|
|
|
)
|
|
|
|
|
|
|
|
(setq revert-buffer-function 'revert-buffer-keep-history)
|
|
|
|
|
|
|
|
(require 'recentf)
|
|
|
|
(recentf-mode 1)
|
|
|
|
(setq recentf-max-saved-items 300)
|
|
|
|
(setq recentf-max-menu-items 20)
|
|
|
|
|
|
|
|
|
2015-03-24 21:58:59 +00:00
|
|
|
(provide '.emacs)
|