vi笔记3——vi之快速移动

2023-11-03

vi笔记3——vi之快速移动

VI快速移动主要包含以下内容:

This chapter covers:
• Movement by screens
• Movement by text blocks
• Movement by searches for patterns
• Movement by line number

 

^F --Scroll forward one screen.
^B --Scroll backward one screen.
^D --Scroll forward half screen (down).
^U --Scroll backward half screen (up).
^E --scroll the screen up one line 
^Y --scroll the screen down one line (^Y).


(In this list of commands, the ^ symbol represents the CTRL key. So ^F means to hold down the CTRL key and press the f key simultaneously.)
^L --Redrawing the Screen,When system messages appear on your screen, you need to redisplay, or redraw, the screen.


Movement Within a Screen
H --Move to home—the top line on screen.
M --Move to middle line on screen.
L --Move to last line on screen.
nH --Move to n lines below top line.
nL --Move to n lines above last line.


Movement by Line
ENTER  --Move to first character of next line.
+  --Move to first character of next line.
-  --Move to first character of previous line.
Home -- Move to first character of current line.
End -- Move to first character of current line. 

Movement on the current line
Don’t forget that h and l move the cursor to the left and right, and that 0 (zero) and $ move the cursor to the beginning or end of the line. You can also use:
^  --Move to first nonblank character of current line.
n|  --Move to column n of current line


z ENTER --Move current line to top of screen and scroll.
z. --Move current line to center of screen and scroll.
z-  -- Move current line to bottom of screen and scroll.


Movement by Text Blocks
You have already learned to move forward and backward by word (w, W, b or B).
e  --Move to end of word.
E  --Move to end of word (ignore punctuation).
(  --Move to beginning of current sentence.
)  --Move to beginning of next sentence.
{  --Move to beginning of current paragraph.
}  --Move to beginning of next paragraph.
[[  --Move to beginning of current section.(如果文件只有一节,就跳到文件第一行)
]]  --Move to beginning of next section.(如果文件只有一节,就跳到文件最后一行)


Movement by Searches
?searchContent  -- search backward,
/searchContent  -- search forward,
n  --Repeat search in same direction.(当使用/ 或者?后使用n可以依次跳转到相应的查询目标上面去)
N  --Repeat search in opposite direction.
/ ENTER  --Repeat search forward.equal to  /
? ENTER  --Repeat search backward.equal to ?
Sometimes you want to find a word only if it is further ahead; you don’t want the search to wrap around earlier in the file. vi has an option, wrapscan, that controls whether searches wrap. You can disable wrapping like this:
:set nowrapscan
When nowrapscan is set and a forward search fails, the status line displays the message:Address search hit BOTTOM without matching pattern
When nowrapscan is set and a backward search fails, the message displays “TOP”instead of “BOTTOM.”


Current Line Searches
fx  --Find (move cursor to) next occurrence of x in the line, where x stands for any
character.
Fx  --Find (move cursor to) previous occurrence of x in the line.
tx  --Find (move cursor to) character before next occurrence of x in the line.
Tx  --Find (move cursor to) character after previous occurrence of x in the line.
;  --Repeat previous find command in same direction.
,  --Repeat previous find command in opposite direction.
dfx  --deletes up to and including the named character x. 
yfx  --yanks up to and including the named character x.


^G  --显示当前行数,总行数,当前百分比;但是本人使用windows的vim和ubuntu1604的vim时候只显示了总行数和百分比


nGG  --move to number n
G  --move to the last number of the file
''  --两个单引号,返回到最后一次使用G的位置


Examples
Remember that you can combine numbers with movement. For example, 3) moves ahead three sentences. Also remember that you can edit using movement commands: d) deletes to the end of the current sentence, 2y} copies (yanks) two paragraphs ahead.



Review of vi Motion Commands
Table 3-1. Movement commands
Movement Command
Scroll forward one Screen 	^F
Scroll backward one screen  	^B
Scroll forward half screen  	^D
Scroll backward half screen  	^U
Scroll forward one line  	^E
Scroll backward one line  	^Y
Move current line to top of screen and scroll    	z ENTER
Move current line to center of screen and scroll  	z.
Move current line to bottom of screen and scroll zRedraw the screen  	^L
Move to home—the top line of screen 	 H
Move to middle line of screen 		 M
Move to bottom line of Screen 		 L
Move to first character of next line  	ENTER
Move to first character of next line 	         +
Move to first character of previous line 	 -
Move to first nonblank character of current line 	 ^
Move to column n of current line 	 n|
Move to end of word 	 e
Move to end of word (ignore punctuation) 	 E
Move to beginning of current sentence 	 (
Move to beginning of next sentence  	)
Move to beginning of current paragraph  	{
Move to beginning of next paragraph  	}
Move to beginning of current section  	[[
Move to beginning of next section  		]]
Search forward for pattern  	/pattern
Search backward for pattern  	?pattern
Repeat last search  	n
Repeat last search in opposite direction  	N
Repeat last search forward  	/
Repeat last search backward  	?
Move to next occurrence of x in current line  	fx
Move to previous occurrence of x in current line  	Fx
Move to just before next occurrence of x in current line 	tx
Move to just after previous occurrence of x in current line 	Tx
Repeat previous find command in same direction  	;
Repeat previous find command in opposite direction  	,
Go to given line n  	nG
Go to end of file  	G
Return to previous mark or context  	``
Return to beginning of line containing previous mark  	''
Show current line (not a movement command)  	^G

以上是学习vim时候整理的一些要点,分享此处以供学习!

对于一些想深入学习vi的人群,可以参考以下图书:Learning.the.vi.and.Vim.Editors.7th

下载链接:http://download.csdn.net/detail/u011127242/9617946

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

vi笔记3——vi之快速移动 的相关文章

