vi

Move to the end of line character in Vi, past the last character in the line

冷暖自知 提交于 2019-12-05 02:12:12
How come in Vi, when I hit $ , it goes to the last character in the line instead of the end of the line character? How would I go to the end of the line character in one keystroke, and what is the fastest way to delete the end of the line character? How come in Vi, when I hit $ , it goes to the last character in the line instead of the end of the line character? Because that’s sufficient for anything you might want to achieve. How would I go to the end of the line character in one keystroke You basically never need to. You just do different things in the next step depending on what you wanted

linux(一)vi和vim

心不动则不痛 提交于 2019-12-05 01:57:45
vi 多模式文本编辑器 多模式产生的原因 四种模式 正常模式 插入模式 命令模式 可视模式 vi man vi vim vim 进入命令模式 i 插入,insert模式 vim正常模式,直接vim回车,或vim空格文件名回车 i进入插入模式 I(shift+i)进入插入模式,且光标到达所在行的开头 a,插入光标所处位置的下一位置 A(shift+a),插入光标所在行的最末尾 o,插入到光标所在行的下一行,原有的光标下面的行依次下移一行 o之前 o之后 O(shift+o),光标所在行的上一行进入到插入模式 O之前 O之后 正常模式下点v键进入可视模式 点:(冒号)进入如命令模式,点ESC退出 正常模式下: h左移 j下移 k上移 l右移 箭头在字符终端中可能有乱码,推荐掌握hjkl y复制 yy 单行复制 在光标所在处点yy 光标上移到第三行 点p,复制 复制到了第四行 点击3yy 下面会显示复制了三行,点p执行复制 y$(y+shift4),复制光标所在位置到光标所在行的最末尾 d剪切 dd,剪切一行 d$,剪切光标所在位置到所在的结束 u撤销 ctrl+r,撤销错了,进行重做 x,单个字符进行删除,光标移动到目标字符,点x,删除该字符 r,单个字符替换,光标移动到字符,点r,输入要替换的字符即可 nG(11+shiftg),移动到第n行,如11G,移动到第11行 g

How to split text into multiple lines based on a pattern using Vim?

半世苍凉 提交于 2019-12-04 23:28:00
Suppose you have this text: name1 = "John"; age1 = 41; name2 = "Jane"; age2 = 32; name3 = "Mike"; age3 = 36; ... and you want to split each line into two lines to give a result like this: name1 = "John"; age1 = 41; name2 = "Jane"; age2 = 32; name3 = "Mike"; age3 = 36; ... How would you automate this operation? Some notes: I already tried the following method: (1) Select the text in virtual-vode, (2) Execute :'<,'>:norm ^3f r^M ***, but it doesn't work correctly; it splits only half of the lines, because after every line is broken, the next repetition of the command applies to the rest of the

Switch between tabs in Sublime Text Vintage Mode

 ̄綄美尐妖づ 提交于 2019-12-04 23:24:26
问题 I know we can achieve this in VIM using nerdtree and gT and gt commands. But is there any way to achieve similar kind of behaviour in Sublime Text Vintage Mode? 回答1: I don't think Vintage mode has these bound to gt , gT or anything but Ctrl + Tab and Ctrl + Shift + Tab do exactly the same thing as gt and gT , whether you are in Vintage mode (INSERT or NORMAL) or not. You know, there is a very easy way to find the shortcuts used by an application: just look at the menu bar. That's what I did

Opening a directory in vim

大城市里の小女人 提交于 2019-12-04 22:35:13
I'm a mac user giving vim a serious try. Most of the GUI editors I'm used to allow me to open a directory as a "project" by executing a command like: edit ~/www/example.com/ The vim equivalent vim ~/www/example.com/ will show me a list of files in the directory, and I can open them. But it does not set vim's working directory to that path, I have to run :cd . to set the working directory. Is there some way, perhaps with a shell script, to open vim and have it's working directory set to a given path? I'm actually using MacVim, if that makes any difference. Thanks to @sehe's suggestions, I came

Vim基本使用总结

