From 4b7e7d228f30687f97550bbdc62c0a8c2c413493 Mon Sep 17 00:00:00 2001 From: Ziyang Lin Date: Tue, 13 Oct 2020 13:57:32 +0800 Subject: [PATCH 1/2] Add autocmd on buffer content change --- autoload/EasyMotion.vim | 6 ++++++ doc/easymotion.txt | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/autoload/EasyMotion.vim b/autoload/EasyMotion.vim index 7ccdcf88..e520dc35 100644 --- a/autoload/EasyMotion.vim +++ b/autoload/EasyMotion.vim @@ -1095,6 +1095,9 @@ function! s:PromptUser(groups) "{{{ let lines_items = items(lines) " }}} + " Invoke autocmd so the user can temporarily disable linters, etc. + doautocmd User EasyMotionPromptBegin + " -- Put labels on targets & Get User Input & Restore all {{{ " Save undo tree let undo_lock = EasyMotion#undo#save() @@ -1148,6 +1151,9 @@ function! s:PromptUser(groups) "{{{ call undo_lock.restore() redraw + + " Invoke autocmd + doautocmd User EasyMotionPromptEnd endtry "}}} " -- Check if we have an input char ------ {{{ diff --git a/doc/easymotion.txt b/doc/easymotion.txt index 9c88c3e1..720b6df9 100644 --- a/doc/easymotion.txt +++ b/doc/easymotion.txt @@ -1139,6 +1139,28 @@ Example: > See |easymotion-plug-table| for a table of motions that can be mapped and their default values. +Autocommands *easymotion-autocommands* + *EasyMotionPromptBegin* *EasyMotionPromptEnd* + +EasyMotion invokes two |User| autocommands, |EasyMotionPromptBegin| and +|EasyMotionPromptEnd|, so you can temporarily disable your linter to avoid +annoying syntax errors. + + +EasyMotionPromptBegin Before the content of buffer is changed with + markers. If EasyMotion directly jumps to the + target (no prompts given), this autocommand will + not be executed. + +EasyMotionPromptEnd After the content of buffer and the undo tree are + restored. + +Example with coc.nvim: > + + autocmd User EasyMotionPromptBegin silent! CocDisable + autocmd User EasyMotionPromptEnd silent! CocEnable +< + ============================================================================== License *easymotion-license* From e50e171b7e345e04925e28a53b496e91b87a564b Mon Sep 17 00:00:00 2001 From: Ziyang Lin Date: Tue, 13 Oct 2020 14:12:35 +0800 Subject: [PATCH 2/2] Add entry in table of contents --- doc/easymotion.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/easymotion.txt b/doc/easymotion.txt index 720b6df9..8385a124 100644 --- a/doc/easymotion.txt +++ b/doc/easymotion.txt @@ -38,6 +38,7 @@ CONTENTS *easymotion-contents* Custom mappings ................. |easymotion-custom-mappings| Leader key .................. |easymotion-leader-key| Custom keys ................. |easymotion-custom-keys| + Autocommands .................... |easymotion-autocommands| License ............................ |easymotion-license| Known bugs ......................... |easymotion-known-bugs| Contributing ....................... |easymotion-contributing| @@ -1139,8 +1140,9 @@ Example: > See |easymotion-plug-table| for a table of motions that can be mapped and their default values. -Autocommands *easymotion-autocommands* - *EasyMotionPromptBegin* *EasyMotionPromptEnd* +------------------------------------------------------------------------------ +Autocommands *easymotion-autocommands* + *EasyMotionPromptBegin* *EasyMotionPromptEnd* EasyMotion invokes two |User| autocommands, |EasyMotionPromptBegin| and |EasyMotionPromptEnd|, so you can temporarily disable your linter to avoid