switch to super emacs

This commit is contained in:
Grant Hunter 2017-10-19 07:48:15 -06:00
parent 6ecb61bbe1
commit f23d4ab708
6 changed files with 186 additions and 147 deletions

View File

@ -1,148 +1,10 @@
(require 'package) ;Record startup timestamp
(setq package-enable-at-startup nil) (defvar super-emacs/invokation-time
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) (current-time))
(add-to-list 'package-archives '("marmalade" . "https://marmalade-repo.org/packages/"))
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))
(package-initialize)
(unless (package-installed-p 'use-package) ;Load configuration files
(package-refresh-contents) (load-file "~/.emacs.d/super-emacs/repositories.el")
(package-install 'use-package)) (load-file "~/.emacs.d/super-emacs/packages.el")
(load-file "~/.emacs.d/super-emacs/interface.el")
(use-package async (load-file "~/.emacs.d/super-emacs/misc.el")
:ensure t) (load-file "~/.emacs.d/super-emacs/key-bindings.el")
(use-package dired-async
:after async
:config
(dired-async-mode 1)
(async-bytecomp-package-mode 1)
)
(if (display-graphic-p)
(if (string-equal system-type "darwin")
(setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin"))
(load-theme 'ubuntu t)
)
)
(setq inhibit-startup-screen t)
;;add ternjs to emacs
(add-to-list 'load-path "~/DevelopmentUtils/tern/emacs/")
(autoload 'tern-mode "tern.el" nil t)
;;auto load tern with .js files
(add-hook 'js-mode-hook (lambda () (tern-mode t)))
(global-linum-mode t)
;;highlight brackets
(show-paren-mode 1)
(setq show-paren-delay 0)
;;window management
(global-set-key (kbd "C-x -") 'shrink-window)
(global-set-key (kbd "C-x +") 'enlarge-window)
(global-set-key (kbd "C-x p") 'previous-multiframe-window)
(put 'downcase-region 'disabled nil)
;;undo
(global-set-key (kbd "C--") 'undo)
(global-set-key (kbd "s--") 'text-scale-decrease)
(global-set-key (kbd "s-=") 'text-scale-increase)
;;neotree
(use-package neotree
:ensure t
:bind("<f8>" . neotree-toggle)
)
;;Rust
(setq racer-cmd "/usr/local/bin/racer")
(setq racer-rust-src-path "/Users/grant/.rust/src/")
(add-hook 'rust-mode-hook #'racer-mode)
(add-hook 'racer-mode-hook #'eldoc-mode)
(add-hook 'racer-mode-hook #'company-mode)
(add-hook 'rust-mode-hook #'rust-enable-format-on-save)
(add-hook 'rust-mode-hook 'cargo-minor-mode)
(add-hook 'rust-mode-hook
(lambda ()
(local-set-key (kbd "C-c <tab>") #'rust-format-buffer)))
(add-hook 'flycheck-mode-hook #'flycheck-rust-setup)
;;Python
;;autocomplete
(use-package company
:ensure t )
(setq company-tooltip-align-annotations t)
(add-hook 'after-init-hook 'global-company-mode)
(eval-after-load "company"
'(add-to-list 'company-backends 'company-anaconda))
(setq company-dabbrev-downcase 0)
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 2)
(use-package py-autopep8
:ensure t)
;;white space
(require 'whitespace)
(autoload 'whitespace-mode "whitespace" "Toggle whitespace visualization." t)
(setq-default indent-tabs-mode nil)
(use-package magit
:ensure t)
(use-package helm
:ensure t
:diminish helm-mode
:init (progn
(require 'helm-config)
(helm-mode)
)
:bind(("C-c h" . helm-mini)
("C-h a" . helm-apropos)
("C-x C-b" . helm-buffers-list)
("C-x b" . helm-buffers-list)
("M-y" . helm-show-kill-ring)
("M-x" . helm-M-x)
("C-x c o" . helm-occur)
("C-x c s" . helm-swoop)
("C-x c y" . helm-yas-complete)
("C-x c Y" . helm-yas-create-snippet-on-region)
("C-x c b" . my/helm-do-grep-book-notes)
("C-x c SPC" . helm-all-mark-rings))
)
(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
("3d5307e5d6eb221ce17b0c952aa4cf65dbb3fa4a360e12a71e03aab78e0176c5" default)))
'(package-selected-packages
(quote
(ubuntu-theme py-autopep8 hide-comnt terraform-mode helm-projectile 0blayout jinja2-mode company-anaconda yaml-mode markdown-mode markdown-mode+ markdownfmt swift-mode swift3-mode go-mode jq-mode web-beautify use-package tern-auto-complete rustfmt racer neotree magit json-reformat js2-highlight-vars jedi helm flymake-rust flycheck-rust csharp-mode company-jedi cargo))))
(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.
'(font-lock-string-face ((t (:foreground "magenta")))))

View File

@ -0,0 +1,20 @@
;Change title-bar text
(setq frame-title-format
"super-emacs")
;Disable menu-bar
(menu-bar-mode -1)
;Disable tool-bar
(tool-bar-mode -1)
;Disable scroll-bar
(scroll-bar-mode -1)
;Activate material theme
(load-theme 'material
t)
;Set font
(custom-set-faces
'(default ((t (:height 120)))))

View File

@ -0,0 +1,36 @@
(defvar super-emacs--my-keyboard-bindings
'(("C-}" . mc/mark-next-like-this)
("C-{" . mc/mark-previous-like-this)
("C-|" . mc/mark-all-like-this)
("C->" . ace-jump-mode)
("C-<" . ace-jump-mode-pop-mark)
("M-/" . undo-tree-visualize)
("C-\," . neotree-toggle)
("C-\"" . theme-looper-enable-next-theme)
("C-M-'" . myterminal-controls-open-controls)
("C-c M-x" . execute-extended-command)
("M-x" . helm-M-x)
("C-x b" . helm-mini)
("C-x C-b" . helm-buffers-list)
("C-x C-f" . helm-find-files)
("C-x C-r" . helm-recentf)
("M-y" . helm-show-kill-ring)
("C-;" . ace-window)
("C-S-<up>" . buf-move-up)
("C-S-<down>" . buf-move-down)
("C-S-<left>" . buf-move-left)
("C-S-<right>" . buf-move-right)
("<f5>" . super-emacs-reload-current-file)
("C--" . undo)
("C-x p" . previous-multiframe-window)
("s--" . text-scale-decrease)
("s-=" . text-scale-increase)
))
(defun super-emacs-apply-keyboard-bindings (pair)
"Apply keyboard-bindings for supplied list of key-pair values"
(global-set-key (kbd (car pair))
(cdr pair)))
(mapc 'super-emacs-apply-keyboard-bindings
super-emacs--my-keyboard-bindings)

25
emacs/super-emacs/misc.el Normal file
View File

@ -0,0 +1,25 @@
(defun super-emacs-reload-current-file ()
"Reload the file loaded in current buffer from the disk"
(interactive)
(cond (buffer-file-name (progn (find-alternate-file buffer-file-name)
(message "File reloaded")))
(t (message "You're not editing a file!"))))
;Disable splash message, start *scratch* buffer by default
(setq initial-buffer-choice
t)
(setq initial-scratch-message
"")
;Enforce spaces for indentation, instead of tabs
(setq-default indent-tabs-mode
nil)
;Enable show-paren-mode
(show-paren-mode)
;Enable winner-mode
(winner-mode t)
;Enable windmove
(windmove-default-keybindings)

View File

@ -0,0 +1,86 @@
;Create repositories cache, if required
(when (not package-archive-contents)
(package-refresh-contents))
;Declare a list of required packages
(defvar super-emacs--required-packages
'(helm
multiple-cursors
ace-jump-mode
ace-window
powerline
buffer-move
ztree
undo-tree
neotree
material-theme
dired-launch
which-key
meta-presenter
myterminal-controls
theme-looper
magit
rust-mode
racer
company
))
;Install required packages
(mapc (lambda (p)
(package-install p))
super-emacs--required-packages)
;Start undo-tree
(global-undo-tree-mode)
;Set hooks for dired-launch-mode
(add-hook 'dired-mode-hook
'dired-launch-mode)
;Start which-key-mode
(which-key-mode)
;Setup company-mode
(setq company-dabbrev-downcase 0)
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 2)
;Set up ace-jump-mode
(autoload 'ace-jump-mode
"ace-jump-mode"
"Emacs quick move minor mode"
t)
(autoload 'ace-jump-mode-pop-mark
"ace-jump-mode"
"Ace jump back:-"
t)
;Enable powerline
(powerline-center-theme)
(setq powerline-default-separator
'slant)
;Configure theme-looper
(theme-looper-set-theme-set '(deeper-blue
wheatgrass
wombat
material))
(theme-looper-set-customizations 'powerline-reset)
;Configure myterminal-controls
(myterminal-controls-set-controls-data
'(("t" "Change color theme" theme-looper-enable-next-theme)
("r" "Reload file" super-emacs-reload-current-file)))
;Set up helm-mode
(helm-mode 1)
(helm-autoresize-mode 1)
(setq helm-split-window-in-side-p
t)
;Set up racer for rust-mode
(add-hook 'rust-mode-hook #'racer-mode)
(add-hook 'rust-mode-hook #'eldoc-mode)
(add-hook 'racer-mode-hook #'company-mode)

View File

@ -0,0 +1,10 @@
;Load package.el
(require 'package)
;Add melpa to list of repositories
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/")
t)
;Initialize package.el
(package-initialize)