Giter Club home page Giter Club logo

Comments (15)

bounceme avatar bounceme commented on June 14, 2024

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.

bounceme avatar bounceme commented on June 14, 2024

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.

bounceme avatar bounceme commented on June 14, 2024

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.

purpleP avatar purpleP commented on June 14, 2024

@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.

bounceme avatar bounceme commented on June 14, 2024

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.

purpleP avatar purpleP commented on June 14, 2024

@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.

bounceme avatar bounceme commented on June 14, 2024

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.

bounceme avatar bounceme commented on June 14, 2024

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.

purpleP avatar purpleP commented on June 14, 2024

@bounceme what is @@? And what's with /\<foo\><cr>yiw? I've tried that, nothing bad have happened.

from vim-cool.

bounceme avatar bounceme commented on June 14, 2024

@@ == @" . wouldnt textyankedPost trigger the highlight disable?

edit: given this foo text /foo<cr>yiw

from vim-cool.

bounceme avatar bounceme commented on June 14, 2024

also, i can't test your code at all, a patch would make this easier

from vim-cool.

purpleP avatar purpleP commented on June 14, 2024

@bounceme

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.

bounceme avatar bounceme commented on June 14, 2024

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.

bounceme avatar bounceme commented on June 14, 2024

still, not interested in this. up to @romainl

#17 (comment)

eventually you'd need to make a patch

from vim-cool.

purpleP avatar purpleP commented on June 14, 2024

@bounceme

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.