From e7b312ec561633d12dd70a17f7d458345e044ae9 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Fri, 30 Dec 2016 21:10:34 -0500 Subject: [PATCH] Extends emacs config to support evil-mode --- configs/.emacs | 120 ++++++++++++++++++++++++++++++++------- configs/.zsh_profile | 4 -- configs/setup_configs.sh | 24 ++++---- 3 files changed, 112 insertions(+), 36 deletions(-) diff --git a/configs/.emacs b/configs/.emacs index e3f89b63a..2e9a5fa73 100644 --- a/configs/.emacs +++ b/configs/.emacs @@ -1,32 +1,112 @@ - -;; Added by Package.el. This must come before configurations of -;; installed packages. Don't delete this line. If you don't want it, -;; just comment it out by adding a semicolon to the start of the line. -;; You may delete these explanatory comments. (package-initialize) (require 'package) (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) (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. + '(mouse-wheel-mode nil) '(package-selected-packages (quote - (helm magit dockerfile-mode elixir-mode elm-mode ack)))) -(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. - ) - + (evil helm-swoop iedit vimrc-mode helm-ispell transpose-frame helm-projectile helm-ack nyan-mode alchemist helm magit dockerfile-mode elixir-mode elm-mode ack)))) +(custom-set-faces) +;; Colorscheme (load-theme 'wombat) +;; Emacs backup files +(setq-default make-backup-files nil) + +;; NyanCat progress bar +;; (nyan-mode) + +;; Enable autocompletion +(add-hook 'after-init-hook 'global-company-mode) + ;; Helm Settings -;; Use helm M-x instead of native M-x +(require 'helm) +(require 'helm-config) + +(global-set-key (kbd "C-c h") 'helm-command-prefix) +(global-unset-key (kbd "C-x c")) + (global-set-key (kbd "M-x") 'helm-M-x) -(global-set-key (kbd "C-x C-f") 'helm-find-files) -(global-set-key (kbd "C-x C-b") 'helm-buffers-list) +(global-set-key (kbd "C-x C-f") 'helm-projectile) +(global-set-key (kbd "M-y") 'helm-show-kill-ring) +(global-set-key (kbd "C-x b") 'helm-mini) +(global-set-key (kbd "C-c h o") 'helm-swoop) + +(define-key helm-map (kbd "") 'helm-execute-persistent-action) +(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) +(define-key helm-map (kbd "C-z") 'helm-select-action) + +(setq helm-buffers-fuzzy-matching t + helm-recentf-fuzzy-match t) + +(setq helm-semantic-fuzzy-match t + helm-imenu-fuzzy-match t) + +(setq helm-locate-fuzzy-match t) + +(helm-mode 1) + + +;; Projectile Settings +(projectile-mode) +(setq projectile-completion-system 'helm) +(helm-projectile-on) + +(setq projectile-switch-project-action 'helm-projectile) + + +;; Alchemist Settings +(add-hook 'elixir-mode-hook 'alchemist-mode) + + +;; Buffer scrolling functions +(global-set-key (kbd "M-n") (lambda () (interactive) (scroll-up 1) (next-line 1))) +(global-set-key (kbd "M-p") (lambda () (interactive) (scroll-down 1) (previous-line 1))) + + +;; Window movement +(global-set-key (kbd "C-c w f") 'windmove-right) +(global-set-key (kbd "C-c w b") 'windmove-left) +(global-set-key (kbd "C-c w p") 'windmove-up) +(global-set-key (kbd "C-c w n") 'windmove-down) + + +;; General Settings +;; Hide the menu-bar +(setq ns-auto-hide-menu-bar t) + +;; Use non-native fullscreen +(setq ns-use-native-fullscreen nil) + +;; Native App Settings +(tool-bar-mode -1) + +;; Disable GUI scrollbars +(scroll-bar-mode -1) + +;; Use spaces instead of tabs +(setq-default indent-tabs-mode nil) + +;; Change font settings +(add-to-list 'default-frame-alist '(font . "Hasklig")) + +(defun bootstrap-evil-mode() + "Custom evil-mode boostrapping" + (interactive) + (evil-mode) + (define-key evil-insert-state-map (kbd "j k") 'evil-force-normal-state) + (define-key evil-normal-state-map (kbd "H") 'evil-beginning-of-line) + (define-key evil-normal-state-map (kbd "L") 'evil-end-of-line)) + +;; Line Numbers in margin for source code mode +;; (add-hook 'prog-mode-hook 'linum-mode) +(add-hook 'prog-mode-hook 'bootstrap-evil-mode) + +;; Add transparency +(set-frame-parameter (selected-frame) 'alpha '(90 . 50)) +(add-to-list 'default-frame-alist '(alpha . (90 . 50))) + +;; Full-screen as Command +(global-set-key (kbd "") 'toggle-frame-fullscreen) diff --git a/configs/.zsh_profile b/configs/.zsh_profile index ab7f2b423..042fd2f6f 100644 --- a/configs/.zsh_profile +++ b/configs/.zsh_profile @@ -4,10 +4,6 @@ export PATH=$HOME/bin:/opt/local/bin:/opt/local/sbin:/usr/local/go/bin:/usr/loca export EDITOR=$(which vim) -# Adds a newline after the prompt to increase linespace for commands. -PS1="${PS1} - " - echo "Welcome back, $USER" # display the space available on each mounted Volume diff --git a/configs/setup_configs.sh b/configs/setup_configs.sh index 02d863277..dd1f55eef 100755 --- a/configs/setup_configs.sh +++ b/configs/setup_configs.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -pc_settings_path="$HOME/pc_settings" +pc_settings_path="${HOME}/pc_settings" config_files=( \ @@ -9,30 +9,30 @@ config_files=( \ ".tmux.conf" \ ".ctags" \ ".vimrc" \ + ".emacs" \ ) -for i in {0..3}; do +for i in {1..5}; do cf="${config_files[i]}" - echo "\"$cf\": " + echo "\"${cf}\": " - if [ -f "$HOME/$cf" ] && [ ! -L "$HOME/$cf" ]; then - echo -n "Backing up $cf ... " && \ - mv "$HOME/$cf" "$HOME/$cf.bak" && \ + if [ -f "${HOME}/${cf}" ] && [ ! -L "${HOME}/${cf}" ]; then + echo -n "Backing up ${cf} ... " && \ + mv "${HOME}/${cf}" "${HOME}/${cf}.bak" && \ echo "Done." fi - if [ -L "$HOME/$cf" ]; then - if [ $(readlink "$HOME/$cf") = "$pc_settings_path/configs/$cf" ]; then - echo "Already properly symlinked to \"$pc_settings_path/configs\"." + if [ -L "${HOME}/${cf}" ]; then + if [ $(readlink "${HOME}/${cf}") = "${pc_settings_path}/configs/${cf}" ]; then + echo "Already properly symlinked to \"${pc_settings_path}/configs\"." else echo "Already symlinked but NOT to the proper location. Aborting..." fi else - echo -n "Symlinking to $pc_settings_path/configs/$cf ... " && \ - ln -s "$pc_settings_path/configs/$cf" "$HOME/$cf" && \ + echo -n "Symlinking to ${pc_settings_path}/configs/${cf} ... " && \ + ln -s "${pc_settings_path}/configs/${cf}" "${HOME}/${cf}" && \ echo "Done." fi echo "" done -