Highlight positions of the marks in Vim?

Your problem may be that the previously changed or yanked text was all on one line. If you use ' with a mark it just takes you to the line, not to the exact character. Use ` instead to get the exact character.

One way to temporarily highlight the region would be to type this:

`[v`]

This will jump to the start change/yank mark, start a visual block and then jump to the end change/yank mark.


Use the showmarks plugin for VIM. It does just that.


Normally you can "blink" the matching delimiter ([{}]) ... using the % (percent sign) command in vi.

(That's not even unique to vim ... it works in other versions of vi as well).

The '[ and '] (single quote, square brackets) are unique to vim as far as I know. They move to the first non-blank character on the first or last line where most recently modified or "put" any text. If your most recent change only only affected a single line then the commands would both move to the same place (as you described).

Note that the ' command (in normal vi as well as vim) is a movement. 'letter (single quote followed by any lower case letter) is a command to move to the locate where a mark was most recently set (using the m command, of course). '' (repeating the single quote command twice) moves to "most recent" cursor location (think of there being a implicit mark there). That's the most recent location from which you initiated a movement or made a change ('[ and '] are ONLY about where you made changes).

For example if I'm on line 100 and I use n to search for the next occurrence of my current search pattern, then '' will get me back to line 100. From there if I type '' again then it will toggle me back to whatever the search (n) command found.
Personally I never use '[ and '] ... I drop a mark using ma (or b, or c or whatever) and then make my changes or pastes before or after the mark I've set, as appropriate.


vim-signature worked well for showing marks.

showmarks didn't work for me. It also hasn't been updated in nearly a decade.

Tags:

Vim