Forked from cszentkiralyi/context_quick_scope.vim
Last active
August 29, 2015 14:27
-
-
Save VanLaser/a781cd29ccf3526da9ef to your computer and use it in GitHub Desktop.
Only enable the quick-scope plugin's highlighting when using the f/F/t/T movements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Insert into your .vimrc after quick-scope is loaded. | |
" Obviously depends on <https://github.com/unblevable/quick-scope> being installed. | |
" enable quick_scope conditionally | |
let g:qs_enable = 0 | |
let g:qs_enable_char_list = [ 'f', 'F', 't', 'T' ] | |
function! Quick_scope_selective(movement) | |
let needs_disabling = 0 | |
if !g:qs_enable | |
QuickScopeToggle | |
redraw! | |
let needs_disabling = 1 | |
endif | |
let letter = nr2char(getchar()) | |
if needs_disabling | |
QuickScopeToggle | |
endif | |
return a:movement . letter | |
endfunction | |
" quick_scope maps, operator-pending mode included (can do 'df' with hint) | |
for i in g:qs_enable_char_list | |
execute 'noremap <expr> <silent>' . i . " Quick_scope_selective('". i . "')" | |
endfor |
You're welcome, and thanks for making the "hack" :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, I've incorporated your changes into my original gist. Seems to work great, I just changed
redraw!
toredraw
since at least on my end I've found the screen clear to be unnecessary.