Some time ago, the company opened a new virtual machine, installed rhel5, And suddenly did not install Emacs during the installation. It was difficult to install it, but found that syntax highlighting is also so complicated. In one breath, I also learned how to use vim. Vim functions may not be as powerful as Emacs, but it is sufficient for cainiao like me.
At home today, I found Ubuntu in my computer (using VM), installed Vim for a long time, and found that only Vim. Tiny was installed during the installation. This is a lite version. So the first time to use:
Sudo apt-Get install Vim
Installation, the following words appear:
The following packages have unmet dependencies: VIM: depends: vim-common (=. 1.314-3ubuntu3. 1) But. 2.079-1ubuntu5 is to be installed
After reading it for a long time, I did not understand it. Later I checked it and found that the vim version of the source list is relatively high, and a newer vim-common version is required. Also, some people on the webpage say they should remove it first.
Vim-tiny, and then install vim.
I tried again and found that the above prompt still appeared. Because vim-tiny has been removed, even vim-tiny cannot be used now. Therefore, we can only remove vim-common and removed, and install Vim again. Hey, the installation process went smoothly ~~~~
Vim is installed, but opening a c file does not see syntax highlighting. After a Google click, we found that Vim also needs one. the vimrc file is used for configuration. Therefore, you can refer to the settings on the Internet as follows:
: Synta on syntax highlighted (if not, add export term = xterm-color to/etc/profile)
: Set tabstop = 4 set the tab to 4
: Set softtabstop = 4 set soft tab to 4
: Set shiftwidth = 4: set the number of indented spaces to 4.
: Set autoindent: Set auto indent (same as the last line)
: Set cindent (C language indent)
: Set cinoptions = {s, T0, N-2, P2s, (03 S, =. 5 S,> 1 s,: 1 s}
: Set nu display row number
: Set hlsearch highlighted match
Save it.
Other descriptions of the. vimrc file are also copied as follows:
The/etc/vimrc file is a common Vim configuration file in the system, which is valid for all users. In each user's home directory, you can create your own private configuration. vimrc. For example, in the/root directory,
Files. vimrc files.
Install vimrc
Sudo gedit/etc/Vim/vimrc
In each version of RedHat/fedora, by default, as long as the vim-enhanced software package is installed, Vi can automatically identify a variety of files and highlight keywords in an appropriate way.