偶尔善良 提交于 2019-12-04 21:23:15
编辑器 vim vi 简介 vi 是 “Visual interface” 的简称, 它在 Linux 上的地位就仿佛 Edit 程序在 DOS 上⼀样。 它可以 执⾏输出、 删除、 查找、 替换、 块操作等众多⽂本操作, ⽽且⽤户可以根据⾃⼰的需要对 其进⾏定制。 Vi 不是⼀个排版程序, 它不象 Word 或 WPS 那样可以对字体、 格式、 段落等 其他属性进⾏编排, 它只是⼀个⽂本编辑程序。 vi 没有菜单, 只有命令, 且命令繁多。 Vi 有三种基本⼯作模式: + 命令模式 + ⽂本输⼊模式 + 末⾏模式。 命令⾏模式 任何时候, 不管⽤户处于何种模式, 只要按⼀下 ESC 键, 即可使 Vi 进⼊命令模式; 我们在 shell 环境 ( 提示符为 $) 下输⼊启动 Vi 命令, 进⼊编辑器时, 也是处于该模式下。 在该模式 下, ⽤户可以输⼊各种合法的 Vi 命令, ⽤于管理⾃⼰的⽂档。 此时从键盘上输⼊的任何字 符都被当做编辑命令来解释, 若输⼊的字符是合法的 Vi 命令, 则 Vi 在接受⽤户命令之后完 成相应的动作。 但需注意的是, 所输⼊的命令并不在屏幕上显示出来。 若输⼊的字符不是 Vi 的合法命令, Vi 会响铃报警。 ⽂本输⼊模式 在命令模式下输⼊插⼊命令 i 、 附加命令 a 、 打开命令 o 、 修改命令 c 、 取代命令 r 或替换命 令 s

Linux——vi命令详解

岁酱吖の 提交于 2019-12-04 20:57:54
转载 Linux——vi命令详解 原文链接: https://blog.csdn.net/cyl101816/article/details/82026678 vi编辑器是所有Unix及Linux系统下标准的编辑器,它的强大不逊色于任何最新的文本编辑器,这里只是简单地介绍一下它的用法和一小部分指令。由于对Unix及Linux系统的任何版本,vi编辑器是完全相同的,因此您可以在其他任何介绍vi的地方进一步了解它。Vi也是Linux中最基本的文本编辑器,学会它后,您将在Linux的世界里畅行无阻。 1、vi的基本概念   基本上vi可以分为三种状态,分别是命令模式(command mode)、插入模式(Insert mode)和底行模式(last line mode),各模式的功能区分如下: 1) 命令行模式command mode)   控制屏幕光标的移动,字符、字或行的删除,移动复制某区段及进入Insert mode下,或者到 last line mode。 2) 插入模式(Insert mode)   只有在Insert mode下,才可以做文字输入,按「ESC」键可回到命令行模式。 3) 底行模式(last line mode)   将文件保存或退出vi,也可以设置编辑环境,如寻找字符串、列出行号……等。 不过一般我们在使用时把vi简化成两个模式,就是将底行模式(last

Linux基础操作-查看文件vi

本小妞迷上赌 提交于 2019-12-04 20:47:19
用vi打开一个yum文件   vi 文件    按 i 键 后 进入insert模式,进入insert模式后才能进行修改   修改完成后   按 esc 键进入command模式,   然后 :wq 保存文件并退出vi( 注意先冒号 )   编辑文件后==》保存命令   按ESC键 跳到命令模式,然后:   :w 保存文件但不退出vi   :w file 将修改另外保存到file中,不退出vi   :w! 强制保存,不推出vi   :wq 保存文件并退出vi   :wq! 强制保存文件,并退出vi   q: 不保存文件,退出vi   :q! 不保存文件,强制退出vi   :e! 放弃所有修改,从上次保存文件开始再编辑 更详细的参考地址: https://www.cnblogs.com/ssgblue/archive/2011/08/02/2125123.html 来源: https://www.cnblogs.com/zluckiy/p/11882611.html

Vi/vim - delete from end line including final character

我是研究僧i 提交于 2019-12-04 19:29:09
问题 I want to do something similar to this question VI (VIM): delete/change right to left? i.e. delete from the end of a line to the last instance of = in that line, which can be done using dT= with the cursor placed at the end of the line. However this and other such commands do not delete the final character of the line, so I have to add an x to that command. I don't mind doing this, yet it seems surprising that vim wouldn't have a command to delete from the current character. Is there one that