vi

Python Interpreter Shell with Vi(m) integration possible?

好久不见. 提交于 2019-12-31 22:27:48
问题 I love to use bpython but in Ruby there is a gem called interactive_editor that makes it possible to combine Vi(m) with the Ruby shell which makes the Development process much more comfortable. A good introduction to interactive_editor: http://vimcasts.org/episodes/running-vim-within-irb/ Are there any tools (like interactive_editor for Ruby) available to combine the Python shell with Vi(m)? 回答1: You could have a look at the vim-ipython vim plugin: https://github.com/ivanov/vim-ipython This

Linux shell (bash) on vi's splitview

别说谁变了你拦得住时间么 提交于 2019-12-30 01:59:19
问题 I've been searching with no results for an integration of bash inside vi, as featured in emacs; the problem is: I have vi open with 2 views, one open with :split command, and I want to use bash through the second view, while I'm editing a file in the first; if I do :sh while editing the second view, the whole session pauses and a bash shell is opened, but I'm not able to edit the file and use the shell at the same time.. I don't want to use !<command> or external programs such as "terminator"

Renaming the current file in Vim

廉价感情. 提交于 2019-12-29 10:08:41
问题 How should I rename my current file in Vim? For example: I am editing person.html_erb_spec.rb I would like it renamed to person.haml_spec.rb I would like to continue editing person.haml_spec.rb How would I go about doing this, elegantly? 回答1: There's a little plugin that let's you do this. 回答2: The command is called :saveas , but unfortunately it will not delete your old file, you'll have to do that manually. see :help saveas for more info. EDIT: Most vim installations have an integrated file

How to include forward slash in vi search & replace

牧云@^-^@ 提交于 2019-12-28 02:39:48
问题 I have a file that contains the string usrbin . I want to search for usrbin and replace it with /usr/bin/ . I tried :%s/usrbin/usr/bin/g , but it's showing error E488: Trailing characters . How do I include a forward slash in a search and replace? 回答1: Here are two ways: escape the / which is the default substitute separator: :s/usrbin/\/usr\/bin use another substitute separator, e.g., using the hash # character: :s#usrbin#/usr/bin . Note that there are characters that you can't use as a

Move entire line up and down in Vim

左心房为你撑大大i 提交于 2019-12-28 01:40:10
问题 In Notepad++, I can use Ctrl + Shift + Up / Down to move the current line up and down. Is there a similar command to this in Vim? I have looked through endless guides, but have found nothing. If there isn't, how could I bind the action to that key combination? Edit: Mykola's answer works for all lines, apart from those at the beginning and end of the buffer. Moving the first line up or the bottom line down deletes the line, and when moving the bottom line up it jumps two spaces initially,

Tab key == 4 spaces and auto-indent after curly braces in Vim

佐手、 提交于 2019-12-27 16:09:06
问题 How do I make vi-Vim never use tabs (converting spaces to tabs, bad!), makes the tab key == 4 spaces, and automatically indent code after curly brace blocks like Emacs does? Also, how do I save these settings so I never have to input them again? I've seen other questions related to this, but it always seems to be a little off from what I want. 回答1: As has been pointed out in a couple of answers below, the preferred method now is NOT to use smartindent, but instead use the following (in your

Tab key == 4 spaces and auto-indent after curly braces in Vim

随声附和 提交于 2019-12-27 16:08:07
问题 How do I make vi-Vim never use tabs (converting spaces to tabs, bad!), makes the tab key == 4 spaces, and automatically indent code after curly brace blocks like Emacs does? Also, how do I save these settings so I never have to input them again? I've seen other questions related to this, but it always seems to be a little off from what I want. 回答1: As has been pointed out in a couple of answers below, the preferred method now is NOT to use smartindent, but instead use the following (in your

How do I use vim registers?

雨燕双飞 提交于 2019-12-27 16:06:03
问题 I only know of one instance using registers is via Ctrl R * whereby I paste text from a clipboard. What are other uses of registers? How to use them? Everything you know about VI registers (let's focus on vi 7.2) -- share with us. 回答1: Registers in Vim let you run actions or commands on text stored within them. To access a register, you type "a before a command, where a is the name of a register. If you want to copy the current line into register k , you can type "kyy Or you can append to a

VIM命令详解

老子叫甜甜 提交于 2019-12-27 10:16:22
vi编辑器 vi是UNIX和类UNIX环境下的可用于创建文件的屏幕编辑器。vi有两种工作模式:命令模式和文本输入模式。启动vi需要输入vi,按[Spacebar]键并输入文件名后回车。 切换模式键 vi从命令模式切换到文本输入模式。每个键以不同方式使vi进入文本输入模式。按 [ESC] 键使vi从文本输入模式回到命令模式。 下面列出了vi从命令模式切换到文本输入模式的命令键及其功能。 键 功能 i 在光标左侧输入正文 I 在光标所在行的行首输入正文 a 在光标右侧输入正文 A 在光标所在行的行尾输入正文 o 在光标所在行的下一行增添新行,光标位于新行的行首 O 在光标所在行的上一行增添新行,光标位于新行的行首 说明: 1. 光标的位置由双下划线(═)标明。 2. 当前行指光标所在的那一行。 退出命令 只有一种方式进入vi,但是有几种方式退出vi,退出方式的选择取决于如何处理编辑后的文件。 除了ZZ命令外,这些命令都以:开始,用[Return]结束命令行。下面列出了vi编辑器的退出命令及其功能。 键 功能 :wq 保存文件,退出vi编辑器 :w 保存文件,但不退出vi编辑器 :q 退出vi编辑器 :q! 不保存文件,退出vi编辑器 ZZ 保存文件,退出vi编辑器 文本修改键 这些键只适用于命令模式。下面列出了vi编辑器的退出命令及其功能。 键 功能 x 删除光标位置指定的字符 dd

vi编辑练习

倖福魔咒の 提交于 2019-12-27 06:23:33
1. 请在/tmp 这个目录下建立一个名为vitest 的目录; 2. 进入vitest 这个目录当中; 3. 将/etc/man.config 复制到本目录底下(或由上述的连结下载man.config 档案); 4. 使用vi 开启本目录下的man.config 这个档案; 5. 在vi 中设定一下行号; 6. 移动到第58 行,向右移动40 个字符,请问你看到的双引号内是什么目录? 7. 移动到第一行,并且向下搜寻一下『bzip2 』这个字符串,请问他在第几行? 8. 接着下来,我要将50 到100 行之间的『小写man 字符串』改为『大写MAN 字符串』,并且一 个一个挑选是否需要修改,如何下达指令?如果在挑选过程中一直按『y』, 结果会在最后一行 出现改变了几个man 呢? 9. 修改完之后,突然反悔了,要全部复原,有哪些方法? 10. 我要复制65 到73 这九行的内容(含有MANPATH_MAP),并且贴到最后一行之后; 11. 21 到42 行之间的开头为# 符号的批注数据我不要了,要如何删除? 12. 将这个档案另存成一个man.test.config 的檔名; 13. 去到第27 行,并且删除15 个字符,结果出现的第一个单字是什么? 14. 在第一行新增一行,该行内容输入『I am a student...』; 15. 储存后离开吧! 整个步骤可以如下显示: