《LINUX學習:Ubuntu配置C++開發環境以及Vim的配置》要點:
本文介紹了LINUX學習:Ubuntu配置C++開發環境以及Vim的配置,希望對您有用。如果有疑問,可以聯系我們。
新的Ubuntu系統一般都已經安裝好,可通過 “gcc –version” 以及 “g++ –version” 查看是否已經安裝好;如果沒有安裝,命令如下:
sudo apt-get install build-essential
sudo apt-get install g++-4.4
sudo apt-get install vim vim-scripts vim-doc
并創建如下.vimrc文件和三個目錄,安裝插件大概便是將.plugin和.doc文件放到對應的目錄中(解壓縮時選擇合并即可)然后修改.vimrc文件即可;
~/.vimrc(~/.vimrc文件中的配置會覆蓋/etc/vimrc中的配置);
~/.vim/plugin
~/.vim/doc
~/.vim/syntax
.vimrc中常用界說:
"設置編碼
set encoding=utf-8
set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
set fileencodings=utf-8,ucs-bom,chinese
"語言設置
set langmenu=zh_CN.UTF-8
"設置行號
set nu
"設置語法高亮
syntax enable
syntax on
"設置配色方案
colorscheme desert
"可以在buffer的任何地方使用鼠標
set mouse=a
set selection=exclusive
set selectmode=mouse,key
"高亮顯示匹配的括號
set showmatch
"去掉vi一致性
set nocompatible
"設置縮進
set tabstop=4
set softtabstop=4
set shiftwidth=4
set autoindent
set cindent
if &term=="xterm"
set t_Co=8
set t_Sb=^[[4%dm
set t_Sf=^[[3%dm
endif
"打開文件類型自動檢測功能
filetype on
vim中文贊助文檔tar包下載地址:http://sourceforge.net/projects/vimcdoc/files/vimcdoc/
解壓后其中有個doc文件夾, 將其中的內容全部復制到~/.vim/doc, 或者vim安裝目錄下的doc目錄中, 此時vim中的help信息已經是中文的了.
安裝敕令:
sudo apt-get install ctags
并在.vimrc文件中添加:
在Vim中按下Ctrl-F12快捷鍵自動生成tags文件.命令執行完后,會在源代碼目錄生成tags文件.Vim默認會自動讀取當前目錄下的tags文件,所以不必要修改~/.vimrc文件.此時,我們已經具有定義跳轉的功能了.有兩組快捷鍵是最常用的.
Ctrl-] 跳轉到光標地點符號的定義;
Ctrl-t 回到上次跳轉前的位置;
在Vim命令行下運行help ctags查詢更多功能.
具體安裝方法請參考 9715.htm
安裝之后的后果圖
這些插件更新較慢,匯總后的插件(更新截止2017-02-14)
可以到Linux公社資源站下載:
------------------------------------------朋分線------------------------------------------
免費下載地址在 http://linux.linuxidc.com/
用戶名與暗碼都是www.linuxidc.com
具體下載目錄在 /2017年材料/9月/29日/Ubuntu配置C++開發環境以及Vim的配置/
下載辦法見 7684.htm
------------------------------------------朋分線------------------------------------------
你也可以本身下載最新插件版本,下載地方分別為:
- Taglist: http://www.vim.org/scripts/script.php?script_id=273
- Cscope: http://cscope.sourceforge.net/cscope_maps.vim
- OmniCppComplete: http://www.vim.org/scripts/script.php?script_id=1520
- SuperTab: http://www.vim.org/scripts/script.php?script_id=1643
- NERDTree: http://www.vim.org/scripts/script.php?script_id=1658
- MiniBufExplorer: http://www.vim.org/scripts/script.php?script_id=159
- Winmanager: http://www.vim.org/scripts/script.php?script_id=95
"設置編碼
set encoding=utf-8
set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936
set fileencodings=utf-8,ucs-bom,chinese
"語言設置
set langmenu=zh_CN.UTF-8
"設置行號
set nu
"設置語法高亮
syntax enable
syntax on
"設置配色方案
colorscheme desert
"可以在buffer的任何處所使用鼠標
set mouse=a
set selection=exclusive
set selectmode=mouse,key
"高亮顯示匹配的括號
set showmatch
"去掉vi一致性
set nocompatible
"設置縮進
set tabstop=4
set softtabstop=4
set shiftwidth=4
set autoindent
set cindent
if &term=="xterm"
set t_Co=8
set t_Sb=^[[4%dm
set t_Sf=^[[3%dm
endif
"打開文件類型自動檢測功能
filetype on
"Ctags
map <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
"TagList
let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1
"OmniCppComplete
set nocp
filetype plugin on
"SuperTab
let g:SuperTabDefaultCompletionType="context"
"MiniBufExplorer
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1
let g:miniBufExplMoreThanOne=0
let g:miniBufExplorerMoreThanOne=0
"NERDTree WinManager
let g:NERDTree_title="[NERDTree]"
let g:winManagerWindowLayout="NERDTree|TagList"
let g:bufExplorerMaxHeight=30
function! NERDTree_Start()
exec 'NERDTree'
endfunction
function! NERDTree_IsValid()
return 1
endfunction
nmap wm :WMToggle<CR>
?
Vim入門根基知識集錦? 40903.htm
Vim入門根基教程 40279.htm
把Vim打造成優秀的C++ IDE? 32262.htm
Ubuntu 14.04進級Vim7.4到8.0? 36816.htm
Vim安裝youcompleteme自動補全插件? 37665.htm
Linux Vim編纂器使用簡單講解? 38930.htm
Vim文本編纂器? 42275.htm
Vim安裝與設置裝備擺設進階版 41724.htm
Vim編纂器使用教程? 45885.htm
Ubuntu 16.04 Vim YouCompleteMe自動補全的安裝設置裝備擺設與使用? 41088.htm
Linux文本編纂器Vim基礎教程? 46930.htm
本文永遠更新鏈接地址:47175.htm
更多LINUX教程,盡在維易PHP學院專欄。歡迎交流!
轉載請注明本頁網址:
http://www.snjht.com/jiaocheng/6545.html