4jrcfa
Last Updated: February 25, 2016
·
1.119K
· benjaminrh
2aca501921a5a98762cc4af16da258b8

Easy Focus Mode in Vim

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

Say Thanks
Respond

1 Response
Add your response

8674
10ca55864735b3ccefb16bd93a1596a7

A screenshot would be great.

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

over 1 year ago ·
Filed Under