Skip to main content

Questions tagged [vi]

vi is a text editor of the Unix operating system.

Filter by
Sorted by
Tagged with
244 votes
12 answers
915k views

How do I select all text in Vi/Vim?

Using VI tool for editing config files. How can I select all the text in a file (around 1000 lines), copy it, then paste into Google Docs?
user avatar
56 votes
7 answers
158k 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 "....
James's user avatar
  • 5,109
37 votes
4 answers
48k views

Inserting a blank line in vim?

I quite often find I have a need to insert a blank line either below or above the current line when editing in vim. o and O will do this, but they subsequently switch into insert mode, which is ...
Andrew Ferrier's user avatar
36 votes
2 answers
16k views

Why is VIM starting in replace mode?

On several new CentOS 7 machines, I find that VIM automatically starts in replace mode. After removing all automatically installed .vimrc files, normal behavior returns. However, if I simply create a ...
Michael's user avatar
  • 641
36 votes
3 answers
21k views

How to use vimium to select text from a page

Background I'm a religious fanatical devoted believer of vimium. It speeds up my internet usage like nothing else. I'm also (naturally) a heavy user of vim itself. Question How can I actually select ...
abbood's user avatar
  • 1,284
34 votes
9 answers
69k views

Vim to replace Vi

Guys, anyone know how to change linux console editor from vi into vim everytime we execute vi? I'm using Ubuntu and Fedora Core
Funky81's user avatar
  • 553
33 votes
3 answers
34k 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 ...
Richard's user avatar
  • 985
33 votes
4 answers
32k views

Vim shows strange characters <91>,<92>

While using Vim over SSH I copied some content from a webpage to my SSH/Vim session and got the following result: SIZE=`df -h|grep $DISC|awk <91>{print $2}<92>` Apparently <91> and ...
Jeremy S.'s user avatar
  • 499
33 votes
7 answers
37k views

Is there a command to split lines in Vim?

In Vim, the J key joins two lines together. Is there a similar, built-in, key combination to split lines with a newline (at the cursor position, or similar)? Alternatively, what would be the most ...
Andrew Ferrier's user avatar
32 votes
5 answers
15k 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 >...
abeger's user avatar
  • 795
25 votes
1 answer
13k 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 ...
Eman Resu's user avatar
  • 285
24 votes
5 answers
30k 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 ...
Benjamin's user avatar
  • 2,299
23 votes
3 answers
6k 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 ...
mike3996's user avatar
  • 1,581
18 votes
3 answers
9k views

vi/vim alternative to sublimetext's "Expand selection to scope"

Sublime text has a cool feature called "Expand selection to scope" SHIFT+CMD+SPACE which selects the everything within the scope. It select everything in scope, works perfectly ( ) or [ ] or { } ...
palaniraja's user avatar
17 votes
7 answers
11k views

How to show the current Vi mode when using Vi keybindings in the shell?

I use the vi keybindings in my tcsh shell. Now, I don't know which vi mode I'm in (insert mode or command mode), which leads to a lot of frustration. Does anyone know of a way to show the current ...
Sundar R's user avatar
  • 1,489
16 votes
1 answer
34k views

Vim: edit multiple lines

I was looking for a way to edit multiple line simultaneously. I found that Ctrl-V + selecting the lines + I should be the solution. The problem is that, for me, after pressing I (in fact Shift-i) I'm ...
gregseth's user avatar
  • 727
15 votes
2 answers
7k 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 ...
tony_sid's user avatar
  • 14.5k
15 votes
4 answers
4k views

I'm using Bash in "vi mode". What's the hotkey sequence to edit the current command line using an external editor?

In Bash's "Emacs mode" (set -o emacs), I can edit the current command line in my favorite external $EDITOR. All I have to do is press Ctrl+X then Ctrl+E. But, because I have switched to Bash's "vi ...
Alby's user avatar
  • 487
15 votes
4 answers
7k views

Hiding vim command-line when it's not being used?

Is there any way to hide the vim command-line (ideally, automatically) when it's not being used? On small screens it takes up one valuable line. I'm thinking it would be 'normally' hidden, and appear ...
Andrew Ferrier's user avatar
15 votes
3 answers
25k views

What does shiftwidth do in VIM editor

I read this about shiftwidth option on Google: To change the number of space characters inserted for indentation, use the 'shiftwidth' option. Ok Ok, but what's that more exactly? How can I try this ...
user223787's user avatar
14 votes
6 answers
25k views

How to get vim color mode to work in vim under cygwin

I have installed vim 7.3 under cygwin. And I have this in my ~/.vimrc $ cat .vimrc colorscheme wombat And then I have this file wombat.vim under '.vim/colors'. $ ls -la .vim/colors/ total 8.0K ...
michael's user avatar
  • 5,985
14 votes
3 answers
14k views

Increase the space between lines in vim

I think the title says it all. I've done my homework and the only command that I found was: :set linespace=3 but it doesn't seem to work, neither on the Mac nor in Linux. Edit: In Mac OSX you can ...
mshohayeb's user avatar
  • 241
