1
vote
1answer
2k views

Replace text when in visual-block mode

Maybe I'm searching the wrong way, but I've failed to find out how to do this. Here's the scenario: I have a list in a text file where I want to insert the same word on multiple lines, here's an ...
0
votes
1answer
94 views

How can I switch vim mode quickly?

This question is not the same as In vim, how can I quickly switch between tabs?, but what I want is a bit similar to it, since we are all trying to find shortcuts when editing with vim:) Now I am in ...
2
votes
1answer
421 views

looking for an alternative to refile in orgmode for emacs

In emacs/orgmode there is something called refile. you select text, hit refile and you get a list of your outline headlines, select one and your text goes there. Can I achieve something like this in ...
4
votes
2answers
119 views

Getting vi/vim syntax highlighting used by certain user

At work most web-development we do, is done in vi/vim, on a debian-server. Sometimes we have to alter some files as root, and the syntax-highlighting-model of that user (root) is absolutely awesome. ...
1
vote
2answers
94 views

How can I use the vim editor to format the text like this?

I have a data.txt file, the data format is something like this: a|Êó• a|Êõ∞ a|Ôõ∏ a|Ôùã aa|Êòå aa|Êòç aaa|Êô∂ aamh|Êöò all I would like to do is convert the following text into this result: 'a' ...
0
votes
2answers
4k views

What is the ^I character and how do I find it with sed?

I usually import data from csv files to MySQL, but my data provider leaves NULL entries as "", so I need to replace "" with "\N". This is easy enough with a script like for csvfile in *.csv do ...
1
vote
1answer
693 views

Changing text in current visual selection in Vim

I have some part of a line visually selected. I would like to remove all non-word characters in the selection and replace all whitespace characters with underscores. How would I go on about this?
2
votes
1answer
155 views

Is it possible to define a custom movement in vim?

Is it even possible? What I mean is, many vim commands can take a movement to operate on, can I define a custom movement so that I can tailor my edits to an environment? The specific command I'm ...
25
votes
4answers
5k views

How reverse selected lines order in vim?

For example, if I have four lines as follows: the first line the second line the third line the fourth line I want to reverse them to the fourth line the third line the second ...
2
votes
3answers
457 views

How to rollback the edit version in VIM?

I realized I had deleted something for mistake when I typed :wq,then how can I rollback to the pre-version?Thank you!
1
vote
3answers
1k views

Vim: Bind <C-Enter>

Using vim for editing latex; how can I bind C-Enter? I tried the following, which does not work: imap <C-Enter> \\<CR> and imap <C-Return> \\<CR> However, something like: ...
4
votes
2answers
476 views

Text files on linux have “<97>” characters

When viewing a particular text file in vim or less on Linux or OS X, all the en dashes show up as highlighted "<97>" characters. What control-sequence do I need to type in order to substitute the ...
6
votes
5answers
2k views

How do I delete the next line in vim?

In emacs, whenever I want to delete a few lines of text, I just use C-k until all the text is gone. However, in vim it seems a bit more complex. I know I can do d$ to delete until the end of the ...
1
vote
2answers
89 views

In vim, is there a way to search for a word in a different window?

I'm working with a file where definitions, and references to those definitions are in different parts of the file. I'm looking at the file in a split window - one half looking at the definition, the ...
5
votes
5answers
2k views

Ubuntu vi Acting Strange

I just installed Ubuntu Server 8 and found vi to be acting strangely (compared to vi on Fedora, CentOS and OSX). When I use the 'a' command to enter text, pressing the arrow keys results in "C", "D", ...
0
votes
3answers
306 views

Remove lines efficiently in Vim

How can you remove given lines efficiently in Vim? I want to remove all lines which match this :g!/div/ I unsuccessfully ran: :g!/div/s/^*//g
4
votes
2answers
7k views

How to distinguish between \r\n and \n in VIM

In VIM I can show all the hidden characters in a file via the command ":set invlist". However, end of line sequences are always displayed as $ whether it is a carriage return/line feed or just a line ...
12
votes
13answers
1k views

What Vim features do you use? [closed]

I spend almost all day programming in Vim and I am sure that a lot of you do too. What features do you use that make your day to day coding that much better? One that I use is gv, which will let ...