Neovim plugin for Slidev - a presentation slides tool for developers.
This plugin allows you to use Slidev CLI features directly from Neovim, enabling you to create presentations without switching to other editors like VSCode.
- Launch dev server with live preview
- Export to multiple formats (PDF, PNG, PPTX, Markdown)
- Production build (SPA)
- Markdown formatting
- Auto cleanup on buffer close
- Cross-platform support (macOS, Linux, Windows)
- Neovim 0.7+
- Node.js and npm (required for Slidev CLI)
- Slidev CLI (recommended: global installation)
# Global installation (recommended)
npm install -g @slidev/cli
# Or local installation per project
npm install -D @slidev/cli
# Can also use npx without installationPDF/PNG/PPTX export requires Playwright:
# For global Slidev installation
npm install -g playwright-chromium
# For local installation
npm install -D playwright-chromiumAlternative: Browser Export
- Start server with
:SlidevPreview - Navigate to
http://localhost:3030/exportin browser - Use browser's print function to save as PDF
The plugin detects Slidev CLI in the following priority:
- Command specified in config
- Global installation (detected from PATH)
- Local installation (
node_modules/.bin/slidev) - Auto-run with npx (
@slidev/cli@latest)
{
'mei28/slidev.nvim',
config = function()
require('slidev').setup({
-- Optional configuration (default values)
port = 3030,
auto_open_browser = true,
debug = false,
})
end,
}use {
'mei28/slidev.nvim',
config = function()
require('slidev').setup()
end
}Plug 'mei28/slidev.nvim'
lua << EOF
require('slidev').setup()
EOF| Command | Description |
|---|---|
:SlidevPreview |
Start dev server and open in browser |
:SlidevWatch |
Alias for SlidevPreview |
:SlidevStop |
Stop server for current buffer |
:SlidevStopAll |
Stop all servers |
:SlidevExport [format] |
Export (default: pdf) |
:SlidevBuild |
Build for production |
:SlidevFormat |
Format markdown |
:SlidevStatus |
Show detailed server status (all buffers) |
-
Open a Slidev markdown file:
:e slides.md -
Start preview:
:SlidevPreview
-
Edit with live reload
-
Export:
:SlidevExport pdf " Output: <filename>-export.pdf (same directory as source file)
require('slidev').setup({
-- Path to Slidev CLI command (nil for auto-detect)
slidev_command = nil,
-- Default port for dev server
port = 3030,
-- Enable automatic browser opening
auto_open_browser = true,
-- Browser to use (nil for system default)
browser = nil,
-- Enable debug logging
debug = false,
-- Remote access configuration
remote = nil, -- nil or password string
-- Theme specification
theme = nil,
})local slidev = require('slidev')
-- Preview
slidev.preview()
-- Preview with custom port
slidev.preview({ port = 8080 })
-- Stop server
slidev.stop()
-- Stop all servers
slidev.stop_all()
-- Export
slidev.export('pdf')
slidev.export('png', { dark = true, range = '1-5' })
-- Custom output path
slidev.export('pdf', { output = '/path/to/output.pdf' })
slidev.export('pdf', { output = 'my-slides.pdf' }) -- relative path
-- Build
slidev.build()
slidev.build({ out = 'build', download = true })
-- Custom output directory
slidev.build({ output = '/path/to/dist' })
slidev.build({ output = 'public' }) -- relative path
-- Format
slidev.format()
-- Check server status
if slidev.is_running() then
print('Server is running')
endslidev.nvim is implemented with an architecture inspired by marp.nvim:
- CLI Detection: Prioritizes local
node_modules/.bin/slidev, falls back tonpx @slidev/cli@latest - Process Management: Launches Slidev CLI processes using
vim.fn.jobstart() - Auto Cleanup: Automatically stops servers when buffers are closed
- Browser Integration: Cross-platform browser launching
-
Verify Slidev CLI is installed:
npx @slidev/cli@latest --version
-
Enable debug mode:
require('slidev').setup({ debug = true })
-
Check Neovim messages:
:messages
Specify a different port:
:lua require('slidev').preview({ port = 8080 })Or change default port in config:
require('slidev').setup({ port = 8080 })Issues and Pull Requests are welcome.
MIT
This plugin was inspired by marp.nvim.