dense-analysis/neural

Changing autocomplete keybind does not appear to work

z4rathustr4 opened this issue ยท 3 comments

Hi, today I tested this awesome plugin (great job btw) with my personal configuration which is customized NvChad settings. I created a separated Lua file for this plugin with the example configuration and tried to change because it's my keybind for NvimTree, and it does not seem to work.
neural.lua file:

local neural = {
    mappings = {
        swift = '<C-m>', -- Context completion
        prompt = '<C-space>', -- Open prompt
    },
    -- OpenAI settings
    open_ai = {
        temperature = 0.1,
        presence_penalty = 0.5,
        frequency_penalty = 0.5,
        max_tokens = 2048,
        context_lines = 16, -- Surrounding lines for swift completion
        api_key = 'some_api_key_i_wont_plaintext'
    },
    -- Visual settings
    ui = {
        use_prompt = true, -- Use visual floating Input
        use_animated_sign = true, -- Use animated sign mark
        show_hl = true,
        show_icon = true,
        icon = '๐Ÿ—ฒ', -- Prompt/Static sign icon
        icon_color = '#ffe030', -- Sign icon color
        hl_color = '#4D4839', -- Line highlighting on output
        prompt_border_color = '#E5C07B',
    },
}

And my init.lua file in custom/plugins folder:

return {
  ["neovim/nvim-lspconfig"] = {
    config = function()
      require "plugins.configs.lspconfig"
      require "custom.plugins.lspconfig"
    end,
    },
  ["simrat39/rust-tools.nvim"] = {
    after = "nvim-lspconfig",
    config = function()
        require('rust-tools').setup({})
    end,
    },

    ["dense-analysis/neural"] = {
    config = function()
            require "custom.plugins.neural"
    end,
    requires = {
        "MunifTanjim/nui.nvim",
        }
    }

}

I hope someone can help and if it's my fault I'll figure it somehow in the next 3 hours ๐Ÿ˜†

Hey @z4rathustr4 thanks for taking a look. Have you tried passing the configuration table inside of the setup function when requiring neural?

Try this amended configuration and let me know if that works:

return {
  ["neovim/nvim-lspconfig"] = {
    config = function()
      require "plugins.configs.lspconfig"
      require "custom.plugins.lspconfig"
    end,
    },
  ["simrat39/rust-tools.nvim"] = {
    after = "nvim-lspconfig",
    config = function()
        require('rust-tools').setup({})
    end,
    },

    ["dense-analysis/neural"] = {
        config = function()
        require('custom.plugins.neural').setup{
            mappings = {
                swift = '<C-m>', -- Context completion
                prompt = '<C-space>', -- Open prompt
            },
            -- OpenAI settings
            open_ai = {
                temperature = 0.1,
                presence_penalty = 0.5,
                frequency_penalty = 0.5,
                max_tokens = 2048,
                context_lines = 16, -- Surrounding lines for swift completion
                api_key = 'some_api_key_i_wont_plaintext'
            },
            -- Visual settings
            ui = {
                use_prompt = true, -- Use visual floating Input
                use_animated_sign = true, -- Use animated sign mark
                show_hl = true,
                show_icon = true,
                icon = '๐Ÿ—ฒ', -- Prompt/Static sign icon
                icon_color = '#ffe030', -- Sign icon color
                hl_color = '#4D4839', -- Line highlighting on output
                prompt_border_color = '#E5C07B',
            },
        }
    end,
    requires = {
        "MunifTanjim/nui.nvim",
        }
    }

}

I don't use any plugin managers myself so its possible I am missing something some kind of magic I don't understand.

Somehow, it seems to work but now works with C-n and C-m at the same time. I'll temporary change my NvimTree keybind for now, but it seems like is hardcoded into the plugin's Lua. Thank you anyway! ๐Ÿ˜„

This is fixed thanks to @LoneExile at #6