Questions tagged [vi]
vi is a text editor of the Unix operating system.
245
questions
0
votes
1
answer
174
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 /...
0
votes
1
answer
125
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.
0
votes
0
answers
4
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 ...
0
votes
1
answer
159
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 ...
0
votes
1
answer
28
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/...
1
vote
0
answers
156
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....
0
votes
1
answer
118
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 ...
0
votes
1
answer
84
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.
...
0
votes
1
answer
2k
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
...
3
votes
3
answers
433
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 "* (...
0
votes
1
answer
241
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 ...
0
votes
1
answer
64
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 ...
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, ...
1
vote
1
answer
367
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
0
answers
237
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
1
answer
2k
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
1
answer
776
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
2
answers
3k
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
1
answer
696
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
1
answer
407
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 ...
2
votes
1
answer
568
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
1
answer
628
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
1
answer
147
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
0
answers
250
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
1
answer
15
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 ...
-1
votes
1
answer
137
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 ...
2
votes
2
answers
7k
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
1
answer
331
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 ...
31
votes
2
answers
12k
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
1
answer
902
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
1
answer
907
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
0
answers
164
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 ...
29
votes
3
answers
15k
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
1
answer
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
3
answers
685
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
1
answer
467
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
1
answer
250
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
1
answer
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
0
answers
590
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
0
answers
51
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
1
answer
295
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 ...
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.
-1
votes
1
answer
347
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
1
answer
345
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
1
answer
127
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
1
answer
509
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
1
answer
47
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
1
answer
4k
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
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 ...
1
vote
0
answers
142
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()...