Advertisement
Guest User

settings.org

a guest
Jan 12th, 2016
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 6.75 KB | None | 0 0
  1. span class="sy0"> * Emacs Initialization
  2. ** Package Repos
  3. #+BEGIN_SRC emacs-lisp
  4.   ;;Set package repos  
  5.   (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
  6.                ("marmalade" . "http://marmalade-repo.org/packages/")
  7.                ("melpa" . "http://melpa.milkbox.net/packages/")))
  8. #+END_SRC
  9.    
  10. ** Other files
  11. #+BEGIN_SRC emacs-lisp
  12.   ;;Add theme files location
  13.   (add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
  14. #+END_SRC
  15.  
  16. * General Settings
  17. ** Style Settings
  18. #+BEGIN_SRC emacs-lisp
  19.   ;;Set theme
  20.   (load-theme 'chiaro t)
  21.  
  22.   ;;Set default font
  23.   (set-frame-font "DejaVu Sans Mono")
  24.   (set-face-attribute 'default nil :height 110)
  25.  
  26.   ;;Hide toolbar
  27.   (tool-bar-mode -1)
  28.  
  29.   ;;Hide menu-bar
  30.   (menu-bar-mode -1)
  31.  
  32.   ;;Hide scrollbar
  33.   (scroll-bar-mode -1)
  34.  
  35.   ;;Highlight current line
  36.   (global-hl-line-mode 1)
  37.  
  38.   ;;Highlight matching pairs (braces, etc.), with delay removed
  39.   (setq show-paren-delay 0)
  40.   (show-paren-mode 1)
  41. #+END_SRC
  42. ** Undo Tree
  43. #+BEGIN_SRC emacs-lisp
  44.   (use-package undo-tree
  45.     :config
  46.     (global-undo-tree-mode))
  47. #+END_SRC
  48. ** Volatile Highlights
  49. #+BEGIN_SRC emacs-lisp
  50.   (use-package volatile-highlights
  51.     :config
  52.     (volatile-highlights-mode t))
  53. #+END_SRC
  54. ** Helm
  55. #+BEGIN_SRC emacs-lisp
  56.   (use-package helm
  57.     :init
  58.     (require 'helm-config)
  59.     :config
  60.     ;;pretty much all of this config is stolen from Tuhdo's Helm guide
  61.     ;;found: http://tuhdo.github.io/helm-intro.html
  62.     ;; The default "C-x c" is quite close to "C-x C-c", which quits Emacs.
  63.     ;; Changed to "C-c h". Note: We must set "C-c h" globally, because we
  64.     ;; cannot change `helm-command-prefix-key' once `helm-config' is loaded.
  65.     (global-set-key (kbd "C-c h") 'helm-command-prefix)
  66.     (global-unset-key (kbd "C-x c"))
  67.     (when (executable-find "curl")
  68.       (setq helm-google-suggest-use-curl-p t))
  69.  
  70.     ;;open helm buffer inside current window, not occupy whole other window
  71.     (setq helm-split-window-in-side-p t)
  72.  
  73.     ;;move to end or beginning of source when reaching top or bottom of source.
  74.     (setq helm-move-to-line-cycle-in-source t)
  75.  
  76.     ;;search for library in `require' and `declare-function' sexp.
  77.     (setq helm-ff-search-library-in-sexp t)
  78.  
  79.     ;;scroll 8 lines other window using M-<next>/M-<prior>
  80.     (setq helm-scroll-amount 8)
  81.  
  82.     ;;need to look up what this does
  83.     (setq helm-ff-file-name-history-use-recentf t)
  84.  
  85.     ;;rebind tab to run persistent action
  86.     (define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action)
  87.  
  88.     ;;make TAB works in terminal
  89.     (define-key helm-map (kbd "C-i") 'helm-execute-persistent-action)
  90.  
  91.     ;;list actions using C-z
  92.     (define-key helm-map (kbd "C-z")  'helm-select-action)
  93.  
  94.     ;;helm-M-x keybind
  95.     (global-set-key (kbd "M-x") 'helm-M-x)
  96.  
  97.     ;;optional fuzzy matching for helm-M-x
  98.     (setq helm-M-x-fuzzy-match t)
  99.  
  100.     ;;helm-show-kill-ring keybind
  101.     (global-set-key (kbd "M-y") 'helm-show-kill-ring)
  102.  
  103.     ;;helm-mini keybind
  104.     (global-set-key (kbd "C-x b") 'helm-mini)
  105.  
  106.     ;;fuzzy matching for helm-mini
  107.     (setq helm-buffers-fuzzy-matching t
  108.           helm-recentf-fuzzy-match    t)
  109.  
  110.     ;;helm-find-files
  111.     (global-set-key (kbd "C-x C-f") 'helm-find-files)
  112.  
  113.     ;;enable search pattern in header line
  114.     (setq helm-echo-input-in-header-line t)
  115.     ;;and turn off minibuffer when using helm session
  116.     (defun helm-hide-minibuffer-maybe ()
  117.       (when (with-helm-buffer helm-echo-input-in-header-line)
  118.         (let ((ov (make-overlay (point-min) (point-max) nil nil t)))
  119.           (overlay-put ov 'window (selected-window))
  120.           (overlay-put ov 'face (let ((bg-color (face-background 'default nil)))
  121.                                   `(:background ,bg-color :foreground ,bg-color)))
  122.           (setq-local cursor-type nil))))
  123.     (add-hook 'helm-minibuffer-set-up-hook 'helm-hide-minibuffer-maybe)
  124.     ;; enables helm completions for Emacs commands
  125.     (helm-mode 1))
  126. #+END_SRC
  127. ** Projectile
  128. #+BEGIN_SRC emacs-lisp
  129.   (projectile-global-mode)
  130.   (setq projectile-mode-line nil)
  131. #+END_SRC
  132. * Org
  133. #+BEGIN_SRC emacs-lisp
  134.   (use-package org
  135.     :config
  136.     ;;enable syntax highighting in org src blocks
  137.     (setq org-src-fontify-natively t)
  138.     ;;enable native tab behavior in src blocks
  139.     (setq org-src-tab-acts-natively t))
  140. #+END_SRC
  141. * Coding
  142. ** General
  143. *** Misc
  144. #+BEGIN_SRC emacs-lisp
  145.   ;;enable linum-mode
  146.   (add-hook 'prog-mode-hook 'linum-mode)
  147.   ;;aggressive indent-mode
  148.   (use-package aggresive-indent
  149.     :config
  150.     (global-aggressive-indent-mode 1))
  151.   ;;fill-column-indicator
  152.   (use-package fill-column-indicator
  153.     :config
  154.     (add-hook 'prog-mode-hook 'fci-mode)
  155.     (setq fci-rule-column 80)
  156.  
  157.     ;;workaround for bug between company mode and fill-column-indicator
  158.     (defvar-local company-fci-mode-on-p nil)
  159.  
  160.     (defun company-turn-off-fci (&rest ignore)
  161.       (when (boundp 'fci-mode)
  162.         (setq company-fci-mode-on-p fci-mode)
  163.         (when fci-mode (fci-mode -1))))
  164.  
  165.     (defun company-maybe-turn-on-fci (&rest ignore)
  166.       (when company-fci-mode-on-p (fci-mode 1)))
  167.  
  168.     (add-hook 'company-completion-started-hook 'company-turn-off-fci)
  169.     (add-hook 'company-completion-finished-hook 'company-maybe-turn-on-fci)
  170.     (add-hook 'company-completion-cancelled-hook 'company-maybe-turn-on-fci))
  171. #+END_SRC
  172. *** Company
  173. #+BEGIN_SRC emacs-lisp
  174.   ;;company mode
  175.   (use-package company
  176.     :config
  177.     ;;enable company mode globally
  178.     (add-hook 'after-init-hook 'global-company-mode)
  179.     ;;makes completion start automatically rather than waiting for 3 chars / 0.5sec
  180.     (setq company-minimum-prefix-length 1)
  181.     (setq company-idle-delay 0))
  182.   ;;company quick help - for docstring tooltip
  183.   (use-package company-quickhelp
  184.     :config
  185.     (company-quickhelp-mode 1)
  186.     (setq company-quickhelp-max-lines 8))
  187. #+END_SRC
  188. *** Emacs-ycmd
  189. #+BEGIN_SRC emacs-lisp
  190.   (use-package ycmd
  191.     :config
  192.     (add-hook 'after-init-hook #'global-ycmd-mode)
  193.     (set-variable 'ycmd-server-command '("python2" "/home/dan/.ycmd/ycmd/ycmd")))
  194.   (use-package company-ycmd
  195.     :config
  196.     (company-ycmd-setup)
  197.     (set-variable 'ycmd-enable-fuzzy-matching nil))
  198. #+END_SRC
  199. *** Flycheck
  200. #+BEGIN_SRC emacs-lisp
  201.   (use-package flycheck
  202.     :config
  203.     (add-hook 'after-init-hook #'global-flycheck-mode))
  204. #+END_SRC
  205. *** Yasnippet
  206. #+BEGIN_SRC emacs-lisp
  207.   (use-package yasnippet
  208.     :config
  209.     (yas-global-mode t))
  210. #+END_SRC
  211. ** Python
  212. #+BEGIN_SRC emacs-lisp
  213.   (use-package pyenv
  214.     :config
  215.     (pyenv-mode))
  216.   (use-package ein
  217.     :config
  218.     ;;enable ycmd in ein, not recognized as supported mode by default
  219.     ;(add-hook 'ein:notebook-multilang-mode-hook 'ycmd-mode)
  220.   (setq python-shell-interpreter "python")
  221.   (setq python-shell-interpreter-args "-m IPython"))
  222. #+END_SRC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement