Questions tagged [vi]

vi is a screen-oriented text editor originally created for the Unix operating system.

Filter by
Sorted by
Tagged with
3 votes
1 answer
395 views

Why RHEL has two vim installed by default?

I'm on a RHEL 8.3 system. I found that the built-in vim and vi are all vim. They have the same version, but compiled differently. Below is my testing: [root@192 ~]# which vim /usr/bin/vim [root@192 ~]#...
user avatar
1 vote
1 answer
45 views

Repeat a sequence of edits in vim

I have this text: gradient continuité direction and I would like this one: \donnee{gradient} \donnee{continuité} \donnee{direction} In visual mode, I can prepare the sequence \donnee{ ESC then going ...
user avatar
  • 749
0 votes
0 answers
16 views

When i cat a shell script log file i am able to seea colored log file as expected and when i use vi editor it is giving color codes [duplicate]

I am executing an ansible playbook in which it internally runs a shell script on remote hosts and log the output into a file. When I cat that log file I am able to see a colored file as expected but ...
user avatar
  • 1
0 votes
2 answers
58 views

add # to every line except those with #

Using vi How do i add # to every line except those lines already having # 1,$s/^/#/ help here Thanks in advance
user avatar
2 votes
0 answers
31 views

How to start xterm instance which automatically opens nvi in a "complete" environment with ^Z :suspend capability

I am having problems starting a xterm instance that automatically opens nvi in a "complete" environment with job control. I am referring to xterm specifically here and not a VTE skin or ...
user avatar
  • 111
0 votes
0 answers
17 views

in terminal utilizing vi command , somehow changed the keyboard so that upon pressing a character on the keyboard does not output the proper value [duplicate]

while in terminal . utilizing and learning basic Linux commands and was covering the usage of the vi command when it became apparent that something was different than the screen that i was taking ...
user avatar
0 votes
1 answer
58 views

Pasting text to VI adds pound? [duplicate]

When I paste the following text into VI VI adds pound to each line, Is there a way around this? #################################### ##Parameters for XEROX Printers MSSQL DB ##########################...
user avatar
0 votes
1 answer
46 views

Load/Connect automatically to the Linux server session using Mputty

Looking for a help on Loading the putty sessions through Mputty. I can login to my app servers(Linux) only through Jumphost. After login to jumphost i need to perform the ssh to connect my App servers....
user avatar
  • 1
0 votes
1 answer
65 views

vi doesn't see a file on an over-mounted file system, while ls does

I have been editing and trouble shooting a script. When I tried to edit it now, it shows an empty file and says[New File]. The file exists both ls and cat see it. And, I had edited about 10 minutes ...
user avatar
  • 309
0 votes
1 answer
65 views

Does my vim not use the config in the home directory when used with sudo?

I tried to manipulate a file with sudo but NERDTree was obviously not loadable. I am new to vi(m) so I don't have many other plugins which I would have had the chance to see if vim missed to load them....
user avatar
  • 303
0 votes
1 answer
153 views

Which $TERM renders bold text in vim as well as display status line?

I am looking for a $TERM which displays bold text in vim and display airline statusline too. To know what I mean,I have screenshot of two identical files opened by vim but using different terms by ...
user avatar
  • 113
0 votes
1 answer
200 views

how do I redirect output of echo "!#/bin/bash" into another SH file using vi editor [duplicate]

basically I am creating another SH file inside a SH file using vi editor and echo commands. here is the content of original SH file- #!/bin/bash echo "#!/bin/bash" > f1.sh echo "echo ...
user avatar
0 votes
0 answers
49 views

middle mouse paste with ctrl only

While editing with vi, I often paste something in the middle of my document without noticing, especially when scrolling. I would like to disable middle mouse pasting, except when the control button is ...
user avatar
3 votes
7 answers
813 views

How to remove \n in a string

I have a tab delimited text file where the 23rd column with string has \n in it which causes it to break to the next line. I opened the text file in vi and enabled white space characters and I can see ...
user avatar
  • 29
0 votes
0 answers
55 views

Keymap causes Readline Delay on `.` in Vi Mode

When I press . in Vi/command mode there is always a delay (half a second) before the last action gets repeated. I found that this is caused by my .inputrc: set editing-mode vi set keymap vi-command &...
user avatar
  • 4,891
0 votes
1 answer
209 views

Setting cmd-mode bindings in inputrc for vi editing-mode

I am using vi key bindings in .inputrc with set editing-mode vi Then I would like to add new bindings for command mode, namely use K and J to perform forward and reverse search in history of what I ...
user avatar
1 vote
2 answers
83 views

Adding vi to vim mapping for all users in centos

I'm using a specific centos7 image from AWS EC2 which, for some reason, does not have vim installed. I already run ansible scripts on newly spun up servers, so I planned to add VIM via ansible. I ...
user avatar
  • 784
0 votes
0 answers
45 views

How to trap interrupt signal using a shell script while editing a file in vi editor which has been opened using the same shell script?

I am trying to write a shell script which helps me to run and edit java files easily with just one click. I mean the script takes the java filename as argument and then provides three different ...
user avatar
  • 183
0 votes
1 answer
19 views

tree: Is there a way to maintain visibility of outer level directory labels when scrolling?

When you generate a tree for a large directory base with innumerable sub-directories and associated files, with -a option, often you get a large file with thousands of lines. While traversing the tree ...
user avatar
  • 133
0 votes
1 answer
168 views

File is having lots of special characters. How to replace?

I have a file with record like: CENTURY®KETTLEBELLS COLEMANTT40°BAG AlphaPro2¾TDLE Lot™Stretch M6×30 It shows normally in notepad files but in terminal when i cat it, it shows: CENTURY▒KETTLEBELL ...
user avatar
  • 13
0 votes
2 answers
117 views

comment out lines in a file when condition met

I can comment out certain lines through vi in files. It is strenuous activity to do it in the 100's of files. Can I put a condition through sed or awk, for example, I want to put a condition as to ...
user avatar
0 votes
3 answers
508 views

Researched, but still really confused about Vi vs. Vim [closed]

My first post on unix.stackexchange.com. Please, don't just react by the title of this post as I'm not jumping in having not researched what I'm asking for. I have done quite a research about Vi vs. ...
user avatar
4 votes
2 answers
862 views

Using the caret symbol (^) in substitutions in the vi editor

I'm using CentOS and I was reading about the substitution command, s///, in the vi editor. I wanted to test some of the examples I saw: :%s/old/new/g Substitutes old with new throughout the file :....
user avatar
3 votes
1 answer
1k views

How can exporting EDITOR="nano visudo" be considered a severe security risk in the context of visudo?

Reading a security guide on how to harden Arch Linux, I've come across the following tip that exporting EDITOR=nano visudo is considered a severe security risk. Tip: To use restricted version of nano ...
user avatar
  • 3,357
2 votes
1 answer
82 views

have vi or perhaps vim leave the file content in the terminal

20 years ago, whatever vi I was using used to leave the file contents on the terminal after you quit. This meant you could exit and then copy and paste some of the content you'd just created. With ...
user avatar
  • 179
0 votes
1 answer
69 views

Scroll, instead of move cursor, if at end of file

I find myself unintentionally hitting j (or some other downward cursor movement key) when I'm at the bottom of a file. Then the next thing I do is to hit Ctrl-E to scroll the current line up - I may ...
user avatar
  • 121
0 votes
1 answer
54 views

Remove multiple @ symbol from a file

I have a file in linux that has json data in each new line. When I open that file in vi editor, multiple @ symbols show up at the end of every record in a new line. The file does have new line after ...
user avatar
  • 1
0 votes
2 answers
493 views

Force create nonexistent directory via vi or touch? [duplicate]

There are -p option in mkdir command to create parent directories as needed wolf@linux:~$ tree . 0 directories, 0 files wolf@linux:~$ wolf@linux:~$ mkdir dir1/dir2/dir3 mkdir: cannot create ...
user avatar
  • 1,251
0 votes
1 answer
193 views

st terminal + shell vi mode

Context: I use zsh and use vi editing mode. To go up in the history instead of pressing ESC to go to the normal mode and pressing k, I press alt+k which sends the esc character and sends k afterwords (...
user avatar
6 votes
5 answers
515 views

How to edit a list of generated files whose names contain spaces

I've got a relatively small list of filenames generated from a pipeline based on find. The file names contain spaces and possibly punctuation but definitely no other non-printing characters or ...
user avatar
  • 90.3k
-3 votes
1 answer
75 views

How to import tmux setting for vim to normal vim?

When using tmux my color/font/syntax highliting in VIM gets improved. How can i import that red/yellow/white combination of color in .vimrc file. I want that. VIM ON TMUX: AND THIS IS MY NORMAL UGLY ...
user avatar
0 votes
0 answers
299 views

How to copy full vim/vi remote file content to my local clipboard

I am having a file in the remote machine ( connected with customized ssh not Normal ssh ) .I do not have a way to copy/move the file to my local ( No scp allowed and no other connectivity ) .I am ...
user avatar
-1 votes
3 answers
514 views

vi, or vim, on Centos7, overwrites the previous 30 lines in my bash window and thus those line are lost forever

I'm running Centos7 with TERM=linux. Whenever I open a file with vi, or vim, the previous 30 lines in my bash window are over written. vi works fine, but when scrolling back, those 30 lines are lost ...
user avatar
1 vote
1 answer
84 views

vi / Vim: oddities of composing delete/change (d/c) with motion

Let's start with investigating some motions in vi(m). I use the sample line AA BBB as subject of these investigations, and for each experiment we are starting off in normal mode, cursor at beginning ...
user avatar
2 votes
4 answers
187 views

Use substitution to delete everything up to a point on a line

I want to use a global substitution in Vim to delete everything up to https. Before The website is https://website.com The website is https://website.com The website is https://website.com After ...
user avatar
  • 323
3 votes
2 answers
358 views

How to jump to the first line of the C/C++ function using vim?

Is there a set of commands to jump between various elements of the C/C++ source code in vim? I know ctags but that offers limited functionality. For example, is it possible to jump to the first line ...
user avatar
  • 223
4 votes
1 answer
373 views

Access time of a file

I am using bash shell. If I just open a file with the vi editor and close it without even moving the cursor even once, then that, as far as I understand, should change the last access time of the file ...
user avatar
  • 183
0 votes
1 answer
294 views

Linux account will no longer let me edit or create files

I was editing a file and Instead of typing ZZ to save and exit I typed something else by mistake. I think it might have been either ctl-z or ctl-c . Anyway it ended up abending the vi session. When I ...
user avatar
  • 1
0 votes
1 answer
178 views

How to set tab for all files to use two spaces when in vi?

When I edit ruby (.rb) and Javascript (.js) files my settings seem to work ok to make a tab be a space. However for other files, such as files with no extension, when I use tab I get a tab, not two ...
user avatar
1 vote
0 answers
42 views

ESC (in VI) on FreeBSD as Guest in VirtualBox on macOSX does not work. Neither over VB own screen, nor via Terminal > SSH

I just installed FreeBSD-12-Current as guest of VirtualBox6 on my MacBook Pro 15° 2018 with TouchBar under macOS Mojave 10.14.6 an then installed "SUDO" on the virtual machine. When I try to configure ...
user avatar
-2 votes
1 answer
30 views

How to reduce numbering indent in vi in 19.10?

Upgraded to 19.10 and my terminal window without numbers is ok but with numbers (:set nu) it now has a large annoying indent! I tried the solution at https://unix.stackexchange.com/a/252200/10043 ...
user avatar
0 votes
1 answer
107 views

How can I delete marks in Kile/Kate in vim-mode?

When setting marks in Kile’s/Kate’s vim-mode via m. the line will be highlighted. This can be annoying and the attempt to remove the mark via :delmarks fails with unknown command: “delmarks”. Is it ...
user avatar
  • 753
0 votes
3 answers
231 views

Search string and add # to the beginning of that line

Need some help using the vi editor. I am trying to comment out a line on crontab for a specific user. This is the line on the crontab among many other lines: 0,5,10,15,20,25,30,35,40,45,50,55 2-...
user avatar
0 votes
1 answer
74 views

How to properly edit a TXT file created in Windows using VI editor

I created a text file (link goes to DropBox) with a Windows application and now I MUST edit it with VI in Unix. Once I opened the file, I realized that I cannot easily navigate within the lines in ...
user avatar
  • 101
0 votes
1 answer
556 views

How do I remap function keys in readline bash vi (vi shell mode)?

Regarding mapping function keys in vi readline, I have read these two stackexchanges: Remap bash vi keys? Custom key bindings for vi shell mode, ie, "set -o vi"? I have a MacBookPro with a ...
user avatar
  • 496
3 votes
2 answers
970 views

Invoking external editor from Vi command line editing mode in zsh

For some reason, I can't get the keybinding to invoke Vim (my editor) to work with Esc+v zsh when using iTerm. I've gone back to a minimalist .zshrc file, to ensure it's not a plugin issue: # If ...
user avatar
  • 131
10 votes
3 answers
8k views

Disabling vim visual mode in /etc/vim/vimrc does not work

I found plenty of questions regarding disabling visual mode in vim but none that tackles my particular problem: I added set mouse-=a to my /etc/vim/vimrc file to disable visual mode for good. Thing ...
user avatar
  • 633
0 votes
0 answers
233 views

vim doesn't terminate when terminal is forcefully closed

steps to replicate: [Windows PC] SSH to machine as user using putty/cmder (centos 7 VM) [Linux VM] vim def.txt (as a user) [Windows PC] kill the terminal program (putty/cmder) using task manager [...
user avatar
  • 11
0 votes
1 answer
610 views

How to turn colors for vim.tiny without internet access?

readlink -f 'which vi' output: /usr/bin/vim.tiny vi --version output: VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 17 2016 07:08:19) Included patches: 1-488, 576 Extra patches: 8.0.0056 ...
user avatar
0 votes
2 answers
2k views

How can I search date format in vi?

I want to search date format like 2019-07-12 11:22:33. but, in vi mode, :/2019-07-12 11:22:33 is not executed by white space. how can I search 2019-07-12 11:22:33? (other format is not pretty)
user avatar
  • 1

1
2 3 4 5
8