kentookura / forester.nvim

Neovim plugin for forester
MIT License
12 stars 4 forks source link

🌲 forester.nvim 🌲

Filetype plugin for forester, a tool for writing mathematical hypertext

Features

This plugin is pre-alpha, expect breaking changes.

Available user commands:

There is ongoing work on the Forester LSP, so I am not going to put effort into supporting completion in this plugin.

Installation

With lazy:

  {
    "kentookura/forester.nvim",
    dependencies = {
      { "nvim-telescope/telescope.nvim" },
      { "nvim-treesitter/nvim-treesitter" },
      { "nvim-lua/plenary.nvim" },
      { "hrsh7th/nvim-cmp" },
    },
  },

You might need to run :TSInstall toml and :TSInstall forester.

Configuration

In your forest.toml (or any other config) you should add the list of prefixes:

prefixes = ["foo", "bar"]

When calling :Forester new, you will then be able to choose the prefix of the new tree.

{
  config = function()
    local forester = require("forester")
    vim.g.mapleader = " "

    vim.keymap.set("n", "<leader>n.", "<cmd>Forester browse<CR>", { silent = true })
    vim.keymap.set("n", "<leader>nn", "<cmd>Forester new<CR>", { silent = true })
    vim.keymap.set("n", "<leader>nr", "<cmd>Forester new_random<CR>", { silent = true })
    vim.keymap.set("i", "<C-t>", "<cmd>Forester transclude<CR>", { silent = true })
    vim.keymap.set("i", "<C-l>", "<cmd>Forester link<CR>", { silent = true })
  end,
}

require("nvim-web-devicons").setup({ override_by_extension = { ["tree"] = { icon = "🌲" } } })

Roadmap