diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf index c58d730..e8fcd1e 100644 --- a/.config/tmux/tmux.conf +++ b/.config/tmux/tmux.conf @@ -1,6 +1,9 @@ set -g default-terminal "tmux-256color" 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 unbind C-b set-option -g prefix C-a diff --git a/.config/vim/vimrc b/.config/vim/vimrc index b94fc85..abca1b8 100644 --- a/.config/vim/vimrc +++ b/.config/vim/vimrc @@ -51,23 +51,36 @@ autocmd filetype zsh syntax clear zshOption " change cursor shape depending on mode if (has('nvim')) - " reset when exiting - autocmd VimLeave * set guicursor=a:ver25 + " Beam when exiting + autocmd VimLeave * silent !echo -ne "\e[5 q" else " https://vim.fandom.com/wiki/Change_cursor_shape_in_different_modes - " start insert mode - vertical bar - let &t_SI = "\[5 q" - " start replace mode - horizontal/underline bar - let &t_SR = "\[3 q" - " end insert or replace mode - block cursor - let &t_EI = "\[1 q" + " https://github.com/tmux/tmux/issues/1593 + if exists('$TMUX') + " Start insert mode - vertical bar/beam + let &t_SI = "\ePtmux;\e\e[5 q\e\\" + " Start replace mode - horizontal bar/underline + 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 - autocmd VimEnter * silent !echo -ne "\e[2 q" - " Reset when exiting - " Finally found out how to do that by looking at: - " https://github.com/jszakmeister/vim-togglecursor/blob/master/plugin/togglecursor.vim - autocmd VimLeave * let &t_te = "\[5 q" . &t_te + " Block when entering + autocmd VimEnter * silent !echo -ne "\ePtmux;\e\e[1 q\e\\" + " Beam when exiting + autocmd VimLeave * silent !echo -ne "\ePtmux;\e\e[5 q\e\\" + else + " 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 " Highlight trailing whitespaces