Git Product home page Git Product logo

vim-iawriter's Introduction

vim-iawriter Github repo link Screenshots

This is a minimal plugin that aims to provide an experience similar to iAwriter's Focus mode. Currently it can only highlight paragraphs. Sentence highlighting is a TODO.

It acts as a wrapper around three other plugins -

For optimal experience, it is recommended to use a GUI or a terminal that supports 24-bit color

Installation

Install the plugins mentioned above, and then install this plugin any way you like ๐Ÿ˜„
In case you have never installed plugins before, I recommend you to check out vim-plug

Using vim-plug, the configuration should be -

Plug 'junegunn/goyo.vim'
Plug 'junegunn/limelight.vim'
Plug 'reedes/vim-colors-pencil'
Plug 'subnut/vim-iawriter'

Usage

:Iawriter

Configuration

vim-iawriter does not touch the configurations defined individually for the abovementioned three plugins. If they are defined, vim-iawriter shall respect them.

In addition, vim-iawriter provides a few configuration options -

iawriter_force_defaults

This option shall override ALL other options
It enforces the defaults that ship with vim-iAwriter

i.e. let g:iawriter_force_defaults = 1 implies -

let g:goyo_width = '70%'
let g:goyo_height = '85%'
let g:limelight_paragraph_span = 0
let g:limelight_default_coefficient = 0.7
let g:iawriter_change_underline = 1
let g:iawriter_change_cursorline = 1
let g:iawriter_center_cursor = 0
let g:iawriter_show_signcolumn = 0

iawriter_change_cursorline

vim-iawriter turns off cursorline (if enabled) by default. To keep it on -

let g:iawriter_change_cursorline = 0

iawriter_change_underline

vim-iawriter turns off the underlining of the cursorline (if enabled) by default. To keep it on -

let g:iawriter_change_underline = 0

iawriter_show_signcolumn

vim-iawriter hides the signcolumn by default. To keep it -

let g:iawriter_show_signcolumn = 1

iawriter_center_cursor

This is an experimental feature. If enabled, vim-iawriter shall try to keep the cursor in the vertical center of the screen. To turn it on -

let g:iawriter_center_cursor = 1

Overrides

vim-iawriter provides some overrides. Useful if you use both Iawriter and Goyo/Limelight. It overrides the defaults set in .vimrc

Configuration Option Overrides
g:iawriter_goyo_width g:goyo_width
g:iawriter_goyo_height g:goyo_height
g:iawriter_goyo_linenr g:goyo_linenr
g:iawriter_limelight_default_coefficient g:limelight_default_coefficient
g:iawriter_limelight_paragraph_span g:limelight_paragraph_span

Extras

Screenshots: here

For the preview feature, I personally use markdown-preview.nvim


Advanced configuration

vim-iawriter provides plenty of autocommands -


Autocommand When
IawriterToggleTriggered s:toggle() enter
IawriterToggleFinished s:toggle() exit
IawriterPrePreEnter s:pre_enter() enter
IawriterPostPreEnter s:pre_enter() exit
IawriterPrePostEnter s:post_enter() enter
IawriterPostPostEnter s:post_enter() exit
IawriterPreLeave s:leave() enter
IawriterPostLeave s:leave() exit

s:toggle()
  • Checks if vim-iawriter is already running. If yes, closes it (by closing Goyo). Else starts it.
s:pre_enter()
  • Closes Goyo (not vim-iawriter) if running
  • Checks if vim-airline is installed & enabled
  • Sets up autocmds to call s:post_enter() on entering Goyo
  • Loads configs
  • Changes colorscheme
  • Starts Goyo
s:post_enter()
  • Runs after Goyo starts
  • Enables Limelight
  • Sets up autocmds to call s:leave() on closing Goyo
  • Applies configs
s:leave()
  • Runs when Goyo closes
  • Restores original configs

See plugin/vim_iawriter.vim for more information on these functions


Screenshots

dark light

vim-iawriter's People

Contributors

imgbotapp avatar subnut avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

leogama

vim-iawriter's Issues

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.