vi

Standard python interpreter has a vi command mode?

前提是你 提交于 2019-12-18 10:22:49
问题 this is going to sound pretty ignorant, but: I was working a bit in the python interpreter (python 2.4 on RHEL 5.3), and suddenly found myself in what seems to be a 'vi command mode'. That is, I can edit previous commands with typical vi key bindings, going left with h, deleting with x... I love it - the only thing is, I don't know how I got here (perhaps it's through one of the modules I've imported: pylab/matplotlib?). Can anyone shed some light on how to enable this mode in the interpreter

Why the dot (.) command is so useful in VIM?

流过昼夜 提交于 2019-12-18 10:15:12
问题 I use VIM pretty regularly now but I never use the dot (.) command to repeat the previous action. I keep reading about how awesome it is but I never see any real world examples that make sense to me and the way I code in VIM. What are some real world examples that show how awesome the dot (.) command is? 回答1: Here are some actions that I do with the dot command: Simpler than :%s/\<word\>/replacement/gc is * on the word, then cereplacement<esc> and then repeat n. . This is nice if you have two

Navigating in Vim's Command Mode

一曲冷凌霜 提交于 2019-12-18 10:08:26
问题 I am a long time emacs user learning Vim. Emacs lets me navigate in the mini-buffer (where I issue commands like C-x C-s) using the same navigation keyboard shortcuts as in any other buffer. For example, I can navigate forward one character using C-f, even while in the mini-buffer. I could also use the arrow keys, but they are too far away. Is there any keyboard shortcut to navigate in Vim's command mode (:), without using the arrow keys -- equivalent to emacs C-f, C-b? Thanks. 回答1: Adding to

Confusion about vim folding - how to disable?

ε祈祈猫儿з 提交于 2019-12-18 10:00:43
问题 When I open the file it looks like this: or even this When I open all folds, they are closed again when I navigated to another buffer and came back. To be able to work with it, I have to apply zR each time when opening a buffer. I have these set up in .vimrc : set foldlevelstart=99 set foldlevel=99 Please point me on how to disable the folding, or at least making the navigation to another buffer not to close the opened ones. 回答1: You're not alone. set nofoldenable " disable folding 回答2: The

How to replace text between quotes in vi

左心房为你撑大大i 提交于 2019-12-17 22:04:41
问题 Say I have this line of code: $query = "SELECT * FROM table"; Is there a command in vi/vim which can instantly delete everything between quotes and position the cursor between them so I can start typing? 回答1: Use ci" , which means: change what inside the double quotes. You can also manipulate other text objects in a similar way, e.g.: ci' - change inside the single quotes ciw - change inside a word ci( - change inside parentheses dit - delete inside an HTML tag, etc. More about different vim

Change File Encoding to utf-8 via vim in a script

前提是你 提交于 2019-12-17 21:40:59
问题 i just got knocked down after our server has been updated from Debian 4 to 5. We switched to UTF-8 environment and now we have problems getting the text printed correctly on the browser, because all files are in non-utf8 encodings like iso-8859-1, ascii, etc. I tried many different scripts. The first one i tried is "iconv". That one doesnt work, it changes the content, but the files enconding is still non-utf8. Same problem with enca, encamv, convmv and some other tools i installed via apt

vim line numbers - how to have them on by default?

纵饮孤独 提交于 2019-12-17 21:24:43
问题 I can :set number from within a file I'm editing but how can I have them always be on by default? 回答1: Add set number to your .vimrc file in your home directory. If the .vimrc file is not in your home directory create one with vim .vimrc and add the commands you want at open. Here's a site that explains the vimrc and how to use it. 回答2: To change the default setting to display line numbers in vi/vim: vi ~/.vimrc then add the following line to the file: set number Either we can source ~/.vimrc

How to write buffer content to stdout?

故事扮演 提交于 2019-12-17 18:39:20
问题 Is there any chance to write the content of the current vim buffer to stdout? I'd like to use vim to edit content that was passed via stdin - without the need of a temporary file to retrieve the modified content (on Linux/Unix). Is it possible that a plugin/script - that act on quit or save put the buffer content to stdout? 回答1: I think :w !tee would work perfectly, 回答2: Since you use Linux/Unix, you might also be interested in trying out moreutils. It provides a command called vipe , which

What is the most useable VI/Vim plugin for Eclipse? [closed]

别来无恙 提交于 2019-12-17 17:39:07
问题 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 . I used to be a huge fan of Intelli-J and there is a fantastic VI plugin for Idea. Now I'm shifting to the Spring Source Tool Suite for

How do I move to end of line in Vim?

杀马特。学长 韩版系。学妹 提交于 2019-12-17 15:04:14
问题 I know how to generally move around in command mode, specifically, jumping to lines, etc. But what is the command to jump to the end of the line that I am currently on? 回答1: Just the $ (dollar sign) key. You can use A to move to the end of the line and switch to editing mode (Append). To jump the last non-blank character, you can press g then _ keys. The opposite of A is I (Insert mode at beginning of line), as an aside. Pressing just the ^ will place your cursor at the beginning of the line.