Compile and configure Vim on RedHat5.3

Source: Internet
Author: User
I suddenly found that my virtual machine does not have Vim on RedHat5.3, And it is inconvenient to use it at all. No way, re-compile the next source code ~~ The download address is very easy to find. The latest version is 7.3: Ghost suddenly finds that my VM does not have Vim on RedHat 5.3. it is not convenient to use it at all. No way, recompile the source code ~~

Download address is easy to find, the latest is 7.3: ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2

After decompression, I simply read./configure-help, and then my./configure options are as follows:

 
 
  1. ./configure --prefix=/usr/local --enable-multibyte --with-features=big --disable-selinux 

If you do not use -- disable-selinux, it will report:

OS _unix.c: 45: 30: error: selinux/selinux. h: No such file or directory
OS _unix.c: In function 'mch _ copy_sec ':
OS _unix.c: 2615: error: 'security _ context_t 'undeclared (first use in this function)
OS _unix.c: 2615: error: (Each undeclared identifier is reported only once
OS _unix.c: 2615: error: for each function it appears in .)
OS _unix.c: 2615: error: expected '; 'before' from _ context'
OS _unix.c: 2616: error: expected '; 'before' to _ context'
OS _unix.c: 2618: error: 'From _ context' undeclared (first use in this function)
OS _unix.c: 2631: error: 'to _ context' undeclared (first use in this function)
Make [1]: *** [objects/OS _unix.o] Error 1

 

Okay, I added -- disable-selinux, but an error is returned, as shown below:

Checking -- with-tlib argument... empty: automatic terminal library selection

Checking for tgetent in-lncurses... no

Checking for tgetent in-ltermlib... no

Checking for tgetent in-ltermcap... no

Checking for tgetent in-lcurses... no

No terminal library found

Checking for tgetent ()... configure: error: not found!

You need to install a terminal library; for example ncurses.

Or specify the name of the library with -- with-tlib.

 

After Google for a long time, it was found that the ncurses library was not installed, and then the library file was found in the installation disk of little red hat, and the installation was executed:

Install ncurses-devel-5.5-24.20060715.x86_64.rpm

Re-configure.

Next, perform the following steps:

 
 
  1. make && make install 

Haha, now your Vim7.3 is in/usr/local/O (∩ _ ∩) O ~

Be careful that the plugin file used by compiled Vim is in the/usr/local/share/vim/vim73/plugin directory!

