Is the cursor flashing at the end of the line in gvim

gvimvim

I recently started using vim/gvim and I have this really annoying problem where cursors flashes at the end of the line with every character I type in insert mode.

Take a look at this video and you'll know what I mean. https://www.youtube.com/watch?v=LT3yGiXONYk

When I start gvim with a blank .vimrc I don't experience this issue. I disable all my plugins and started turning them back on one by one. I couldn't tell if there was a single plugin responsible for this.

It looks like that all the plugins together have a huge performance impact on vim.

set encoding=utf-8
set fileencoding=utf-8
set shell=/bin/bash
set t_Co=256
set t_ut=
syntax on
set number

set guioptions-=m " No menu bar
set guioptions-=T " No tool bar
set guioptions-=r " No right-hand scroll bar
set guioptions-=L " No left-hand scroll bar

set autoindent " Automatic indentation
set smarttab
set showmatch " Show matching brackets
set ignorecase " Ignore case when searching
set hlsearch " Highlight search terms
set incsearch " Show search matches while typing
set title " Change terminal title
set pastetoggle=<F2> " Enable easy pasting
set nocompatible " Set some better better defaults
set laststatus=2 " Always display status line

" Neccessary for installing vundle
filetype off

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

Bundle 'gmarik/vundle'
Bundle 'bling/vim-airline'
Bundle 'vim-scripts/sudo.vim'
Bundle 'tpope/vim-fugitive'
Bundle 'altercation/vim-colors-solarized'
Bundle 'snipMate'
Bundle 'rstacruz/sparkup', {'rtp': 'vim/'}
Bundle 'Lokaltog/vim-easymotion'
Bundle 'kien/ctrlp.vim'
Bundle 'tpope/vim-surround'
Bundle 'tomasr/molokai'
Bundle 'Align'
Bundle 'plasticboy/vim-markdown'
Bundle 'slim-template/vim-slim.git'
Bundle 'scrooloose/nerdtree'
Bundle 'scrooloose/syntastic'
Bundle 'vim-scripts/netrw.vim'
Bundle 'kchmck/vim-coffee-script'
Bundle 'bogado/file-line'
Bundle 'wting/rust.vim'
Bundle 'cespare/vim-toml'
Bundle 'lambdatoast/elm.vim'
Bundle 'tyru/restart.vim'
Bundle 'danro/rename.vim'
Bundle 'tpope/vim-rbenv'
Bundle 'tpope/vim-rails'
Bundle 'tpope/vim-eunuch'
Bundle 'tpope/vim-commentary'
Bundle 'tpope/vim-sleuth'
Bundle 'chase/vim-ansible-yaml'
Bundle 'jdonaldson/vaxe'
Bundle 'Hackerpilot/DCD', {'rtp': 'editors/vim'}
Bundle 'sollidsnake/vterm'
Bundle 'airblade/vim-gitgutter'
Bundle 'bufkill.vim'
Bundle 'tpope/vim-vividchalk'
Bundle 'rking/ag.vim'

call vundle#end()
filetype plugin indent on

colorscheme molokai

" airline
let g:airline_theme="dark"
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts=1
let g:airline_enable_fugitive=1

" Custom keybindings
nmap <Tab><Tab> :NERDTreeToggle<CR>
nnoremap <C-Tab> :bnext<CR>
nnoremap <C-S-TAB> :bprevious<CR>
map / <Plug>(easymotion-sn)
omap / <Plug>(easymotion-tn)
map n <Plug>(easymotion-next)
map N <Plug>(easymotion-prev)

" File type specific settings
autocmd FileType ruby setlocal ts=2 sts=2 et sw=2
autocmd FileType python setlocal ts=4 sts=4 et sw=4
autocmd FileType yaml setlocal ts=2 sts=2 et sw=2
autocmd FileType javascript setlocal ts=4 sts=0 noet sw=4

au BufRead,BufNewFile *.md set filetype=markdown
au BufRead,BufNewFile *.cson set filetype=coffee

set backup
set backupdir=~/.vim/backup
set directory=~/.vim/tmp
set tags=./tags

Is there any way to profile vim (not talking about startup time)? Do you have any Idea what's causing this?

Best Answer

I think your best option is to debug it following the procedure on a similar question, which is copied below:

You could follow the steps on Vim-FAQ 2.5. Some relevant parts follows:

2.5. I have a "xyz" (some) problem with Vim. How do I determine it is a problem with my setup or with Vim? / Have I found a bug in Vim?

First, you need to find out, whether the error is in the actual runtime files or any plugin that is distributed with Vim or whether it is a simple side effect of any configuration option from your .vimrc or .gvimrc. So first, start vim like this:

vim -u NONE -U NONE -N -i NONE

this starts Vim in nocompatible mode (-N), without reading your viminfo file (-i NONE), without reading any configuration file (-u NONE for not reading .vimrc file and -U NONE for not reading a .gvimrc file) or even plugin.

If the error does not occur when starting Vim this way, then the problem is either related to some plugin of yours or some setting in one of your local setup files. You need to find out, what triggers the error, you try starting Vim this way:

vim -u NONE -U NONE -N

If the error occurs, the problem is your .viminfo file. Simply delete the viminfo file then. If the error does not occur, try:

vim -u ~/.vimrc --noplugin -N -i NONE

This will simply use your .vimrc as configuration file, but not load any plugins. If the error occurs this time, the error is possibly caused by some configuration option inside your .vimrc file. Depending on the length of your vimrc file, it can be quite hard to trace the origin within that file.

The best way is to add :finish command in the middle of your .vimrc. Then restart again using the same command line. If the error still occurs, the bug must be caused because of a setting in the first half of your .vimrc. If it doesn't happen, the problematic setting must be in the second half of your .vimrc. So move the :finish command to the middle of that half, of which you know that triggers the error and move your way along, until you find the problematic option. If your .vimrc is 350 lines long, you need at a maximum 9 tries to find the offending line (in practise, this can often be further reduced, since often lines depend on each other).

If the problem does not occur, when only loading your .vimrc file, the error must be caused by a plugin or another runtime file (indent autoload or syntax script). Check the output of the :scriptnames command to see what files have been loaded and for each one try to disable each one by one and see which one triggers the bug. Often files that are loaded by vim, have a simple configuration variable to disable them, but you need to check inside each file separately.

There is additional information on the link if the steps above doesn't solves the problem.

Related Question