Skip to content

Conversation

@Parsifa1
Copy link

ref #797 #123
close #774

add --ascii --nascii getascii

api 参考了 rime/weasel#1113

我不是特别了解swift

该pr在 ai 的辅助下完成 我在本地测试了这几个功能 如果有写的不符合普遍范式的情况可以直接修改或者review提出来(

@Parsifa1 Parsifa1 changed the title feat(Squirrel cli): add --ascii && --nascii --getascii feat(Squirrel cli): add --ascii, --nascii and --getascii Sep 21, 2025
@Parsifa1
Copy link
Author

cal be used in :

local current = vim.fn.system "/Library/Input\\ Methods/Squirrel.app/Contents/MacOS/Squirrel --getascii"

function Switch_to_English_input_method()
  current = vim.fn.system "/Library/Input\\ Methods/Squirrel.app/Contents/MacOS/Squirrel --getascii"
  if current ~= "ascii" then
    vim.fn.system "/Library/Input\\ Methods/Squirrel.app/Contents/MacOS/Squirrel --ascii"
  end
end

function Set_input_method()
  if current ~= "ascii" then
    vim.fn.system(
      "/Library/Input\\ Methods/Squirrel.app/Contents/MacOS/Squirrel --" .. string.gsub(current, "\n", "")
    )
  end
end

vim.cmd [[
augroup input_method
  autocmd!
  autocmd InsertEnter * :lua Set_input_method()
  autocmd InsertLeave * :lua Switch_to_English_input_method()
augroup END
]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

能否提供一个命令行接口,来切换中英文状态?

1 participant