Now you can configure your. vimrc file to customize your Vim. (I think every time I Customize What I Want to use, I enjoy it, just like the decoration. Haha, it's far away ;))

You can write a new. vimrc file by yourself, or use the sample vimrc file in/usr/local/share/vim/vim73/as a template.

I have a vimrc file that I have used for a long time ~ /Directory.

Of course, you can also share your vimrc files. You may be more concerned about this. Haha:

Set nocompatible
Source $ VIMRUNTIME/vimrc_example.vim
Source $ VIMRUNTIME/mswin. vim
Behave mswin

Set nocompatible "Disable vi compatibility mode
Syntax on "auto syntax highlighting
Filetype on
Filetype plugin on
Colorscheme molokai "sets the color scheme
Set number "display row number
Set cursorline "to highlight the current row
Set ruler "Open the status bar ruler
Set shiftwidth = 4 "set <and> the width of the command to move is 4.
Set softtabstop = 4 "allows you to delete four spaces at a time when you press the return key.
Set tabstop = 4 "set the tab length to 4
Set nobackup "does not back up when overwriting files
Set autochdir "automatically switches the current directory to the directory where the current file is located
Filetype plugin indent on "Enable Plug-in
Set backupcopy = yes "sets the backup behavior to overwrite
Set ignorecase smartcase is case-insensitive during search, but remains case-sensitive when one or more uppercase letters exist.
Set nowrapscan: no re-search is allowed when both ends of the file are searched.
Set incsearch: the search result is displayed when you enter the search content.
Set hlsearch "highlight the found text during search
Set noerrorbells "Disable Error message logging
Set novisualbell "Disable the use of visual bell instead of call
Set t_vb = "Terminal code for setting an empty wrong ringtone
When brackets are inserted in "set showmatch", the matching brackets are jumped temporarily.
"Set matchtime = 2" Jump to the matching bracket time for a short time
Set magic "set magic
Set hidden "allows you to switch the buffer when there are unsaved changes. At this time, vim is responsible for saving the changes.
Set guioptions-= T "Hide Toolbar
Set guioptions-= m "hide the menu bar
Set smartindent
Set backspace = indent, eol, start
"You cannot use the return key and Delete key to Delete the carriage return when the insertion status is not set.
Set limit Height = 1 "set the number of lines in the command line to 1
Set laststatus = 2 "display status bar (default value: 1, unable to display status bar)
Set statusline = \ % <% F [% 1 * % M % * % n % R % H] % = \ % y \ % 0 (% {& fileformat} \ % {& amp; encoding} \ % c: % l/% L % )\
"Set the information displayed in the status line
Set foldenable
Set foldmethod = syntax "set syntax collapse
Set foldcolumn = 0 "set the width of the collapsed area
Setlocal foldlevel = 1 "set the number of folding layers
"Set foldclose = all" is set to auto-disable fold
"Nnoremap @ = (Foldclosed (line ('.') <0 )? 'Zc': 'Z ')
"Use the Space key to switch and collapse


"Return OS type, eg: windows, or linux, mac, et. st ..
Function! MySys ()
If has ("win16") | has ("win32") | has ("win64") | has ("win95 ")
Return "windows"
Elseif has ("unix ")
Return "linux"
Endif
Endfunction

"User directory variable $ VIMFILES
If MySys () = "windows"
Let $ VIMFILES = $ VIM. '/vimfiles'
Let $ VIMCONF = '_ vimrc'
Elseif MySys () = "linux"
Let $ VIMFILES = $ HOME. '/. vim'
Let $ VIMCONF = '. vimrc'
Endif

"Set the doc document directory
Let helptags = $ VIMFILES. '/doc'

"Set Font and Chinese support
If has ("win32 ")
Set guifont = "Courier New: h12: cANSI"
Endif

"Configure a multi-language environment
If has ("multi_byte ")
"UTF-8 Encoding
Set encoding = UTF-8
Set termencoding = UTF-8
Set formatoptions + = mM
Set fencs = UTF-8, gbk

If v: lang = ~? '^ \ (Zh \) \ | \ (ja \) \ | \ (ko \)'
Set ambiwidth = double
Endif

If has ("win32 ")
Source $ VIMRUNTIME/delmenu. vim
Source $ VIMRUNTIME/menu. vim
Language messages zh_CN.utf-8
Endif
Else
Echoerr "Sorry, this version of (g) vim was not compiled with + multi_byte"
Endif

"Generate html with CSS syntax for Tohtml
"Syntax/2html. vim, which can be used: runtime! Syntax/2html. vim
Let html_use_css = 1

"General settings of Python files, such as not tab
Autocmd FileType python set tabstop = 4 shiftwidth = 4 expandtab
Autocmd FileType python map :! Python %

"Ctrl + c copy in selected state
Vmap "+ Y

"Open javascript collapse
Let B: javascript_fold = 1
"Open javascript support for dom, html, and css
Let javascript_enable_domhtmlcss = 1
"Set dictionary ~ /. Vim/dict/file path
Autocmd filetype javascript set dictionary = $ VIMFILES/dict/javascript. dict
Autocmd filetype css set dictionary = $ VIMFILES/dict/css. dict
Autocmd filetype php set dictionary = $ VIMFILES/dict/php. dict

"-----------------------------------------------------------------
"Plugin-bufexplorer. vim Buffers Switch
"\ Be full screen mode to view the list of all opened files
"\ Bv left and right view \ bs up and down view
"-----------------------------------------------------------------

"-----------------------------------------------------------------
"Plugin-taglist. vim: to view the function list, the ctags program is required.
"F4 open the hidden taglist window
"-----------------------------------------------------------------
If MySys () = "windows" "sets the location of the ctags program in windows
Let Tlist_Ctags_Cmd = '"'. $ VIMRUNTIME. '/ctags.exe "'
Elseif MySys () = "linux" "sets the location of the ctags program in windows
Let Tlist_Ctags_Cmd = '/usr/bin/ctags'
Endif
Nnoremap : TlistToggle
Let Tlist_Show_One_File = 1 "the tag of multiple files is not displayed at the same time, only
Let Tlist_Exit_OnlyWindow = 1 "if the taglist window is the last window, exit vim
Let Tlist_Use_Right_Window = 1 "display the taglist window on the right
Let Tlist_File_Fold_Auto_Close = 1 "automatically collapse the list of methods for the current non-editing File
Let Tlist_Auto_Open = 0
Let Tlist_Auto_Update = 1
Let Tlist_Hightlight_Tag_On_BufEnter = 1
Let Tlist_Enable_Fold_Column = 0
Let Tlist_Process_File_Always = 1
Let Tlist_Display_Prototype = 0
Let Tlist_Compact_Format = 1

"-----------------------------------------------------------------
"Plugin-mark. vim marks different colors for various tags, allowing you to conveniently view and adjust the plug-ins.
"\ M mark or unmark the word under (or before) the cursor
"\ R manually input a regular expression. Used for searching.
"\ N clear this mark (I. e. the mark under the cursor), or clear all highlighted marks.
"\ * Next to the current MarkWord \ # previous to the current MarkWord
"\/Next of all MarkWords \? The previous one of all MarkWords
"-----------------------------------------------------------------


"-----------------------------------------------------------------
"Plugin-NERD_tree.vim: Tree View of files and directories in the system
": ERDtree enable NERD_tree: NERDtreeClose disable NERD_tree
"O open and close the file or directory t open on the tab
"T open in the background tab! Execute this file
"P to the upper directory P to the root directory
"K to the first node J to the last Node
"U open the upper directory m to display the file system menu (add, delete, and move operations)
"R recursively refresh the current directory R recursively refresh the current root directory
"-----------------------------------------------------------------
"F3 NERDTree Switch
Map : NERDTreeToggle
Imap : NERDTreeToggle

"-----------------------------------------------------------------
"Plugin-NERD_commenter.vim used to annotate the code,
"[Count], cc add comments (7, cc) row by row under count cursor)
"[Count], cu the cursor below the count line by line uncomment (7, cu)
"[Count], cm the cursor below the count line tries to add block comments (7, cm)
", CA inserts/**/at the end of a row and enters the insertion mode. This command is convenient for writing comments.
"NOTE: The count parameter is optional. If no value is set, the selected row or the current row is used by default.
"-----------------------------------------------------------------
Let NERDSpaceDelims = 1 "left a space between the annotator and the statement
Let NERDCompactSexyComs = 1 "multi-line comments look better

"Set mapleader
Let mapleader = ","

"Fast reloading of the. vimrc
Map Ss: source $ VIM/$ VIMCONF
"Fast editing of. vimrc
Map Ee: e $ VIM/$ VIMCONF
"When. vimrc is edited, reload it
Autocmd! Bufwritepost $ VIMCONF source $ VIM/$ VIMCONF

"-----------------------------------------------------------------
"Plugin-DoxygenToolkit. vim is generated by the annotation document and can quickly generate the function standard annotation.
"-----------------------------------------------------------------
Let g: DoxygenToolkit_authorName = "Asins-asinsimple AT gmail DOT com"
Let g: DoxygenToolkit_briefTag_funcName = "yes"
"Map Da: DoxAuthor
Map Df: Dox
Map Db: DoxBlock
Map Dc /**/

"-----------------------------------------------------------------
"Plugin-checksyntax. vim common JavaScript syntax error check
"The default shortcut is F5.
"-----------------------------------------------------------------
Let g: checksyntax_auto = 0 "not automatically checked

"-----------------------------------------------------------------
"Plugin-snipMate. vim Automatic completion plug-in (No need configuration)
"(I discard NeoComepeCache)
"-----------------------------------------------------------------

"-----------------------------------------------------------------
"Plugin-autocomplpop. vim (No need configuration)
"-----------------------------------------------------------------

"Save the file
"Map W: w
Map, w: w
"Quit
Map, q: q
"Save and quit
Map, z ZZ
Set fileformats = unix, dos, mac
Nmap Fd: se fileformat = dos
Nmap Fu: se fileformat = unix
"Buffers operation shortcut!
Nnoremap : Bnext
Nnoremap : Bprevious

"Tab operation shortcut!
Nnoremap : Tabnext
Nnoremap : Tabprev

"About the tab shortcut
"Map tn: tabnext
"Map tp: tabprevious
"Map td: tabnew.
"Map te: tabedit
"Map tc: tabclose

"When the window is split, the shortcut key for switching needs to be connected twice, for example, moving from the lower window
"To move the cursor to the top window, you must K, which is very troublesome. Now the re ing is , Switched
"It will become very convenient.
Nnoremap H
Nnoremap J
Nnoremap K
Nnoremap L

"Some good ing conversion syntaxes (useful if different languages are mixed in a file)
Nnoremap 1: set filetype = xhtml
Nnoremap 2: set filetype = css
Nnoremap 3: set filetype = javascript
Nnoremap 4: set filetype = php

"Use Ctrl + [l | n | p | cc] to list | next | previous | jump to count the result
"Map L : Cl
"Map N : Cn
"Map P : Cp
"Map C : Cc

Do not misunderstand that all the above configurations are my original ones. I just integrated them into several networks and I thought vimrc was well written. Haha, playing the spirit of open-source sharing O ~

Many plug-ins are used in the configuration. There are too many plug-ins, but they are relatively simple. You can see how to use their help, and it is easy to find them online. I will not explain them one by one.

Need to mention is, with the ctags plug-in, this general machine does not ctags, you need to find the ctags source code to compile a: http://sourceforge.net/projects/ctags/files/ctags/5.8/ctags-5.8-1.src.rpm/download

Compilation is simple, as follows:

./Configure & make install

Copy the compiled ctags to/usr/bin/, and then your vimrc can use the ctags function.

Basically, enjoy it

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.