Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danielfgray/distractionfree.vim
Distraction-free editing in Vim
https://github.com/danielfgray/distractionfree.vim
minimal vim
Last synced: about 2 months ago
JSON representation
Distraction-free editing in Vim
- Host: GitHub
- URL: https://github.com/danielfgray/distractionfree.vim
- Owner: DanielFGray
- License: gpl-2.0
- Created: 2015-03-11T22:58:59.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2022-10-02T23:34:49.000Z (over 2 years ago)
- Last Synced: 2024-04-14T11:54:42.027Z (9 months ago)
- Topics: minimal, vim
- Language: Vim Script
- Homepage:
- Size: 94.7 KB
- Stars: 25
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DistractionFree.vim
Distraction-free editing in vim
![screenshot](https://raw.githubusercontent.com/DanielFGray/DistractionFree.vim/master/screencast.gif)
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](https://github.com/junegunn/goyo.vim) and [litedfm](https://github.com/bilalq/lite-dfm), 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](https://github.com/junegunn/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:
``` vim
nnoremap df :DistractionsToggle
```You can define the list of settings you want toggled (shown is the default):
``` vim
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):
``` vim
let g:distraction_free#toggle_limelight = 1
```You can also toggle the tmux status bar:
``` vim
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`:
``` vim
function! s:distractions_off()
set showmode showcmd
endfunction
function! s:distractions_on()
set noshowmode noshowcmd
endfunction
autocmd! User DistractionsOn nested call distractions_on()
autocmd! User DistractionsOff nested call distractions_off()
```