vi is a screen-oriented text editor originally created for the Unix operating system.

learn more… | top users | synonyms

9
votes
4answers
816 views

How can I paste (overwriting) with vim?

In vim I use yy and p all the time to yank and paste lines. However, if I want to replace one line multiple places in the file, I can't use yy p dd p because the dd deletes the line to the clipboard ...
5
votes
2answers
1k views

Pasting from clipboard to vi-enabled zsh or bash shell

I'd like to be able to paste from the system clipboard (or text selection) into my "vi-like" shell prompt using the keyboard. I normally use zsh and sometimes bash. In both cases, I have the shell set ...
7
votes
4answers
487 views

Bash vi mode configuration to default to command mode

Is it possible to configure bash vi mode so that initially it is in command mode instead on insert mode? I find that I have to press Esc far too much. It seems that there is possibility to specify ...
3
votes
5answers
1k views

vi - how to join differents specific lines

I'm looking for a solution about a "paste" problem on vi/vim . How to join specific lines in a text file? I have a file like this: 15/10/2011 Revolution day 16/10/2011 About Rome - differents ...
2
votes
1answer
205 views

How to open a file in the last closed position in VI

I want to open a file which is closed in line xxx. So I can easily continue editing
7
votes
1answer
5k views

Switch VI to use backspace key instead of Control+H for backspace?

I'm on Solaris 10 and by default vi version SVR4.0, Solaris 2.5.0 is installed. The system was set up so that when I ssh to it Control+H does backspace, and backspace outputs ^? I added stty erase ...
3
votes
5answers
2k views

How can I check what version of the VI editor I have?

How can I check what version of the vi editor I have? What's the best way to upgrade it or install vim on Solaris?
7
votes
2answers
322 views

Vi mode in other console programs

I quite like the Vi mode of bash. Is there any way to make it work in other programs (gnuplot for instance)? EDIT: As Shawn suggested below, configuring .inputrc and using rlwrap -a -c gnuplot gives ...
21
votes
4answers
2k views

Change cursor shape (or color) to indicate vi mode in bash

To clarify: I am not asking how to change the cursor when using vim within a terminal. I want the cursor to change when switching between input and command mode within Bash's vi-mode: set -o vi ...
2
votes
1answer
352 views

vi - how to add specific characters at the end of line

I would like to know if is possible in vi to add at the end of a line some specific character of ther line itself. Example: Before donald /mount/donald_01 mickey /mount/mickey_01 mickeym ...
2
votes
2answers
902 views

Unable to type some special characters in vi on a debian

on a machine I have access to, when I type "€" in vi, "~B� " is displayed instead, and when I type "£", "£ " What can cause this strange behavior, how can I fix it? Typing it in the console gives even ...
7
votes
1answer
409 views

Note-taking and outlining using Vi: On startup, highlight tags and display tags in a preview window

I am using vi as a note-taking and outlining tool and therefore I thought that this stackexchange site would be appropriate to ask this question. I am constructing the "tags" file by myself. What I ...
2
votes
1answer
254 views

Vi: On startup, highlight tags and display tags in a preview window

I am using vi as a note-taking and outlining tool. I am constructing the "tags" file by myself. What I would like to do is that when I open my notes or outline file, vi reads the tags present in this ...
3
votes
1answer
350 views

Select between given characters in vim

Given three sample lines: some('lorem _ ipsum'); $some['lorem _ ipsum']; <span class="some _ class"> (cursor is in _ position) Which is the fastest way to select (for pasting in other ...
1
vote
1answer
325 views

How to set keycodes manually in vim?

Sometimes when I fire up vim, my Insert key doesn't work (need to use i) and my arrows don't work (they give me letters instead). I'm guessing this has to do with my keys not being mapped correctly. ...
2
votes
1answer
157 views

Why does Vim have different cursor positions for different modes?

Why does vim have different cursor positions for the different modes? First, in insert mode, the cursor is between characters (like every other editor), second, in command mode, the cursor is under a ...
6
votes
4answers
971 views

Indent several lines with VIM?

For eample, I'm editing this code: <html> <body> <script> var a = 10; a += 100; </script> </body> </html> now I need to indent the script line: ...
7
votes
2answers
232 views

How do I get just the user-manual for Vim

To get the vim user-manual I am doing vi test and then, once the file is opened, I do :help user-manual This opens up a split window, which makes reading manual inconvenient to read. How do I ...
1
vote
3answers
351 views

Redirection of output from the terminal to a file in unix/linux

I am facing a slight problem in my project. I have a menu driven program and one of my options is Display all, which displays all the entries from a map using a loop. The display is on the terminal ...
6
votes
5answers
3k views

vi command for adding blank line?

In vi, I can use o or O to add a blank line and go into insertion mode. But what if I want to stay in command mode, is there a command for this? In googling, I'm seeing suggestions to add stuff to my ...
2
votes
1answer
2k views

Edit really big files with vi

How can I edit a really big file with vi? e.g.: a 20 GByte log file. Are there any modifications for it to handle this size?
24
votes
4answers
3k views

Why does `ESC` move the cursor back in vim?

In vim, when I hit ESC to return to command mode, the cursor moves one character to the left. This is not what I would hope for, occasional I immediately hit l to move back to that spot, perhaps to ...
8
votes
5answers
6k views

delete line in vi

How can I delete a line in VI? Here what I am doing right now: Open up the terminal alt + ctrl + t vi a.txt I move my cursor to the line which I wan to delete, then what key-combination is should ...
2
votes
1answer
378 views

How to cancel :X encryption in vi

This has annoyed me for years but I've never found a solution. Instead of pressing Esc then :x to save an exit from vi, I accidentally type a capital X and press Enter. The only way to continue is to ...
3
votes
1answer
2k views

vim: delete lines before cursor

We can delete lines after the cursor (e.g.: the next 3 lines) with: 3dd But how can we delete the lines before the cursor? (e.g.: 3 lines before cursor)?
2
votes
1answer
338 views

How to stop Vim from changing my directory when executing a makefile?

OK, I posted this question before I knew the extent of what was happening. Suppose I have a mix of Python and C++ code. I use a simple makefile which copies the files from my editing directory to ...
3
votes
2answers
349 views

Jump to start of the line in Bash's Vi mode

I'm using Bash Vi mode (aka set -o vi). Still I miss the Ctrl-A shortcut from Emacs mode, which is very handy. Many times I'm retrieving the last command and append an echo to the beginning of the ...
8
votes
2answers
2k views

Can less invoke vim instead of the default vi when I hit the 'v' key?

I want to launch vim instead of the default vi editor when I hit v in less. Are there any settings I can modify to allow me to do this?
5
votes
1answer
393 views

As we call `#!/bin/perl` 'shebang', what we call `-*- perl -*-`?

The first line of a script may be in format of #! interpreter, so the shell will execute the script using the specific interpreter. This is so called shebang or shbang. Similarly, there can be some ...
4
votes
2answers
751 views

cursor position after pasting in vi / vim

One thing that has always bothered me in vi / vim: If I "yank" (a.k.a. "copy") some text, then move to another place in the file and do a "paste", my cursor remains at the beginning of the text I ...
3
votes
1answer
274 views

Ex and Vi: buffers and regexes

I want to put regex matches to buffer but cannot get even simpler example y :.put myNewBuffer return msg [line] [put] [buffer] working ie how to put something to buffer? So to regular expressions ...
2
votes
2answers
387 views

lookbehind and using it with grep in Vi?

Trying to get into Vi (not Vim), after learning Vim. Vim has a lookabehind like /\(Not this\)\@<!$, how to do it in Vi? If I want to search recurvively down directory in Vim, I could do :vimgrep ...
9
votes
2answers
360 views

How do I modify the ci command in vim

Just like "ci(" changes everything between parentheses, I want "ci$" to change everything between dollar signs (for editing LaTeX.) Is this possible?
8
votes
2answers
324 views

Vim command for inserting a character

I'm looking for the opposite of x. I want to insert just one character and stay in command mode.
42
votes
3answers
25k views

Delete from cursor to end of line on VI

I know I've probably looked over this a million times in all the VI documents I've read, but I can't seem to find the delete from cursor to end of line command.
1
vote
3answers
2k views

What is a vi equivalent of vim's 'set ruler' command?

Is there a way to show the current row and column position in vi? In vim, I know there is the set ruler command, but what are my options when using vi?