随机推荐

  • C++ 模板

    模板是泛型编程的基础 泛型编程即以一种独立于任何特定类型的方式编写代码 模板是创建泛型类或函数的蓝图或公式 库容器 比如迭代器和算法 都是泛型编程的例子 它们都使用了模板的概念 每个容器都有一个单一的定义 比如 向量 我们可以定义许多不同类
  • springboot整合Redis时spring.redis.database参数不生效

    问题描述 配置配件中配置redis的database参数无论配置什么值时都是默认的0 网上查阅大量资料没有查到原因 解决 在网上找到了此网友的回答 虽然没有直接帮助我们解决问题 但给我提供了解决问题的思路 从这图阔以看出redis的data
  • PCL分割方法:区域生长分割算法(RegionGrowing)

    转载 有梦想的田园犬 https blog csdn net AmbitiousRuralDog article details 80267519
  • 数字信号处理基础----傅里叶级数

    1 傅里叶级数的余弦形式 1 1 正交的三角函数集 三角函数集 1 2 2 1 2 3 内的函数在区间 上彼此正交 也即 任意两个不同的函数的内积为0 函数和自身的内积不为零 因此 函数可以由该正交函数集唯一的表示 1 2 傅里叶级数的定义
  • vite+vue3打包部署问题

    最近使用vite vue3写了个小的demo 发现打包部署后页面出不来 如果是正常把包放在服务器的根目录中 项目页面是可以打开的 但是我要部署的是根目录dist包里面 外面多了一层文件夹 解决 vite config ts文件 base z
  • 横向手风琴效果

    html
  • 华硕a501lb5200加内存和固盘并装上win7系统并设置固盘为第一启动

    华硕a501lb5200加内存和固盘并装上win7系统并设置固盘为第一启动 最近入手一只华硕a501lb5200 然后某宝上买内存 固盘 接着拆机加内存和固盘并装上win7系统 于是想分享下自己的经验 大家多多补充 1 拆机加内存和固盘 内
  • Redis集群主从复制不生效的问题分析及解决

    一 集群信息 Redis版本 5 0 集群规模 三主三从 二 基本情况 在项目中为了达到高可用的目的 使用了Redis集群 搭建过程同Redis Cluster集群原理 三主三从交叉复制实战 故障切换 但是在实际使用中发现 集群方式比单点模
  • discuz未登录情况下首页tdk显示“首页”

    问题 discuz未登录状态下首页tdk与后台设置的不符 如图问题keywords和description变成了门户 也有部分变成了首页 解决办法 用编辑器打开 source class helper下的helper seo php文件 找
  • LeetCode#88. 合并两个有序数组(Python)

    题目 来源力扣 给你两个按 非递减顺序 排列的整数数组 nums1 和 nums2 另有两个整数 m 和 n 分别表示 nums1 和 nums2 中的元素数目 请你 合并 nums2 到 nums1 中 使合并后的数组同样按 非递减顺序
  • 很全的 Java 权限认证框架

    今天给大家推荐的这个开源项目超级棒 可能是史上功能最全的 Java 权限认证框架 这个开源项目就是 sa token Sa Token是什么 sa token是一个轻量级Java权限认证框架 主要解决 登录认证 权限认证 Session会话
  • FATFS:一个兼容windows的嵌入式文件系统API使用详解

    FATFS 一个兼容windows的嵌入式文件系统API使用详解 目录 FATFS 一个兼容windows的嵌入式文件系统API使用详解 1 API分类 2 常用API说明 2 1 挂载文件系统与解除挂载 2 2 文件操作 2 2 1 文件
  • arduino 1 读取电机编码器值

    define BAUDRATE 115200 define LEFT 0 左轮 define RIGHT 1 右轮 define FORWARDS true define BACKWARDS false 如果一个变量所在的代码段可能会意外地
  • vue3项目打开本地pdf文件实现方法

    vue3项目打开本地pdf文件实现方法 效果图 引入pdf插件 pdf页面封装 pdf存放目录 结语 效果图 引入pdf插件 注意一定要这个版本 不然会报错key split at is not a function npm install
  • 深度学习入门笔记之VggNet网络

    VGGNet是由牛津大学的视觉几何组 Visual Geometry Group 和谷歌旗下DeepMind团队的研究员共同研发提出的 获得了ILSVRC 2014 2014年ImageNet图像分类竞赛 的第二名 将 Top 5错误率降到
  • 数据库事务的四大特性以及事务的隔离级别

    本篇讲诉数据库中事务的四大特性 ACID 并且将会详细地说明事务的隔离级别 1 数据库事务的四大特性 如果一个数据库声称支持事务的操作 那么该数据库必须要具备以下四个特性 1 1 原子性 Atomicity 原子性是指事务包含的所有操作要么
  • lvgl实现动态切换横竖屏

    有两种方式 一种是通过lvgl自带的软件选择 但是这个效率很慢 而且只支持90度 180度 270度的旋转 不一定达到想要的效果 我需要实现的是这种效果 软件旋转没有办法实现 旋转后会镜像过去 而且如果你的屏幕不是等比例的 比如240 24
  • upload-labs pass02-05攻略(详细)

    pass 02 进入关卡 查看提示和源码 根据源代码我们可以发现 这一关是对文件类型验证 也就是验证MIME信息 接下来我们进行文件上传 使用burpsuit抓包 将Content Type修改为允许上传的类型 image jpeg ima
  • ERROR - Connection is read-only.

    今天在serviceImpl的查询中 调用了一样更新的操作 结果出现如下错误 ERROR Connection is read only Queries leading to data modification are not allowe
  • vi笔记3——vi之快速移动

    vi笔记3 vi之快速移动 VI快速移动主要包含以下内容 This chapter covers Movement by screens Movement by text blocks Movement by searches for pa