if vim.fn.has("mac") == 1then localfunctionswitch_input() vim.g.stored_input = vim.fn.split(vim.fn.system("input_selector current"))[1] if vim.g.stored_input ~= "com.apple.keylayout.ABC"then vim.fn.system("input_selector select com.apple.keylayout.ABC") end end
vim.api.nvim_create_autocmd("InsertEnter", { callback = function() if vim.g.stored_input == nilthen vim.g.stored_input = vim.fn.split(vim.fn.system("input_selector current"))[1] end if vim.fn.split(vim.fn.system("input_selector current"))[1] ~= vim.g.stored_input then vim.fn.system("input_selector select " .. vim.g.stored_input) end end, }) end