Zeioth/compiler.nvim

[help] Issue with Redo Last key mapping.

Closed this issue · 1 comments

Hi, attempted to install your compiler.nvim plugin.

Copying the suggested mappings however does not seem to work.

Generates an error/warning. "Redo last selected option" throws a "Cannot assign 'function' to a parameter 'string'".

Am I doing something incorrectly?

-- Open compiler
vim.api.nvim_buf_set_keymap(0, 'n', '', "CompilerOpen", { noremap = true, silent = true })

-- Redo last selected option
vim.api.nvim_buf_set_keymap(0, 'n', '', function()
vim.cmd("CompilerStop") -- (Optional, to dispose all tasks before redo)
vim.cmd("CompilerRedo")
end, { noremap = true, silent = true })

-- Toggle compiler results
vim.api.nvim_buf_set_keymap(0, 'n', '', "CompilerToggleResults", { noremap = true, silent = true })

Zeioth commented

Hello @10zero11 those are just an example. You are meant to define your own keymappings. But I've fixed the readme so you can just copy paste them if you prefer.

-- Open compiler
vim.api.nvim_set_keymap('n', '<F6>', "<cmd>CompilerOpen<cr>", { noremap = true, silent = true })

-- Redo last selected option
vim.api.nvim_set_keymap('n', '<S-F6>',
     "<cmd>CompilerStop<cr>" -- (Optional, to dispose all tasks before redo)
  .. "<cmd>CompilerRedo<cr>",
 { noremap = true, silent = true })

-- Toggle compiler results
vim.api.nvim_set_keymap('n', '<S-F7>', "<cmd>CompilerToggleResults<cr>", { noremap = true, silent = true })

Thank you for reporting it.