1

Vim is famously (or infamously) a child of line-based editing. For many cases this is acceptable. But I wish to use it primarily as an academic tool with large amounts of text. I want the experience to feel oriented around visual lines as opposed to logical lines. Let me flush out some of what that means:

  • jk are both mapped to gj and gk respectively.
  • gj and gk are mapped to j and k respectively.
  • commands such a 4j and 4k work on visual lines.
  • commands such as 4d work on visual lines.
  • relative line numbering and absolute line numbering both work with visual lines and not logical lines.

The first is implemented with remapping:

nnoremap <expr> j v:count ? 'j' : 'gj'
nnoremap <expr> k v:count ? 'k' : 'gk'

I'm sure with extensive creativity and work many of the other asks and more can be achieved. Has anyone done this before? It seems like a lot of work and something that could be implemented as a plugin. If not does anyone have part of a vimrc file that implements this functionality that they are willing to share? Or perhaps there is a mode in vanilla vim that has this behavior and I am just overlooking it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.