lyokha / vim-xkbswitch

vim plugin for automatic keyboard layout switching in insert mode
MIT License
479 stars 23 forks source link

Cause lagging in vim #29

Open aborilov opened 7 years ago

aborilov commented 7 years ago

I used this plugin for a long time, but after I updated some other plugins, vim starts to lagging very hard(scrolling, moving cursor, etc). To research this problem, I turn off plugins one by one and it looks like xkbwitch cause of the problem. Don't know how updating of other plugins could break xkbswitch.

lyokha commented 7 years ago

Try it this way (for terminal):

vim --noplugin -c 'runtime plugin/xkbswitch.vim'

Is it still bad?

aborilov commented 7 years ago

no, with just this plugin, work normally. that plugin in pair with some other break vim. here list of my plugins. may be you will see some suspicious plugin :)

Bundle 'Raimondi/delimitMate'
Plugin 'bling/vim-airline'
Plugin 'scrooloose/nerdtree'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-fugitive'
Plugin 'scrooloose/syntastic'
Plugin 'airblade/vim-gitgutter'
Plugin 'scrooloose/nerdcommenter'
Plugin 'Valloric/YouCompleteMe'
Plugin 'altercation/vim-colors-solarized'
Plugin 'klen/python-mode'
Plugin 'tomasr/molokai'
Plugin 'vim-scripts/taglist.vim'
Plugin 'szw/vim-ctrlspace'
Plugin 'mileszs/ack.vim'
Plugin 'nathanaelkane/vim-indent-guides'
Plugin 'christoomey/vim-tmux-navigator'
Plugin 'edkolev/tmuxline.vim'
Plugin 'sjl/gundo.vim'
Plugin 'benmills/vimux'
Plugin 'ryanoasis/vim-devicons'
" start to work too slow
" Plugin 'lyokha/vim-xkbswitch'
Plugin 'machakann/vim-sandwich'
Plugin 'pearofducks/ansible-vim'
Plugin 'fatih/vim-go'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'tpope/vim-unimpaired'
Plugin 'rizzatti/dash.vim'
lyokha commented 7 years ago

Try disable translation and Select mode mappings by putting in .vimrc lines

let g:XkbSwitchIMappings = []
let g:XkbSwitchSkipGhKeys = ['gh', 'gH']
aborilov commented 7 years ago

nope, didn't helped

xaiamov commented 4 years ago

I observed the same problem and found out that the reason was in sequence which was used for the arrow keys: https://stackoverflow.com/a/25111512/4177749

I just needed to switch back to the _enus layout in command mode without remembering current layout. So I have completely disabled the plugin solved the problem with this code in .vimrc:

function <SID>condLayout()
    if mode() == "n"
        call libcall('/usr/local/lib/libxkbswitch.dylib', 'Xkb_Switch_setXkbLayout', "2")
    endif
endfunction

autocmd InsertLeave * call timer_start(200, { tid -> <SID>condLayout()})

The script checks current vim mode after 200 ms timeout and if it is "normal" - switches to _enus layout. Timeout helps to avoid switching layout on cursor movements.

Thank you guys for the library and this plugin which helped me to find the solution.