Skip to content

DanielFGray/DistractionFree.vim

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
doc
 
 
 
 
 
 
 
 

DistractionFree.vim

Distraction-free editing in vim

screenshot

The idea behind this plugin is to disable some of the fancier plugins or settings that might be running in Vim. Maybe you're writing a README file or a blog post and your Vim feels too busy for prose writing. This plugin will save the values of a list of settings and then disable them until you turn them back on.

Drawing inspiration from Goyo.vim and litedfm, I decided to try my hand at making my own but with a user definable list of settings to toggle, and without any of the margins or padding around buffers.

Installation

Installation is done as usual, with your plugin manager of choice.

If you don't have one already, I suggest vim-plug.

Customization

This plugin exposes a couple of commands to switch between modes: :DistractionsOn, :DistractionsOff, and :DistractionsToggle. There aren't any mappings defined, you must add your own. I use the following:

nnoremap <Leader>df <Esc>:DistractionsToggle<CR>

You can define the list of settings you want toggled (shown is the default):

let g:distraction_free#toggle_options = [
  \ 'cursorline',
  \ 'colorcolumn',
  \ 'cursorcolumn',
  \ 'number',
  \ 'relativenumber',
  \ 'list',
  \ 'ruler',
  \ 'showtabline',
  \ 'laststatus',
\]

You can enable toggling of Limelight (show in screencast above):

let g:distraction_free#toggle_limelight = 1

You can also toggle the tmux status bar:

let g:distraction_free#toggle_tmux = 1

You can also define autocmds to be fired when entering or leaving DistractionFree mode, for example if you wanted to enable showmode and showcmd:

function! s:distractions_off()
  set showmode showcmd
endfunction
function! s:distractions_on()
  set noshowmode noshowcmd
endfunction
autocmd! User DistractionsOn nested call <SID>distractions_on()
autocmd! User DistractionsOff nested call <SID>distractions_off()

About

Distraction-free editing in Vim

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published