Skip to content

jaytyrrell13/static.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

static.nvim

Plugin for Neovim to enhance the experience of developing a site using a static site generator.

Installation

Lazy:

{
    'jaytyrrell13/static.nvim',
    opts = {},
    keys = {
        { '<leader>Sb', ':Static build<cr>' },
        { '<leader>Ss', ':Static serve<cr>' },
        { '<leader>Sp', ':Static prod<cr>' },
    },
}

Packer:

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>

Usage

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:

Commands

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.

Parameters

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

Strategies

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!

Configuration

static.nvim comes with the following defaults:

{
  strategy = 'basic',
}

Snippets

This plugin also includes snippets for Astro. To use them, add this plugin as a dependency of LuaSnip.

{
    'L3MON4D3/LuaSnip',
    dependencies = {
        'jaytyrrell13/static.nvim',
    }
}

Also, make sure to have this line in your config for LuaSnip.

require('luasnip.loaders.from_vscode').lazy_load()

Support

If you'd like to support the development of static.nvim, you can buy me a coffee.

About

Plugin for Neovim to enhance the experience of developing a site using a static site generator.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages