vim常用命令

本文详细介绍了vim编辑器中的常用命令,包括光标移动、文本操作、撤销重做、查找替换、折叠功能,以及如何在IdeaVim插件中配置输入法自动切换。同时提到了不同操作系统的要求。
摘要由CSDN通过智能技术生成

vim常用命令

移动光标
# hjkl
# 2w 向前移动两个单词
# 3e 向前移动到第 3 个单词的末尾
# 0 移动到行首
# $ 当前行的末尾
# gg 文件第一行
# G 文件最后一行
# 行号+G 指定行
# <ctrl>+o 跳转回之前的位置
# <ctrl>+i 返回跳转之前的位置
退出
# <esc> 进入正常模式
# :q! 不保存退出
# :wq 保存后退出
删除
# x 删除当前字符
# dw 删除至当前单词末尾
# de 删除至当前单词末尾,包括当前字符
# d$ 删除至当前行尾
# dd 删除整行
# 2dd 删除两行
修改
# i 插入文本
# A 当前行末尾添加
# r 替换当前字符
# o 打开新的一行并进入插入模式
撤销
# u 撤销
# <ctrl>+r 取消撤销
复制粘贴剪切
# v 进入可视模式
# y 复制
# p 粘贴
# yy 复制当前行
# dd 剪切当前行
状态
#<ctrl>+g 显示当前行以及文件信息
查找
# / 正向查找(n:继续查找,N:相反方向继续查找)
# ? 逆向查找
# % 查找配对的 {,[,(
# :set ic 忽略大小写
# :set noic 取消忽略大小写
# :set hls 匹配项高亮显示
# :set is 显示部分匹配
替换
# :s/old/new 替换该行第一个匹配串
# :s/old/new/g 替换全行的匹配串
# :%s/old/new/g 替换整个文件的匹配串
折叠
# zc 折叠
# zC 折叠所有嵌套
# zo 展开折叠
# zO 展开所有折叠嵌套

How To Enable:
auto-switch feature is disabled by default
enable the feature with the commands below, input in normal mode:
:set keep-english-in-normal enable auto-switch feature restore input method when return insert mode
:set nokeep-english-in-normal-and-restore-in-insert keep auto-switch feature, but doesn’t restore input method when return insert mode
:set nokeep-english-in-normal disable auto-switch feature
You can also addset keep-english-in-normal[-and-restore-in-insert]to the~/.ideavimrc` file and restart IDE to enable the feature.
Notice:
The plugin support MacOS and Windows and Linux(with fcitx)
MacOS need enable en_US OR ABC keyboard Windows need enable en_US keyboard Linux need fcitx-remote
GitHub RepositorySource and Feedback

为IdeaVim插件增加自动切换为英文输入法的功能
输入法自动切换功能不会默认启用
编辑器中normal模式下输入输入下面的指令以启用自动切换输入法功能:
:set keep-english-in-normal 开启输入法自动切换功能
:set keep-english-in-normal-and-restore-in-insert 回到insert模式时恢复输入法
:set nokeep-english-in-normal-and-restore-in-insert 保留输入法自动切换功能,但是回到insert模式不恢复输入法
:set nokeep-english-in-normal 关闭输入法自动切换功能
也可以通过将set keep-english-in-normal[-and-restore-in-insert]加入到~/.ideavimrc文件中并重启IDE来启用插件功能。
注意:支持MacOS和Windows, 通过fcitx-remote支持Linux
MacOS需要开启英语美国键盘或ABC键盘 Windows需要开启英语美国键盘 Linux需要使用fcitx输入法,通过fcitx-remote切换
GitHub Repository: 源码和问题反馈

  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值