in vimscript, how can I highlight the whole text when losing focus?

In vimscript, I want to highlight the whole text when losing focus; the following command does not work but moves cursor one line below.

autocmd FocusLost * execute '/.'

Let me know the correct way.


I include my code with what @Ry- answered.

The code dims the whole text of the buffer when losing focus and reverts it in syntax highlight when gaining focus.

augroup dimbuf
  autocmd!
  autocmd FocusLost * execute 'highlight Search cterm=none guifg=#555555 guibg=NONE
  autocmd FocusLost * call matchadd('Search', '.', 0, 1843991912)
  autocmd FocusGained * call matchdelete(1843991912)
  autocmd FocusGained * execute 'highlight Search none' | execute 'highlight Search cterm=reverse'
augroup END


Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)