首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >Vim第三讲 置入、替换、更改

Vim第三讲 置入、替换、更改

作者头像
宋天伦
发布于 2020-07-15 08:23:11
发布于 2020-07-15 08:23:11
64700
代码可运行
举报
文章被收录于专栏:fryteafrytea
运行总次数:0
代码可运行

3.1 置入类命令

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
** 输入 p 将最后一次删除的内容置入光标之后。 **
# example
---> b) Violets are blue,
---> c) Intelligence is learned,
---> d) Can you learn too?
---> |a) Roses are red,
$ dd
|
---> b) Violets are blue,
---> c) Intelligence is learned,
---> d) Can you learn too?
$ p
|---> a) Roses are red,
---> b) Violets are blue,
---> c) Intelligence is learned,
---> d) Can you learn too?

3.2 替换

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
** 输入 r 和一个字符替换光标所在位置的字符。**
# example
--->  Whan this lime was t|uoed in, someone presswd some wrojg keys!
--->  When this line was typed in, someone pressed some wrong keys!
$ ry
--->  Whan this lime was t|yoed in, someone presswd some wrojg keys!
--->  When this line was typed in, someone pressed some wrong keys!

3.3 更改

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
** 要改变文本直到一个单词的末尾,请输入 ce **
# example
---> This line has a few w|ptfd that mrrf changing usf the change operator.
---> This line has a few words that need changing using the change operator.
$ ce ords
---> This line has a few words| that mrrf changing usf the change operator.
---> This line has a few words that need changing using the change operator.
$ <Esc>

3.4 使用c更改更多

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
** 更改类操作符可以与删除中使用的同样的动作配合使用。 **\
# example
---> The end of this line needs |some help to make it like the second.
---> The end of this line needs to be corrected using the  c$  command.
$ c$ to be corrected using the  c$  command.
---> The end of this line needs to be corrected using the  c$  command.|
---> The end of this line needs to be corrected using the  c$  command.
$ <Esc>

总结

  1. 要重新置入已经删除的文本内容,请按小写字母 p 键。该操作可以将已删除 的文本内容置于光标之后。如果最后一次删除的是一个整行,那么该行将置

于当前光标所在行的下一行。

  1. 要替换光标所在位置的字符,请输入小写的 r 和要替换掉原位置字符的 新字 符 即可。
  2. 更改类命令允许您改变从当前光标所在位置直到动作指示的位置中间的文本。 比如输入 ce 可以替换当前光标到单词的末尾的内容;输入 c$ 可以替换当

前光标到行末的内容。

  1. 更改类命令的格式是: c number motion

Author: Frytea

Title: Vim第三讲 置入、替换、更改

Link: https://cloud.tencent.com/developer/article/1662393

