Record the twists and turns of Vim installation for future reference. Before writing, I would like to thank some powerful search engines and netizens who finally helped me solve various problems. Because I am a newbie for Linux and Vim, the problem may be very low-level, and experts can bypass it directly. The operating system of Vim installed this time is Fedora16. In fact, Vim has been pre-installed in Fedora and can be opened by entering vi in terminal. But this Vim version is not the full version. It is just a lite version. If you don't want to mention it, let's record the twists and turns of installing Vim in the help document for future reference. Before writing, I would like to thank some powerful search engines and netizens who finally helped me solve various problems. Because I am a newbie for Linux and Vim, the problem may be very low-level, and experts can bypass it directly.
The operating system of Vim installed this time is Fedora 16. In fact, Vim has been pre-installed in Fedora. You only need to input vi in terminal. But this Vim is not a full version, but a lite version. If you don't talk about it, the help documentation is incomplete, and it doesn't feel very helpful for learning. So I decided to go to the Vim official website to get the next full version. I downloaded the vim-7.3.tar.bz2 package, which containsRuntime files and source files must be compiled before installation. Open the add/remove software application of Fedora before installation, search for vim, and a bunch of related software will be listed soon. One of them is the lite version of vim, the above shows that the software has been installed and is directly detached.
Open terminal,enter vim-7.3.tar.bz2 directory, enter tar jxvf vim-7.3.tar.bz2 press enter (enter tar press enter to view tar command usage, j indicates to extract with bzip2, x indicates to Extract files, v indicates to output relevant information during processing, f indicates operations on common files), the compressed package is decompressed to the current directory, input ls (indicating that the file folder in the current directory is displayed), and the current directory contains the vim73 folder. Cd vim73 enter this folder, which contains some files such as readme. You can use gedit to open it and see how to install vim. After installation, go to the src folder under vim73, which contains an INSTALL file, which is opened with gedit. It will teach you how to INSTALL vim in different environments. In a unix-like environment, use a terminal to enter the src folder under vim73, and then input the make and make install commands in sequence. As mentioned above, input "make" first, and then start compiling. An error occurs in the result, prompting You to install a terminal library; for example ncurses. or specify the name of the library with -- with-tlib. okay, let's install ncurses: open add/remove software, search for ncurses, and find that ncurses library has been installed. Why can't we just do it, I found another software called development files for ncurses library. After reading the instructions, I felt like I installed it. Then make and make install.
The battle is not over yet. After Vim is installed, input vim in termimal to open vim. In vim normal mode, enter e: itob. c open a previously written c program and want to change it to see if vim can be used. The result shows that the backspace key of vim and the upper and lower right keys cannot be used, and the behavior is very strange, I found out that vim is compatible with the vi mode by default, and there are several backspace modes to choose from. To adjust vim to conform to previous habits, I need to configure it. vimrc file .. The vimrc file should be placed under the root directory of the user, that is, the home/user name directory. Terminal input cd ~ Go to this directory, use gedit to create the. vimrc file, and enter set nocp
: Set backspace = indent, eol, start
: Set ww = <,>, [,]
Save the file and exit. These three statements mean 1. The compatibility mode is canceled. 2. indent: You can use the backspace key to delete the field indent. Otherwise, no response is returned. Eol: If the row starts in insert mode, you can use the backspace key to merge the two rows. Start: only when this parameter is set can the input before insertion be deleted. 3. For more information, see vim Help:
Allow specified keys that move the cursor left/right to move to the previous/next line when the cursor is on the first/last character in the line. concatenate characters to allow this for these keys:
Char key mode
B Normal and Visual
S Normal and Visual
H "h" Normal and Visual (not recommended)
L "l" Normal and Visual (not recommended)
< Normal and Visual
> Normal and Visual
~ "~ "Normal
[ Insert and Replace
] Insert and Replace
So: set ww = <,>, [,] is used to press the left and right keys in each mode, when the cursor arrives at the beginning or end of a row, it can be automatically transferred to the previous or next row. Otherwise, it can only be moved in the row.
After the configuration is complete, restart the system vim and it will be available normally. It is not easy. However, I found another question, which was originally created in the user directory. vimrc is missing. It is strange that it is a search. vimrc is a hidden file, and the ls command does not show the hidden file. If you enter ls-al, the file will be displayed. After a long time, we finally completed the installation and basic use of vim, but we still need to learn a lot to make good use of vim. To sum up, we learned how to decompress the. tar.bz2 compressed package and use the tar command. 2. Use make install to compile and install the software. 3. Use. vimrc to set vim. 4. ls-al: view all files in the current directory that contain hidden files.