Questions tagged [vi]

vi is a text editor of the Unix operating system.

Filter by
Sorted by
Tagged with
0
votes
0answers
21 views

Add a space when pasting at start/end of line in vim

When I yank some text (say a word) and want to paste that word at the end of another line in vim, it ends up being joined with no space and I then need to manually insert the space myself. For example:...
0
votes
1answer
16 views

Why does VI not run when called from cron?

I can run this command perfectly at the command line and it works as expected. /usr/bin/vi /tmp/test.txt -c ":%s/test/production/g" -c ":wq" However the same command run from a ...
0
votes
0answers
10 views

Centos 8 Random symbol/--inserts— edit when using VI/VIM editor

Recently started using Centos8 and I am facing problem when using vi/vim editor. It is inserting random symbols(AB) when moving using arrow keys and " --Insert-- " text. Maybe someone has ...
0
votes
0answers
9 views

Is VSCode, how can I extend the selection to a Find target?

In VSCode, is there a way to select from the current cursor position to the results of a "Find" operation? (Similar to vi's "/{target}" behavior) For example, if the cursor is at ...
0
votes
0answers
47 views

How do I set vi-mode in current bash/inputrc to “normal” mode by default

I run bash in vi-mode, and configured my .inputrc to use the keys "jk" to switch to normal-mode in vi. However, bash puts me in insert-mode by default. I think I would rather be in normal ...
1
vote
1answer
937 views

Why am I getting this error after removing vi? “No vim found, using vi”

I'm on Fedora 33 Server. I've removed vi and installed vim-enhanced: dnf remove vi dnf install vim-enhanced But I get this error on using vim command: [root@localhost ~]# vim No vim found, using vi, ...
0
votes
0answers
17 views

Is there a way to make VIFM move into a directory but not launch a file on `l` or <right> key?

Currently when clicking letter l or arrow it moves into a directory or open a file. I am wondering if there is a way to make just change directory but not launch the file. Maybe move the "view&...
1
vote
1answer
68 views

Moving up and down through history in zsh vi mode

Trying to get used to zsh to match the new Mac default, and one of the things that's tripping me up is the differences in vi mode. I already found the answers at How can I make zsh's vi mode ...
0
votes
0answers
80 views

Enable gnome-terminal hotkeys depending on the vi mode in the terminal

I have recently discovered that it is possible to enable vim bindings in the gnome-terminal with: set -o vi Now I would like to know whether it is possible to also enable hotkeys for the terminal ...
0
votes
1answer
247 views

Use sed to replace part of a string leaving other part represented by regex unchanged

Consider you want to replace part of a sentence and leave other part represented by the regular expression (regex) unchanged. For instance, here's a text file text1.txt A Egg b Egg C Egg D Egg E ...
0
votes
1answer
104 views

Why is Mobaxterm not copying all my lines in my clipboard?

I have trouble copying the lines i have in my clipboard into Mobaxterm (In a VI file with Unix) since it is not copying all my lines, only certain amount and may cut a line in half at the end
1
vote
2answers
50 views

how to switch tabs in vim when openning vim using -O option

I opened two files using -O vim file1 file2 -O it opens the files horizontally aligned but I dont know how switch between them ?
1
vote
1answer
412 views

my WSL ubuntu vi editor screen is broken when I scroll down

When I scroll down at my vim editor, all of my codes is wrapped with strange boxes. Can I fix it? My .vimrc file: Problem Image:
0
votes
1answer
177 views

No color in vim with SSH on Linux server

At work, I use SSH to remotely connect on servers to edit files. As I got quickly bored of vi, I built a local vim, years ago, and everything worked fine. As my profile is shared between almost all ...
1
vote
1answer
262 views

How to enable VI key binding in cmder?

In linux terminal we can easily enable vi key-binding mode with commands like set -o vi. Does cmder on windows provide any such feature? Or Is there any hack available to do so?
0
votes
1answer
339 views

Confusing text when editing .bash_profile

I am running MacOS v.10.13.6, and in Terminal I was installing pipenv by following a tutorial. As part of the installation I went to edit bash_profile with vi editor in order to add 3 directories to ...
2
votes
1answer
65 views

How to make Vim “repeat search” direction absolute instead of relative?

I am looking for a way to make Vim always go backwards whether I press repeat last , or N and forward when using their pairs ; or n. Currently Vim is using a relative direction which depends on the ...
0
votes
0answers
110 views

when I'm trying to open file in vi mode its prompting help.txt, How to resolve this issue

When I'm trying to open file in vi mode its prompting help.txt as shown below. I tried to close it by using :q, for few seconds its closing again im getting help.txt. i;m not able to edit my file. ...
0
votes
1answer
10 views

Stack line numbers/file locations in vi

A lot of the time I'm reading through code and going from function to function, simulating a call stack. Once I get to the bottom, I need to work my way backwards to see how the returned values are ...
-2
votes
1answer
75 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 ...
1
vote
2answers
5k 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
1answer
224 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 ...
18
votes
2answers
6k 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
740 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 ...
3
votes
1answer
789 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
107 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 ...
21
votes
2answers
7k 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 ...
-1
votes
1answer
2k 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
179 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
388 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
109 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
1k 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
432 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
46 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
287 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 ...
2
votes
1answer
2k 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
266 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.
2
votes
1answer
266 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
111 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
301 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
39 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
3k 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
47 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
112 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
130 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
6k 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?
4
votes
5answers
31k 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
132 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
398 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
2answers
2k 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?

1
2 3 4 5