Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Make your voice heard. Take the 2019 Developer Survey now

Questions tagged [vi]

vi is a text editor of the Unix operating system.

-2
votes
1answer
41 views

What time is it? - Fewest number of keystrokes in vim? [closed]

Task: display current time to the vim user. It is not a matter of inserting the time into a document, which one can easily do with e.g. !!date. In my question, the user simply wants to know what time ...
0
votes
0answers
16 views

Vim ftplugin is applied globally

I'm new to Vim. I have a ftplugin for C files located in /usr/share/vim/vim74/plugin/c.vim. For some reason these rules are not only applied to C files, but globally for all files (and even when Vim ...
1
vote
1answer
531 views

OpenSSH via powershell - vi turns prompt blue

I'm on Windows 10, using Win32-OpenSSH via Powershell to connect to a CentOS 7 machine on my network. If I launch vi on a new file, or on occasion open other files, any and all new text in my window ...
0
votes
0answers
413 views

How to push or copy files to android's /system/etc directory?

I would like to find a way to append part of my desktop's /etc/hosts file to my android's /system/etc/hosts file without manually writing each line and preferably with a single command because the ...
0
votes
0answers
22 views

WALL into vi / emacs?

How would I WALL a program template into vi or emacs? Tried this with no luck: wall vi template.C cat template.C | wall wall :wq Note: template.C contains a template for C++ code, i.e. include ...
0
votes
1answer
152 views

Copying/Pasting a block of lines in vi editor

I have a strange problem when copying/pasting a group of lines within vi. For example, let us say we have a group of lines as follows: AAAAAAAA AAAAAAAAAAAAAA BBBBBB BBBBB BBBBBBBBBB CCCCC ...
6
votes
1answer
786 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 ...
1
vote
1answer
666 views

reload file in vim without scrolling

Is it possible to :e a buffer in vim without having the scrolling adjusted? The behavior I see: the file is reloaded followed by a zz (redraw with line count at center of window). I'd like to just ...
2
votes
1answer
346 views

How to paste vim command into vim editor on mac

I have a bunch of vim commands that I keep in a file because I don't find them easy to remember. I want to paste them into whatever vim session I'm running. However, since upgrading to High Sierra, ...
0
votes
0answers
46 views

screen and $TERM and misformatted vi

