vi is a text editor of the Unix operating system.

learn more… | top users | synonyms

0
votes
1answer
485 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
593 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
751 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
590 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
1k 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
607 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
152 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 ...
1
vote
2answers
837 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
339 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
772 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
495 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 ...
10
votes
2answers
127 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
2k 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
911 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
608 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 ...
5
votes
1answer
9k 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
893 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 ...
12
votes
1answer
4k 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
204 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
442 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
358 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.
7
votes
3answers
3k 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
437 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
77 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
121 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
130 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
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
97 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
62 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-\>? ...
10
votes
3answers
2k 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 ...
2
votes
1answer
112 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
7k 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
513 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
194 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
3k 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
83 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
274 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
213 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
4k 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
2k 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
3k 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 ...
1
vote
2answers
1k 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
34 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?