The problem was that I had the following line in my .vimrc file which is supposed to reload the i3 session whenever the .i3 config file is saved.
autocmd BufWritePost ~/.i3 silent !i3-msg reload | redraw
When I change that line as follows, it seems to work now.
autocmd BufWritePost ~/.i3 execute '!i3-msg reload' | redraw!
I also had to add a line autocmd!
at the top of my .vimrc to clear all previous autocmds.
The explanation for exclamation point at the end of the redraw
command (from the vim docs):
:redr[aw][!] ?????Redraw the screen right now. When ! is included it is
cleared first.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…