Skip to content

Add autocommands to notice linters #437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions autoload/EasyMotion.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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 ------ {{{
Expand Down
24 changes: 24 additions & 0 deletions doc/easymotion.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down Expand Up @@ -1139,6 +1140,29 @@ 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*

Expand Down