vi is a text editor of the Unix operating system.

learn more… | top users | synonyms

1
vote
1answer
239 views

Vi: how can I paste the last string of text that I entered when I was in insert mode?

How can I paste the last string of text that I entered when I was in insert mode? I think I've done this before on accident but I can't recall how.
5
votes
3answers
1k views

Linux: How can I edit all the files returned by find in vi?

Something I find myself doing a lot is running a find command and then editing all of them in vi, which looks something like this: > find . "*.txt" ./file1.txt ./file2.txt ./path/to/file3.txt ...
0
votes
0answers
318 views

Vim shell bindings (set -o vi) on iTerm2

Trouble with history when using bash vi bindings on iTerm2 on Lion. (I had the same problem with iTerm when I switched to Lion.) Hard to explain exactly, but when I hit k to go to most recent ...
1
vote
0answers
76 views

How do I set the meta key with the meta convert feature in most *nix terminals?

.Xdefaults: xterm*eightBitInput: false This command apparently allows you to use a meta key + something to enter vi editing mode in a linux terminal. But what is the meta key and how do you set the ...
1
vote
1answer
2k views

How can I save settings in VI?

I have changed tab settings in VI with set tabstop=4. But when I restart VI, the settings are restored. How can I save the settings?
4
votes
2answers
117 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. ...
6
votes
1answer
732 views

How can I edit a google doc with vi and automatically update the original doc in the cloud when I write the file?

I'm using ubuntu 11.04. I have installed googlecl which claims to allow me to edit google doc files with vim. I have a google doc "test": google docs edit --title "test" --editor vim opens the file ...
2
votes
3answers
111 views

Target one line only in vim for a text substitution

Is there a way in vi(m) to target one specific line in a file for a string substitution? I need to frequently add SSL SHA fingerprints from Web servers to my Mercurial .hgrc. I can grab the required ...
3
votes
3answers
2k views

How to copy and paste between cygwin's vi/emacs and windows clipboard?

I tried to paste what I copied in windows clipboard into cygwin's vi or emacs, and it doesn't seem to work with yy (vi) or M-w (emacs). Is there a way to do it? I learned that /etc/clipboard has the ...
3
votes
3answers
94 views

VI adding # moves cursor to beginning of the line

Why does vim move me to the begining of a line when I press # for a comment or remark say in a perl file? Why would I not want my comment to be indented at the same level of the current code?
1
vote
2answers
60 views

CTRL-\ vs <C-\> in Vim help

From Vim documentation: Additionally the command CTRL-\ CTRL-N or <C-\><C-N> can be used to go to Normal mode from any other mode. So what is the difference between CTRL-\ and <C-\>? ...
0
votes
0answers
227 views

Why can't I open a text file I just created?

I'm on Fedora distro server and OSX on Mac as client connected via crossover cable using a local IP. Fedora is serving web pages and the Mac is browsing and connected via ssh on the terminal. I was ...
8
votes
3answers
566 views

vi: how can I jump to end of file with a new line appended?

Here's an answer I want about 5 times a day. In vi, the command to go to the end of the file is G. But that always leaves me at the start of the last line of the file, if files don't have a blank ...
1
vote
1answer
110 views

Readline in vi mode: how can I access previously executed commands?

I recently followed this post's advice on how to make vi more ubiquitous and I changed my readline mode to vi. Before I did this, I could use the arrow keys to access previously executed commands. ...
0
votes
3answers
2k views

Ubuntu + Unable to Edit .bashrc file because of ReadOnly

I am getting the following warning: Unable to verify SSL certificate for api.heroku.com To disable SSL verification, run with HEROKU_SSL_VERIFY=disable By searching Google I was able to find a few ...
4
votes
6answers
6k views

UNIX - How to copy and paste between different bash windows with files opend with VI?

Lets say I log in to bash, open a file in vi, then using alt-f2 I open a new terminal. After logging in I navigate to a second file and open that in vi. How can I CnP between these two files? I found ...
2
votes
2answers
416 views

