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.
This commit is contained in:
Ade Attwood 2021-07-08 09:03:27 +01:00
parent a5c86ed6f2
commit bb66289983
3 changed files with 28 additions and 5 deletions

View file

@ -26,3 +26,19 @@
;; Once vterm is dead, the vterm buffer is useless. Why keep it around? We can ;; Once vterm is dead, the vterm buffer is useless. Why keep it around? We can
;; spawn another if want one. ;; spawn another if want one.
(setq vterm-kill-buffer-on-exit t)) (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))

View file

@ -23,9 +23,14 @@
(set-face-attribute 'default nil :font a-font :height a-font-size) (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 '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 (use-package base16-theme
:init :init
;; Fix terminal color theme for base16 ;; Fix terminal color theme for base16
@ -33,7 +38,9 @@
;; See: https://github.com/belak/base16-emacs/issues/73#issuecomment-721942335 ;; See: https://github.com/belak/base16-emacs/issues/73#issuecomment-721942335
(setq base16-theme-256-color-source 'base16-shell) (setq base16-theme-256-color-source 'base16-shell)
(setq base16-distinct-fringe-background nil) (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) (use-package all-the-icons)

View file

@ -6,7 +6,7 @@ bind v split-window -h -c "#{pane_current_path}"
# Smart pane switching with awareness of vim splits # Smart pane switching with awareness of vim splits
# See: https://github.com/christoomey/vim-tmux-navigator # See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ 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-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-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" 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. # Highlight active window.
#set -w -g window-status-current-bg red #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' set -g window-active-style 'bg=colour0'
# Window separator # Window separator