vim

【linux基础】vi、vim编辑器

孤者浪人 提交于 2020-01-24 03:31:14
Vi、Vim编辑器常使用的命令 下图所示菜鸟教程里总结键盘图,很nice,推荐! 1、打开或新建一个文件 vi test.py 2、使打开的test.py显示行号/取消行号 :set nu :set nonu 3、光标迅速移动到第6行,第5个字符 6↓ 5→ 4、光标迅速回到文件首行;快速移到文件末尾 H G 5、光标迅速移动到行首、行尾 ^ $ 6、快速复制光标所在行开始数3行代码,并复制到文件末尾(下面三个命令依次使用) 3yy G P 7、快速删除光标所在行 dd 8、进入编辑模式 i 9、回退操作 u 10、查找字符串hello /hello 10、剪贴3行并粘贴 3dd 移动到要粘贴的位置后 p 来源: CSDN 作者: 3L_csdn 链接: https://blog.csdn.net/qq_35061334/article/details/103745368

How can I repeatedly match from A until B in VIM?

我们两清 提交于 2020-01-24 01:39:16
问题 I need to get all text between <Annotation> and </Annotation> , where a word MATCH occurs. How can I do it in VIM? <Annotation about="MATCH UNTIL </Annotation> " timestamp="0x000463e92263dd4a" href=" 5raS5maS90ZWh0YXZha29rb2VsbWEvbGFza2FyaS8QyrqPk5L9mAI"> <Label name="las" /> <Label name="_cse_6sbbohxmd_c" /> <AdditionalData attribute="original_url" value="MATCH UNTIL </Annotation> " /> </Annotation> <Annotation about="NO MATCH" href="

Mac终端 vi/vim 的简单使用

↘锁芯ラ 提交于 2020-01-24 00:20:07
vi/vim 的使用 基本上 vi/vim 共分为三种模式,分别是 命令模式(Command mode) , 插入模式(Insert mode) 和 底线命令模式(Last line mode) 命令模式: 用户刚刚启动 vi/vim,便进入了命令模式。 i   切换到插入模式,以输入字符。 x 删除当前光标所在处的字符。 : 切换到底线命令模式,以在最底一行输入命令。 若想要编辑文本: 启动Vim,进入了命令模式,按下i,切换到输入模式 输入模式: 在命令模式下按下 i 就进入了输入模式。 在输入模式中,可以使用以下按键: ENTER (回车键)      换行 BACK SPACE (退格键)    删除光标前一个字符 方向键         在文本中移动光标 HOME/END    移动光标到行首/行尾 Page Up/Page Down 上/下翻页 ESC      退出输入模式,切换到命令模式 底线命令模式: 在命令模式下按下 : (英文冒号)就进入了底线命令模式。 底线命令模式可以输入单个或多个字符的命令,可用的命令非常多。 在底线命令模式中,基本的命令有(已经省略了冒号): q   退出程序 w   保存文件 按ESC键可随时退出底线命令模式 。 vi/vim 使用实例 使用 vi 来建立名为 test.txt 的文件 vi test.txt 按下 ESC

I want to customize the text vim shows in collapsed folds

狂风中的少年 提交于 2020-01-23 11:47:28
问题 I use folds for comments like # Stuff between the # are comments and automatically folded # But when folded they look like this +-- 4 lines: #-------------------------------------------------------------- I would rather have them say +-- 4 Stuff between the # are comments and automatically folded and not be highlighted, or whatever makes them white background on my black terminal. I think its the foldtext variable, and the regex-ing is beyond me. 回答1: In addition to method ZyX shows you can

Vim: Mac vs. Linux ^M Problem

回眸只為那壹抹淺笑 提交于 2020-01-23 09:55:44
问题 I use Vim and GIT to develop my project on a Linux/Ubuntu machine. In the past, I used to use Windows, which means line ends were DOS format. Now after moving to Linux, I always see ^M confusing/annoying characters at the end of the line. Some people here: How to convert the ^M linebreak to 'normal' linebreak in a file opened in vim? suggested that I should make a find/replace or use tools like dos2unix. These are good suggestions, but with a version-controlled project it means I have to add

Debian下安装vim

