mirror of
https://github.com/vim-airline/vim-airline.git
synced 2025-07-23 22:15:28 +02:00
commit
f65f27b9eb
@ -429,7 +429,7 @@ function! airline#extensions#load()
|
|||||||
call add(s:loaded_ext, 'grepper')
|
call add(s:loaded_ext, 'grepper')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if (get(g:, 'airline#extensions#xkblayout#enabled', 1) && exists('g:XkbSwitchLib'))
|
if get(g:, 'airline#extensions#xkblayout#enabled', 1) && (exists('g:XkbSwitchLib') || exists('*FcitxCurrentIM'))
|
||||||
call airline#extensions#xkblayout#init(s:ext)
|
call airline#extensions#xkblayout#init(s:ext)
|
||||||
call add(s:loaded_ext, 'xkblayout')
|
call add(s:loaded_ext, 'xkblayout')
|
||||||
endif
|
endif
|
||||||
|
@ -3,15 +3,20 @@
|
|||||||
|
|
||||||
scriptencoding utf-8
|
scriptencoding utf-8
|
||||||
|
|
||||||
if !exists('g:XkbSwitchLib')
|
if !exists('g:XkbSwitchLib') && !exists('*FcitxCurrentIM')
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
|
|
||||||
function! airline#extensions#xkblayout#status()
|
function! airline#extensions#xkblayout#status()
|
||||||
let keyboard_layout = libcall(g:XkbSwitchLib, 'Xkb_Switch_getXkbLayout', '')
|
if exists('g:XkbSwitchLib')
|
||||||
let keyboard_layout = get(split(keyboard_layout, '\.'), -1, '')
|
let keyboard_layout = libcall(g:XkbSwitchLib, 'Xkb_Switch_getXkbLayout', '')
|
||||||
let short_codes = get(g:, 'airline#extensions#xkblayout#short_codes', {'2SetKorean': 'KR', 'Chinese': 'CN', 'Japanese': 'JP'})
|
let keyboard_layout = get(split(keyboard_layout, '\.'), -1, '')
|
||||||
|
else
|
||||||
|
" substitute keyboard-us to us
|
||||||
|
let keyboard_layout = substitute(FcitxCurrentIM(), 'keyboard-', '', 'g')
|
||||||
|
endif
|
||||||
|
|
||||||
|
let short_codes = get(g:, 'airline#extensions#xkblayout#short_codes', {'2SetKorean': 'KR', 'Chinese': 'CN', 'Japanese': 'JP'})
|
||||||
if has_key(short_codes, keyboard_layout)
|
if has_key(short_codes, keyboard_layout)
|
||||||
let keyboard_layout = short_codes[keyboard_layout]
|
let keyboard_layout = short_codes[keyboard_layout]
|
||||||
endif
|
endif
|
||||||
|
@ -1699,7 +1699,8 @@ vim-windowswap <https://github.com/wesQ3/vim-windowswap>
|
|||||||
------------------------------------- *airline-xkblayout*
|
------------------------------------- *airline-xkblayout*
|
||||||
|
|
||||||
The vim-xkblayout extension will only be enabled, if the global variable
|
The vim-xkblayout extension will only be enabled, if the global variable
|
||||||
`g:XkbSwitchLib` is set. It should be set to a C library that will be called
|
`g:XkbSwitchLib` is set or `FcitxCurrentIM()` exists.
|
||||||
|
`g:XkbSwitchLib` should be set to a C library that will be called
|
||||||
using |libcall()| with the function name `Xkb_Switch_getXkbLayout`. For
|
using |libcall()| with the function name `Xkb_Switch_getXkbLayout`. For
|
||||||
details on how to use it, see e.g. <https://github.com/ierton/xkb-switch>
|
details on how to use it, see e.g. <https://github.com/ierton/xkb-switch>
|
||||||
|
|
||||||
@ -1718,11 +1719,17 @@ details on how to use it, see e.g. <https://github.com/ierton/xkb-switch>
|
|||||||
\ {'2SetKorean': 'KR', 'Chinese': 'CN', 'Japanese': 'JP'}
|
\ {'2SetKorean': 'KR', 'Chinese': 'CN', 'Japanese': 'JP'}
|
||||||
|
|
||||||
* define path to the backend switcher library
|
* define path to the backend switcher library
|
||||||
|
Linux with gnome (Install https://github.com/lyokha/g3kb-switch): >
|
||||||
|
let g:XkbSwitchLib = '/usr/lib/libg3kbswitch.so'
|
||||||
|
<
|
||||||
Linux (Install https://github.com/ierton/xkb-switch): >
|
Linux (Install https://github.com/ierton/xkb-switch): >
|
||||||
let g:XkbSwitchLib = '/usr/local/lib/libxkbswitch.so'
|
let g:XkbSwitchLib = '/usr/lib/libxkbswitch.so'
|
||||||
<
|
<
|
||||||
macOS (Install https://github.com/vovkasm/input-source-switcher): >
|
macOS (Install https://github.com/vovkasm/input-source-switcher): >
|
||||||
let g:XkbSwitchLib = '/usr/local/lib/libInputSourceSwitcher.dylib'
|
let g:XkbSwitchLib = '/usr/local/lib/libInputSourceSwitcher.dylib'
|
||||||
|
<
|
||||||
|
Linux with fcitx (Install https://github.com/fcitx/fcitx5):
|
||||||
|
Install https://github.com/lilydjwg/fcitx.vim) to get `FcitxCurrentIM()`
|
||||||
|
|
||||||
------------------------------------- *airline-xtabline*
|
------------------------------------- *airline-xtabline*
|
||||||
xtabline <https://github.com/mg979/vim-xtabline>
|
xtabline <https://github.com/mg979/vim-xtabline>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user