non-destructive piping in vim?

Is there a way to pipe selected text through an external command in vim, but not to replace the selected text with the output? Occasionally I want to copy something in a vim buffer to the X clipboard, ...
1
vote
1answer
174 views

How to connect an old dumb terminal to a modern PC?

Could one connect an old dumb terminal to a modern PC? I have this fantasy of hacking around with some vi on an old ADM-3A, but have no idea if it's networkable with modern hardware.
12
votes
2answers
2k views

How to use a pipe to edit a file with vi

Lets say I have a file called file.txt. In it is a name of a file that I want to edit with vi. I want to do something like this so that I can edit the file: cat file.txt | vi However, that doesn't ...
0
votes
3answers
61 views

How to using redirection to create a file

I have a linux script that generates a string and prints it to the console. I want this string to be the name of a file and open it for editing in vi. How can this be done?
0
votes
1answer
72 views

How to navigate word-wrapped text files in vi

I find that navigating text files that have been word wrapped somewhat difficult in vi. If there is a line that is word-wrapped and it goes down several lines, then it is hard to navigate around this ...
3
votes
1answer
215 views

bash vi mode: what is (arg: N)?

I am using vi mode in a bash shell. If I enter insert command mode and type a number from 1-9 (eg: 5, in the example below), I get the following prompt: (arg: 5) <cursor> What does this ...
1
vote
1answer
166 views

Is there a setting that will allow vim to remember the column it was on, even if traverses a line who's EOL is less?

Is there a setting that will allow vim to remember the column it was on, even if traverses a line who's EOL is less? Consider the following lines: foo bar foo foo bar Say my cursor position is the ...
1
vote
2answers
3k views

how to write into file after doing sudo vi /dir to file

i have ubuntu 10.10 installed on a box. and i ssh to it from another computer. when i do sudo vi /var/www/page.php i enter a text editor. when when i try to type i hear that ding noise as in i cant ...
3
votes
2answers
1k views

Create file with 751 permissions at creation

I keep creating practice perl scripts in a linux directory using vi <filename> and need to chmod 751 <filename> before I can run it as I wish to. I'm sure there is a simple way to default ...
4
votes
1answer
2k views

How to pass vim buffer contents through shell command and capture the output to a split window

I've read lots of threads about running shell commands from vim, lots of documentation on vim commands, .vimrc and all that, but I just can't seem to understand the "ex" language or vim mappings well ...
0
votes
2answers
818 views

Why is my vi Editor highlighting all the text?

All of a sudden all the text in my vi editor is highlighted.I have no idea how this happened. Please help.
1
vote
1answer
73 views

vim - tab awareness

If I am writing code like this in vim: def my_function and I hit enter, I would like the cursor to be positioned below the d. Currently it is positioning the cursor as far left as possible. How ...
1
vote
1answer
33 views

How to return to where I was just now in vi/vim?

After G to go the the end,how to return to where I was just now?
2
votes
2answers
452 views

Ubuntu/Gnome copy and paste problem

I am having a peculiar problem with copying and pasting from a terminal in vim. Sporadically, copy-paste will refuse to work. Control-Shift-C and Control-Shift-V cause nothing. Often, after ...
2
votes
5answers
513 views

Repeating through lines in vim

