Questions tagged [vi]

vi is a text editor of the Unix operating system.

Filter by
Sorted by
Tagged with
0 votes
1 answer
99 views

Is there a simple way to review changes before writing file in Neovim on Windows?

I want to review changes I made to my file before I save it. Is it possible to do this, preferably without using vimrc or installing additional software? I'm using Neovim on Windows. I tried one of ...
Arthur F's user avatar
0 votes
1 answer
1k views

Why can't I edit the sudoers.d files with vim but I can with nano

I tried editing a file in the sudoers.d directory using vi in a vagrant box (Ubuntu Trusty64) but it just opens the file in readonly mode but when I use the nano editor it works. The command sudo vi /...
George Udosen's user avatar
1 vote
1 answer
376 views

Fish shell: Map jk to enter normal mode (in vi mode)

While using vi keybindings in fish shell, is it possible to map jk to enter Normal mode? Currently Escape is used for doing that but I want to change (or add a new way) to do so.
GoodBoyNeon's user avatar
0 votes
1 answer
13 views

Want to add # for perticular line vi editor

Hello I want to add # at the beginning for few lines where content like /vol/home12 & vol/home14, line number not in sequence so I want to change with global option for file instead of going with ...
Avinash 's user avatar
0 votes
1 answer
284 views

vi mode visual selection in zsh on WSL

I use zhs in vi mode on my WSL install, however for whatever reason the Windows terminal disables visual selection in the shell. Whenever I press v the system just plays the error bell, which makes ...
Andrii Kozytskyi's user avatar
0 votes
1 answer
49 views

Have lost the ability to use vi, apt-get, etc. as user ROOT after editing ROOT .bashrc

I am using Debian Linux. After logging in today, there was a message saying Firefox had an update. I clicked on it, but it errored out saying 'ldconfig' not found and that usually, /sbin, /usr/local/...
user3063547's user avatar
1 vote
0 answers
275 views

Vim Ex Command History Ctrl-F not working

I used to use Ctrl-F in my personal laptop to successfully get the command history pop-up in ex-mode but in my work PC, that no longer works. It just shows as ^F if I type Ctrl-F. Vim Version is 7.4....
toddlermenot's user avatar
0 votes
1 answer
237 views

With Firefox, open .vi files from web pages directly with LabVIEW

I use Firefox (now 98.0.1; March 2022) and Windows 10. In the recent past (i.e., Feb 2022), when I clicked on a web link to a vi, it used to open the file in LabVIEW directly. Now, Firefox instead ...
Edward Pogozelski's user avatar
0 votes
1 answer
104 views

vim -- search and replace function call with type field

I have a tricky one. I have a bunch of function calls in my code, i.e. getproperty(mytype). I want to replace all of these with mytype.property A well crafted %s would make life easier. Many thanks. ...
cj wyett's user avatar
0 votes
1 answer
3k views

Ctrl+c/Ctrl+v/Ctrl+p not working on vim

I'm trying to make Ctrl+c, Ctrl+v and Ctrl+p work on vim, but it doesn't work as properly. I'm using Linux (Debian) My config files (.vimrc): ... map <C-p> "+P vnoremap <C-c> "+y ...
victor locateli's user avatar
3 votes
3 answers
628 views

How do I add a keymap into fish vi keybindings?

I've just started using fish and I'm loving using the vi keybindings it provides. I wanted though to add a custom keymap that I use in vi. I usually map space+c in visual mode to yank to "* (...
Augusto's user avatar
  • 133
0 votes
1 answer
442 views

Does Systemverilog color work for vi?

I've added the correct $display in Systemverilog to use colors in my log file. Looks great when I use 'more' but vi doesn't show the color. Is there a .vimrc setup file I need to define. I don't have ...
Brad Giles's user avatar
0 votes
1 answer
85 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 ...
Criggie's user avatar
  • 2,439
1 vote
1 answer
1k 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, ...
harshrathod50's user avatar
1 vote
1 answer
496 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 ...
Mark Reed's user avatar
  • 574
0 votes
0 answers
339 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 ...
Dimfred's user avatar
0 votes
1 answer
3k 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 ...
Culip's user avatar
  • 195
2 votes
1 answer
1k 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
Mercenary204's user avatar
1 vote
2 answers
4k 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 ?
becks's user avatar
  • 135
1 vote
1 answer
807 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:
SunBathe's user avatar
0 votes
1 answer
483 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 ...
Maxime's user avatar
  • 1
2 votes
1 answer
684 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?
Prabhat's user avatar
  • 33
0 votes
1 answer
673 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 ...
DevilsIvy's user avatar
2 votes
1 answer
185 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 ...
Nicolas LIENART's user avatar
0 votes
0 answers
363 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. ...
Aswani's user avatar
  • 1
0 votes
1 answer
19 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 ...
Brydon Gibson's user avatar
-1 votes
1 answer
146 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 ...
malew's user avatar
  • 11
2 votes
2 answers
8k 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 ...
p0lar_bear's user avatar
0 votes
1 answer
443 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 ...
Dave SAVY's user avatar
36 votes
2 answers
15k 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
1 vote
1 answer
994 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 ...
Matt's user avatar
  • 403
3 votes
1 answer
937 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, ...
Bruce's user avatar
  • 161
0 votes
0 answers
209 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 ...
Johannes Ernst's user avatar
35 votes
3 answers
19k 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,274
-1 votes
1 answer
3k 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. ...
Ecojin's user avatar
  • 1
2 votes
3 answers
1k 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|||...
xman's user avatar
  • 21
0 votes
1 answer
542 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 ...
Anyon's user avatar
  • 1
0 votes
1 answer
283 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 ...
sreekesh padmanabhan's user avatar
0 votes
1 answer
2k 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 ...
cp.engr's user avatar
  • 242
0 votes
0 answers
663 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/...
destan's user avatar
  • 1,137
0 votes
0 answers
57 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 ...
user3459474's user avatar
1 vote
1 answer
311 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 ...
Julien's user avatar
  • 13
3 votes
1 answer
4k 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.
Salil Surendran's user avatar
-1 votes
1 answer
390 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.
Kent's user avatar
  • 226
2 votes
1 answer
413 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 ...
The Vivandiere's user avatar
0 votes
1 answer
138 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?
Eric Pruitt's user avatar
0 votes
1 answer
619 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 // ...
user1032531's user avatar
  • 1,651
1 vote
1 answer
61 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.....
chinK's user avatar
  • 11
0 votes
1 answer
5k 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 ...
katit's user avatar
  • 163
0 votes
1 answer
54 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 ...
mperrin's user avatar
  • 616

1
2 3 4 5