vi

Limiting search scope for code in Vim

时光总嘲笑我的痴心妄想 提交于 2019-11-28 20:48:42
How can I limit the search scope in Vim to the function/class/code block that the cursor is currently in, without having to figure out what the line numbers are? Being able to search in the visual selection would also do, as there are methods for selecting the current code block. (Similar to this question, but more generic) I'm going to just copy and paste the entire content of "Searching with / and ?" (within a visual selection) from the Vim Tips Wiki . In visual mode, / and ? will update the visual selection just like any other cursor-movement command (that is, when in visual mode, searching

Does any IDE have a vi keybindings options? [closed]

对着背影说爱祢 提交于 2019-11-28 20:03:13
问题 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 6 years ago . One of the reasons I usually don't use an IDE for development is that I'm so used to vi keybindings that I usually end up messing up

Tips for using vim over a slow connection?

被刻印的时光 ゝ 提交于 2019-11-28 19:25:54
I'm using vim over a slow connection and it is a little painful. Is there anything I can do in vim to alleviate the pain? vi was created to use over 300 baud modem, that is why there is all those funny and strange (and short) command to move and navigate. Learn them... Play with things like :10 -> jump to line 10 7j -> move 7lines down And since my keyboard has a little physical dot at the keys f and j, I use the dot on key j to easy find the vim navigation "hjkl". But the best thing is to never ever scroll at all, search to move is a life saver. When you search your pointer ends up right at

LinuxVIM编辑器用法

妖精的绣舞 提交于 2019-11-28 19:16:59
vi编辑器是Linux系统下标准的编辑器.而且不逊色于其他任何最新的编辑器. 基本上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 line mode)也算入命令行模式command mode)。 光标的移动除了键盘上的上下左右键.也可以是小写模式下,按键盘上的"h,j,k,l", "ctrl+b":屏幕往后移动一页 "ctrl+f":屏幕往前移动一页 "ctrl+u":屏幕往后移动半页 "ctrl+d":屏幕往前移动半页 输入任何一个整数,然后输入"shift+G" 就可以到这一页的开头了. 按键盘上的大写"G"移动到文章的最后. 按"$"符号将光标移动到行尾 "^"将光标移到行头 "w":将光标移到下一行头

vim与程序员

拟墨画扇 提交于 2019-11-28 18:05:31
所有的 Unix Like 系统都会内建 vi 文书编辑器,其他的文书编辑器则不一定会存在。 但是目前我们使用比较多的是 vim 编辑器。 vim 具有程序编辑的能力,可以主动的以字体颜色辨别语法的正确性,方便程序设计。 什么是 vim? Vim是从 vi 发展出来的一个文本编辑器。代码补完、编译及错误跳转等方便编程的功能特别丰富,在程序员中被广泛使用。 简单的来说, vi 是老式的字处理器,不过功能已经很齐全了,但是还是有可以进步的地方。 vim 则可以说是程序开发者的一项很好用的工具。 vi/vim 的使用 基本上 vi/vim 共分为三种模式,分别是 命令模式(Command mode) , 输入模式(Insert mode) 和 底线命令模式(Last line mode) 。 这三种模式的作用分别是: 命令模式: 用户刚刚启动 vi/vim,便进入了命令模式。 此状态下敲击键盘动作会被Vim识别为命令,而非输入字符。比如我们此时按下i,并不会输入一个字符,i被当作了一个命令 移动光标 w(e)  移动光标到下一个单词b    移动到光标上一个单词数字0  移动到本行开头$    移动光标到本行结尾H    移动光标到屏幕首行M    移动到光标到屏幕的中间一行L    移动光标到屏幕的尾行gg    移动光标到文档的首行G    移动光标到文档尾行ctrl + f 

Vim “show my last command” command?

瘦欲@ 提交于 2019-11-28 16:57:52
Is there a command which shows what was the last command in normal mode? Suppose I accidently hit random key and got some unexpected result. Sure I can undo it, but could I reveal what key was pressed and how it was interpreted? user3620332 Hit the colon ( : ) and then use the up arrow to start going back through previous commands. You can use the up/down arrows too to move around the list. q: will show you command history in Vim. q/ will show you history of searches The text from the last command is stored in the . register. You can see all registers by :display . Unfortunately it doesn't say

Using normal-mode motions in command-line mode in Vim

拈花ヽ惹草 提交于 2019-11-28 16:29:14
Is modal editing possible in command-line mode? Some examples: After writing !ls ~/foo/bar I want to db to delete bar I executed the above command and now I want to change ls to mv and jump back to $ By default you can press Control + f (or otherwise see set cedit ) when on the Vim command-line, which opens the command-line window where you can edit the command using normal-mode Vim editing keys. Enter will run the command or Control + c will return you to the standard command-line. So in your specific example, you could press Control + f on the Vim command-line then db and it would do what

vim in tmux background color changes when paging

倾然丶 夕夏残阳落幕 提交于 2019-11-28 16:27:35
问题 I am using vim in 256 color mode on Solaris (connected via Putty on Windows). Everything looks great and works fine outside of tmux, but within tmux the background color changes periodically when paging/scrolling through a file. Here is how it's supposed to look: Here is how it appears after paging around a bit: Thanks! 回答1: As explained here, disable Background Color Erase (BCE) by clearing the t_ut terminal option (run :set t_ut= in Vim and then press Control + L to refresh the terminal's

【正确使用vim编辑器的姿势】

心已入冬 提交于 2019-11-28 16:25:40
原文: http://blog.gqylpy.com/gqy/312 vi:可视化接口 (Visual Interface) vim:是vi的增强版 (vi iMprove) vi 编辑器是所有Unix及Linux系统下标准的编辑器,他就相当于windows系统中的记事本一样,它的强大不逊色于任何最新的文本编辑器。它是我们使用Linux系统不能缺少的工具。Unix及linux系统的任何版本下的vi编辑器是完全相同的,学会它后,您将在Linux的世界里畅行无阻。 vim 可以说的vi的升级版本,它可以用多种颜色的方式来显示一些特殊的信息。 vim 具有程序编辑能力,可以以字体颜色辨别语法的正确性,方便程序设计。 vim 会依据文件扩展名或者是文件内的开头消息,来判断该文件的内容而自动的执行该程序的语法判断式,再以颜色来区分显示代码与注册信息。 vim 加入了很多额外的功能,例如支持正则表达式的搜索、多文件编辑、快复制等等。这帮助我们在进行一些配置文件的修改工作时提高了不少的效率。 vim 有三种工作模式,如下图: vim编辑器的配置文件:全局 /etc/vimrc 用户 ~/.vimrc 修改配置文件可使某项配置默认生效,比如在配置文件内加入一行: set nu ,那么打开文件后将默认显示行号。 打开文件 vim + file 打开文件并定位到最后一行 . vim +n file