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之快速移动 的相关文章

  • 如何使用 vim 更改文件的编码?

    我习惯使用 vim 修改文件的行结尾 file file file ASCII text with CRLF line terminators vim file set ff mac wq file file file ASCII text
  • 在 COC vim 中自动从自动完成预览中选择第一项?

    有没有办法让 coc vim 自动选择第一个预览建议而不是使用箭头键 我使用的是 vim 8 1 Add suggest noselect false到你的 coc settings json 您可以在 coc 文档中找到该设置
  • gvim中的鼠标输入

    标准鼠标输入可以在 vim 中自定义吗 在我的例子中是 vim 插件也是可以接受的选择 我特别感兴趣的是 覆盖 双击某个单词 这样 gvim 就不仅仅是突出显示该单词 而是进行搜索 从而突出显示文件中该单词的所有实例 我在其他编辑器中看到过
  • 在 Mac OS X 中将 Caps Lock 用作 Esc

    How do I make Caps Lock work like Esc in Mac OS X Edit As described in this answer https stackoverflow com a 40254864 66
  • 有没有办法在 (g)Vim 中突出显示多个搜索?

    我想在 Vim gVim 中搜索多个字符串 并用不同的颜色突出显示它们 有没有办法用开箱即用的 Vim 或插件来做到这一点 在 vim 编辑器中突出显示多个单词有两种简单的方法 进入搜索模式 即输入 然后输入 v后面是您要搜索的单词 以 分
  • 在 vim 中设置文本宽度而不覆盖特定于文件类型的内容

    我希望 vim 中默认的文本宽度为 80 但如果特定文件类型有自己的文本宽度 特别是 gitcommit 其中 tw 72 我希望 vim 尊重该宽度 在我的 vimrc 中 我有以下行 set tw 80 我也尝试过 setlocal t
  • 为什么在 Vim 的插入模式下粘贴长一行非常慢?

    昨天 当我尝试将 1200 行 每行 80 个字符 粘贴到 Vim 时 我的 Macbook 被卡住了 下载文件而不是粘贴文本要快得多 我认为这个问题可能是互联网运营商允许上传速度比下载速度慢的原因 如果您将其粘贴到终端窗口中 Vim 会认
  • git commit 保存 vim 文件时出错

    我正在遵循简单的 git 指南nettuts 简易 git 指南 http net tutsplus com tutorials other easy version control with git 我在我的中初始化了一个空的 git 实
  • 如何在 VIm 和终端中始终拥有相同的当前目录?

    我希望我的终端当前目录跟随我的 VIM 目录 Example 在终端中 gt pwd gt Users rege gt vim 然后在VIM中 cd Users rege project
  • Vi/vim - 从末尾行删除,包括最后一个字符

    我想做类似这个问题的事情VI VIM 删除 更改从右到左 https stackoverflow com q 9154212 301527即从行尾删除到该行中 的最后一个实例 这可以使用dT 将光标放置在该行的末尾 然而 这个命令和其他这样
  • VIM语法折叠:禁用折叠多行注释

    我在 vim 7 3 中使用 语法 折叠方法 在 vimrc中 set foldmethod syntax 当我打开 Test cpp 时 包含 A function with a multi line comment This takes
  • 按文件类型设置 Vim 空白首选项

    在我的工作中 我需要遵循房屋风格进行缩进 如下所示 编码 html 和 ruby 时有 2 个空格 编码 javascript 时使用制表符 建议使用 tabwidth 4 为每个文件类型指定不同的空白首选项的最佳方法是什么 方法有很多 但
  • 如何在 NERDTree 中显示隐藏文件(以句点开头)?

    我怎样才能使NERDTree https github com scrooloose nerdtree显示以 a 开头的文件 时期 我有一个名为 hgignore在项目目录中 如果我使用 NERDTree 浏览到该目录 该文件不会显示在树中
  • 如何连接行并添加分隔符?

    命令J连接线 命令gJ连接线删除空格 是否还有连接行的命令 在行之间添加分隔符 Example Input text other text more text text 我想做的事 选择这4行 如果开始和 或 EOL 处有空格 请将其删除
  • vim 中的 python 2 支持

    我正在尝试设置 YouCompleteMe 一个 vim 代码完成插件 当我运行 vim 时 它给我这个错误消息 YouCompleteMe unavailable 需要 python 2 x 我的 ubuntu 机器上安装了正确版本的 p
  • Vim 在 Mingw 上表现异常

    我在 MinGW 4 6 2 上的 Vim 表现得很奇怪 例如 在插入模式下按 Backspace 会删除字符 但我必须用箭头键移动光标才能删除的字符消失 而且它也会使我退出插入模式 另一个例子 按 Del 删除字符有时会生成奇怪的字符 例
  • vim 按语法高亮类型搜索

    我正在将 i18n 添加到现有项目 Web 应用程序 这涉及到用对 i18n 库的调用来替换静态文本的每一位 如果能够搜索该文本 而不是依靠语法突出显示来直观地识别它 将会很方便 在 vim 中 是否可以在文件中搜索特定突出显示类型的出现
  • 如何禁用vim的switch case缩进?

    我目前正在与 Vim 作斗争 我似乎无法让缩进选项达到我想要的效果 这是我的设置 我将它们放在 vimrc 的底部以确保它们优先 正如你所看到的 我有点疯狂 所以我尝试关闭几乎所有的东西 set cindent set cinkeys o
  • 代码折叠未保存在我的 vimrc 中

    我将以下代码添加到我的 vimrc 中 save and restore folds when a file is closed and re opened autocmd BufWinLeave mkview autocmd BufWin
  • 改变 vim 'gutter' 颜色

    请参阅下面我如何配置 vim 的屏幕截图 gutter 即出现 和 符号的位置 使用 vim 的这个令人惊叹的 sublime text 端口显示我的 git 状态 https github com airblade vim gitgutt

随机推荐

  • 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