diff options
author | Franck Cuny <franckcuny@gmail.com> | 2015-09-16 16:40:16 -0700 |
---|---|---|
committer | Franck Cuny <franckcuny@gmail.com> | 2015-09-16 16:40:16 -0700 |
commit | f10b5d0e994fe4167935047d99444b3bfa612474 (patch) | |
tree | 5279e7320ed826fde12b9fb4278755604bb94f9b | |
parent | [bash] editor (again) (diff) | |
download | emacs.d-f10b5d0e994fe4167935047d99444b3bfa612474.tar.gz |
[emacs] split config in different files.
Move the configuration for each language and major mode in it's own configuration file. Enable the theme "leuven" if run in windowed mode.
-rw-r--r-- | emacs.d/init.el | 82 | ||||
-rw-r--r-- | emacs.d/inits/00_bindings.el | 4 | ||||
-rw-r--r-- | emacs.d/inits/00_emacs.el | 20 | ||||
-rw-r--r-- | emacs.d/inits/00_ui.el | 40 | ||||
-rw-r--r-- | emacs.d/inits/50_development.el | 47 | ||||
-rw-r--r-- | emacs.d/inits/50_flycheck.el | 23 | ||||
-rw-r--r-- | emacs.d/inits/50_flyspell.el | 9 | ||||
-rw-r--r-- | emacs.d/inits/50_git.el | 6 | ||||
-rw-r--r-- | emacs.d/inits/70_org.el | 29 | ||||
-rw-r--r-- | emacs.d/inits/90_lang-c.el | 6 | ||||
-rw-r--r-- | emacs.d/inits/90_lang-gol.el | 14 | ||||
-rw-r--r-- | emacs.d/inits/90_lang-python.el | 5 | ||||
-rw-r--r-- | emacs.d/inits/90_lang-scala.el | 6 | ||||
-rw-r--r-- | emacs.d/inits/90_markdown.el | 9 | ||||
-rw-r--r-- | emacs.d/inits/90_mustache.el | 4 | ||||
-rw-r--r-- | emacs.d/inits/90_puppet.el | 3 | ||||
-rw-r--r-- | emacs.d/inits/90_shell.el | 3 | ||||
-rw-r--r-- | emacs.d/inits/90_thrift.el | 3 | ||||
-rw-r--r-- | emacs.d/inits/90_yaml.el | 3 | ||||
-rw-r--r-- | emacs.d/packages.el | 4 |
20 files changed, 266 insertions, 54 deletions
diff --git a/emacs.d/init.el b/emacs.d/init.el index 83b622d..2ec87da 100644 --- a/emacs.d/init.el +++ b/emacs.d/init.el @@ -1,50 +1,32 @@ -;; no menu -(menu-bar-mode -1) - -;; show parenthesis -(show-paren-mode +1) - -;; no color -(global-font-lock-mode -1) - -;; and lose the stupid pipe chars on the split-screen bar -(set-face-foreground 'vertical-border "white") -(set-face-background 'vertical-border "white") - -;; alias yes-or-no to y-or-n -(fset 'yes-or-no-p 'y-or-n-p) - -;; set utf-8 as the default encoding -(prefer-coding-system 'utf-8-unix) - -(autoload 'ibuffer "ibuffer" "List buffers." t) - -;;; set some variables -;; add a new line at the end of the file -(setq - auto-save-default nil - auto-save-list-file-prefix nil - frame-title-format '(buffer-file-name "%f" ("%b")) - inhibit-startup-message t - make-backup-files nil - require-final-newline t - tab-always-indent 'complete - vc-follow-symlinks t) - -;; twitter's default -(setq-default - c-basic-offset 2 - indent-tabs-mode nil - python-indent-offset 2 - scala-indent:use-javadoc-style t - sh-basic-offset 2 - sh-indentation 2) - -;;; some bindings -(global-set-key (kbd "M-j") 'join-line) -(global-set-key (kbd "C-x C-b") 'ibuffer) - -;;; if our version is >= 24 and we have the packages.el file, load it. -(when (>= emacs-major-version 24) - (if (file-exists-p "~/.emacs.d/packages.el") - (load "~/.emacs.d/packages.el"))) +(require 'package) + +;;; Code: +(setq package-archives + (append package-archives + '(("melpa" . "http://melpa.milkbox.net/packages/")))) + +(package-initialize) +(setq package-enable-at-startup nil) + +(unless package-archive-contents + (message "Refreshing ELPA package archives...") + (package-refresh-contents)) + +(unless (package-installed-p 'use-package) + (message "`use-package' not found. Installing...") + (package-install 'use-package)) + +(require 'use-package) +(setq use-package-minimum-reported-time 0 + use-package-verbose t) + +(use-package init-loader + :ensure t + :config + (setq init-loader-show-log-after-init t) + (init-loader-load (locate-user-emacs-file "inits"))) + +(use-package server + :config + (unless (server-running-p) + (server-start))) diff --git a/emacs.d/inits/00_bindings.el b/emacs.d/inits/00_bindings.el new file mode 100644 index 0000000..216d601 --- /dev/null +++ b/emacs.d/inits/00_bindings.el @@ -0,0 +1,4 @@ +;;; some bindings +(global-set-key (kbd "M-j") 'join-line) +(global-set-key (kbd "C-x C-b") 'ibuffer) +(global-set-key (kbd "<s-return>") 'toggle-frame-fullscreen) diff --git a/emacs.d/inits/00_emacs.el b/emacs.d/inits/00_emacs.el new file mode 100644 index 0000000..02ca40c --- /dev/null +++ b/emacs.d/inits/00_emacs.el @@ -0,0 +1,20 @@ +;; alias yes-or-no to y-or-n +(fset 'yes-or-no-p 'y-or-n-p) + +;; set utf-8 as the default encoding +(prefer-coding-system 'utf-8-unix) + +(setq auto-save-default nil) + +(setq auto-save-list-file-prefix nil) + +;; *no* backups +(setq make-backup-files nil) + +;; always add a newline +(setq require-final-newline t) + +;; follow symlinks +(setq vc-follow-symlinks t) + +(setq tab-always-indent 'complete) diff --git a/emacs.d/inits/00_ui.el b/emacs.d/inits/00_ui.el new file mode 100644 index 0000000..151d0c1 --- /dev/null +++ b/emacs.d/inits/00_ui.el @@ -0,0 +1,40 @@ +;; no menu +(menu-bar-mode -1) + +;; show parenthesis +(show-paren-mode +1) + +;; enable colors +(global-font-lock-mode +1) + +;; no startup screen +(setq inhibit-startup-message t) + +(setq frame-title-format '(buffer-file-name "%f" ("%b"))) + +;; and lose the stupid pipe chars on the split-screen bar +;; (set-face-foreground 'vertical-border "white") +;; (set-face-background 'vertical-border "white") + +;; (set-fringe-mode 1) + +(use-package diminish + :ensure t + :config + (progn + (eval-after-load "whitespace" '(diminish 'whitespace-mode)))) + +(use-package leuven-theme + :ensure t) + +(when window-system + ;;hide tool-bar + (tool-bar-mode 0) + ;;hide scroll-bar + (scroll-bar-mode 0) + ;;hide menu-bar + (menu-bar-mode 0) + ;; load leuven + (load-theme 'leuven t) + ;; menlo + (set-frame-font "Menlo-11")) diff --git a/emacs.d/inits/50_development.el b/emacs.d/inits/50_development.el new file mode 100644 index 0000000..526ec53 --- /dev/null +++ b/emacs.d/inits/50_development.el @@ -0,0 +1,47 @@ +(use-package ag + :ensure t + :defer t) + +(use-package goto-chg + :ensure t + :bind (("C-." . goto-last-change) + ("C-," . goto-last-change-reverse))) + +(use-package projectile + :ensure t + :diminish projectile-mode + :init + (setq projectile-enable-caching t) + :config + (projectile-global-mode)) + +(use-package rainbow-delimiters + :ensure t + :defer t + :init + (progn + (add-hook 'emacs-lisp-mode-hook #'rainbow-delimiters-mode))) + +(use-package smartparens + :ensure t + :diminish smartparens-mode + :config + (progn + (require 'smartparens-config) + (smartparens-global-mode 1))) + +(use-package gist + :ensure t + :bind ("C-c g p" . gist-region-or-buffer-private) + :config + (setq gist-view-gist t)) + +(use-package github-browse-file + :ensure t + :defer t) + +(setq-default indent-tabs-mode nil) + +(use-package exec-path-from-shell + :config + (exec-path-from-shell-initialize)) diff --git a/emacs.d/inits/50_flycheck.el b/emacs.d/inits/50_flycheck.el new file mode 100644 index 0000000..345e717 --- /dev/null +++ b/emacs.d/inits/50_flycheck.el @@ -0,0 +1,23 @@ +(use-package flycheck + :ensure t + :defer t + :preface (progn + (defun check-source-predicate () + (and (executable-find "check.pex") + (buffer-file-name) + (string-match "src/source/.*\.py$" (buffer-file-name))))) + :init + (progn + (add-hook 'prog-mode-hook 'flycheck-mode) + (setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc))) + :config + (progn + (flycheck-define-checker source-check + "A syntax checker for python source code in Source, using `dist.pex'" + :command ("check.pex" source) + ;;; errors are reported like this: + ;;; E241:ERROR <file name>:<line> <message> + :error-patterns ((error line-start (1+ nonl) ":ERROR" (1+ nonl) ":" line (message) line-end)) + :predicate check-source-predicate + :modes (python-mode)) + (add-to-list 'flycheck-checkers 'source-check))) diff --git a/emacs.d/inits/50_flyspell.el b/emacs.d/inits/50_flyspell.el new file mode 100644 index 0000000..fe0c754 --- /dev/null +++ b/emacs.d/inits/50_flyspell.el @@ -0,0 +1,9 @@ +;; (use-package flyspell +;; :ensure t +;; :defer t +;; :init +;; (progn +;; (setq ispell-program-name "aspell" +;; ispell-list-command "--list") +;; (add-hook 'prog-mode-hook 'flyspell-prog-mode) +;; (add-hook 'text-mode-hook 'turn-on-flyspell))) diff --git a/emacs.d/inits/50_git.el b/emacs.d/inits/50_git.el new file mode 100644 index 0000000..7ce259c --- /dev/null +++ b/emacs.d/inits/50_git.el @@ -0,0 +1,6 @@ +(use-package magit + :ensure t + :bind ("C-x g" . magit-status) + :config + (progn + (setenv "GIT_PAGER" ""))) diff --git a/emacs.d/inits/70_org.el b/emacs.d/inits/70_org.el new file mode 100644 index 0000000..4f20faa --- /dev/null +++ b/emacs.d/inits/70_org.el @@ -0,0 +1,29 @@ +(use-package org + :ensure t + :bind ("C-c c" . org-capture) + :init + (progn + (add-hook 'org-mode-hook 'turn-on-auto-fill)) + :config + (setq + org-startup-indented t + org-tags-column -70 + org-hide-leading-stars t + org-cycle-separator-lines 0 + org-src-fontify-natively t + org-edit-src-content-indentation 0 + org-catch-invisible-edits 'error + org-pretty-entities t + org-default-notes-file "~/Dropbox/Projects/capture.org") + (setq org-capture-templates + '(("t" "Capture a Task" entry + (file org-default-notes-file) + "* TODO %?\n%i\n" :empty-lines 0))) + (setq org-todo-state-tags-triggers + (quote (("CANCELLED" ("CANCELLED" . t)) + ("WAITING" ("WAITING" . t)) + ("HOLD" ("WAITING") ("HOLD" . t)) + (done ("WAITING") ("HOLD")) + ("TODO" ("WAITING") ("CANCELLED") ("HOLD")) + ("NEXT" ("WAITING") ("CANCELLED") ("HOLD")) + ("DONE" ("WAITING") ("CANCELLED") ("HOLD")))))) diff --git a/emacs.d/inits/90_lang-c.el b/emacs.d/inits/90_lang-c.el new file mode 100644 index 0000000..bd4cc7f --- /dev/null +++ b/emacs.d/inits/90_lang-c.el @@ -0,0 +1,6 @@ +(use-package google-c-style + :ensure t + :defer t + :config + (progn + (setq c-basic-offset 2))) diff --git a/emacs.d/inits/90_lang-gol.el b/emacs.d/inits/90_lang-gol.el new file mode 100644 index 0000000..c7ce19d --- /dev/null +++ b/emacs.d/inits/90_lang-gol.el @@ -0,0 +1,14 @@ +(use-package go-eldoc + :ensure t + :defer t + :init (add-hook 'go-mode-hook 'go-eldoc-setup)) + +(use-package go-mode + :ensure t + :defer t + :config + (progn + (bind-key "C-c C-f" 'gofmt go-mode-map) + (bind-key "C-c h" 'godoc go-mode-map) + (bind-key "C-c C-g" 'go-goto-imports go-mode-map) + (bind-key "C-c C-r" 'go-remove-unused-imports go-mode-map))) diff --git a/emacs.d/inits/90_lang-python.el b/emacs.d/inits/90_lang-python.el new file mode 100644 index 0000000..dd0e46e --- /dev/null +++ b/emacs.d/inits/90_lang-python.el @@ -0,0 +1,5 @@ +(use-package python + :mode ("\\.\\(py\\|aurora\\)$" . python-mode) + :config + (progn + (setq python-indent-offset 2))) diff --git a/emacs.d/inits/90_lang-scala.el b/emacs.d/inits/90_lang-scala.el new file mode 100644 index 0000000..d105bcc --- /dev/null +++ b/emacs.d/inits/90_lang-scala.el @@ -0,0 +1,6 @@ +(use-package scala-mode2 + :ensure t + :defer t + :config + (progn + (setq-default scala-indent:use-javadoc-style t))) diff --git a/emacs.d/inits/90_markdown.el b/emacs.d/inits/90_markdown.el new file mode 100644 index 0000000..3ec3ec4 --- /dev/null +++ b/emacs.d/inits/90_markdown.el @@ -0,0 +1,9 @@ +(use-package markdown-mode + :ensure t + :mode ("\\.\\(m\\(ark\\)?down\\|md\\)$" . markdown-mode) + :config + (progn + (let ((preferred-markdown-impl "peg-markdown")) + (when (executable-find preferred-markdown-impl) + (setq markdown-command preferred-markdown-impl))))) + diff --git a/emacs.d/inits/90_mustache.el b/emacs.d/inits/90_mustache.el new file mode 100644 index 0000000..32e1161 --- /dev/null +++ b/emacs.d/inits/90_mustache.el @@ -0,0 +1,4 @@ +(use-package mustache-mode + :mode ("\\.\\(alert\\|mustache\\)$" . mustache-mode) + :ensure t + :defer t) diff --git a/emacs.d/inits/90_puppet.el b/emacs.d/inits/90_puppet.el new file mode 100644 index 0000000..97b8a67 --- /dev/null +++ b/emacs.d/inits/90_puppet.el @@ -0,0 +1,3 @@ +(use-package puppet-mode + :ensure t + :mode ("\\.pp$" . puppet-mode)) diff --git a/emacs.d/inits/90_shell.el b/emacs.d/inits/90_shell.el new file mode 100644 index 0000000..aa3fab5 --- /dev/null +++ b/emacs.d/inits/90_shell.el @@ -0,0 +1,3 @@ +(setq-default + sh-basic-offset 2 + sh-indentation 2) diff --git a/emacs.d/inits/90_thrift.el b/emacs.d/inits/90_thrift.el new file mode 100644 index 0000000..3a99429 --- /dev/null +++ b/emacs.d/inits/90_thrift.el @@ -0,0 +1,3 @@ +(use-package thrift + :ensure t + :defer t) diff --git a/emacs.d/inits/90_yaml.el b/emacs.d/inits/90_yaml.el new file mode 100644 index 0000000..6758789 --- /dev/null +++ b/emacs.d/inits/90_yaml.el @@ -0,0 +1,3 @@ +(use-package yaml-mode + :ensure t + :defer t) diff --git a/emacs.d/packages.el b/emacs.d/packages.el index e4f4e8d..443a115 100644 --- a/emacs.d/packages.el +++ b/emacs.d/packages.el @@ -110,16 +110,12 @@ (use-package markdown-mode :ensure t :mode ("\\.\\(m\\(ark\\)?down\\|md\\)$" . markdown-mode) - :init - (add-hook 'markdown-mode-hook 'spell-check-and-wrap-at-80) :config (progn (let ((preferred-markdown-impl "peg-markdown")) (when (executable-find preferred-markdown-impl) (setq markdown-command preferred-markdown-impl))))) -(use-package midnight) - (use-package mustache-mode :mode ("\\.\\(alert\\|mustache\\)$" . mustache-mode) :ensure t |