A Neovim plugin for presenting markdown files as slideshows.
Start a presentation from the current buffer by calling start_presentation
with no arguments, or optionally pass a table with a filepath
field to present a specific file;
require("present").start_presentation({
filepath = "/path/to/file.md" -- optional argument
})
or just run the :PresentStart <filepath?>
command, optionally passing a file path to present
Calling the setup
function is optional if you want to pass any configuation options, the following table shows all valid configuration options with their default values;
require("present").setup({
-- whether the chosen separator character(s) should be removed from the slide header
hide_separator_in_title = true,
-- a list of lua matching patterns to use as slide boundaries
-- lines matching one of these separators will become slide titles in the header
separators = { "^# " },
-- the normal mode keymaps available while in presentation mode, see the `Keymaps` section below
keymaps = {
execute_code_blocks = "X",
previous_slide = "p",
next_slide = "n",
first_slide = "f",
last_slide = "e",
end_presentation = "q",
},
-- vim options that will be modified when in presentation mode
-- you can pass any valid vim options here to customise how presentation mode behaves
-- see :help option-list to see all valid fields for this table
presentation_vim_options = {
cmdheight = 0,
conceallevel = 0,
hlsearch = false,
linebreak = true,
wrap = true,
},
-- the default code executors available, see the `Live Code Block Execution` section below
executors = {
go = execution.execute_go_code,
javascript = execution.create_system_executor("node"),
lua = execution.execute_lua_code,
python = execution.create_system_executor("python"),
rust = execution.execute_rust_code,
},
})
You can execute code inside markdown code blocks on a slide, e.g.
print("Hello world!")
and the result will be displayed in a floating window
- Execution functions are provided for
lua
,go
,rust
,python
, andjavascript
by default - You can add your own to the
executors
table in thesetup
config table - The default executors may not be compatible with your system and you may need to write a custom executor. See
lua/present/execution.lua
for example implementations - For interpreted languages, you can use the
create_system_executor
utility function provided bypresent.nvim
to easily create a new executor;
local present = require("present")
present.setup({
executors = {
ruby = present.create_system_executor("ruby")
}
})
These keymaps are active in normal mode when presenting a file. You can customise them using the keymaps
table in the config table passed to setup
(see Configuration above)
key | description |
---|---|
p |
move to the previous slide |
n |
move to the next slide |
f |
move to the first slide |
e |
move to the last slide |
q |
quit the presentation |
X |
execute the code blocks on the slide |
- This project requires the following development dependencies to be installed:
just
(command runner)watchexec
(file watcher)plenary.nvim
plugin/library for testing- the plenary repo must be cloned as a sibling directory to this repo by default, i.e. available at
../plenary.nvim/
- alternatively the
PLENARY_NVIM_DIR
env var can be set to provide a different location on your system
- the plenary repo must be cloned as a sibling directory to this repo by default, i.e. available at
- Run the entire test suite with
just test
- Run the entire test suite in watch mode with
just test-watch
- Run
just --list
for optional arguments and more info
Inspired by and adapted from @tjdevries "Neovim Plugin from Scratch" YouTube series
See also tjdevries/present.nvim