13 votes
3 answers
4k views

Logged in to vi, made changes, forgot to sudo first - now what

I made lengthy changes to a configuration file on a Ubuntu Linux computer with the vi editor. Unfortunately, I forgot to sudo first, so now I'm in the editor, but can't save my changes because of ...
simon's user avatar
  • 1,633
13 votes
13 answers
2k views

What Vim features do you use? [closed]

I spend almost all day programming in Vim and I am sure that a lot of you do too. What features do you use that make your day to day coding that much better? One that I use is gv, which will let ...
13 votes
3 answers
43k 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 ...
sss's user avatar
  • 153
12 votes
2 answers
58k views

Vi can write to file despite file being read-only

The following example show how to create a file with only read permissions. As we can see, when I try to write to this file using the echo command I get, Permission denied. But why, in the case that ...
maihabunash's user avatar
12 votes
7 answers
8k views

Error location navigation in Vim Syntastic

I've got Syntastic installed in Vim and it is finding errors perfectly (mostly in Python code I'm working on). If I jump around normally in the file I see the errors in the status bar when the cursor ...
Chris Jones's user avatar
12 votes
4 answers
7k 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 ...
Christian Delahousse's user avatar
11 votes
5 answers
25k views

Notepad++ visibility for BOM

How to use the 6.2.3 version of Notepad++.I want to know how to make visible of BOM chanracters.I tried with menu list available but no use. But those characters are available only at Linux ...
sunleo's user avatar
  • 213
11 votes
2 answers
221 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 (gj/...
user001's user avatar
  • 3,704
10 votes
1 answer
10k 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!!
dan's user avatar
  • 203
9 votes
6 answers
11k 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 ...
Mauricio Scheffer's user avatar
9 votes
3 answers
16k 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 :set ...
Lucas's user avatar
  • 749
9 votes
4 answers
9k 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 ...
malvim's user avatar
  • 195
9 votes
1 answer
2k 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 ...
Chestone's user avatar
  • 193
8 votes
2 answers
15k views

Moving the the very bottom of the file with vi

No, I'm not talking about vim, I'm talking about old-school vi; because in vim you can actually issue a :bot and it'll move to the bottom of the file.
leeand00's user avatar
  • 22.7k
8 votes
2 answers
24k views

Why does VIM say there are trailing characters on this command?

I am trying to write a beautify CSS command in vim that sorts and alphabetizes all of the CSS properties as well as checks to see if there is not a space after the colon and inserts one. Here is my ...
Jesse Atkinson's user avatar
8 votes
2 answers
2k views

Is it possible to launch MacVim NOT in full screen mode?

Whenever I Launch MacVim it takes up the whole screen. I don't want this. Is there any way to prevent it from happening? I run OS X 10.8.
Nick Vikeras's user avatar
8 votes
3 answers
4k 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 ...
Danilo Bargen's user avatar
8 votes
1 answer
6k 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 ...
James's user avatar
  • 5,109
8 votes
1 answer
6k views

What's the difference between tiny, huge and small in vim on MacPorts?

I'm trying to install vim via MacPorts. I found this port at http://trac.macports.org/browser/trunk/dports/editors/vim/Portfile. There are variants like tiny, small and huge. Is there any way to tell ...
TK.'s user avatar
  • 585
8 votes
2 answers
1k 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 ...
dkam's user avatar
  • 261
7 votes
4 answers
7k views

vi visual mode doesn't work

I'm running vim (7.0.237) after sshing to a remote CentOS box, and it just won't enter visual mode. When I press 'v', it just beeps and does nothing. I'm running Ubuntu with GNOME Terminal, and the ...
BobMarley's user avatar
  • 105
7 votes
3 answers
11k views

vi: How do I save without exiting the editor?

Any way to save changes in vi without exiting the editor? I'm experimenting with php and checking my work in the browser. To get back to my code I have to reopen the php file which is an extra step. ...
Scandalist's user avatar
  • 3,089
7 votes
4 answers
17k views

Vim is not reading gzipped files automatically

I want to see some zipped log files .gz in unix through putty. When I open them in vim the contents are not readable. I think vim is not able to unzip them.
Ahmad's user avatar
  • 229
7 votes
1 answer
8k 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?
Suresh's user avatar
  • 583
7 votes
4 answers
7k 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 ...
prosseek's user avatar
  • 5,964
7 votes
1 answer
9k 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 ...
user avatar
7 votes
2 answers
4k views

Is it possible to control the whole Gnome desktop with vi-like commands?

I know with readline you can use emacs or vi commands to edit the input of several interactive text programs. I wonder if there exists such a similar facility to control the whole desktop in Gnome or ...
Castamos's user avatar
  • 181
6 votes
5 answers
16k views

Is there a VI equivalent I can use on Windows XP and later?

I get frustrated using Notepad on my Windows XP machine when I want to do more complicated text manipulation. Having used VI on various versions of UNIX I'd like to get something with its power on my ...
ianfuture's user avatar
  • 1,000

1
2 3 4 5