Difference between revisions of "Vi in unbuntu"

From 307 Lab Note
Jump to navigation Jump to search
(Created page with "Fixing hitting arrow keys adds characters in vi editor issue ==Simpliest method== 1. <code>sudo apt-get install vim</code> 2. Use <code>vim</code> instead of <code>vi</code...")
 
m
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Fixing hitting arrow keys adds characters in vi editor issue
+
*The default setting of vi editing program under Ubuntu contains bugs, and need to do some modifications so it can work properly.
 +
*Here is a quick summary of fixing hitting arrow keys adds characters in vi editor issue
  
==Simpliest method==
+
==Simplest method==
 
1. <code>sudo apt-get install vim</code>  
 
1. <code>sudo apt-get install vim</code>  
  
Line 13: Line 14:
 
2. Add the following content to ''vim.rc''. To start editing the file press <code>i</code> in the location where you want to start edit
 
2. Add the following content to ''vim.rc''. To start editing the file press <code>i</code> in the location where you want to start edit
  
<code>set nocompatible</code> <br>
+
:<code>set nocompatible</code> <br>
<code>set backspace=2</code>
+
:<code>set backspace=2</code>
  
 
3. Save the file via <code>esc</code>, then <code>:qc</code>.
 
3. Save the file via <code>esc</code>, then <code>:qc</code>.

Latest revision as of 02:59, 6 October 2021

  • The default setting of vi editing program under Ubuntu contains bugs, and need to do some modifications so it can work properly.
  • Here is a quick summary of fixing hitting arrow keys adds characters in vi editor issue

Simplest method

1. sudo apt-get install vim

2. Use vim instead of vi

Alternative method

1.E dit a file called vim.rc in your root folder. If it's not present create one.

vi ~/.vimrc

2. Add the following content to vim.rc. To start editing the file press i in the location where you want to start edit

set nocompatible
set backspace=2

3. Save the file via esc, then :qc.