From 296fe1b8f671e4fda2fc6b37b63dcbba399b21aa Mon Sep 17 00:00:00 2001 From: William Carroll Date: Sat, 1 Jul 2017 15:50:38 -0400 Subject: [PATCH] Stylizes tabbar; extends emacs config --- configs/shared/.emacs | 38 +++++++++++++++++++------------ emacs/wc-doom-functions.el | 46 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 14 deletions(-) create mode 100644 emacs/wc-doom-functions.el diff --git a/configs/shared/.emacs b/configs/shared/.emacs index d57a0802e..93bf00153 100644 --- a/configs/shared/.emacs +++ b/configs/shared/.emacs @@ -40,7 +40,7 @@ '(org-fontify-whole-heading-line t) '(package-selected-packages (quote - (nlinum tabbar rainbow-delimiters s font-lock+ f diminish dash avy all-the-icons 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))) + (swiper ivy nlinum tabbar rainbow-delimiters s font-lock+ f diminish dash avy all-the-icons 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 @@ -56,6 +56,8 @@ ("^*helm .+*$" :regexp t) ("^*helm-.+*$" :regexp t) ("^*helm .+*$" :regexp t) + ("^*helm-.+*$" :regexp t) + ("^*helm .+*$" :regexp t) ("^*helm .+*$" :regexp t) ("*Miniedit Help*" :noselect t) (completion-list-mode :noselect t) @@ -168,14 +170,23 @@ (add-hook 'minibuffer-setup-hook #'solaire-mode-in-minibuffer)) +;; Colorized delimiters +(use-package rainbow-delimiters + :ensure t + :config + (add-hook 'prog-mode-hook 'rainbow-delimiters-mode)) + + ;; Colorscheme (use-package doom-themes :ensure t :config (setq doom-themes-enable-bold nil doom-themes-enable-italic nil) - (load-theme 'doom-molokai) - (doom-themes-neotree-config)) + (load-theme 'doom-one) + (doom-themes-visual-bell-config) + (doom-themes-neotree-config) + (load "~/.emacs.d/wc-doom-functions.el")) ;; Nyan cat @@ -237,7 +248,10 @@ ;; All-the-fonts (use-package all-the-icons - :ensure t) + :ensure t + :config + ;; (all-the-icons-install-fonts) + ) ;; Thesaurus @@ -245,13 +259,6 @@ :ensure t) -;; Doom Themes -(use-package doom-themes - :ensure t - :init - (use-package doom-nlinum)) - - ;; View stream of Emacs commands (use-package command-log-mode :ensure t @@ -346,7 +353,8 @@ :map evil-normal-state-map ("" . nil) - ([tab] . nil) + ([tab] . tabbar-forward-tab) + ([backtab] . tabbar-backward-tab) ("K" . nil) ("M-." . nil) ("s" . nil) @@ -383,6 +391,7 @@ (setq evil-replace-state-cursor '("VioletRed3" bar)) (setq evil-operator-state-cursor '("VioletRed3" hollow)) (evil-ex-define-cmd (kbd "w") 'save-buffer-always) + (evil-ex-define-cmd (kbd "qb") 'kill-this-buffer) ;; center search results (defadvice evil-search-next @@ -424,6 +433,7 @@ "x" 'helm-M-x "" 'wc/switch-to-mru-buffer "a" 'ace-delete-window + "l" 'global-linum-mode "s" 'ace-swap-window "n" 'neotree-toggle-project-dir "N" 'neotree-reveal-current-buffer @@ -507,6 +517,8 @@ :bind (:map neotree-mode-map ("j" . next-line) ("k" . previous-line) + ("g" . beginning-of-buffer) + ("G" . end-of-buffer) ("" . neotree-enter) ([tab] . neotree-enter) ("D" . neotree-delete-node) @@ -540,8 +552,6 @@ ("C-x C-f" . helm-find-files) :map helm-map - ([backtab] . helm-previous-source) - ([tab] . helm-next-source) ("C-j" . helm-next-line) ("C-k" . helm-previous-line) ("C-z" . helm-select-action) diff --git a/emacs/wc-doom-functions.el b/emacs/wc-doom-functions.el new file mode 100644 index 000000000..4c35a24b5 --- /dev/null +++ b/emacs/wc-doom-functions.el @@ -0,0 +1,46 @@ +(defun make-xpm-bar (color height width) + "Create an XPM bitmap of a bar." + (propertize + " " 'display + (let ((data (make-list height (make-list width 1))) + (color (or color "None"))) + (create-image + (concat + (format "/* XPM */\nstatic char * percent[] = {\n\"%i %i 2 1\",\n\". c %s\",\n\" c %s\"," + (length (car data)) + (length data) + color + color) + (apply #'concat + (cl-loop with idx = 0 + with len = (length data) + for dl in data + do (cl-incf idx) + collect + (concat "\"" + (cl-loop for d in dl + if (= d 0) collect (string-to-char " ") + else collect (string-to-char ".")) + (if (eq idx len) "\"};" "\",\n"))))) + 'xpm t :ascent 'center)))) + +(defun my-tabbar-display-tab (tab) + (let ((label (if tabbar--buffer-show-groups + (format "[%s]" (tabbar-tab-tabset tab)) + (format "%s" (tabbar-tab-value tab)))) + (bar-color "#51afef") + (bar-height 25) + (bar-width 3) + (selected-p (eq tab (tabbar-selected-tab (tabbar-current-tabset))))) + (concat (when (and (display-graphic-p) selected-p) + (make-xpm-bar bar-color bar-height bar-width)) + " " + (if tabbar-auto-scroll-flag + label + (tabbar-shorten + label (max 1 (/ (window-width) + (length (tabbar-view + (tabbar-current-tabset))))))) + " "))) + +(setq tabbar-tab-label-function #'my-tabbar-display-tab)