半世苍凉 提交于 2020-01-23 07:27:48
问题描述:安装完系统以后,刚要打算开始写程序,发现,vim还没有装,用su -切换到root后 直接运行apt-get install vim,提示插入disc源,然后回车,陷入无法解决的状态。 上网通过搜索,找到一下解决方法: 以下内容均在root的家目录下完成, cd ~ 先要更新系统的软件源: sudo cp /etc/apt/sources.list /etc/apt/sources.list_bak #备份一下软件源 sudo vi /etc/apt/sources.list 加入如下内容即可 # 网易163更新服务器: deb http://mirrors.163.com/debian/ squeeze main non-free contrib deb http://mirrors.163.com/debian/ squeeze-proposed-updates main non-free contrib deb-src http://mirrors.163.com/debian/ squeeze main non-free contrib deb-src http://mirrors.163.com/debian/ squeeze-proposed-updates main non-free contrib # sohu 更新服务器: deb http:/

Is Vim really that good? [closed]

我与影子孤独终老i 提交于 2020-01-23 07:27:08
问题 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 had to see what all the fuss was about Vim so tried it out for a little while; built a whole site in it. In the end I decided I was

文本编辑工具vim

旧巷老猫 提交于 2020-01-23 00:56:51
?vim编辑器是visual interface 的简称,通常称之为vim。它可以执行输出、删除、查找、替换和块操作等众多文本操作,而且用户可以根据自己的需要对其进行定制,这是其他编辑程序所没有的。 vim编辑器并不是一个排版程序,它不像word或wps那样可以对字体、格式、段落等其他属性进行编排,它只是一个文本编辑程序。 命令模式是vim打开文件后默认进入的模式,这个模式中不能插入字符,但是可以设定vim的工作方式 :set nu ##设置行号 :set nonu? ##取消设置行号 :set cursorline ##添加所在行的标识 :set mouse=a ##添加鼠标选择 注:在vim中直接设定vim的工作方式是临时设定,也就是说当vim关闭,设定失效。 如果要永久设定需要编写"/etc/vimrc".这个文件也是vim的配置文件。 建议:当文件内容更改信息不确定正确与否的时,应该先备份要所更改的文件!!! 按"x" ?删除光标所在字符 按"u" ?undo 恢复 按"ctrl+r" ?redo 撤销恢复 按"y" ?复制 ?"yw" ? ?##复制一个单词 ?"yl" ? ?##复制一个字母 ?"yy" ? ?##复制一整行 ?"y5y" ? ?##复制5行 按"c" ?剪切 ?"cw" ? ?##剪掉一个单词 ?"cl" ? ?##剪掉一个字母 ?"cc" ? ?#

Vim 的 paste 模式

拟墨画扇 提交于 2020-01-22 22:43:37
文章目录 1、问题:Vim缩进混乱 2、基本解法 3、偷懒解法 1、问题:Vim缩进混乱 最近用 Vim 写代码的时候,发现复制整段代码再粘贴的时候,缩进就全乱了,比如: 2、基本解法 这是因为 Vim 自动缩进了,按照如下设置可以解决该问题: 在 Vim 视图,输入如下命令,可以使 vim 进入 paste 模式,这时候再整段复制黏贴,就OK了: :set paste 进入paste模式执行 set paste,它做了以下这些事情: textwidth设置为0 wrapmargin设置为0 set noai set nosi softtabstop设置为0 revins重置 ruler重置 showmatch重置 formatoptions使用空值 lisp 选项值不变,但被禁用 indentexpr 选项值不变,但被禁用 cindent 选项值不变,但被禁用 在 Vim 视图,可以输入如下命令,退出 paste 模式: :set nopaste 3、偷懒解法 另外,有一个切换 paste 开关的选项叫 pastetoggle, 可以通过用它来绑定一个快捷键,即可实现单键控制 激活/退出 paste模式: :set pastetoggle=<F5> 参考文档: Toggle auto-indenting for code paste 来源: CSDN 作者: 一得的跋涉 链接:

Is VIM omni-completion really so limited? Or am I missing something?

走远了吗. 提交于 2020-01-22 19:49:05
问题 Ruby: file = File.new("some.txt", "r") lines = file.readlines Omni-completion tests file.readl --------- readline <- PASSED readlines --------- "hola".capital --------- capitalize <- PASSED capitalize! --------- lines. <-- FAILED (no suggestions) lines[0].capital <-- FAILED (no suggestions) I tried Python as well, and it worked in similar way. So it looks like omni-completion can't be used for real development, as it fails on pretty simple cases? Am I missing some thing? May be the