Ubuntu下vim外掛程式的線上安裝

來源:互聯網
上載者:User

今天弄vim外掛程式搞了好久,最後還是發現線上安裝是最省事兒的~~


1.安裝taglist —瀏覽源碼

源碼瀏覽外掛程式taglist可以把代碼中的函數、結構體、變數等羅列在taglist列表中,檔案中包含了那些元素,一目瞭然。

# vim-addons install taglist  

 

在vimrc中加入taglist的配置描述

.vimrc for taglist                                     let Tlist_Show_One_File = 1       “ 只顯示當前檔案的taglet Tlist_Use_Left_Window = 1     “ 在左側顯示taglistlet Tlist_Exit_OnlyWindow = 1     “ 當taglist是最後一個視窗時,退出vimlet Tlist_Enable_Fold_Column = 1  “ 顯示摺疊樹let Tlist_WinWidth = 40           “ 設定taglist的寬度let Tlist_WinHeight = 50          “ 設定taglist的高度

安裝完成後,vim開啟後介面如下:

如果要讓開啟vim的時候自動開啟taglist則在vimrc中添加:let Tlist_Auto_Open=1   

2 安裝winmanager —檔案瀏覽和視窗管理

# vim-addons install winmanager  

 

安裝完成後,進入vim,輸入:WMToggle,可以看到左邊出現了檔案清單。

通過修改vimrc檔案,將命令:WMToggle映射為normal模式下的wm命令,這樣,下次使用時,就可以直接輸入wm。

 

.vimrc for winmanagernmap wm :WMToggle<cr> 

 

 

把檔案瀏覽以及taglist整合在最左側顯示,檔案瀏覽在上,taglist在下。

.vimrclet g:winManagerWindowLayout = “FileExplorer|TagList”      let g:winManagerWidth = 40          let g:winManagerHeight = 80    

安裝完成後在命令列輸入:VMToggle顯示如下:



我的設定檔如下:

     1" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just     2" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime     3" you can find below.  If you wish to change any of those settings, you should     4" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten     5" everytime an upgrade of the vim packages is performed.  It is recommended to     6" make changes after sourcing debian.vim since it alters the value of the     7" 'compatible' option.     8     9" This line should not be removed as it ensures that various options are    10" properly set to work with the Vim-related packages available in Debian.    11runtime! debian.vim    12    13" Uncomment the next line to make Vim more Vi-compatible    14" NOTE: debian.vim sets 'nocompatible'.  Setting 'compatible' changes numerous    15" options, so any other options should be set AFTER setting 'compatible'.    16"set compatible    17    18" Vim5 and later versions support syntax highlighting. Uncommenting the next    19" line enables syntax highlighting by default.    20if has("syntax")    21  syntax on    22endif    23    24" If using a dark background within the editing area and syntax highlighting    25" turn on this option as well    26"set background=dark    27    28" Uncomment the following to have Vim jump to the last position when    29" reopening a file    30"if has("autocmd")    31"  au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif    32"endif    33    34" Uncomment the following to have Vim load indentation rules and plugins    35" according to the detected filetype.    36"if has("autocmd")    37"  filetype plugin indent on    38"endif    39    40" The following are commented out as they cause vim to behave a lot    41" differently from regular Vi. They are highly recommended though.    42"set showcmd" Show (partial) command in status line.    43"set showmatch" Show matching brackets.    44"set ignorecase" Do case insensitive matching    45"set smartcase" Do smart case matching    46"set incsearch" Incremental search    47"set autowrite" Automatically save before commands like :next and :make    48"set hidden             " Hide buffers when they are abandoned    49"set mouse=a" Enable mouse usage (all modes)    50    51" Source a global configuration file if available    52if filereadable("/etc/vim/vimrc.local")    53  source /etc/vim/vimrc.local    54endif    55set tags=tags    56set autochdir    57    58"顯示行號    59set number    60    61"自動縮排與C語言風格縮排    62set autoindent    63set cindent    64    65"縮排寬度    66set tabstop=4    67set softtabstop=4    68set shiftwidth=4    69"建議開啟expandtab選項,會自動將tab擴充很空格,代碼縮排會更美觀    70set expandtab    71"set noexpandtab    72    73"switch case 對齊風格    74set cino=g0,:0    75    76    77"    78" taglist    79"    80let Tlist_Show_One_File=1    "只顯示當前檔案的tags    81let Tlist_WinWidth=40        "設定taglist寬度    82let Tlist_Exit_OnlyWindow=1  "tagList視窗是最後一個視窗,則退出Vim    83let Tlist_Use_Right_Window=1 "在Vim視窗右側顯示taglist視窗    84let Tlist_Auto_Open=1    85let g:winManagerWindowLayout = “FileExplorer|TagList”          86let g:winManagerWidth = 40              87let g:winManagerHeight = 80   



相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.