Last Updated: February 25, 2016
·
2.804K
· benjaminrh

Easy Focus Mode in Vim

If you like full-screen focus mode on text editors (like Sublime's), you might have wanted the same thing in Vim. I know of at least one other plugin that lets you do this, but here's a very simple method that you can paste right into your .vimrc and just use. It was written by Paul Rouget.

""" FocusMode
function! ToggleFocusMode()
  if (&foldcolumn != 12)
    set laststatus=0
    set numberwidth=10
    set foldcolumn=12
    set noruler
    hi FoldColumn ctermbg=none
    hi LineNr ctermfg=0 ctermbg=none
    hi NonText ctermfg=0
  else
    set laststatus=2
    set numberwidth=4
    set foldcolumn=0
    set ruler
    execute 'colorscheme ' . g:colors_name
  endif
endfunc
nnoremap <F1> :call ToggleFocusMode()<cr>

Screenshot

1 Response
Add your response

A screenshot would be great.

EDIT: Much better, thanks. I might give it a try :)

over 1 year ago ·