vim:删除显示行而不是物理行 [英] vim: delete display lines instead of physical lines

查看:28
本文介绍了vim:删除显示行而不是物理行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当 vim 在单词之间换行时,像 j 和 k 这样的常规动作会从一个物理行跳到下一个物理行.here 中建议的nnoremap j gj"等映射将通过显示来移动光标线路而不是物理线路.

When vim wraps long lines between words regular movements like j and k will jump from one physical line to the next. Mappings like "nnoremap j gj" as suggested here will do the trick of moving the cursor by display lines instead of physical lines.

不过,这种方法至少存在一个问题.例如,dj 将删除两条物理线而不是两条显示线.

There's at least one problem with this approach though. For example, dj will delete two physical lines instead of two display lines.

有没有办法解决这个问题?

Is there a way to fix this?

推荐答案

dd 和 yy:

:nnoremap dd g0dg$
:nnoremap yy g0yg$

这篇关于vim:删除显示行而不是物理行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