vi is a text editor of the Unix operating system.

learn more… | top users | synonyms

2
votes
1answer
730 views

bash vi key bindings: Can I map keys? Display mode (insert vs command)?

I am a long time vi(m) user and recently made the switch to using vi key binding in bash. I can already tell that this will be an improvement, but I would like to customize a few things to really ...
3
votes
1answer
1k views

VIM: how to select a line, up to the cursor, including the char under the cursor?

From normal mode I select what's before the cursor with: v<Home> Is adding to the selection what's under the cursor possible? Thanks!!
4
votes
1answer
237 views

Abort a vim paste

Sometimes I paste a lot of data into vim (>5000 rows) and forget to enable paste mode. In that case, vim is busy for several minutes, trying to correctly indent all the text (which gets REALLY bad ...
0
votes
1answer
96 views

Using regular expressions in vi

When I write a blog entry in Google blogger then a lot of entries like shown as below are getting inserted in HTML (not sure why). <span id="textmarked_8" name="textmarker_9" ...
10
votes
5answers
8k views

Always use :set paste, Is it a good idea?

In a terminal vim, pasting clipboard data often messes up the code indent. I just knew if I uses :set paste the indent is not broken. Though, after pasting data, should I do :set nopaste again? What ...
0
votes
3answers
111 views

Insert text with vi editor

I was using nano before. I'm a bit confused on how to start inserting text, sometimes I just start typing and on the bottom I see -- insert -- and I can edit and save fine. But sometimes I just skip ...
0
votes
1answer
590 views

Replace text with text from another file in a script?

I want to replace 5 rows of text in a file with the text of another file in my script, I know that running vim I can do :45,50d :r replacement.txt to delete 5 rows and then insert the entire file, ...
1
vote
1answer
887 views

How do I type numbers in vi?

Sometimes when I have to do basic editing of a file or write a basic script when I'm working in Terminal, I use vi. The problem is that when I type numbers, it goes to that line. Is there a way to ...
3
votes
2answers
896 views

Exclude dash (-) from word separators in vi

vi uses dash and space as word separators. is there any way to exclude dash from word separators ? This is required to work with the symbols generated by ctags exe. when symbol contain a "-" ,vi tags ...
0
votes
1answer
666 views

Remap shift-tab to tab in bash/screen/putty in Linux?

Well I use vi-mode in bash via the set -o vi command. What's annoying is when I'm typing words in capital then try to complete using tab but don't release the shift-key fast enough, it brings me out ...
1
vote
4answers
2k views

How do I edit a file currently being used by vi?

I am new to Linux and trying out Ubuntu 11.10. I am setting up a SSH server and one of the instructions asks me to edit sshd_config file using vi. In vi, I can't remember what happen (it's all a ...
1
vote
1answer
762 views

Copy vertical text block in Vim on Mac

How do I copy a vertical text block in vim on a Mac? On a PC on would just do ctrl-c at starting point and ctrl-c at the end point and it would copy between these two coordinates. How do I do that on ...
0
votes
1answer
154 views

vi substitution matching

I am able to pattern match a regex in vi, but when I add the replacement string, vi thinks that is part of the regex match. This occurs despite use of various different delimiters. Is there some way ...
2
votes
2answers
1k views

VI make every first letter that comes after a underscore uppercase

Found this site: http://unix.t-a-y-l-o-r.com/VMswitch.html And it works for the first character but my lines are line this this_is_a_string And I would like this This_Is_A_String Any ...
0
votes
1answer
368 views

iTerm2 Terminal Too Wide Error

I am using iTerm2 to ssh to various servers. When i use VI to edit a file i get an error that reads 'Terminal Too Wide.' To fix this I use the following command 'stty columns 120.' Is there a ...
0
votes
2answers
893 views

How to make VI use spaces instead of tab even when I press backspace key?

When I tried to use yml, it requires NO TAB, ONLY SPACE policy. I realized I need a special setting for this. Anyway, I can't live without tabs. So I want to make my VI behave like this. When I ...
4
votes
5answers
1k views

In Vi, how do I map “:t” equal to “:tabnew”?

I don't want to always type the word. it's annoying.
8
votes
2answers
535 views

Readline in vi mode: how can I enable up/down arrows?

When bash has vi bindings available (set -o vi), up/down arrows work in both command and insertion mode. When I setup readline's ~/.inputrc to use vi mode (set editing-mode vi), applications like ...
11
votes
2answers
142 views

vi / vim abrumpt buffer movements within window

When using :set wrap in vi/vim, the contents of an entire wrapped line are placed in the display buffer upon moving the cursor into a new line, even when navigating through a file by display line ...
4
votes
1answer
3k views

how to block select, move, copy, paste in vi?

I am trying to migrate from Notepad++ to vi. In N++, I constantly rely on block edit (or "column mode"), as it is a great increase in productivity: I can select a rectangular area of text by pressing ...
4
votes
2answers
1k views

Whats the difference between vi editor in Red Hat linux and Ubuntu?

I realize a difference in vi editor of ReD Hat and Ubuntu. In my company, I'm working in Red Hat. In that, the vi editing commands working as usual. Say, 'dd' to delete,'p' to paste, 'yy' to yank, ...
0
votes
1answer
703 views

Mac OS X. Vi - E185 cannot find color scheme

Editing with vi in terminal gives the following error. E185: Cannot find color scheme metacosm. I think the problem is not im my .vimrc (no strange carrage returns). I strongly suspect this problem ...
6
votes
1answer
12k views

Vi on Linux: show ^M line endings for DOS-format files

On Solaris, if you open a file in vi that has Windows line endings, this shows up as ^M at the end of every line. On Linux, vi is cleverer and understands the Windows file format, and does not ...
0
votes
2answers
1k views

mingw/msys with vi, ctags support?

I'm trying to run vim on win7 inside msys (which isnt entirely necessary, i know i can run gvim in windows, but i'd like to be able to use vi inside terminal) everything installs fine with mingw-get ...
13
votes
1answer
5k views

How to switch comfortably to vi command mode on the zsh command line?

In vi, I have mapped 'jj' to escape to be able to switch to command mode without using the annoying escape key. Now I want to have the same for command line editing for which I use vi-mode. I already ...
2
votes
2answers
252 views

Can I display emacs buffer modification history?

I've used vi for decades, but I'm trying to improve my emacs skills. In vi, I often check the status of my buffer by issuing this command: :w !diff - % Is there a command in emacs that I can use ...
5
votes
8answers
493 views

vi / vim tutorial recommendations

Being a common tool for *nix System Administrators, I'm looking for recommendations for vi/vim tutorials. After seeing this 'how do I do [this] in vim' question in Stack Overflow, I realize that I ...
0
votes
2answers
57 views

Forcing highlighter to html in VI when it fails to recognize an input file

I'm having trouble editing HTML in an older version of VI(M). VIM - Vi IMproved 6.3 (2004 June 7, compiled [...] 2005). When reading .sh shell scripts there is no problem, though. It doesn't ...
4
votes
1answer
438 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.
12
votes
4answers
4k views

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

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
499 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
78 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 ...
3
votes
1answer
3k 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
126 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
1k 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
144 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
4answers
3k 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
98 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
64 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-\>? ...
11
votes
3answers
3k 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 ...
3
votes
1answer
119 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
3k 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
8k 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
577 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
215 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.
14
votes
2answers
4k 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
62 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
87 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 ...
4
votes
1answer
312 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
260 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 ...