Closed viccuad closed 9 years ago
Yeah, I would love to see such option, too!
+1 for such option
Having this setting would be great.
... and keep (or re-enable) the highlight when ;
or ,
is pressed, + disable it when any other keys are pressed.
why not trying any other plugin like vim-sneak, easymotion, clever-f etc? there are a lot of different plugins that tries to improve on vim motions in slightly different ways, so maybe there's already one that is closer to you needs.
@cvlmtg Those plugins are great, but, correct me if I am wrong, they do not do what this feature request wants, so it's not like you can just use one of those plugins intead of quick-scope.
Or if you're saying quick-scope in its current state is obsolete because of those plugins, I would not agree. From the readme:
- This plugin neither introduces new motions nor overrides built-in ones.
- You don't have to learn any new commands or mappings.
- This helps you to become a better user of vanilla Vim.
The advantage is it's quite lightweight and much easier to get started with than the plugins you mentioned. Everyone already knows how to use fFtT;,
, quick-scope simply makes it even more efficient, without actually changing the functionality of it (I think). Yes perhaps those plugins are a step up, but I think you should be able to see why some would prefer something less 'intrusive' like this.
With regards to the OP, I am +1. I might not use this feature myself (not sure), but I can see why it can be a useful option to have.
In the meantime, you could turn off the highlight by default, with:
let g:qs_enable = 0
And mapping QuickScopeToggle
as recommended on the documentation.
@vyp no I'm not saying this plugin is obsolete, I like the idea behind this plugin. I was just suggesting to all the people requiring this option to try the other plugins, as they might fit better their needs or at least come closer to their needs. I'm pretty sure there are at least a couple that highlight the possible targets when you press a key. however there are a lot of them and I haven't tried them all. and the point of my previous message is that perhaps even the people requiring this option haven't tried them all.
:+1:
I really like this idea, and including it in the plugin would be ideal. In the mean time, I have implemented this in my own .vimrc
; if anyone else wants a hacked-together solution, you can find the relevant bits here: https://gist.github.com/cszentkiralyi/dc61ee28ab81d23a67aa
Came here to request this exact feature. @cszentkiralyi thanks for the hack.
+1
Thanks @VanLaser and @cszentkiralyi it's perfect.
I'd like to suggest a small modification to the plugin, which would help with the selective highlighting: there could be an additional global variable, e.g. g:quickscope_direction
or similar, that could take these values: 1
(= highlight after cursor position), 2
(highlight before cursor position) and 3
(highlight entire line), with the default value 3
. This variable would be checked by s:highlight_line()
in order to conditionally highlight before, after or the entire line (it would be very easy, considering how the function is written).
This would help when using selective highlight functionality (e.g. for @cszentkiralyi's solution) in the following way: maps for f
or t
would enable QuickScope, and briefly set g:quickscope_direction
to 1
; maps for F
or T
would enable QuickScope and set g:quickscope_direction
to 2
; both would disable QuickScope afterwards, if needed, but - in any case - they would set g:quickscope_direction
back to 3
, so that default functionality is not changed.
If you have nothing against the idea, but don't feel like writing it, I could probably do it and propose a pull request.
fwiw, I think that's a great idea @VanLaser. +1
Hey everyone, so I'm finally working on this feature now after seeing the overwhelming number of users who want it added.
In response to @cvlmtg and @vyp, quick-scope originally didn't have this feature because I felt its greatest advantage was that it was always "on" so that you could calculate your movements beforehand. Also, I thought that having quick-scope trigger on a key would make it an inferior option to other motion-plugins since a few of them could at least guarantee you could move to any word on a line in the same number of keystrokes.
However, after all the feedback, I feel that quick-scope still has its advantages even with the proposed option on.
Much thanks to @cszentkiralyi and @VanLaser for creating the hack to make everyone happy while I was gone. Unfortunately, I don't think I can simply add your code to the repo without major modifications, but I still would like to mark you as contributors somehow. You can see why after looking at the task list:
Let's call the option g:qs_highlight_on_key_press
:
[ ] Disable the highlight only after a motion other than ; or , is pressed. (The highlight markers should probably still "refresh" after the cursor moves).
On a semi-related note, a patch was recently submitted to Vim to give you access to the character "stored" in ; and ,, so I'll be able to highlight that character in a another color in a future update.
g:qs_highlight_on_key_press
is enabled, avoid using autocommands if possible.Any thoughts?
quick-scope originally didn't have this feature because I felt its greatest advantage was that it was always "on" so that you could calculate your movements beforehand
I actually agree with this too. When it's always on, I don't have to 'wait', even if only for a half a second, for my fingers to pick up what key to press next. But at the same time, I can see why some would like some sort of option that does not always keep it on, because it can be distracting. I try to make it less distracting by change it to a lower contrast colour though.
This is very good news :) Meanwhile, two things:
f
(or t
etc.) target character is hit, but before a possible ;
or ,
- in this situation, it would highlight only the target character, both backwards and forward.t
and T
, as they are usually used when you already know the target character (e.g. to dt(
).Fingers crossed :)
If anyone can test out the pull request, I'd appreciate it!
So far, so good! I use 'vim-plug', the relevant line to test would be:
Plug 'unblevable/quick-scope', { 'branch': 'highlight-on-key-press' }
+1. I find the underline mildly annoying and would appreciate this feature!
Also testing the highlight-on-key-press branch. No issues so far.
I think the pull request is good to go now. I'll merge it in later today.
Right now the highlighting happens all the time on the cursor line. As it can be a bit distracting, it could be nice to add an option to only display the characters' highlighting after pressing f, F, t or T.