红帽子怎么vi编译c语言,在RedHat5.3上编译和配置Vim
今天忽然發現我的虛擬機紅帽子5.3上居然沒有Vim,暈~~
唉,要用的時候一點都不方便,沒辦法,重新下個源代碼來編譯一個吧~~
下載的地址很容易找到啦,最新的是7.3: ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2
解壓后,簡單看了下./configure -help,然后我的./configure選項如下:./configure --prefix=/usr/local --enable-multibyte --with-features=big --disable-selinux
這里需要說的是,如果你沒有使用 --disable-selinux, 它就會報: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
好的,我是加了--disable-selinux啦,但是還是報錯了,如下: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.
谷歌了好久,發現是沒有安裝ncurses那個庫,然后又從小紅帽的安裝盤里面找到庫文件,執行安裝:
Install ncurses-devel-5.5-24.20060715.x86_64.rpm
重新configure即可。
接下來就按部就班了,執行:make && make install
哈哈,現在你的Vim7.3就在 /usr/local/了 O(∩_∩)O~
有一點要小心,編譯后的Vim所使用的插件文件是在 /usr/local/share/vim/vim73/plugin目錄,別弄錯了!
現在可以來配置你的.vimrc文件,定制化你的Vim。(我覺得每次定制化自己要用東西都是很享受的,就像裝修一樣,哈哈,扯遠了;))
你可以自己重新寫一個.vimrc,也可以將 /usr/local/share/vim/vim73/里面的示例vimrc文件作為模板,看你自己啦。
我是有一個自己用了好久的vimrc文件,直接放到 ~/目錄就好了。
當然,也可以給大家曬曬我的 vimrc文件,可能大家還更關心這個,哈哈:
set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin
set nocompatible ? ? ? ? ? ?" 關閉 vi 兼容模式
syntax on ? ? ? ? ? ? ? ? ? " 自動語法高亮
filetype on
filetype plugin on
colorscheme molokai ? ? ? ? " 設定配色方案
set number ? ? ? ? ? ? ? ? ?" 顯示行號
set cursorline ? ? ? ? ? ? ?" 突出顯示當前行
set ruler ? ? ? ? ? ? ? ? ? " 打開狀態欄標尺
set shiftwidth=4 ? ? ? ? ? ?" 設定 << 和 >> 命令移動時的寬度為 4
set softtabstop=4 ? ? ? ? ? " 使得按退格鍵時可以一次刪掉 4 個空格
set tabstop=4 ? ? ? ? ? ? ? " 設定 tab 長度為 4
set nobackup ? ? ? ? ? ? ? ?" 覆蓋文件時不備份
set autochdir ? ? ? ? ? ? ? " 自動切換當前目錄為當前文件所在的目錄
filetype plugin indent on ? " 開啟插件
set backupcopy=yes ? ? ? ? ?" 設置備份時的行為為覆蓋
set ignorecase smartcase ? ?" 搜索時忽略大小寫,但在有一個或以上大寫字母時仍保持對大小寫敏感
set nowrapscan ? ? ? ? ? ? ?" 禁止在搜索到文件兩端時重新搜索
set incsearch ? ? ? ? ? ? ? " 輸入搜索內容時就顯示搜索結果
set hlsearch ? ? ? ? ? ? ? ?" 搜索時高亮顯示被找到的文本
set noerrorbells ? ? ? ? ? ?" 關閉錯誤信息響鈴
set novisualbell ? ? ? ? ? ?" 關閉使用可視響鈴代替呼叫
set t_vb= ? ? ? ? ? ? ? ? ? " 置空錯誤鈴聲的終端代碼
" set showmatch ? ? ? ? ? ? ? " 插入括號時,短暫地跳轉到匹配的對應括號
" set matchtime=2 ? ? ? ? ? ? " 短暫跳轉到匹配括號的時間
set magic ? ? ? ? ? ? ? ? ? " 設置魔術
set hidden ? ? ? ? ? ? ? ? ?" 允許在有未保存的修改時切換緩沖區,此時的修改由 vim 負責保存
set guioptions-=T ? ? ? ? ? " 隱藏工具欄
set guioptions-=m ? ? ? ? ? " 隱藏菜單欄
set smartindent ? ? ? ? ? ? " 開啟新行時使用智能自動縮進
set backspace=indent,eol,start
" 不設定在插入狀態無法用退格鍵和 Delete 鍵刪除回車符
set cmdheight=1 ? ? ? ? ? ? " 設定命令行的行數為 1
set laststatus=2 ? ? ? ? ? ?" 顯示狀態欄 (默認值為 1, 無法顯示狀態欄)
set statusline=\ %
" 設置在狀態行顯示的信息
set foldenable ? ? ? ? ? ? ?" 開始折疊
set foldmethod=syntax ? ? ? " 設置語法折疊
set foldcolumn=0 ? ? ? ? ? ?" 設置折疊區域的寬度
setlocal foldlevel=1 ? ? ? ?" 設置折疊層數為
" set foldclose=all ? ? ? ? ? " 設置為自動關閉折疊
" nnoremap
大家不要誤會上面的配置全部是我原創的哈,只是我綜合了好幾個網絡上我覺得寫得好的vimrc后我整合了下下,哈哈,發揮開源共享精神嘛O(∩_∩)O~
配置里面用到很多插件,這個太多了,但是都比較簡單,看他們的help就曉得怎么用了,網上也很容易找到,我就不再一一講解。
編譯這個很簡單,如下:
./configure && make && make install
編譯好的ctags復制到 /usr/bin/下面,然后你的vimrc就可以用ctags的功能了哈。
基本上就是這樣,enjoy it
總結
以上是生活随笔為你收集整理的红帽子怎么vi编译c语言,在RedHat5.3上编译和配置Vim的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: c语言 文件 long double 读
- 下一篇: c语言双分支结构运算符,c语言——运算符