Browse Source

work on custom emacs setup

master
Brett Langdon 7 years ago
parent
commit
13ec4b472c
No known key found for this signature in database GPG Key ID: B664881177781B04
10 changed files with 205 additions and 0 deletions
  1. +3
    -0
      .gitignore
  2. +48
    -0
      emacs.d/core.el
  3. +17
    -0
      emacs.d/custom.el
  4. +6
    -0
      emacs.d/funcs.el
  5. +14
    -0
      emacs.d/init.el
  6. +2
    -0
      emacs.d/layers.el
  7. +22
    -0
      emacs.d/layers/python/init.el
  8. +63
    -0
      emacs.d/packages.el
  9. +27
    -0
      emacs.d/startup.el
  10. +3
    -0
      emacs.d/theme.el

+ 3
- 0
.gitignore View File

@ -3,3 +3,6 @@
*.elc
config/
zshrc.d/.env.*.zsh
emacs.d/elpa
emacs.d/anaconda-mode
emacs.d/*.eld

+ 48
- 0
emacs.d/core.el View File

@ -0,0 +1,48 @@
;; Configure customization
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file)
;; Hide startup message
(setq inhibit-startup-message t)
;; Configure package and use-package
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)
(when (not package-archive-contents)
(package-refresh-contents))
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(require 'use-package)
(setq use-package-always-ensure t)
;; Disable backup files and auto-saving
(setq backup-inhibited t)
(setq auto-save-default nil)
;; revert buffers automatically when underlying files are changed externally
(global-auto-revert-mode t)
;; Whitespace
;; Newline at end of file
(setq require-final-newline t)
(add-hook 'before-save-hook 'whitespace-cleanup)
(whitespace-mode)
;; Subword mode
(global-subword-mode)
;; Enable global line numbers
(global-linum-mode t)
;; Custom functions
;; DEV: Load this last
(load "~/.emacs.d/funcs.el")

+ 17
- 0
emacs.d/custom.el View File

@ -0,0 +1,17 @@
(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.
'(custom-safe-themes
(quote
("5f27195e3f4b85ac50c1e2fac080f0dd6535440891c54fcfa62cdcefedf56b1b" default)))
'(package-selected-packages
(quote
(helm-gtags ggtags smartparens helm-ag flymake-python-pyflakes flycheck company-anaconda anaconda-mode osx-clipboard diminish ws-butler company company-mode helm-projectile ivy ag projectile helm use-package))))
(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.
)

+ 6
- 0
emacs.d/funcs.el View File

@ -0,0 +1,6 @@
(defun enable-flycheck ()
;; Flycheck
;; http://www.flycheck.org/en/latest/index.html
(use-package flycheck
:config
(flycheck-mode)))

+ 14
- 0
emacs.d/init.el View File

@ -0,0 +1,14 @@
;; Startup optimizations
(load "~/.emacs.d/startup.el")
;; Configure core required setup
(load "~/.emacs.d/core.el")
;; Configure theme
(load "~/.emacs.d/theme.el")
;; Configure global packages
(load "~/.emacs.d/packages.el")
;; Configure layers
(load "~/.emacs.d/layers.el")

+ 2
- 0
emacs.d/layers.el View File

@ -0,0 +1,2 @@
;; Load layers
(load "~/.emacs.d/layers/python/init.el")

+ 22
- 0
emacs.d/layers/python/init.el View File

@ -0,0 +1,22 @@
(add-hook 'python-mode-hook
(lambda ()
;; Anaconda mode
;; https://github.com/proofit404/anaconda-mode
(use-package anaconda-mode
:diminish anaconda-mode
:config
(anaconda-mode)
(anaconda-eldoc-mode))
;; Company anaconda
;; https://github.com/proofit404/company-anaconda
(use-package company-anaconda
:init
(eval-after-load "company"
'(add-to-list 'company-backends 'company-anaconda)))
(use-package eldoc
:diminish eldoc-mode
:config
(eldoc-mode))
(enable-flycheck)))

+ 63
- 0
emacs.d/packages.el View File

@ -0,0 +1,63 @@
;; Global packages
;; Configure osx-clipboard
;; https://github.com/joddie/osx-clipboard-mode
(use-package osx-clipboard
:diminish osx-clipboard-mode
:config
(osx-clipboard-mode t))
;; Configure helm
;; https://emacs-helm.github.io/helm/
(use-package helm
:diminish helm-mode
:bind (("M-x" . helm-M-x)
("C-x C-f" . helm-find-files))
:config
(use-package helm-ag)
(helm-mode 1))
;; Configure projectile
;; https://www.projectile.mx/en/latest/
(use-package projectile
:diminish projectile-mode
:config
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(projectile-mode +1)
;; Use helm-projectile
(use-package helm-projectile
:config
(setq projectile-switch-project-action 'helm-projectile)
(helm-projectile-on)))
;; Configure company-mode
;; http://company-mode.github.io/
(use-package company
:diminish company-mode
:init
(setq company-idle-delay 0.2
company-minimum-prefix-length 2
company-require-match nil
company-dabbrev-ignore-case nil
company-dabbrev-downcase nil)
:config
(global-company-mode))
;; Configure ws-butler
;; https://github.com/lewang/ws-butler
(use-package ws-butler)
;; Configure diminish
;; https://github.com/myrjola/diminish.el
(use-package diminish)
;; Smartparens
;; https://github.com/Fuco1/smartparens
(use-package smartparens
:config
(smartparens-global-mode))

+ 27
- 0
emacs.d/startup.el View File

@ -0,0 +1,27 @@
;; Startup optimizations
;; Set garbage collection threshold
;; https://www.reddit.com/r/emacs/comments/3kqt6e/2_easy_little_known_steps_to_speed_up_emacs_start/
(setq gc-cons-threshold-original gc-cons-threshold
gc-cons-percentage-original gc-cons-percentage)
(setq gc-cons-threshold (* 1024 1024 100)
gc-cons-percentage 0.6)
;; Set file-name-handler-alist
;; https://www.reddit.com/r/emacs/comments/3kqt6e/2_easy_little_known_steps_to_speed_up_emacs_start/
(setq file-name-handler-alist-original file-name-handler-alist)
(setq file-name-handler-alist nil)
;; Set deferred timer to reset them
;; https://emacs.stackexchange.com/a/34367
(run-with-idle-timer
5 nil
(lambda ()
(setq gc-cons-threshold gc-cons-threshold-original)
(setq gc-cons-percentage gc-cons-percentage-original)
(setq file-name-handler-alist file-name-handler-alist-original)
(makunbound 'gc-cons-threshold-original)
(makunbound 'gc-cons-percentage-original)
(makunbound 'file-name-handler-alist-original)
(message "gc-cons-threshold and file-name-handler-alist restored")))

+ 3
- 0
emacs.d/theme.el View File

@ -0,0 +1,3 @@
(use-package monokai-theme
:config
(load-theme 'monokai t))

Loading…
Cancel
Save