Comments (15)
yanktextpost
is neovim only, what about textchangedI
?
also, I think the operator mode search isn't exceptional enough to have different behaviour
from vim-cool.
edit:
just remove that line, right? or change to insertleave
https://github.com/romainl/vim-cool/blob/master/plugin/cool.vim#L63
from vim-cool.
and here is a version which doesn't touch this plugin:
augroup Pmap
au!
augroup END
function! s:PurpleP()
let o = &eventignore
set ei+=insertenter
exe 'au Pmap insertleave * let &eventignore =' string(o) '| au! Pmap insertleave'
return 'cgn'
endfunction
nnoremap <expr> cgn <SID>PurpleP()
from vim-cool.
@bounceme Yeah, TextChange
and TextChangeI
can be used in vim. I guess it will just be a bit worse heuristic with more false positives.
also, I think the operator mode search isn't exceptional enough to have different behaviour
Well, It's not about being exceptional. It's about whether the user needs search highlight after using search in operator pending mode. I certainly don't.
You seem to be thinking that I'm using this plugin. I don't. I'm just sharing the idea as I did previously when the current approach was used instead of remapping all search related keys.
The most problematic thing that I've solved with this TextYankPost
is that search highlight stays on when doing replacements with cgn
. As far as I understand the behavior of this plugin it will be turned off while typing replacement and will be back again after exiting to insert mode. Some may see this as desired behavior, I don't. The behavior I have now is closer to original vim behavior, while still having benefits of automatic turning off of the highlighting.
@romainl and you @bounceme will decide whether or not you want to use this heuristic in @romainl plugin. I'm not asking for this to be implemented.
from vim-cool.
The most problematic thing that I've solved with this TextYankPost is that search highlight stays on when doing replacements with cgn.
did you try that small code snippet?
from vim-cool.
@bounceme Why would I try it if I don't use this plugin? But I see what you did there. It should also work. What I'm saying is that I've solved two problems in one go basically.
The solution to one of the problems that you are suggesting needs more work to be used in real life. For example what if user mapped the action of cgn
into something else? Or cgn
itself have been remapped to a different functionality. That's why I don't like the solutions which try to remap default vim keybindings.
Solution that I propose doesn't have this problems (it has others, because it's a heuristic like a said).
from vim-cool.
and what about when you happen to have the same text in @@
as the text you are searching? not a uncommon situation for me atleast
/\<foo\><cr>yiw
from vim-cool.
Vim-cool disables search highlighting when you are done searching and re-enables it when you search again.
Not really fitting with the plugins spirit to add a bunch of corner cases.
Up to @romainl to reopen this
from vim-cool.
@bounceme what is @@
? And what's with /\<foo\><cr>yiw
? I've tried that, nothing bad have happened.
from vim-cool.
@@
== @"
. wouldnt textyankedPost
trigger the highlight disable?
edit: given this foo text /foo<cr>yiw
from vim-cool.
also, i can't test your code at all, a patch would make this easier
from vim-cool.
i can't test your code at all
Um... Yes you can, just add a snippet to your vimrc or start vim with sourcing this snippet. Answering your question about @@ == @/
it would keep highlighting for one CursorMove
event. On the second move it would be off just as it is now.
from vim-cool.
so the comment contains all the code needed, will just replacing the current plugin with it work?
did you try the given this foo text
then /foo<cr>yiw
. what happens then?
never mind
from vim-cool.
still, not interested in this. up to @romainl
eventually you'd need to make a patch
from vim-cool.
will just replacing the current plugin with it work?
Yes, but that's not the point. You seem to not getting my point. I've said already that I'm not using this plugin and I am not planning to use it. And I'm not interested in making patches. I've got an idea, I've implemented it and shared it in case someone interested in it. You aren't, maybe @romainl or someone else is I don't know. And I don't care. Maybe I should share it at vim tips instead.
If you have any other questions about my idea and implementation I will gladly answer them.
from vim-cool.
Related Issues (20)
- Works fine with neovim as well HOT 1
- Problem starting vim-cool HOT 15
- Bug: highlighting disappears with */#/gd and smartcase HOT 7
- Searching a magic * followed by some text incorrectly clears highlighting HOT 3
- Error for custom Esc from search commandline HOT 1
- Extra input when going from normal/hlsearch to insert mode HOT 2
- With 'nnoremap * *N', Vim won't highlight the word under cursor when the next match is inside a closed fold
- wrapping de-highlights all matches when the very first word of the buffer is a match HOT 1
- Conflict with vim-doge HOT 5
- Toggling on/off HOT 6
- Mismatch with vnoremap snippet HOT 2
- Allow blink cursor on current match? HOT 4
- Odd interaction with fzf HOT 5
- after :TOhtml, generate <Plug>(StopHL) HOT 1
- Highlighting toggles on when sourcing vimrc containing `set hlsearch` HOT 7
- Conflict with vim-floaterm HOT 2
- Check if highlight is enabled? HOT 3
- screenshots
- vim-cool doesn't seem to work in my setup HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-cool.