Vimの入力モードの切り替えでFcitx5をオン/オフする

.vimrcに以下を追記

function! Osc52Copy()
  " 現在の無名レジスタの中身を退避
  let l:save_reg = @"
  normal! gvy
  let l:content = @"
  " レジスタを復元
  let @" = l:save_reg
  if len(l:content) == 0
    echo "Nothing to copy"
    return
  endif
  " Base64
  let l:b64 = system('base64 | tr -d "\n"', l:content)
  " 文字数制限
  if len(l:b64) > 100000
    redraw
    echohl WarningMsg
    echo "Warning: Content too large for OSC 52 copy."
    echohl None
    return
  endif
  " シーケンスを作成
  "    \x1b]52;c;{base64}\x07
  let l:seq = "\x1b]52;c;" . l:b64 . "\x07"
  call writefile([l:seq], "/dev/tty", "b")
  redraw!
  echo "Copied to clipboard (OSC 52)"
endfunction