Ⅰ. 插件描述
Distraction-free editing in VimⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'danielfgray/distractionfree-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'danielfgray/distractionfree-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'danielfgray/distractionfree-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/danielfgray/distractionfree.vim
Ⅳ. 文档说明
# DistractionFree.vim
Distraction-free editing in vim

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 = 1You can also toggle the tmux status bar:
let g:distraction_free#toggle_tmux = 1You 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()