Home  >  Q&A  >  body text

In Vim, if a paragraph is automatically wrapped and counted as one line by Vim, how can it be set up so that the J and K keys can be used to move between each "line"?

Vim’s branch

After automatically wrapping lines in Emacs, you can still use C-p and C-n to move between lines, and these lines are actually one long line. It doesn't work in Vim, but I want to be able to use HJKL to quickly locate it, but I don't want to destroy the whole line, so that I can paste it directly into word, so is there any knocking function that can do this?

迷茫迷茫2689 days ago618

reply all(1)I'll reply

  • 为情所困

    为情所困2017-05-16 16:42:34

    It is recommended to make the following key mapping, which almost (to me) does not affect the basic behavior.

    nnoremap 0 g0
    vnoremap 0 g0
    nnoremap ^ g^
    vnoremap ^ g^
    nnoremap $ g$
    vnoremap $ g$
    nnoremap j gj
    vnoremap j gj
    nnoremap k gk
    vnoremap k gk
    

    reply
    0
  • Cancelreply