aboutsummaryrefslogtreecommitdiff
path: root/env/.config/nvim/after/plugin/asciidoc-preview.lua
blob: a80bd7f8e2b47ce1210fdac78dcebf3c33ed9f5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
local ok, asciidoc = pcall(require, 'asciidoc-preview')
if ok then
    asciidoc.setup({
        server = {
            -- Specifies how the AsciiDoc file is converted to HTML for the preview.
            -- `js`  - asciidoctor.js (no local installation needed)
            -- `cmd` - asciidoctor command (local installation needed)
            converter = 'cmd',

            -- Specifies the hostname or IP address of the preview website for the client.
            -- This is only needed if you run neovim in a remote session and
            -- want to access the preview website from another machine.
            hostname = 'localhost',

            -- Specifies the port of the preview website on the client and server side.
            -- Must be between 10000 and 65535.
            port = 11235,
        },
        preview = {
            -- Specifies the scroll position of the preview website.
            -- `current` - Keep current scroll position
            -- `start`   - Start of the website
            -- `sync`    - (experimental) Same (similar) position as in Neovim
            --             => inaccurate, because very content dependent
            position = 'current',
        },
    })
    vim.keymap.set('n', '<leader>max', ':AsciiDocPreview<cr>')
    vim.keymap.set('n', '<leader>mas', ':AsciiDocPreviewStop<cr>')
end