Copyright: This work by TL-Song is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
Vimtutor中文版
=============================================================================== = 欢 迎 阅 读 《 V I M 教 程 》 —— 版本 1.5 = =============================================================================== vim 是一个具有很多命令的功能非常强大的编辑器。限于篇幅,在本教程当中 就不详细介绍了。本教程的设计目标是讲述一些必要的基本命令,而掌握好这 些命令,您就能够很容易将vim当作一个通用的万能编辑器来使用了。
大数据流动
2019/08/08
1.7K0
Vim第二讲 删除、重复、撤销
其中: operator - 操作符,代表要做的事情,比如 d 代表删除 [number] - 可以附加的数字,代表动作重复的次数 motion - 动作,代表在所操作的文本上的移动,例如 w 代表单词(word), $ 代表行末等等。
宋天伦
2020/07/15
1.4K0
vim配置即.vimrc文件的配置及vim操作技巧
1.下载vim(略)。让vi命令也可以使用vim的配置,需要修改 vi /etc/bashrc 增加如下一行内容
Twcat_tree
2022/11/30
4.4K0
运维分享|Linux指令入门vim命令
简介: Vim 非常稳定,开发迭代版本贴别快。其特点有以下几个:持久的多级撤消树、广泛的插件系统、支持数百种编程语言和文件格式、强大的搜索和替换、与许多工具集成
六月暴雪飞梨花
2023/11/27
4430
运维分享|Linux指令入门vim命令
vim 从嫌弃到依赖(2)——vim 模式
在上一篇文章中我们获取到了neovim 并对它进行了基础配置。现在已经具备一般编辑器的基本功能了。让我们先学会如何使用vim基本功能进行编辑,后面再看如何进行配置,以达到某某IDE或者编辑器的效果
Masimaro
2022/05/10
6600
vim 从嫌弃到依赖(2)——vim 模式
vim 回顾
下面是一篇旧文,大多是一些已有知识的整理,并不太成熟。欢迎关注专栏 space-vim , 有空我会以 Vim 自带的 help (不妨 :help help 看一下) 为线索, 分享一些关于 Vim 的小知识 ,也会顺带着介绍一下 space-vim 的配置与用法。
用户1558438
2018/08/23
6660
VSC x VIM - 反正多学几个快捷键没有坏处
当年研究过一段时间 VIM, 因为操作不熟练没有用作主力 IDE, 而是单纯在 CLI 里面用于轻度编辑
szhshp
2022/10/31
1.5K0
VSC x VIM - 反正多学几个快捷键没有坏处
vim常用命令总结
文本的选择,对于编辑器来说,是很基本的东西,也经常被用到,总结如下: v    从光标当前位置开始,光标所经过的地方会被选中,再按一下v结束。  V    从光标当前行开始,光标经过的行都会被选中,再按一下V结束。  Ctrl + v   从光标当前位置开始,选中光标起点和终点所构成的矩形区域,再按一下Ctrl + v结束。  ggVG 选中全部的文本, 其中gg为跳到行首,V选中整行,G末尾
阳光岛主
2019/02/19
1.6K0
VSC x VIM - 反正多学几个快捷键没有坏处
如上配置之后可以通过 <space><space>w{char} 快速跳转到包含特定字母的字符的开头
szhshp
2022/10/31
1.4K0
VSC x VIM - 反正多学几个快捷键没有坏处
第十三章 : vi 简介
There is an old joke about a visitor to New York City asking a passerby for directions tothe city’s famous classical music venue:
砖业洋__
2023/05/06
3260
如何退出Vi或Vim编辑器「建议收藏」
The vi editor is confusing if you’re not used to it. It takes a secret handshake to escape this application if you’ve stumbled into it. Here’s how to quit vi or vim on Linux, macOS, or any other Unix-like system.
全栈程序员站长
2022/11/11
5.2K0
如何退出Vi或Vim编辑器「建议收藏」
一天一个 Linux 命令(1):vim 命令
本文为joshua317原创文章,转载请注明:转载自joshua317博客 https://www.joshua317.com/article/77
joshua317
2021/09/08
9830
Linux命令(34)——vim命令
vim是Unix和类Unix操作系统中最通用的全屏幕纯文本编辑器,它是vi的增强版(vi iMproved),与vi编辑器完全兼容,而且实现了很多增强功能。
恋喵大鲤鱼
2019/02/22
8.8K0
Linux命令(34)——vim命令
第二十九章 : 读取键盘输入
The scripts we have written so far lack a feature common in most computer programs —interactivity. That is, the ability of the program to interact with the user. While manyprograms don’t need to be interactive, some programs benefit from being able to acceptinput directly from the user. Take, for example, this script from the previous chapter:
砖业洋__
2023/05/06
3940
【Linux】《how linux work》第十一章 Shell 脚本简介
If you can enter commands into the shell, you can write shell scripts (also known as Bourne shell scripts). A shell script is a series of commands written in a file; the shell reads the commands from the file just as it would if you typed them into a terminal.
阿东
2024/04/28
2800
【Linux】《how linux work》第十一章 Shell 脚本简介
2018-09-03 简单问题:VIM中 查找 “上一个” 的快捷键是什么?G 移动光标到指定行#. 例如: 5G-> 光标下反向搜索关键词 (search the word under cursor
https://blog.csdn.net/qq_31307253/article/details/78652494
Albert陈凯
2018/09/20
6.4K0
2018-09-03 简单问题:VIM中 查找 “上一个” 的快捷键是什么?G 移动光标到指定行#. 例如: 5G-> 光标下反向搜索关键词 (search the word under cursor
一篇就学会vim
学会一个软技能,总结一篇文章就够了。 剩下要做的就是不停的练习,不停的尝试,本文是在学习这个仓库之后的极简总结中。 主要作为一个备忘录使用。
六个周
2022/10/28
3.6K0
一篇就学会vim
【Linux】《how linux work》第二章 基本命令和目录层次结构
This chapter is a guide to the Unix commands and utilities that will be referenced throughout this book. This is preliminary material, and you may already know a substantial amount of it. Even if you think you’re up to speed, take a few seconds to flip through the chapter just to make sure, especially when it comes to the directory hierarchy material in 2.19 Linux Directory Hierarchy Essentials.
阿东
2024/03/05
3080
【Linux】《how linux work》第二章 基本命令和目录层次结构
Vim编辑器基础入门
Vim(Visual Interface|可视化接口),在linux中常常使用的工具,是进行Linux嵌入式编程的必备工具之一; vim最大的贡献就是它的按键系统这也是为什么chrome、idea、atom等编辑器都会提供一个vim mode;
全栈工程师修炼指南
2020/10/23
1.9K0
Vim编辑器基础入门
【Linux】《how linux work》第二章 基本命令和目录层次结构(第一部分)
This chapter is a guide to the Unix commands and utilities that will be referenced throughout this book. This is preliminary material, and you may already know a substantial amount of it. Even if you think you’re up to speed, take a few seconds to flip through the chapter just to make sure, especially when it comes to the directory hierarchy material in 2.19 Linux Directory Hierarchy Essentials.
阿东
2024/04/21
1760
【Linux】《how linux work》第二章 基本命令和目录层次结构(第一部分)
相关推荐
Vimtutor中文版
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
本文部分代码块支持一键运行,欢迎体验
本文部分代码块支持一键运行,欢迎体验