Skip to content

Commit 4b7e7d2

Browse files
committed
Add autocmd on buffer content change
1 parent 6c9c054 commit 4b7e7d2

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

autoload/EasyMotion.vim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,9 @@ function! s:PromptUser(groups) "{{{
10951095
let lines_items = items(lines)
10961096
" }}}
10971097

1098+
" Invoke autocmd so the user can temporarily disable linters, etc.
1099+
doautocmd User EasyMotionPromptBegin
1100+
10981101
" -- Put labels on targets & Get User Input & Restore all {{{
10991102
" Save undo tree
11001103
let undo_lock = EasyMotion#undo#save()
@@ -1148,6 +1151,9 @@ function! s:PromptUser(groups) "{{{
11481151
call undo_lock.restore()
11491152

11501153
redraw
1154+
1155+
" Invoke autocmd
1156+
doautocmd User EasyMotionPromptEnd
11511157
endtry "}}}
11521158

11531159
" -- Check if we have an input char ------ {{{

doc/easymotion.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,28 @@ Example: >
11391139
See |easymotion-plug-table| for a table of motions that can be mapped
11401140
and their default values.
11411141

1142+
Autocommands *easymotion-autocommands*
1143+
*EasyMotionPromptBegin* *EasyMotionPromptEnd*
1144+
1145+
EasyMotion invokes two |User| autocommands, |EasyMotionPromptBegin| and
1146+
|EasyMotionPromptEnd|, so you can temporarily disable your linter to avoid
1147+
annoying syntax errors.
1148+
1149+
1150+
EasyMotionPromptBegin Before the content of buffer is changed with
1151+
markers. If EasyMotion directly jumps to the
1152+
target (no prompts given), this autocommand will
1153+
not be executed.
1154+
1155+
EasyMotionPromptEnd After the content of buffer and the undo tree are
1156+
restored.
1157+
1158+
Example with coc.nvim: >
1159+
1160+
autocmd User EasyMotionPromptBegin silent! CocDisable
1161+
autocmd User EasyMotionPromptEnd silent! CocEnable
1162+
<
1163+
11421164
==============================================================================
11431165
License *easymotion-license*
11441166

0 commit comments

Comments
 (0)