Skip to content

Howto create a keybind to toggle the "auto_fim" setting ? #41

Answered by Frefreak
notDavid asked this question in Q&A
Discussion options

You must be logged in to vote

@notDavid In case you still need it and for future visitors, the equivalent config in lua is something like the following:

function ToggleLlamaAutoFIM()
    local config = vim.g.llama_config
    config.auto_fim = not config.auto_fim
    vim.g.llama_config = config
    vim.fn["llama#init"]()
end

vim.api.nvim_set_keymap('n', '<leader>af', ':lua ToggleLlamaAutoFIM()<CR>', {noremap = true, silent = true})

TIL setting table field directly like vim.g.llama_config.auto_fim = not ... would not work, see https://stackoverflow.com/questions/75300318/changing-global-variable-value-neovim

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@notDavid
Comment options

@Frefreak
Comment options

Frefreak Feb 1, 2025
Collaborator

Answer selected by notDavid
@notDavid
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants