Have you just installed Ubuntu and found that vim has no syntax highlighted, while others are header files, variables ...... They all have specific colors and are depressing. Is it always a small problem for the compiler to prompt that a certain header file cannot find and forget the prototype of a function to flip a thick book. Here are some small methods to solve these problems. First, solve the problem of not displaying syntax highlighting: You may also know that You can enable syntax highlighting by removing the double quotation marks before "syntaxon" in the/etc/vim/vimrc file,
Have you just installed Ubuntu and found that vim has no syntax highlighted, while others are header files, variables ...... They all have specific colors and are depressing. Is it always a small problem for the compiler to prompt that a certain header file cannot find and forget the prototype of a function to flip a thick book. Here are some small methods to solve these problems.
First, solve the problem that syntax highlighting cannot be displayed:
You may also know that You can enable syntax highlighting by removing the double quotation marks before "" syntax on "in the/etc/vim/vimrc file, but with this option enabled, there will be some inexplicable prompts when you open vim. We don't want to upgrade vim. The upgrade method can be:
1. Enter sudo apt-get install vim in the terminal
2. download and install the following software packages:
Vim, vim-common, vim-runtime, and vim-tiny
I am using version 7.1
After the upgrade, check that vim is different. Does it feel bright! Vim is easy to use, but it is not easy to use. You need to explore it slowly.
The following describes how to view the header file and library functions in a centralized manner:
1. The simplest method is to install the man manual of the corresponding library. The pringf information is directly displayed on the terminal man xxx (function) such as man printf, this method is simple and contains a lot of information, provided that you must pass the English! This method is not the focus here.
Install sudo apt-get install manpages-dev
2. This method gives you a better understanding of the header file or kernel source code structure.
(1) first install a tool Ctags: sudo apt-get install Ctags
After entering/usr/include or your kernel directory, perform the following operations: ctags-R *. This will recursively generate a tags Tag file for each subdirectory in the current directory, this operation can be performed after the first execution.
Now, when we execute vim-t printf, we can see that we have entered the vim editing interface and the printf declaration. Or enter the tag in the vim editing interface. <函数名或宏等> You can press the TAB key to perform a pattern match.
However, this may not be the one you want. How can this problem be solved?
(2) to solve the above problem, you need to install a tool cs.pdf: sudo apt-get install cs.pdf.
The functions of the preceding tools are not very powerful, but they are very powerful. I have a vim script that I use here. There are not many features of others copied, but it is enough.
Create a new. vimrc file in the user directory and add the following content to the file:
Set mouse =
Let Tlist_Use_Right_Window = 1
Let Tlist_File_Fold_Auto_Close = 1
Map : TlistToggle
Noremap : Make
Noremap : Make clean; make
Noremap : Tlist
Noremap : TlistSync
Noremap :!. /Vitags. sh : Cs reset
Noremap :! Cvs up
Nnoremap @ = (Foldclosed (line ('.') <0) 'zc': 'Z ')
If has ("multi_byte ")
Set encoding = UTF-8
Set fileencoding = chinese
Set fileencodings = ucs-bom, UTF-8, chinese
Endif
Set wrap
Set hlsearch
Filetype plugin on
Colorscheme elflord
Syntax on
Set nocp
Filetype plugin on
Filetype indent on
If has ("CSAs ")
Set csprg =/usr/bin/cs.pdf
Set csto = 0
Set cst
Set nocsverb
"Add any database in current directory
If filereadable ("cscope. out ")
Cs add cscope. out
"Else add database pointed to by environment
Elseif $ CSCOPE_DB! = ""
Cs add $ CSCOPE_DB
Endif
Set csverb
Set cscopetag
Endif
Set nu
Set ts = 4
Set sw = 4
Set ru
Set hls
Set is
Set sm
Set cin
Set cino =: 0g0t0 (sus
Set autoread "read open files again when changed outside Vim
Set incsearch "use incremental search
Set nowrap "do not wrap lines
Set nobackup
Set nowritebackup
Map :! Ctags-R -- c-kinds = + p -- fields = + iaS -- extra = + q.
Map :! Ctags-R.
Try vim-t again. <函数名或宏等> If there are multiple options, a list will appear to let you select the one you need.
An easy-to-use tool can greatly improve your work efficiency. Here is just a little introduction. I hope you can add some suggestions and correct the mistakes.