Skip to content

Commit

Permalink
tmux: Undo TERM hacking
Browse files Browse the repository at this point in the history
Undoes the hack introduced in 1136ef2
to fix the combination of Home/End keys, italics in Vim, and background
highlighting in Delta.

This works on my Fedora system at home, so I need to go test on my
Ubuntu 22.04 system at work - suspect that the tmux-256color termcap has
been fixed on at least Fedora.

Fixes #143
  • Loading branch information
Notgnoshi committed Nov 10, 2024
1 parent d2a14d7 commit 3822e14
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions stowdir/.tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,16 @@ bind-key C-a send-prefix
bind-key C-l send-keys C-l
bind-key l send-keys C-l

set -g default-terminal xterm-256color
# set -g default-terminal tmux-256color
# Fix delta background colors
# See: https://dandavison.github.io/delta/tips-and-tricks/using-delta-with-tmux.html
set -ga terminal-overrides ",xterm-256color:Tc"
set -ga terminal-overrides ",*-256color:Tc"
# Fix Home/End keys not working with xterm-256color
# Requires additional settings in my vimrc so that Vim doesn't insert an H or an F on the line above
# the cursor ಠ_ಠ
# See: https://stackoverflow.com/a/55616731
bind-key -n Home send Escape "OH"
bind-key -n End send Escape "OF"
# bind-key -n Home send Escape "OH"
# bind-key -n End send Escape "OF"

set -g set-titles on
# Forward the pane's title on to the terminal
Expand Down
16 changes: 8 additions & 8 deletions stowdir/.vim/vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -632,14 +632,14 @@ let test#strategy = "dispatch"
" Keybinds
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

" Handle tmux $TERM quirks in vim
" See: https://stackoverflow.com/a/9674158
if $TERM =~ '^screen-256color'
map <Esc>OH <Home>
map! <Esc>OH <Home>
map <Esc>OF <End>
map! <Esc>OF <End>
endif
" " Handle tmux $TERM quirks in vim
" " See: https://stackoverflow.com/a/9674158
" if $TERM =~ '^screen-256color'
" map <Esc>OH <Home>
" map! <Esc>OH <Home>
" map <Esc>OF <End>
" map! <Esc>OF <End>
" endif

" Turn off search highlighting with enter
nnoremap <CR> :nohl<CR><CR>
Expand Down

0 comments on commit 3822e14

Please sign in to comment.