vim

vim替换命令

廉价感情. 提交于 2020-01-12 20:45:42
1 语法 :[range]s/source/target/[option] 2 range range表示要替换的范围,想要全局替换的话,可以使用一个百分号. :%s/xxx/xxxx 另外,小数点表示当前行,美元符号表示最后一行,数字表示范围. :1,.s 替换第一行到当前行 :.,$s 替换当前行到最后一行 :1,$s 替换第一行到最后一行,相当于 :%s 3 source与target 表示源字符串与目标字符串,如 :1,.s/123/456 表示把第一行到当前行的首次出现的123替换成456,注意是首次出现,如果要替换某一行全部源字符串需要在后面加上 /g 另外,对于一些特殊字符比如小数点,斜杠,双引号等需要转义,方式是使用反斜杠,在需要转义的字符面前加一个反斜杠 如把 "123//" 替换为 '123\\' 命令如下: :s/\"123\/\/\"/\'123\\\\\'/g 因为 "123//" 中 " 转义为 \" / 转义为 \/ '123\\' 中 ' 转义为 \' \ 转义为 \\ 4 option 选项如下: /g 全局替换 /c 确认 /p 替换结果逐行显示 注意选项的组合结果是 /cg /pc 这样的形式,而不是 /c/g /g/p 这样的形式. 5 总结 全局替换的话,使用 :%s/source/target/g 局部替换的话,使用 :n,ms

How to become productive using Vim/Emacs [closed]

北战南征 提交于 2020-01-12 19:13:46
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 8 years ago . I've been an Eclipse user for the last 3 years or more. I do Java EE (and Spring) development in it and so far I've done 90% of my

vim替换命令

試著忘記壹切 提交于 2020-01-12 17:11:54
1 语法 :[range]s/source/target/[option] 2 range range表示要替换的范围,想要全局替换的话,可以使用一个百分号. :%s/xxx/xxxx 另外,小数点表示当前行,美元符号表示最后一行,数字表示范围. :1,.s 替换第一行到当前行 :.,$s 替换当前行到最后一行 :1,$s 替换第一行到最后一行,相当于 :%s 3 source与target 表示源字符串与目标字符串,如 :1,.s/123/456 表示把第一行到当前行的首次出现的123替换成456,注意是首次出现,如果要替换某一行全部源字符串需要在后面加上 /g 另外,对于一些特殊字符比如小数点,斜杠,双引号等需要转义,方式是使用反斜杠,在需要转义的字符面前加一个反斜杠 如把 "123//" 替换为 '123\\' 命令如下: :s/\"123\/\/\"/\'123\\\\\'/g 因为 "123//" 中 " 转义为 \" / 转义为 \/ '123\\' 中 ' 转义为 \' \ 转义为 \\ 4 option 选项如下: /g 全局替换 /c 确认 /p 替换结果逐行显示 注意选项的组合结果是 /cg /pc 这样的形式,而不是 /c/g /g/p 这样的形式. 5 总结 全局替换的话,使用 :%s/source/target/g 局部替换的话,使用 :n,ms

Vim using non-standard configuration when called from `git commit`?

北城以北 提交于 2020-01-12 16:49:08
问题 I've noticed that git seems to use different vim settings any time I'm writing a commit message. I have the git+svn install off Macports, and I've checked the $MYVIMRC variable: it's set to the correct file. Still, every time I go to commit a message I have a restriction on 80 characters per line, case sensitive search, and none of the plugins I've installed. It's probably something silly. Would appreciate a pointer as to what it is. EDIT: Actually I just checked: my plugins work. It's only

Linux

怎甘沉沦 提交于 2020-01-12 15:26:35
这周我们学习了Linux系统里的vim编辑器和一些简单的系统命令,我就简单写写我对vim编辑器的一些梳理。 首先我需要了解vim编辑器,vim有三种工作模式。 1.命令模式 命令模式就是用来操作vim编辑器的,也就是说通过指令来达到自己想要在vim来实现对应的操作的。 vim命令模式的进入方法:在英文下按下esc即可进入命令模式 光标移动的命令 1.上下左右 2.G定位到末尾行 3.$定位到当前行的尾行 4.^定位到当前行的首行 5.gg快速定位到第一行 6.ngg n标识的时数值 定位几行 7.M 定位显示区域的中间行 8.L定位显示区域的最后一行 9.w向后移动一个字 10.b向前移动一个字符 11.k上 j下 h左 l右 删除的指令: 1.x删除光标所在字符的位置 2. X删除光标前的一个字符 3.dd删除当前行 4.ndd从光标开始 删除n指定的行数 5.d0删除本行中光标前的所有字符 6.dw删除的是本行中光标后的一个字符 7. u 撤销上一个字符 8. CTRL+r 是反撤销 9.重复命令 10.· 表示的是重复上一次的命令 拷贝指令: 1.yy—拷贝当前行 2.nyy—拷贝指定行数的内容 3.p—粘贴 2.编辑模式 编辑模式是用来对文档进行修改的 编辑模式下的操作 i—输入内容的时候是在光标的位置输入的 I—输入内容的时候在首行添加内容 a—光标向后移动一位在进行输入

Where is libintl3 and libiconv2 for gnu make on windows, needed to compile vim with ruby on MinGW

烂漫一生 提交于 2020-01-12 14:50:35
问题 I am trying to run gnu make for windows, but it wouldn't run because libint3.dll was not found. Sure enough, http://gnuwin32.sourceforge.net/packages/make.htm specifies that libint3 and libiconv2 are required, but trying to follow their link obviously generates an error on the server. So, do I need these libraries, and where would I get them, or can I download gnu make from somewhere else. more background Here's what I try to do, and maybe someone else can share a way how to do it differently

Where is libintl3 and libiconv2 for gnu make on windows, needed to compile vim with ruby on MinGW

泪湿孤枕 提交于 2020-01-12 14:50:27
问题 I am trying to run gnu make for windows, but it wouldn't run because libint3.dll was not found. Sure enough, http://gnuwin32.sourceforge.net/packages/make.htm specifies that libint3 and libiconv2 are required, but trying to follow their link obviously generates an error on the server. So, do I need these libraries, and where would I get them, or can I download gnu make from somewhere else. more background Here's what I try to do, and maybe someone else can share a way how to do it differently

vim: open preview window without moving text in main window

一笑奈何 提交于 2020-01-12 14:27:12
问题 When omni-completion (or other things) opens the preview window, the size of the main window is reduced in order to make room for the preview window. By default, the first line that was visible in the main window before the preview window pops up will also be the same after the preview window pops up. This has the unfortunate effect that the text in the main window is pushed down visually. I would prefer if the text in the main window would stay where it is. This would effectively mean that

vim: open preview window without moving text in main window

孤街醉人 提交于 2020-01-12 14:25:07
问题 When omni-completion (or other things) opens the preview window, the size of the main window is reduced in order to make room for the preview window. By default, the first line that was visible in the main window before the preview window pops up will also be the same after the preview window pops up. This has the unfortunate effect that the text in the main window is pushed down visually. I would prefer if the text in the main window would stay where it is. This would effectively mean that

vim删除空行和注释

落花浮王杯 提交于 2020-01-12 10:22:53
删除空行 :g/^$/d 删除空行以及只有空格的行 :g/^\s*$/d 删除以 # 开头或 空格# 或 tab#开头的行 :g/^\s*#/d 对于 php.ini 配置文件,注释为 ; 开头 :g/^\s*;/d 使用正则表达式删除行 如果当前行包含 bbs ,则删除当前行 :/bbs/d 删除从第二行到包含 bbs 的区间行 :2,/bbs/d 删除从包含 bbs 的行到最后一行区间的行 :/bbs/,$d 删除所有包含 bbs 的行 :g/bbs/d 删除匹配 bbs 且前面只有一个字符的行 :g/.bbs/d 删除匹配 bbs 且以它开头的行 :g/^bbs/d 删除匹配 bbs 且以它结尾的行 :g/bbs$/d .ini 的注释是以 ; 开始的,如果注释不在行开头,那么删除 ; 及以后的字符 :%s/\;.\+//g 删除 # 之后所有字符 %s/\#.*//g 来源: https://www.cnblogs.com/litifeng/p/12181904.html