Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Motions can be inclusive or exclusive. It works like the different ways of annotating ranges: [0,1] and (0,1).

Consider the command `d` (delete) combined with the motions for `"`.

First we have `da"`, it deletes the everything between the pair of `"` characters that surround my cursor. Next, `di"` deletes the contents of the `"` pair.

The movement `a"` is inclusive (think 'a quote') and `i"` is exclusive (think 'inside quote'). Combined with the command you get "delete a quote" and "delete inside quote" when the mnemonics are spelled out.

https://vimhelp.org/motion.txt.html#exclusive





oh, wow, great info, thanks. i knew about the general concept from high school math (where it is called open and closed intervals) and also about Python ranges, but didn't know about it in connection with vim. Got it now.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: