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

learn more… | top users | synonyms

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 ...
6
votes
4answers
121 views

Replace a line with the line that I have in the buffer in vi

I cc or dd to copy a line into my paste buffer. Then I go to a new location. I want to replace a line that I see. So I type p Down dd. Is there an easier way (fewer keystrokes)?
1
vote
4answers
383 views

Is learning a text editor like vi necessary and still worth the time today? [closed]

I started a new internship where all the servers run on AIX. Logging in for the first time I was suprised to see that my favorite text editor nano was not installed. Everyone here uses vi not ...
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 ...
3
votes
3answers
83 views

console space eaten up by file contents

see the example below to understand my problem ; consider my console prompt look like this user@server $ ls "I opened a file temp" user@server $ vi temp "temp will open in the same window, when I ...
8
votes
2answers
1k views

why inode value changes when we edit in “vi” editor?

When I edit a file in "vi" editor the inode value of the file is changing. But when edited with cat command the inode value is not changing.
2
votes
1answer
2k views

Replace using VIM, reuse part of the search pattern

I am working with VIm and trying to set up a search and replace command to do some replacements where I can re-use the regular expression that is part of my search string. A simple example would be a ...
5
votes
3answers
360 views

Search and replace next n words in vi [duplicate]

Possible Duplicate: Vim :s replace first N < g occurrences on a line In vi, how do I search and replace a word's first n occurrences with a word, say "hello", and the next m occurrences ...
2
votes
2answers
909 views

How to delete the line after a search pattern, globally with vi?

Assume I have a big file, ~1k lines, and I need to delete the line after some pattern, lets call it: somePatern. Conditions: cannot be done by hand (no searching -- /somePattern, and/or manually ...
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
147 views

Expanding text format in VI

The following code is taken from the superfish module for websites: (function($){$.fn.hoverIntent=function(f,g){var ...
21
votes
1answer
2k views

How to get root inside of vi? [duplicate]

Possible Duplicate: Becoming root from inside Vim It could happen to anyone. The admin types: vi /etc/resolv.conf as a regulare user. He edits the /etc/resolv.conf file, but when he ...
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 ...
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 ...
9
votes
4answers
817 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 ...
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
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 ...
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 ...
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
973 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 ...
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?
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?
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
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 ...
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 ...
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 ...
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.
4
votes
2answers
754 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 ...
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?