Vim:我如何交换两个字符? [英] Vim: how do I swap two characters?

查看:40
本文介绍了Vim:我如何交换两个字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有快速修改的命令

Cnotrol

Control

推荐答案

在正常模式下,将光标放在要交换的第一个字符的顶部,您可以键入 xp 删除一个字符并在光标后put 它,有效地交换了两个字符.

While in normal mode, with your cursor on top of the first character to swap, you can type xp to delete one character and put it after the cursor, effectively swapping the two characters.

一个可能有用的命令(直接取自 关于交换的 Vim 页面)是

One possibly useful command (taken straight from the Vim page on swapping) would be

:nnoremap <silent> gc xph

gc(或您选择的其他命令)映射到交换两个字符.请注意,h 只是将光标移回其原始位置,位于要交换的两个字符中的第一个的顶部.

to map gc (or another command of your choice) to swapping two characters. Note that the h simply moves the cursor back to its original position, on top of the first of the two characters to be swapped.

这篇关于Vim:我如何交换两个字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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