Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- span class="sy0"> * Emacs Initialization
- ** Package Repos
- #+BEGIN_SRC emacs-lisp
- ;;Set package repos
- (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
- ("marmalade" . "http://marmalade-repo.org/packages/")
- ("melpa" . "http://melpa.milkbox.net/packages/")))
- #+END_SRC
- ** Other files
- #+BEGIN_SRC emacs-lisp
- ;;Add theme files location
- (add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
- #+END_SRC
- * General Settings
- ** Style Settings
- #+BEGIN_SRC emacs-lisp
- ;;Set theme
- (load-theme 'chiaro t)
- ;;Set default font
- (set-frame-font "DejaVu Sans Mono")
- (set-face-attribute 'default nil :height 110)
- ;;Hide toolbar
- (tool-bar-mode -1)
- ;;Hide menu-bar
- (menu-bar-mode -1)
- ;;Hide scrollbar
- (scroll-bar-mode -1)
- ;;Highlight current line
- (global-hl-line-mode 1)
- ;;Highlight matching pairs (braces, etc.), with delay removed
- (setq show-paren-delay 0)
- (show-paren-mode 1)
- #+END_SRC
- ** Undo Tree
- #+BEGIN_SRC emacs-lisp
- (use-package undo-tree
- :config
- (global-undo-tree-mode))
- #+END_SRC
- ** Volatile Highlights
- #+BEGIN_SRC emacs-lisp
- (use-package volatile-highlights
- :config
- (volatile-highlights-mode t))
- #+END_SRC
- ** Helm
- #+BEGIN_SRC emacs-lisp
- (use-package helm
- :init
- (require 'helm-config)
- :config
- ;;pretty much all of this config is stolen from Tuhdo's Helm guide
- ;;found: http://tuhdo.github.io/helm-intro.html
- ;; The default "C-x c" is quite close to "C-x C-c", which quits Emacs.
- ;; Changed to "C-c h". Note: We must set "C-c h" globally, because we
- ;; cannot change `helm-command-prefix-key' once `helm-config' is loaded.
- (global-set-key (kbd "C-c h") 'helm-command-prefix)
- (global-unset-key (kbd "C-x c"))
- (when (executable-find "curl")
- (setq helm-google-suggest-use-curl-p t))
- ;;open helm buffer inside current window, not occupy whole other window
- (setq helm-split-window-in-side-p t)
- ;;move to end or beginning of source when reaching top or bottom of source.
- (setq helm-move-to-line-cycle-in-source t)
- ;;search for library in `require' and `declare-function' sexp.
- (setq helm-ff-search-library-in-sexp t)
- ;;scroll 8 lines other window using M-<next>/M-<prior>
- (setq helm-scroll-amount 8)
- ;;need to look up what this does
- (setq helm-ff-file-name-history-use-recentf t)
- ;;rebind tab to run persistent action
- (define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action)
- ;;make TAB works in terminal
- (define-key helm-map (kbd "C-i") 'helm-execute-persistent-action)
- ;;list actions using C-z
- (define-key helm-map (kbd "C-z") 'helm-select-action)
- ;;helm-M-x keybind
- (global-set-key (kbd "M-x") 'helm-M-x)
- ;;optional fuzzy matching for helm-M-x
- (setq helm-M-x-fuzzy-match t)
- ;;helm-show-kill-ring keybind
- (global-set-key (kbd "M-y") 'helm-show-kill-ring)
- ;;helm-mini keybind
- (global-set-key (kbd "C-x b") 'helm-mini)
- ;;fuzzy matching for helm-mini
- (setq helm-buffers-fuzzy-matching t
- helm-recentf-fuzzy-match t)
- ;;helm-find-files
- (global-set-key (kbd "C-x C-f") 'helm-find-files)
- ;;enable search pattern in header line
- (setq helm-echo-input-in-header-line t)
- ;;and turn off minibuffer when using helm session
- (defun helm-hide-minibuffer-maybe ()
- (when (with-helm-buffer helm-echo-input-in-header-line)
- (let ((ov (make-overlay (point-min) (point-max) nil nil t)))
- (overlay-put ov 'window (selected-window))
- (overlay-put ov 'face (let ((bg-color (face-background 'default nil)))
- `(:background ,bg-color :foreground ,bg-color)))
- (setq-local cursor-type nil))))
- (add-hook 'helm-minibuffer-set-up-hook 'helm-hide-minibuffer-maybe)
- ;; enables helm completions for Emacs commands
- (helm-mode 1))
- #+END_SRC
- ** Projectile
- #+BEGIN_SRC emacs-lisp
- (projectile-global-mode)
- (setq projectile-mode-line nil)
- #+END_SRC
- * Org
- #+BEGIN_SRC emacs-lisp
- (use-package org
- :config
- ;;enable syntax highighting in org src blocks
- (setq org-src-fontify-natively t)
- ;;enable native tab behavior in src blocks
- (setq org-src-tab-acts-natively t))
- #+END_SRC
- * Coding
- ** General
- *** Misc
- #+BEGIN_SRC emacs-lisp
- ;;enable linum-mode
- (add-hook 'prog-mode-hook 'linum-mode)
- ;;aggressive indent-mode
- (use-package aggresive-indent
- :config
- (global-aggressive-indent-mode 1))
- ;;fill-column-indicator
- (use-package fill-column-indicator
- :config
- (add-hook 'prog-mode-hook 'fci-mode)
- (setq fci-rule-column 80)
- ;;workaround for bug between company mode and fill-column-indicator
- (defvar-local company-fci-mode-on-p nil)
- (defun company-turn-off-fci (&rest ignore)
- (when (boundp 'fci-mode)
- (setq company-fci-mode-on-p fci-mode)
- (when fci-mode (fci-mode -1))))
- (defun company-maybe-turn-on-fci (&rest ignore)
- (when company-fci-mode-on-p (fci-mode 1)))
- (add-hook 'company-completion-started-hook 'company-turn-off-fci)
- (add-hook 'company-completion-finished-hook 'company-maybe-turn-on-fci)
- (add-hook 'company-completion-cancelled-hook 'company-maybe-turn-on-fci))
- #+END_SRC
- *** Company
- #+BEGIN_SRC emacs-lisp
- ;;company mode
- (use-package company
- :config
- ;;enable company mode globally
- (add-hook 'after-init-hook 'global-company-mode)
- ;;makes completion start automatically rather than waiting for 3 chars / 0.5sec
- (setq company-minimum-prefix-length 1)
- (setq company-idle-delay 0))
- ;;company quick help - for docstring tooltip
- (use-package company-quickhelp
- :config
- (company-quickhelp-mode 1)
- (setq company-quickhelp-max-lines 8))
- #+END_SRC
- *** Emacs-ycmd
- #+BEGIN_SRC emacs-lisp
- (use-package ycmd
- :config
- (add-hook 'after-init-hook #'global-ycmd-mode)
- (set-variable 'ycmd-server-command '("python2" "/home/dan/.ycmd/ycmd/ycmd")))
- (use-package company-ycmd
- :config
- (company-ycmd-setup)
- (set-variable 'ycmd-enable-fuzzy-matching nil))
- #+END_SRC
- *** Flycheck
- #+BEGIN_SRC emacs-lisp
- (use-package flycheck
- :config
- (add-hook 'after-init-hook #'global-flycheck-mode))
- #+END_SRC
- *** Yasnippet
- #+BEGIN_SRC emacs-lisp
- (use-package yasnippet
- :config
- (yas-global-mode t))
- #+END_SRC
- ** Python
- #+BEGIN_SRC emacs-lisp
- (use-package pyenv
- :config
- (pyenv-mode))
- (use-package ein
- :config
- ;;enable ycmd in ein, not recognized as supported mode by default
- ;(add-hook 'ein:notebook-multilang-mode-hook 'ycmd-mode)
- (setq python-shell-interpreter "python")
- (setq python-shell-interpreter-args "-m IPython"))
- #+END_SRC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement