vim

How do I visual select a calculation backwards?

孤者浪人 提交于 2020-01-11 07:22:07
问题 I would like to visual select backwards a calculation p.e. 200 + 3 This is my text -300 +2 + (9*3) |-------------|* This is text 0,25 + 2.000 + sqrt(15/1.5) |-------------------------|* The reason is that I will use it in insert mode. After writing a calculation I want to select the calculation (using a map) and put the results of the calculation in the text. What the regex must do is: - select from the cursor (see * in above example) backwards to the start of the calculation (including \/-+*

How can I get Vim to not break DocBlock comments?

僤鯓⒐⒋嵵緔 提交于 2020-01-11 06:35:11
问题 /** * Example Comment */ When I press enter after Comment Vim autoindents but leaves the cursor lined up with the * characters. How can I get Vim to add the * and a space so that my comment lines up with the E ? 回答1: You will want to modify the value of the formatoptions (short name fo ) Vim option, like this: :set fo+=or The r option enables the behavior in insert mode; o enables it when using o or O in normal to switch into insert. Try Vim's builtin help for details: :help formatoptions 来源:

linux vim四种模式学习(一)

自古美人都是妖i 提交于 2020-01-11 05:37:47
vim四种模式 edit model: 文本内部编辑。(和windows一样) normal model: 例: i->光标前输入;I->光标所在行首输入 a->光标后输入;A->光标所在行尾输入 o->光标后一行输入;O->光标前一行输入 j->光标下移;k->光标上移。 command model: (有点像windows的菜单栏) 例: :set nu->加入行号; :vs ->分屏; :q取消分屏; :% s/1/2 全部替换1->2 visual model: v->选择单个字符;V->选择整行; d->删除;u->撤销; y->复制;p->粘贴; ctrl+v ->字符块删除 来源: CSDN 作者: shenjide 链接: https://blog.csdn.net/shenjide/article/details/103857683

vim 基本操作及使用

北慕城南 提交于 2020-01-11 04:19:09
1.1使用vim命令进入vim界面 vim后面加上你要打开的已存在的文件名或者不存在(则作为新建文件)的文件名。 打开终端,输入以下命令 $ vim practice_1.txt 直接使用vim也可以打开vim编辑器,但是不会打开任何文件。 $ vim 进入命令行模式后输入:e 文件路径 同样可以打开相应文件。 1.2游标移动 进入vim后,按下i键进入 插入模式 。在该模式下可以输入文本信息. 按Esc进入普通模式,在该模式下使用方向键或者h,j,k,l键可以移动游标。 h 左 l 右 j 下 k 上 w 移动到下一个单词 b 移动到上一个单词 在 普通模式 下使用下面的键将进入 插入模式 ,并可以从相应的位置开始输入 i 在当前光标处进行编辑 I 在行首插入 A 在行末插入 a 在光标后插入编辑 o 在当前行后插入一个新行 O 在当前行前插入一个新行 cw 替换从光标所在位置后到一个单词结尾的字符 1.3退出vim 命令行模式下退出vim 从普通模式输入:进入命令行模式,输入wq回车,保存并退出编辑 以下为其它几种退出方式: :q! 强制退出,不保存 :q 退出 :wq! 强制保存并退出 :w <文件路径> 另存为 :saveas 文件路径 另存为 :x 保存并退出 :wq 保存并退出 普通模式下退出vim 普通模式下输入Shift+zz即可保存退出vim 1.4删除文本

Vim快捷键命令

醉酒当歌 提交于 2020-01-11 03:38:59
vi中跳到文件的第一行和最后一行 由于vi编辑器不能使用鼠标,所以一个大文件如果要到最后一行只用键盘下键的话会是一个很痛苦的过程,还好有各种比较快捷的方法归我们使用: 1. vi 编辑器中跳到文件的第一行:    a 输入 :0 或者 :1 回车    b 键盘按下 小写 gg 2.vi 编辑器跳到文件最后一行:    a 输入 :$ 回车    b 键盘按下大写 G    c 键盘按 shift + g (其实和第二种方法一样) Vim快速移动光标至行首和行尾 1、 需要按行快速移动光标时,可以使用键盘上的编辑键Home,快速将光标移动至当前行的行首。除此之外,也可以在命令模式中使用快捷键"^"(即Shift+6)或0(数字0)。 2、 如果要快速移动光标至当前行的行尾,可以使用编辑键End。也可以在命令模式中使用快捷键"$"(Shift+4)。与快捷键"^"和0不同,快捷键"$"前可以加上数字表示移动的行数。例如使用"1$"表示当前行的行尾,"2$"表示当前行的下一行的行尾。 参考: Vim快捷键分类 vim跳转到文件头与文件末尾的命令 30 个 VIM 常用命令和使用技巧整理 VIM用什么命令跳到文件头和文件尾 Vim快速移动光标至行首和行尾 、第一行和最后一行 史上最全的Vim命令 vim 跳到最后一行和跳到最后一行的最后一个字符 Vim中如何快速进行光标移动? 来源:

Linux中的编辑器 - vim

左心房为你撑大大i 提交于 2020-01-11 00:55:32
编辑器 - vim 启动vim。可以通过 vi 或 vim 命令来启动vim,启动时可以指定文件名来打开一个文件,如果没有指定文件名,也可以在保存的时候指定文件名。 (base) liuzuoping@liuzuoping~Lenove-G480:~$vim guess.py 命令模式、编辑模式和末行模式:启动vim进入的是命令模式(也称为Normal模式),在命令模式下输入英文字母 i 会进入编辑模式(Insert模式),屏幕下方出现 -- INSERT -- 提示;在编辑模式下按下 Esc 会回到命令模式,此时如果输入英文 : 会进入末行模式,在末行模式下输入 q! 可以在不保存当前工作的情况下强行退出vim;在命令模式下输入 v 会进入可视模式(Visual模式),可以用光标选择一个区域再完成对应的操作。 保存和退出vim:在命令模式下输入 : 进入末行模式,输入 wq 可以实现保存退出;如果想放弃编辑的内容输入 q! 强行退出,这一点刚才已经提到过了;在命令模式下也可以直接输入 ZZ 实现保存退出。如果只想保存文件不退出,那么可以在末行模式下输入 w ;可以在 w 后面输入空格再指定要保存的文件名。 光标操作。 在命令模式下可以通过 h 、 j 、 k 、 l 来控制光标向左、下、上、右的方向移动,可以在字母前输入数字来表示移动的距离,例如: 10h 表示向左移动10个字符

Conditional regex in vim?

别来无恙 提交于 2020-01-10 19:57:20
问题 Is it possible to do conditional regex (like the one described in http://www.regular-expressions.info/conditional.html) in Vim? 回答1: Vim regex does not have this feature, so you will need to use a bit of repetition to create the same behaviour: /\(\%(condition\)\@=then\|\%(condition\)\@!else\) Note that you have to use the condition twice in the Vim version and the lookahead/lookbehind must always be the opposite in the then/else parts otherwise your regex will not be correct. 回答2: Not

Vim textwidth comma indent problem

时光总嘲笑我的痴心妄想 提交于 2020-01-10 19:30:10
问题 If i set the following option in Vim, set textwidth=80 the text will break at 80 characters. This works, but the problem is if a comma (,) is on the end of a line, Vim indents the next line. What can I do to avoid this behaviour? 回答1: You probably have C style indenting on. :set nocindent should do the trick 回答2: Edit your .vimrc and comment set fo=... out. 来源: https://stackoverflow.com/questions/1516054/vim-textwidth-comma-indent-problem

ELK部署

霸气de小男生 提交于 2020-01-10 19:13:18
ELK部署 ELK适用场景 公司网站的访问量有多大,访问高峰期的时间段是多少,最经常访问的热点数据是什么?这一切的一切,虽然我们可以自己通过shell等手段截取出来, 但是如果网站多了,服务器多了,还是非常不方便,而且阅读性也不好,因此ELK应运而生,不仅可以获取访问高峰期,还可以制作图表,让你的领导一目了然, ELK已然成为各大互联往公司必部署的项目,因此接下来我们就来部署一套ELK系统 实验环境 192.168.254.13 ES,Kibana 192.168.254.11 logstash ELK版本:7.5.1 操作系统:CentOS Linux release 7.6.1810 (Core) note: 请确保你的firewalld和selinux关闭 最好确保你的机器是2个cpu以上 最好确保你的机器是2G以上内存 原理 logstash负责收集客户端的日志信息发送给ES服务器,然后通过Kibana以web形式展现出来 note:ES和logstash服务器需要java8以上 部署kibana 1.解压ES和kibana包,并移动到/usr/local下 tar -zxvf kibana-7.5.1-linux-x86_64.tar.gz tar -zxvf elasticsearch-7.5.1-linux-x86_64.tar.gz mv elasticsearch

How do I search for the selected text?

有些话、适合烂在心里 提交于 2020-01-10 17:45:53
问题 How do I search for the selected (with v and y ) string? I usually search with / , but I cannot paste the selected string after / . 回答1: In insert mode you can use CTRL-R to insert the contents of Vim registers. By default, copied text gets put in the unnamed register " , so to insert that text you would type <C-R>" in insert mode. The search prompt uses Command-line mode which has its own CTRL-R that works almost identically to the one in Insert mode. So if I just yanked the text foo ,