kentookura / forester.nvim

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

Snippets #19

Open dannypsnl opened 5 months ago

dannypsnl commented 5 months ago

I just inspired by my friend's note: https://yfwu.pro/2024-02-06-suite, this Obisidian plugin can convert x/y to \frac{x}{y} automatically, I think this feature is good to have.

kentookura commented 5 months ago
kentookura commented 5 months ago

https://www.youtube.com/watch?v=KtQZRAkgLqo

dannypsnl commented 5 months ago

I have some settings in my config

      ls.add_snippets("forester", {
        s("\\ul", { t({ "\\ul{", "  " }), i(1), t({ "", "}" }) }),
        s("\\ol", { t({ "\\ol{", "  " }), i(1), t({ "", "}" }) }),
        s("\\li", { t("\\li{"), i(1), t("}") }),
        s("\\p", { t("\\p{"), i(1), t("}") }),
        s("\\au", { t("\\author{dannypsnl}") }),
        s("\\ba", { t("\\import{base-macros}") }),
        s("\\ti", { t("\\title{"), i(1), t("}") }),
        s("#", {
          c(1, {
            { t("#{"),  i(1), t("}") },
            { t("##{"), i(1), t("}") }
          })
        }),
        s("\\al", {
          t({ "\\begin{aligned}", "" }),
          i(1),
          t({ "", "\\end{aligned}" })
        }),
        s("\\eq", {
          t({ "\\begin{equation}", "" }),
          i(1),
          t({ "", "\\end{equation}" })
        }),
      }, {
        type = "autosnippets",
        key = "forester_auto"
      })
kentookura commented 4 months ago

Snippets + Treesitter: https://www.youtube.com/watch?v=aNWx-ym7jjI