From bb66289983284eaf39d7f77a38fd1a22aafebc2a Mon Sep 17 00:00:00 2001 From: Ade Attwood Date: Thu, 8 Jul 2021 09:03:27 +0100 Subject: [PATCH] feat(shell): integrate the emacs better into the terminal There a quite a few fixes and feature here to make the terminal experience of emacs better. Most of this is only enabled when running in the terminal. 1) Better tmux integration with navigating between splits and also highlighting the active window between emacs and tmux so you can better see the active window you are working in. 2) Mouse and clipboard support through the x window manager so "yank" copies text into the system clipboard 3) Changing the cursor style between insert and normal mode inside the terminal this is not the case in default evil mode. --- site-modules/core/files/emacs/src/term.el | 16 ++++++++++++++++ site-modules/core/files/emacs/src/ui.el | 13 ++++++++++--- site-modules/core/files/tmux.conf | 4 ++-- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/site-modules/core/files/emacs/src/term.el b/site-modules/core/files/emacs/src/term.el index 07e1b8e..78291e3 100644 --- a/site-modules/core/files/emacs/src/term.el +++ b/site-modules/core/files/emacs/src/term.el @@ -26,3 +26,19 @@ ;; Once vterm is dead, the vterm buffer is useless. Why keep it around? We can ;; spawn another if want one. (setq vterm-kill-buffer-on-exit t)) + +(use-package auto-dim-other-buffers + :config (auto-dim-other-buffers-mode) + :custom-face + (auto-dim-other-buffers-face ((t (:background "#e0e0e0"))))) + +(unless (display-graphic-p) + (use-package tmux-pane + :config (tmux-pane-mode)) + (use-package evil-terminal-cursor-changer + :config (evil-terminal-cursor-changer-activate)) + + (use-package xclip + :config (xclip-mode)) + + (xterm-mouse-mode)) diff --git a/site-modules/core/files/emacs/src/ui.el b/site-modules/core/files/emacs/src/ui.el index d009636..9005556 100644 --- a/site-modules/core/files/emacs/src/ui.el +++ b/site-modules/core/files/emacs/src/ui.el @@ -23,9 +23,14 @@ (set-face-attribute 'default nil :font a-font :height a-font-size) (set-face-attribute 'fixed-pitch nil :font a-font :height a-font-size) -(set-face-attribute 'variable-pitch nil :font "Lato" :height a-font-size :weight 'regular) +(set-face-attribute 'variable-pitch nil :font a-font :height a-font-size :weight 'regular) + +(use-package doom-themes + :init + (load-theme 'doom-tomorrow-day t t) + (when (display-graphic-p) + (enable-theme 'doom-tomorrow-day))) -(use-package doom-themes) (use-package base16-theme :init ;; Fix terminal color theme for base16 @@ -33,7 +38,9 @@ ;; See: https://github.com/belak/base16-emacs/issues/73#issuecomment-721942335 (setq base16-theme-256-color-source 'base16-shell) (setq base16-distinct-fringe-background nil) - (load-theme 'base16-ocean t)) + (load-theme 'base16-tomorrow t t) + (unless (display-graphic-p) + (enable-theme 'base16-tomorrow))) (use-package all-the-icons) diff --git a/site-modules/core/files/tmux.conf b/site-modules/core/files/tmux.conf index 8113b84..e39b856 100644 --- a/site-modules/core/files/tmux.conf +++ b/site-modules/core/files/tmux.conf @@ -6,7 +6,7 @@ bind v split-window -h -c "#{pane_current_path}" # Smart pane switching with awareness of vim splits # See: https://github.com/christoomey/vim-tmux-navigator is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ - | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" + | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$|emacs'" bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" @@ -121,7 +121,7 @@ set -g window-status-activity-style fg=colour233,bg=colour245 # fg and bg are fl # Highlight active window. #set -w -g window-status-current-bg red -set -g window-style 'bg=colour22' +set -g window-style 'bg=colour18' set -g window-active-style 'bg=colour0' # Window separator