From 8fbafc3a5cf6a16aff65ee87af243ec598b4c08f Mon Sep 17 00:00:00 2001 From: William Carroll Date: Tue, 20 Jun 2017 07:48:03 -0400 Subject: [PATCH] Conditionally enables Evil; adds Dired+; conditionally applies linum --- configs/.emacs | 58 +++++++++++++++++++++++------------- emacs/wc-helper-functions.el | 9 +++--- 2 files changed, 43 insertions(+), 24 deletions(-) diff --git a/configs/.emacs b/configs/.emacs index 7d0a263f8..e1c5e3dab 100644 --- a/configs/.emacs +++ b/configs/.emacs @@ -32,7 +32,7 @@ '(neo-window-width 35) '(package-selected-packages (quote - (linum-off git markdown-mode yaml-mode haskell-mode color-theme-sanityinc-tomorrow graphql-mode flycheck-elm popup-kill-ring green-phosphor-theme green-screen-theme minimal-theme creamsody-theme autothemer solarized-theme avk-emacs-themes github-theme all-the-icons-dired ace-window yasnippet chess synonyms powerline doom-neotree doom-themes persp-mode use-package helm-projectile persp-projectile perspective projectile with-editor helm-core company helm-ag evil-leader flycheck-mix flycheck-elixir evil-matchit typescript-mode evil-surround erlang elixir-mode golden-ratio flycheck-credo flycheck command-log-mode atom-one-dark-theme exec-path-from-shell clues-theme gotham-theme dracula-theme zenburn-theme fill-column-indicator neotree evil iedit vimrc-mode helm-ispell transpose-frame helm-ack nyan-mode alchemist helm dockerfile-mode elm-mode ack))) + (dired+ linum-off git markdown-mode yaml-mode haskell-mode color-theme-sanityinc-tomorrow graphql-mode flycheck-elm popup-kill-ring green-phosphor-theme green-screen-theme minimal-theme creamsody-theme autothemer solarized-theme avk-emacs-themes github-theme all-the-icons-dired ace-window yasnippet chess synonyms powerline doom-neotree doom-themes persp-mode use-package helm-projectile persp-projectile perspective projectile with-editor helm-core company helm-ag evil-leader flycheck-mix flycheck-elixir evil-matchit typescript-mode evil-surround erlang elixir-mode golden-ratio flycheck-credo flycheck command-log-mode atom-one-dark-theme exec-path-from-shell clues-theme gotham-theme dracula-theme zenburn-theme fill-column-indicator neotree evil iedit vimrc-mode helm-ispell transpose-frame helm-ack nyan-mode alchemist helm dockerfile-mode elm-mode ack))) '(popwin-mode t) '(popwin:popup-window-height 25) '(popwin:special-display-config @@ -130,6 +130,11 @@ (smart-mode-line-enable)) +;; Nyan cat +(use-package nyan-mode + :ensure t) + + ;; Git client (use-package git :ensure t) @@ -153,10 +158,12 @@ ;; Linum (use-package linum :init - (setq linum-disabled-modes-list '(term-mode dired-mode Man-mode)) + (setq linum-disabled-modes-list '(term-mode dired-mode Man-mode org-mode emacs-pager-mode)) :config (defun linum-on () - (if (memq major-mode linum-disabled-modes-list) + (if (or (memq major-mode linum-disabled-modes-list) + (minibufferp) + (string-match-p "*" (buffer-name))) (linum-mode -1) (linum-mode nil))) (setq linum-format " %d ") @@ -220,7 +227,6 @@ :ensure t :init (setq explicit-shell-file-name "/bin/zsh") - :bind (("C-v" . wc/ansi-term-paste)) :config (add-hook 'term-mode-hook 'wc/bootstrap-ansi-term)) @@ -244,6 +250,13 @@ (setq wdired-allow-to-change-permissions t)) +;; Dired-plus +(use-package dired+ + :ensure t + :init + (setq diredp-hide-details-initially-flag nil)) + + ;; Evil Settings (use-package evil :ensure t @@ -300,18 +313,20 @@ ("tap" . alchemist-test-at-point) ("lt" . alchemist-mix-rerun-last-test)) :init + (global-evil-matchit-mode t) + (global-evil-surround-mode t) + (global-evil-leader-mode t) + :config (setq evil-emacs-state-cursor '("VioletRed3" box)) (setq evil-normal-state-cursor '("DeepSkyBlue2" box)) (setq evil-visual-state-cursor '("orange" box)) (setq evil-insert-state-cursor '("VioletRed3" bar)) (setq evil-replace-state-cursor '("VioletRed3" bar)) (setq evil-operator-state-cursor '("VioletRed3" hollow)) - - (global-evil-matchit-mode t) - (global-evil-surround-mode t) - (global-evil-leader-mode t) - :config - (evil-ex-define-cmd (kbd "w") 'save-buffer-always)) + (evil-ex-define-cmd (kbd "w") 'save-buffer-always) + (add-hook 'prog-mode-hook 'evil-local-mode) + (add-hook 'org-mode-hook 'evil-local-mode) + (add-hook 'markdown-mode-hook 'evil-local-mode)) ;; Hack at the moment for extending the behavior of the jump to mark command @@ -428,12 +443,7 @@ ("D" . neotree-delete-node) ("R" . neotree-rename-node) ("c" . neotree-create-node) - ("C-h" . evil-window-left) - ("C-l" . evil-window-right) - ("C-k" . evil-window-up) - ("C-j" . evil-window-down) - ("C-p" . helm-ag-neotree-node) - ) + ("C-p" . helm-ag-neotree-node)) :init (hl-line-mode) (setq neo-theme (if (display-graphic-p) 'icons 'arrow)) @@ -453,10 +463,12 @@ (use-package helm :ensure t :commands (helm-mode) - :bind ( - ("M-x" . helm-M-x) + :bind (("M-x" . helm-M-x) ("M-y" . helm-show-kill-ring) ("C-x b" . helm-mini) + ("C-x f" . helm-projectile-find-file) + ("C-x p" . helm-projectile-ag) + ("C-x C-f" . helm-find-files) :map helm-map ([backtab] . helm-previous-source) @@ -474,7 +486,7 @@ (setq helm-imenu-fuzzy-match t) (setq helm-locate-fuzzy-match t) :config - (load "~/.emacs.d/wc-helm-functions.el")) + (load "~/.emacs.d/wc-helm-functions.el") ;; Helm Projectile Settings @@ -497,7 +509,6 @@ (setq company-idle-delay 0)) -(add-hook 'after-init-hook 'evil-mode) (add-hook 'after-init-hook 'global-whitespace-mode) (add-hook 'after-init-hook 'global-hl-line-mode) (add-hook 'after-init-hook 'global-flycheck-mode) @@ -531,6 +542,13 @@ (global-set-key (kbd "C-x C-;") 'comment-or-uncomment-region) +;; Window movements +(global-set-key (kbd "C-h") 'windmove-left) +(global-set-key (kbd "C-l") 'windmove-right) +(global-set-key (kbd "C-k") 'windmove-up) +(global-set-key (kbd "C-j") 'windmove-up) + + ;; Fullscreen settings (setq ns-use-native-fullscreen nil) (global-set-key (kbd "") 'toggle-frame-fullscreen) diff --git a/emacs/wc-helper-functions.el b/emacs/wc-helper-functions.el index 7d6597b9e..8c14d43b2 100644 --- a/emacs/wc-helper-functions.el +++ b/emacs/wc-helper-functions.el @@ -135,10 +135,11 @@ "Custom `ansi-term' configuration." (interactive) (goto-address-mode t) - (local-set-key (kbd "C-h") 'evil-window-left) - (local-set-key (kbd "C-l") 'evil-window-right) - (local-set-key (kbd "C-k") 'evil-window-up) - (local-set-key (kbd "C-j") 'evil-window-down) + (define-key term-raw-map (kbd "C-c") 'term-interrupt-subjob) + (define-key term-raw-map (kbd "C-h") 'windmove-left) + (define-key term-raw-map (kbd "C-l") 'windmove-right) + (define-key term-raw-map (kbd "C-k") 'windmove-up) + (define-key term-raw-map (kbd "C-j") 'windmove-down) (wc/expose-global-binding-in-term (kbd "M-x")) (evil-define-key 'normal term-raw-map (kbd "i") 'wc/focus-term-at-bottom)