A Neovim plugin that saves & restores Fcitx state between modes.
- Neovim (obviously)
- Fcitx5 or Fcitx, with
fcitx5-remoteorfcitx-remotein$PATH
vim.pack.add { 'https://github.com/0xsvenka/fcvimtx' }
require('fcvimtx').setup {}Using lazy.nvim
{
'0xsvenka/fcvimtx',
config = function()
require('fcvimtx').setup {}
end,
}Other plugin managers should follow similar patterns.
The setup function, as shown above, provides the default behavior: disable the input method after saving its state when leaving insert mode, then restore that state when entering insert mode.
Alternatively, you can bypass setup and create your own autocmds by using the functions provided by fcVIMtx:
local fcvimtx = require('fcvimtx')
fcvimtx.turn_on()
fcvimtx.turn_off()
fcvimtx.save()
fcvimtx.restore()For reference, the setup function creates these two autocmds:
vim.api.nvim_create_autocmd('InsertEnter', {
callback = fcvimtx.restore,
})
vim.api.nvim_create_autocmd('InsertLeave', {
callback = function()
fcvimtx.save()
fcvimtx.turn_off()
end,
})