Giter Site home page Giter Site logo

Comments (7)

christianparpart avatar christianparpart commented on June 12, 2024

@ferdinandyb I think there's a misunderstanding.

  • w refers to the beginning of the next word (using word delimiters, such as ., ,, :, space, etc..
  • W refers to the beginning of the next word (using whitespace delimiters only)
  • e refers to the end of the current word (delimiters as in w)
  • W refers to the end of the current word (delimiters as in W, i.e. whitespaces only)

So pressing yW will yank everything from the current cursor position to the beginning of the next word whereas yE (and similarily ye) will yank from current position to the end of the current word.

p.s.: I was implementing this based on what I was reading in the vim documentation. However, trying it out right now in vim (and Contour), I noticed a different in vim itself.

vim itself behaves differently in marking the range for yW vs vW. This is a WTF for me. I may have accidentally skipped reading something in the docs that would describe this, but to me that sounds a bit weird. Not sure sure why yW and vW in vim (neovim for me) do operate on a different range, that is, yW excludes the right boundary whereas vW does indeed include it (as we do in Contour, however, for both cases).

So not sure how to process on this ticket. If vim and neovim are doing it that way, then we should adapt of course. Because it's meant to be inspired by vim. It should feel the same then.

from contour.

ferdinandyb avatar ferdinandyb commented on June 12, 2024

from contour.

christianparpart avatar christianparpart commented on June 12, 2024

Keep me posted, please. :)

from contour.

ferdinandyb avatar ferdinandyb commented on June 12, 2024

from contour.

Yaraslaut avatar Yaraslaut commented on June 12, 2024

vim itself behaves differently in marking the range for yW vs vW.

evil-mode behaves similar to contour, makes selection until the next word

from contour.

ferdinandyb avatar ferdinandyb commented on June 12, 2024

The vim question is still ongoing, but two comments came to mind:

  • yanking the first character of the next WORD is a bug either way: neither yW nor vW does that

  • the exact amount of whitespace yanked could be totally irrelevant in many cases, especially if there's a white space stripping mechanism (which I sort of remember contour having?)

from contour.

ferdinandyb avatar ferdinandyb commented on June 12, 2024

Here's the detailed answer: https://vi.stackexchange.com/a/44056/25312. In short:

  • motions can be inclusive or exclusive, but that only counts after an operator, not when using them to move the cursor in normal mode

  • visual mode always implies inclusive unless the defaults are changed

I guess the question is, how close you want to copy vim. I personally think, it should be as close to vim defaults as possible, but that does entail some additional complexity right now.

from contour.

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.