Skip to content

Commit fea18da

Browse files
committed
feat: improve startup speed
1 parent 7385021 commit fea18da

File tree

2 files changed

+27
-28
lines changed

2 files changed

+27
-28
lines changed

README.md

+10-12
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ Improve Vim/Neovim experience with input methods.
33

44
Basically, this plugin does these things:
55

6-
- Switch to the default IM of your choice on `InsertLeave`
7-
- Switch back to your previous IM on `InsertEnter`
8-
- Switch to the default IM of your choice on `FocusGained` if you are in
9-
normal mode, or do nothing if not
10-
- Switch back to your previous IM on `FocusLost` if you are in normal mode, or
6+
- Switch to the "default IM" on `InsertLeave`
7+
- Switch back to the previous IM on `InsertEnter`
8+
- Switch to the "default IM" on `FocusGained` if you are in normal mode, or do
9+
nothing if not
10+
- Switch back to the previous IM on `FocusLost` if you are in normal mode, or
1111
do nothing if not
12-
- If you are using a GUI (e.g., GVim), switch back to your previous IM before
12+
- If you are using a GUI (e.g., GVim), switch back to the previous IM before
1313
exiting Vim if you are in normal mode, or do nothing if you are in insert
14-
mode. If you are under a terminal, switch to the default IM of your choice
15-
before exiting Vim.
14+
mode. If you are under a terminal, switch to the "default IM" before exiting
15+
Vim.
1616

1717
## Requirements
1818

@@ -28,8 +28,7 @@ be installed.
2828
[tmux-plugins/vim-tmux-focus-events](https://github.com/tmux-plugins/vim-tmux-focus-events)
2929
is recommended if you are using Tmux. This plugin provides `FocusGained` and
3030
`FocusLost` events for (Neo)Vim under Tmux. (NOTE: It is reported that this
31-
plugin does not work well with Vim/Vim cannot recognize the terminal code from
32-
this plugin, however it works well with Neovim.)
31+
plugin does not work well with Vim, however it works well with Neovim.)
3332

3433
## Commands
3534

@@ -131,8 +130,7 @@ to enable anyway.
131130
Set this variable to 0 if you want disable IM switching in the command-line
132131
mode. This setting is useful for users who wish to use a different input method
133132
(specifically for English characters) in the command-line mode, as opposed to
134-
the main text.
135-
default value is 1.
133+
the main text. The default value is 1.
136134

137135
<!-- vim: cc=79
138136
-->

plugin/im_select.vim

+17-16
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@ endif
2626
if !exists('g:im_select_get_im_cmd') || !exists('g:ImSelectSetImCmd')
2727
if has('win32') || has('win64') || has('win32unix') || has('wsl') || $PATH =~ '/mnt/c/WINDOWS'
2828
if !exists('g:im_select_command')
29-
let cmd = exepath('im-select.exe')
30-
if cmd == ''
31-
echohl ErrorMsg | echomsg 'im-select.exe is not found on your system. Please refer to https://github.com/daipeihust/im-select' | echohl None
32-
finish
33-
endif
29+
" let cmd = exepath('im-select.exe')
30+
" if cmd == ''
31+
" echohl ErrorMsg | echomsg 'im-select.exe is not found on your system. Please refer to https://github.com/daipeihust/im-select' | echohl None
32+
" finish
33+
" endif
34+
let cmd = 'im-select.exe'
3435
let g:im_select_command = cmd
3536
endif
3637

@@ -41,12 +42,12 @@ if !exists('g:im_select_get_im_cmd') || !exists('g:ImSelectSetImCmd')
4142
let g:ImSelectSetImCmd = {key -> [g:im_select_command, key]}
4243
elseif has('mac') || has('macunix') || has('osx') || has('osxdarwin')
4344
if !exists('g:im_select_command')
44-
let cmd = exepath('im-select')
45-
if cmd == ''
46-
echohl ErrorMsg | echomsg 'im-select is not found on your system. Please refer to https://github.com/daipeihust/im-select' | echohl None
47-
finish
48-
endif
49-
45+
" let cmd = exepath('im-select')
46+
" if cmd == ''
47+
" echohl ErrorMsg | echomsg 'im-select is not found on your system. Please refer to https://github.com/daipeihust/im-select' | echohl None
48+
" finish
49+
" endif
50+
let cmd = 'im-select'
5051
let g:im_select_command = cmd
5152
endif
5253
if !exists('g:im_select_default')
@@ -143,7 +144,7 @@ let g:im_select_enable_cmd_line = get(g:, 'im_select_enable_cmd_line', 1)
143144

144145
let g:im_select_prev_im = ''
145146

146-
function! im_select#enable() abort
147+
function! s:im_select_enable() abort
147148
augroup im_select
148149
autocmd!
149150
if g:im_select_enable_cmd_line
@@ -167,14 +168,14 @@ function! im_select#enable() abort
167168
augroup END
168169
endfunction
169170

170-
function! im_select#disable() abort
171+
function! s:im_select_disable() abort
171172
autocmd! im_select
172173
endfunction
173174

174-
command! -nargs=0 ImSelectEnable call im_select#enable()
175-
command! -nargs=0 ImSelectDisable call im_select#disable()
175+
command! -nargs=0 ImSelectEnable call s:im_select_enable()
176+
command! -nargs=0 ImSelectDisable call s:im_select_disable()
176177

177-
call im_select#enable()
178+
call s:im_select_enable()
178179

179180
let &cpo = s:save_cpo
180181
unlet s:save_cpo

0 commit comments

Comments
 (0)