Git Product home page Git Product logo

goyo.vim's Introduction

goyo.vim (고요)

Distraction-free writing in Vim.

(Color scheme: seoul256)

Best served with limelight.vim.

Installation

Use your favorite plugin manager.

  • vim-plug
    1. Add Plug 'junegunn/goyo.vim' to .vimrc
    2. Run :PlugInstall

Usage

  • :Goyo
    • Toggle Goyo
  • :Goyo [dimension]
    • Turn on or resize Goyo
  • :Goyo!
    • Turn Goyo off

The window can be resized with the usual [count]<CTRL-W> + >, <, +, - keys.

Dimension expression

The expected format of a dimension expression is [WIDTH][XOFFSET][x[HEIGHT][YOFFSET]]. XOFFSET and YOFFSET should be prefixed by + or -. Each component can be given in percentage.

" Width
Goyo 120

" Height
Goyo x30

" Both
Goyo 120x30

" In percentage
Goyo 120x50%

" With offsets
Goyo 50%+25%x50%-25%

Configuration

  • g:goyo_width (default: 80)
  • g:goyo_height (default: 85%)
  • g:goyo_linenr (default: 0)

Callbacks

By default, vim-airline, vim-powerline, powerline, lightline.vim, vim-signify, and vim-gitgutter are temporarily disabled while in Goyo mode.

If you have other plugins that you want to disable/enable, or if you want to change the default settings of Goyo window, you can set up custom routines to be triggered on GoyoEnter and GoyoLeave events.

function! s:goyo_enter()
  silent !tmux set status off
  set noshowmode
  set noshowcmd
  set scrolloff=999
  Limelight
  " ...
endfunction

function! s:goyo_leave()
  silent !tmux set status on
  set showmode
  set showcmd
  set scrolloff=5
  Limelight!
  " ...
endfunction

autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave()

More examples can be found here: Customization

Inspiration

Pros.

  1. Works well with splits. Doesn't mess up with the current window arrangement
  2. Works well with popular statusline plugins
  3. Prevents accessing the empty windows around the central buffer
  4. Can be closed with any of :q[uit], :clo[se], :tabc[lose], or :Goyo
  5. Can dynamically change the width of the window
  6. Adjusts its colors when color scheme is changed
  7. Realigns the window when the terminal (or window) is resized or when the size of the font is changed
  8. Correctly hides colorcolumns and Emojis in statusline
  9. Highly customizable with callbacks

License

MIT

goyo.vim's People

Contributors

heylu avatar junegunn avatar mxdubois avatar prurigro avatar thirtythreeforty avatar tlvince avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.