Skip to content

A markdown preview directly in your neovim.

License

Notifications You must be signed in to change notification settings

brunoherrick/glow.nvim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Preview markdown code directly in your neovim terminal
Powered by charm's glow

glow.mp4

Breaking changes are now moved to a fixed topic in Discussions. Click here to see them

Prerequisites

  • Neovim 0.8+

Installing

LuaRocks

with vim-plug

Plug 'ellisonleao/glow.nvim'
lua << EOF
require('glow').setup()
EOF

with packer.nvim

use {"ellisonleao/glow.nvim", config = function() require("glow").setup() end}

with lazy.nvim

{"ellisonleao/glow.nvim", config = true, cmd = "Glow"}

Setup

The script comes with the following defaults:

{
  glow_path = "", -- will be filled automatically with your glow bin in $PATH, if any
  install_path = "~/.local/bin", -- default path for installing glow binary
  border = "shadow", -- floating window border config
  style = "dark|light", -- filled automatically with your current editor background, you can override using glow json style
  pager = false,
  width = 80,
  height = 100,
  width_ratio = 0.7, -- maximum width of the Glow window compared to the nvim window size (overrides `width`)
  height_ratio = 0.7,
  default_type = "preview|keep|split", -- default behaviour of output window
  split_dir = "split|vsplit", -- default split direction
  winbar = true, -- enable winbar in Glow windows
  winbar_text = "%#Error#%=GLOW%=" -- text in Glow winbar `:h 'statusline'`
  mappings = { -- set up mappings for glow, multiple keys can do the same action
     close = { "<Esc>", "q" }, -- to close Glow
     toggle = { "p" } -- to toggle between input buffer and glow output in a Glow window
  }
}

To override the custom configuration, call:

require('glow').setup({
  -- your override config
})

Example:

require('glow').setup({
  style = "dark",
  width = 120,
})

Window types

When you glow on a markdown buffer you can choose one of three possible window "options":

  • preview: open output in preview window
  • keep: open output in same window as input buffer
  • split: open window in a split (vertical or horizontal based on opts.split_dir

Usage

Preview file

:Glow [path-to-md-file] [window_type]
:Glow [window_type] [path-to-md-file]

:Glow split         -> render current file in split
:Glow keep %        -> render current file in current window
:Glow % preview     -> render current file in preview window

Preview current buffer with default window type

:Glow

Close window or return to input buffer

:Glow!

You can also close the floating window / split or go back to the initial buffer using q or <Esc> keys

About

A markdown preview directly in your neovim.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Lua 98.6%
  • Makefile 1.4%