I'm using vim inside tmux and it does a very annoying thing: whenever I do some edits in vim (no matter if I save or not) and then immediately switch to another pane, the vim pane's indicator starts blinking until I return to it. This is a common scenario when debugging, when I'm jumping constantly between code and make/gdb output. This doesn't always happen, it only happens when my I/O speeds are low (I'm logged in to a remote server that has a NFS file system and the networked disk tends to get very slow at times), so I think what's happening is that vim does some I/O (e.g writing to swap files) and wants to let me know it's done. It won't happen if I don't immediately switch to another pane and give it some time to do its housekeeping (but that's obviously counterproductive).
Here's a gif of what happens immediately after I switch from pane 1 which has vim:
Here's my tmux config:
set -g default-terminal "screen-256color" # colors!
setw -g xterm-keys on
set -s escape-time 0 # fastest command sequences
set -sg repeat-time 600 # increase repeat timeout
#set -s quiet on # disable various messages
#set -s focus-events on
set -g prefix2 C-q # GNU-Screen compatible prefix
bind C-a send-prefix -2
set -q -g status-utf8 on # expect UTF-8 (tmux < 2.2)
setw -q -g utf8 on
set -g history-limit 5000 # boost history
set-window-option -g mode-keys vi
# edit configuration
bind e new-window -n '~/.tmux.conf.local' "sh -c '\${EDITOR:-vim} ~/.tmux.conf.local && tmux source ~/.tmux.conf && tmux display \"~/.tmux.conf sourced\"'"
set-option -g repeat-time 0
# reload configuration
bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
# -- display -------------------------------------------------------------------
set -g base-index 1 # start windows numbering at 1
setw -g pane-base-index 1 # make pane numbering consistent with windows
setw -g automatic-rename on # rename window to reflect current program
set -g renumber-windows on # renumber windows when a window is closed
set -g set-titles on # set terminal title
set -g set-titles-string '#h ❐ #S ● #I #W'
set -g display-panes-time 800 # slightly longer pane indicators display time
set -g display-time 1000 # slightly longer status messages display time
set -g status-interval 10 # redraw status line every 10 seconds
# clear both screen and history
bind -n C-l send-keys C-l \; run 'sleep 0.05 && tmux clear-history'
# activity
set -g monitor-activity on
set -g visual-activity off
Here's my vim config:
set encoding=utf-8 " The encoding displayed.
set fileencoding=utf-8 " The encoding written to file.
set nocompatible
filetype off
syntax on
set tabstop=4
set expandtab
set shiftwidth=4
set softtabstop=4
set number
set hlsearch
set list
set listchars=tab:>-
set listchars+=eol:�
set listchars+=space:�
set splitright
set splitbelow
colorscheme molokai
" Vundle config
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
call vundle#end()
filetype plugin indent on
set laststatus=2
set updatetime=1000
au BufNewFile,BufRead * if &syntax == '' | set syntax=sh | endif
The blinking kept bugging me so I searched more and finally found an answer courtesy of this link. Turns out one has to disable the bell in tmux.
I've reproduced the answer below for the sake of reference:
# disable in vim
set vb t_vb= " no visual bell & flash
# disable bell in tmux
# disable sound bell
set -g bell-action none
# disable visual bell
set -g visual-bell off