I have some lines of text like this: firstName lastName email Now I add private readonly string to the start of the first line. How do I repeat this edit for the other lines? (not manually visiting ...
3
votes
3answers
7k views

How can I enable backspace key in VI?

I have bare-bone FreeBSD installation. No package installed. And VI doesn't accept backspace key. (I pressed backspace key but nothing happen) How can I enable backspace key in VI? Oh, and I'm using ...
4
votes
3answers
3k views

Display invisible characters in vim

When I compile my source with Latex, I get the following error message Unicode char \u8:  not set up for use with LaTeX. Now I suspect that this is due to an invisible character. The command ...
9
votes
3answers
2k views

Any IRC clients with VI key binds?

Is there any IRC client that supports VI keys? The ''obvious'' script VimIRC is and has been broken for so long it's not even funny. Do you know any IRC clients on Linux, GUI or Curses, that provides ...
2
votes
1answer
618 views

Can I use vi keybindings in the Chrome/Safari JavaScript console?

I'd like to be able to use vi keybindings in the Chrome JavaScript console (cmd-opt-J in OS X, ctrl-shift-J elsewhere, I think). Basically, I want to be able to hop around and edit like I do in vim. ...
3
votes
2answers
212 views

How to delete password in vim without storing it in a register?

I have a password in a text file. I'm editing the file in vim and I want to delete the password. If I just delete it, say with 'dw', it's stored in several registers. I want to avoid keeping any track ...
26
votes
8answers
77k views

How do i select all text in Vi/Vim?

I always use vi for editing config files. Today I wanted to select all the text in a file (around 1000 lines), copy it, then paste into Google Docs. How can I do that?
3
votes
4answers
340 views

Indenting an X number of lines in vim

I've been coding in Java for a job recently and I've noticed that I'll write some code and then determine that I need to wrap the code in a try/catch block. I've just been moving to the beginning of ...
3
votes
3answers
5k views

changing the color of comments in vim

I use vim to browse the source code. In java source files comments appear in blue color on black background which is difficult to read, how to change this color scheme so that comments can appear in ...
2
votes
1answer
1k views

How to move x lines up in vi/vim editor

nenter moves the cursor to n lines down from the current position. is there any shortcut to move n lines up?
1
vote
1answer
388 views

GVIM to find and replace with a carriage return

I'm trying to automatically globally search through a file in a Windows system and replace certain strings with the found string, plus a carriage return (^r^n, or something like that). Here is what ...
5
votes
1answer
637 views

Close VIM session over ssh

I work remotely some days and I left vim open with some unsaved changes at the office. Now I'd like to save and close those sessions so I can work on those files at home. I am logged into that machine ...
6
votes
4answers
9k views

How to get rid of the warnings when opening a file that has a .swp file?

How can I get rid of the annoying warnings when I open a file that has a .swp file? Or, how do I not generate the .swp files at all? Example warning: E325: ATTENTION Found a swap file by the name ...
0
votes
1answer
42 views

How do I view and edit last expression used in a find in vi?

Is there a way to bring up the last regular expression used in vi for a search? If I enter a long regular expression, it would be nice to just edit the expression if it was incorrect or other ...
1
vote
2answers
1k views

in VI and man command, how to exactly match a string?

in VI and man command, how to exactly match a string? I don't know how to exact match a string~
0
votes
1answer
198 views

Setting active window on Vim startup

I'm using MacVim with the Taglist plugin, which I want to be open all the time when I start MacVim. So in my .gvimrc I have the following :TlistToggle Which opens the sidebar when I load my MacVim ...
2
votes
2answers
12k views

How do I save changes after editing vi /etc/hosts?

I am doing a Linux installation. I installed the system fine and am trying to change the vi /etc/hosts file. I have edited the file but am not sure how to save it. I have --INSERT-- showing at the ...
3
votes
3answers
1k views

Vi-Vim like control keybindings for Windows

I've been using gVim for a while and love the interface. I'm in love with my keyboard-fu skillz. I was wondering if there was any application that would extend its functionality to all parts of ...
3
votes
9answers
1k views

emacs or vi which should a windows user learn?

I am currently reading a book on bash and it recommends learning either emacs or vi. I am primarily a windows user and not very experienced with linux yet. So which would be best to learn, or is there ...
7
votes
1answer
1k views

vi: what is verbose mode and when/how do I use it?

Sometimes When I'm using vi I accidentally hit caps lock when I'm in command mode. This apparently puts vi into verbose mode which I'm having trouble finding documentation about how to use. How and ...