Plugin for Neovim to enhance the experience of developing a site using a static site generator.
Lazy:
{
'jaytyrrell13/static.nvim',
opts = {},
keys = {
{ '<leader>Sb', ':Static build<cr>' },
{ '<leader>Ss', ':Static serve<cr>' },
{ '<leader>Sp', ':Static prod<cr>' },
},
}
use {
'jaytyrrell13/static.nvim',
config = function()
require('static').setup()
end
}
Add your preferred mappings to your configuration:
nmap <leader>Sb :Static build<cr>
nmap <leader>Ss :Static serve<cr>
nmap <leader>Sp :Static prod<cr>
Running :Static build<cr>
for example, will determine the Static Site Generator and then run the build command that is configured in runners.lua.
If you'd like to run a specific Static Site Generator, you can specify it in the command like :Static astro build<cr>
.
Supported Static Site Generators:
Command | Description |
---|---|
build |
Build the site for local development |
serve |
Start a webserver to view the site |
prod |
Build the site for production |
Note: Some Static Site Generators do not support the prod
command, use the build
command instead.
Any parameters passed to one of the commands is passed along to the underlying command. For example, if you'd like to use a different port for the serve
command, you can run:
:Static serve --port=8081
This plugin can execute the SSG commands using different methods called "strategies".
Strategy | Identifier | Description |
---|---|---|
Basic (default) | basic |
Runs commands using ! |
Neovim | neovim |
Runs commands using :terminal in a horizontal split |
Dispatch | dispatch dispatch_background |
Runs commands using :Dispatch or :Dispatch! |
static.nvim comes with the following defaults:
{
strategy = 'basic',
}