I'm ssh'ing from my Mac (Terminal.app) into a Linux box, where I need to run ckermit or screen over USB to have a console on a second Linux box. (There are no graphics on the second box, and I'm ...
2
votes
1answer
1k 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 ...
-1
votes
1answer
515 views

If/Else Statements Linux, Vi , Simple Scripts

First I have tried finding answers to my questions and it's really difficult for a newbie to phrase his questions in a way that yields online results with answers relevant to the situation at hand. ...
2
votes
3answers
86 views

How can I substitute multiple instances of a character with the same number of instances of a different character in linux sed?

I need to substitute a repeating set of characters (2 or more) with the exact number of replacement characters. I need to do this either with sed, or within vi. Examples "abc,,,def" becomes "abc|||...
0
votes
1answer
160 views

Why is bash not recognizing my newline character?

I am trying to get a script to reverse the order of entrees ( yes I know "tac" command already does this) my script is as follows, The print F line that prints the array value and then is followed by ...
0
votes
1answer
50 views

VI Ctrl+W terminal Alternative

Is there a mouse control short cut to Ctrl+W, like Option+click, to go to any screen directly? I dont want to cycle through all windows, instead want to directly go to say 7th screen, of the 10 split ...
0
votes
1answer
444 views

Reconnect to accidentally stopped vi session (git commit)

On Cygwin, I accidentally pressed Ctrl+Z while in vim. I was editing a git commit message. This resulted in $ git commit -a [1]+ Stopped git commit -a I think the vi session is ...
0
votes
0answers
265 views

How can I make `file -i` command return ISO-8859-9?

Let's say I have a text file with content şşş and in vi/vim I have set fileencoding as :set fileencoding=ISO-8859-9. Later when I check the encoding with file -i <myFile> it gives text/...
0
votes
0answers
40 views

Have vim not caring about the capslock state in normal mode

I would like to know if it is possible (and if yes, how) to have vim (or another vi-like editor, really. Changing from vim to another one would not annoy me that much, as long as the editor is usable ...
1
vote
1answer
208 views

How to enter Vi / Vim command mode with `;` instead of `:`?

When using Vi or Vim, I need to perform the following sequence to save a file: esc + :s But the : key is hard to reach on my keyboard. So I would like to switch : and ; so that I can type esc + ;s to ...
1
vote
1answer
771 views

Close multiple files in vi

If I open multiple files in vi using vi *.py then how do I exit the whole vi session instead of editing each and every file? Seems like a simple enough issue but can't find anything on google.
-1
votes
1answer
172 views

How to map cw to ciw in Vim

I almost never use the cw in Vim. Instead I use ciw. Is there a way to make cw do the same thing as ciw? I have tried googling and looking in the man page but I have not found a clear answer.
3
votes
1answer
121 views

vim shortcut for moving to beginning of previous line not working

Pressing Shift and + takes me to first non whitespace character of the next line. I expected that Shift and - would similarly take me to first non-whitespace character of the previous line. But, it ...
0
votes
1answer
70 views

Can tab be remapped in nvi?

I want to map tab in nvi(1). When I try to map a literal tab by typing Ctrl+V then Tab, it does not get rendered as ^I and nvi(1) shows "Usage: map[!] [keys replace]". Can tab be remapped in nvi?
0
votes
1answer
56 views

Copy and paste using vi duplicates comment lines

On a windows PC, I copy the following to the tooltip. var http = require("http"); http.createServer(function (request, response) { // Send the HTTP header // HTTP Status: 200 : OK // ...
1
vote
1answer
33 views

Is it possible to change permission of group by VI editor

I'm new to vi-editor and trying to edit permission of mc (Midnight Commander) group by vi-editor. I try to locate where is mc: vi /usr/share/mc but it gives me empty file and says mc is a directory.....
0
votes
1answer
836 views

Trying to edit file in vi and it crashes [1]+ Stopped

Found this question, this is what I see: Swap file error message while trying to edit .vimrc file? But in my case, I can delete swap files, try to edit file and Ctrl-Z and I get this: [6]+ Stopped ...
0
votes
1answer
43 views

Prevent Vim from selecting less than 2 characters?

I use Vim more and more, and I installed the plugin ideaVim in my IDE from JetBrains (pyCharm, phpStorm). I still use the mouse a lot to navigate and select text, and sometimes when I click in the ...
1
vote
0answers
79 views

Make part of php comment line bold in vim

I've a PHP script, and I would like to know if natively, I can make a part of a comment line BOLD. For example a comment : // it is released when you execute RELEASE_LOCK(), execute a new GET_LOCK()...
0
votes
2answers
58 views

VI - Paste something in the first position/character of a succession of lines

I would like to yank one character and paste it in the first position of the succession of lines. For example, I need to add a "#" in the front of 7 lines of a file. Someone can help me?
0
votes
4answers
4k views

How to extend vim editor to full screen in putty?

When I use vi or vim to edit files in putty, it only shows a limited lines and columns. So how to extend the editor to full screen?
2
votes
4answers
19k views

How do I copy text from window text editor to nano/vi in a Putty window

I was following some guide to create key-pair for my remote linux system, one of the steps being copy the public key generated and saved on my local computer to the authorized-keys file on remote ...
5
votes
1answer
59 views

Trouble defining an environment variable on Cygwin

I'm using the Cygwin 64-bit installation on my Windows 7 machine. In my ~/.bash_profile, I set export JBOSS_HOME=/cygdrive/c/Program\ Files/wildfly-10.0.0.CR2/ However, when I attempt to open a ...
1
vote
2answers
288 views

Vim; Shortcut to add comment at beginning of line

When I code, I tend to execute the following manually a lot after having selected multiple lines of code. :'<,'>s/^/#/ I want to add this to my .vimrc but I am having troubles making it work. ...
0
votes
1answer
866 views

Vi copy and paste is not working

When I open vi/vim in conemu I am unable to paste text from clipboard (mouse right button), and unable to copy file to clipboard (mark text). However in git bash everything works fine. Any clues?
0
votes
0answers
38 views

Does VIMProbable have register support?

VIMProbable is a browser that works using vi keys. Does it have support for storing text in registers?
0
votes
1answer
133 views

Cannot Suspend vi with Ctrl-Z

It's on an AIX 6.1 connected via PuTTY 0.65. If I open a file and hit Ctrl-Z then. It works 1st. But when I switch back and hit Ctrl-Z again. A square cursor jumps to the bottom. I can type something ...
2
votes
1answer
383 views

What does this vim cmd mean? :%y+

I found a command to select all text in Vi/Vim file. :%y+ Could someone explain the line, please?
0
votes
2answers
460 views

search and replace in VI

I need to convert '12.22.54' to '12:22:54' in a string below so that it works in MS SQL. cast('14-JAN-14 06.65.22 AM' as datetime),'63.124.79.253'); cast('14-JAN-14 12.22.36 AM' as datetime),'63....
1
vote
1answer
60 views

Navigating with arrow keys in vi is slow

I use rlogin to remote login from a Solaris 10 Sparc to a Solaris 10 x86 host. When using vi, navigating with the h, j, k, and l keys is very fast and smooth. However, navigating with the arrow keys ...
0
votes
1answer
401 views

How would I write this VIM command for `sed`?

I have a .csv with special characters that are wrecking an import I need to do. In VIM, I discovered away to remove the special characters with : :%s/\r//g This removes ^M from some of my broken ...
3
votes
3answers
13k views

How to use the mouse to scroll up/down in MacOS Yosemite Terminal when vi is open

In MacOS X, pre-Yosemite versions I could open vi in the Terminal window and scroll up and down the history of the Terminal. The vi lines in this case did not scroll. To scroll I used the mouse-pad'...
0
votes
1answer
90 views

Replace terminal's vi with windowed vim for root

I'm on Mac OS X, but I guess this is the same for other unixes. Every time I type vi on the terminal, I want to open the GUI version of Vim (in Mac OS it's called mvim). For my user, I got it ...
12
votes
2answers
15k 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 ...
0
votes
1answer
263 views

Vi like editing operating system wide? [closed]

Is there an extension I can install on Mac OS X that lets me use vi like commands everywhere in the operating system? And if this is not possible, is there a solution that just extends the terminal?
0
votes
2answers
97 views

vim. ensure each buffer is mapped to 1 tab and always showing

So I want vim to behave like a "standard" text editor where whatever buffers are open will always map to a tab, and that tab only shows 1 buffer only. This is like say sublime text, where any open ...
3
votes
3answers
5k views

Why does the 'vi' command open 'vim' editor?

I am using Ubuntu 12.04. Not that I am complaining as I like my vim and prefer its many features. However, I’m curious as to why it does it. It is not aliased in .bashrc or .bash_profile. I am not ...
4
votes
2answers
563 views

In VIM, how do you delete to end of line while in command mode :?

While in VIM, I have a leader shortcut for the following: :!git commit % -m 'updated '; git push; ...
0
votes
1answer
67 views

Vi Editior Navigator Not Working Properly in Solaris 10

I am using ViEditor : This is my code of line : sh /u02/oraprod/prod/db/tech_st/11.1.0/appsutil/scripts/PROD_hooradb2/adautocfg.sh appspass=apps > $HOME/LOG/autocfg.log perl /u02/oraprod/prod/db/...
1
vote
0answers
150 views

Vi scrolling in Firefox/Chrome

Is there a way to rebind j and k to scroll pages in Firefox or Chrome, or addons available just for vi-like scrolling that aren't entire emulators like vimperator and vimium? All I want to do is ...
3
votes
3answers
6k 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. ...