kawre / leetcode.nvim

A Neovim plugin enabling you to solve LeetCode problems.
MIT License
1.05k stars 45 forks source link

Hook on opening #22

Closed TobinPalmer closed 10 months ago

TobinPalmer commented 10 months ago

Is it possible to add a configuration hook so that when you run nvim leetcode.nvim it will trigger a function. I think this functionally would be useful for people who want to disable plugins before coding. For example, I want to disable Copilot before writing code.

kawre commented 10 months ago

You want something like this?

{
    ---@type lc.domain
    domain = "com", -- For now "com" is the only one supported

    ---@type string
    arg = "leetcode.nvim",

    ---@type lc.lang
    lang = "cpp",

    ---@type lc.sql
    sql = "mysql",

    ---@type string
    directory = vim.fn.stdpath("data") .. "/leetcode/",

    ---@type boolean
    logging = true,

    console = {
        open_on_runcode = true, ---@type boolean

        dir = "row", ---@type "col" | "row"

        size = {
            width = "90%", ---@type string | integer
            height = "75%", ---@type string | integer
        },

        result = {
            size = "60%", ---@type string | integer
        },

        testcase = {
            virt_text = true, ---@type boolean

            size = "40%", ---@type string | integer
        },
    },

    description = {
        position = "left", ---@type "top" | "right" | "bottom" | "left"

        width = "40%", ---@type string | integer
    },

   ***********************************************************************
   ---@type function[]
   hooks = { fn1, fn2, ..., fnN },
   ***********************************************************************
}

hooks property that will accept list of functions that will get executed when leetcode.nvim starts?

kawre commented 10 months ago

@TobinPalmer it's now available