1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

show IME on statusline on macOS

This commit is contained in:
jdhao 2021-12-19 20:52:23 +08:00
parent 22c7c6ee05
commit 56a43e4009

View File

@ -6,6 +6,17 @@ local function spell()
return "" return ""
end end
local function ime_state()
if vim.g.is_mac then
local layout = vim.fn.libcall(vim.g.XkbSwitchLib, 'Xkb_Switch_getXkbLayout', '')
if layout == '0' then
return '[CN]'
end
end
return ""
end
local function trailing_space() local function trailing_space()
-- Get the positions of trailing whitespaces from plugin 'jdhao/whitespace.nvim'. -- Get the positions of trailing whitespaces from plugin 'jdhao/whitespace.nvim'.
local trailing_space_pos = vim.b.trailing_whitespace_pos local trailing_space_pos = vim.b.trailing_whitespace_pos
@ -63,7 +74,11 @@ require("lualine").setup({
spell, spell,
color = {fg = 'black', bg = '#a7c080'} color = {fg = 'black', bg = '#a7c080'}
}, },
"filename" "filename",
{
ime_state,
color = {fg = 'black', bg = '#f46868'}
},
}, },
lualine_x = { lualine_x = {
"encoding", "encoding",