vi

Easiest way to swap occurrences of two strings in Vim?

What is the easiest way to replace all occurrences of string_a with string_b while at the same time changing anything that was already string_b into string_a? My current method is as follows: :s/string_a/string_c/g :s/string_b/string_a/g :s/string_c/string_b/g Although this works, it requires extra typing and seems inefficient. ...

Cannot move cursor in Insert mode

Just noted I can't move cursor to left or right (up and down works correctly) in Insert mode while editing an .sql file, with other files it works ok also. Any hint?. Vim: 7.2.330 - Ubuntu 10.04 x86_64 ...

zsh vi mode status line

Is there a way in zsh or bash to have a status line? e.g. in VI it will let you know that you are in insert mode with -- INSERT -- Is there an eqivalent for the command line? ...

Move to the end of line character in Vi, past the last character in the line

How come in Vi, when I hit $, it goes to the last character in the line instead of the end of the line character? How would I go to the end of the line character in one keystroke, and what is the fastest way to delete the end of the line character? ...

Calling vim or TextMate from emacs.

I've been using vi quite a while, and with a Mac, I sometimes use TextMate, and finally, I found the greatness of emacs. And, it's very likely that I settle in emacs. The problem is, I sometimes need the other (vi/TextMate) editor for doing something. It's not that emacs doesn't have the feature, it's just that I need the feature right ...

Repeating a navigation command in vi

How do I repeat a navigation command in vi? For example, I execute the command 20j which moves the cursor down 20 lines, and I tried hitting . to repeat that command, but it says "No command to repeat". P.S. Also, what command goes to the next page in a document? ...

How do I indent a single line multiple times in vi or vim?

I've found several answers on how to indent multiple lines in vim, I want to know how to take a single line and indent it more than once. In effect, I want a shorter version of the following command: ">>>>>>>>>>" (That is 10 right bracket "greater-than" signs.) ...

Is there a way to make vi and vim behave differently on OSX?

Is there a way to have two separate config files or somehow disassociate vi and vim on Mac OSX? Simply, I want vi and vim to open up in 2 different window sizes. Thanks! ...

Why don't more people use emacs with viper-mode?

I've started to use emacs, and I've found out that while the editor-specific features of emacs are better than those of vi, the text-manipulation methods of vi are better than those of emacs (and easier on your control-pinky!). It seems that viper-mode, a marriage of the two best parts of each editor, is the ideal solution for someone t...

What modern editors compete with emacs/vi?

Emacs and vi are the traditional editors of the programming gurus. But, have any modern editors been able to displace these two in terms of extensibility and text editing productivity? I know editors such as Eclipse and commercial editors provide language specific advantages such as intellisense and refactoring, though this is not quit...

What can you execute on visually selected text in vim?

Hello, What are the possible operations (with keyboard shortcuts) that you could execute on a visually selected text? For the simplicity consider this simple piece: a b cd 1 p a b cd 2 y a b cd 3 t a b cd 4 h a b cd 5 o a b cd 6 n One specific question: is it possible to execute Python/shell ...

How to start VIM with NERD tree opened automatically?

Possible Duplicate: Auto-open NERDTree in EVERY tab Is there a way to automatically execute the :NERDTree command when VIM is launched for the first time or configure NERDTree to always open on startup? PLEASE CLOSE. Just noticed that this question was answered before: http://stackoverflow.com/questions/1979520/auto-open-nerd...

Do developers actually use vim to write code (Java) on a Windows OS?

...or is vi/vim only used when developing on a non-Windows OS? If not, what feature(s) does vim provide that modern IDEs such as Eclipse do not? Why would one elect to use vim over Eclipse (or IntelliJ, Websphere, or other feature-rich IDEs) when developing on a Windows workstation? Note that I'm referring to Java development and to som...

xargs with command that open editor leaves shell in weird state

Hey guys, I tried to make an alias for committing several different git projects. I tried something like cat projectPaths | \ xargs -I project git --git-dir=project/.git --work-tree=project commit -a where projectPaths is a file containing the paths to all the projects I want to commit. This seems to work for the most part, firing...

sort rows in 'VI' editor

If i have to sort following rows on the basis of values on left of '='. But the sorting should expand the selection to column after '=' simultaneously. Thtz is we dnt have to sort column after '=' :: 50599=1000000 50454=00000054 50080=00005464 50098=00000875 50661=00000665 50788=10000035 50988=10000006 50994=10000656 570...

vim: autoindent not working

my autoindent is not working, any diagnostic tests to figure it out? my ":set" is: :set --- Options --- cindent laststatus=2 scroll=17 tabstop=4 window=36 filetype=cpp number smartindent ttyfast helplang=en paste syntax=cpp ttymouse=xterm2 backspace=indent,...

In vi/vim is there any way to make Visual Block Mode unconstrained by line endings?

In vi/vim is there any way to make Visual Block Mode unconstrained by line endings? ...

How can I delete the current line in Emacs? (Equivalent of vi's `dd`)

What is the emacs equivalent of vi's dd? I want to delete the current line. Tried CTRL + k but it only deletes from current position. ...

How to use VIM's toupper whithin a replacement string?

Hello, Is it possible to use toupper in replacement string? Suppose, there are member Declarations like this: int myVar; I want to make the first letter of variable name to a capital-letter: int MyVar; Unfortunately this doesn't work: :1,$s/\(\w\+\)\s\+\(\w\)\(\w*\)\s*;/\1 \=toupper(submatch(\2))\3;/ Finally, I could use \u for ...

How to copy to clipboard using vim?

Is it possible to copy to clipboard directly from vim? e.g I want to be able to use all the functionality that a normal vim command allows, like lets say if cc means copy line to clipboard, then 4cc should copy 4 lines etc. Is there any such command in vim or you can only yank stuff within vim? ...