Different cursor styles also in TMUX
Set cursor style depending on the current mode also in TMUX.
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
set -g default-terminal "tmux-256color"
|
set -g default-terminal "tmux-256color"
|
||||||
set -g mouse on
|
set -g mouse on
|
||||||
|
|
||||||
|
# https://github.com/neovim/neovim/wiki/FAQ#cursor-shape-doesnt-change-in-tmux
|
||||||
|
set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q'
|
||||||
|
|
||||||
# Set C-a as new prefix
|
# Set C-a as new prefix
|
||||||
unbind C-b
|
unbind C-b
|
||||||
set-option -g prefix C-a
|
set-option -g prefix C-a
|
||||||
|
|||||||
@@ -51,23 +51,36 @@ autocmd filetype zsh syntax clear zshOption
|
|||||||
|
|
||||||
" change cursor shape depending on mode
|
" change cursor shape depending on mode
|
||||||
if (has('nvim'))
|
if (has('nvim'))
|
||||||
" reset when exiting
|
" Beam when exiting
|
||||||
autocmd VimLeave * set guicursor=a:ver25
|
autocmd VimLeave * silent !echo -ne "\e[5 q"
|
||||||
else
|
else
|
||||||
" https://vim.fandom.com/wiki/Change_cursor_shape_in_different_modes
|
" https://vim.fandom.com/wiki/Change_cursor_shape_in_different_modes
|
||||||
" start insert mode - vertical bar
|
" https://github.com/tmux/tmux/issues/1593
|
||||||
let &t_SI = "\<Esc>[5 q"
|
if exists('$TMUX')
|
||||||
" start replace mode - horizontal/underline bar
|
" Start insert mode - vertical bar/beam
|
||||||
let &t_SR = "\<Esc>[3 q"
|
let &t_SI = "\ePtmux;\e\e[5 q\e\\"
|
||||||
" end insert or replace mode - block cursor
|
" Start replace mode - horizontal bar/underline
|
||||||
let &t_EI = "\<Esc>[1 q"
|
let &t_SR = "\ePtmux;\e\e[3 q\e\\"
|
||||||
|
" End insert or replace mode - block
|
||||||
|
let &t_EI = "\ePtmux;\e\e[1 q\e\\"
|
||||||
|
|
||||||
" Set when entering
|
" Block when entering
|
||||||
autocmd VimEnter * silent !echo -ne "\e[2 q"
|
autocmd VimEnter * silent !echo -ne "\ePtmux;\e\e[1 q\e\\"
|
||||||
" Reset when exiting
|
" Beam when exiting
|
||||||
" Finally found out how to do that by looking at:
|
autocmd VimLeave * silent !echo -ne "\ePtmux;\e\e[5 q\e\\"
|
||||||
" https://github.com/jszakmeister/vim-togglecursor/blob/master/plugin/togglecursor.vim
|
else
|
||||||
autocmd VimLeave * let &t_te = "\<Esc>[5 q" . &t_te
|
" Start insert mode - vertical bar/beam
|
||||||
|
let &t_SI = "\e[5 q"
|
||||||
|
" Start replace mode - horizontal bar/underline
|
||||||
|
let &t_SR = "\e[3 q"
|
||||||
|
" End insert or replace mode - block
|
||||||
|
let &t_EI = "\e[1 q"
|
||||||
|
|
||||||
|
" Block when entering
|
||||||
|
autocmd VimEnter * silent !echo -ne "\e[1 q"
|
||||||
|
" Beam when exiting
|
||||||
|
autocmd VimLeave * silent !echo -ne "\e[5 q"
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Highlight trailing whitespaces
|
" Highlight trailing whitespaces
|
||||||
|
|||||||
Reference in New Issue
Block a user