• 推荐vi配置及说明


    配置包含 .vim文件夹 、 .vimrc 、《vim使用高手》

    vi配置及使用进阶  http://vdisk.weibo.com/s/oh6JB

    下载后直接解压放在自己的目录下 cd ~

    .vimrc 配置相当详细,包含代码高亮等各种常用设置及代码折叠、文件列表、taglist等多种插件,用起来相当爽。

    对于vi使用不太熟练的coder来说,绝对是最好的选择。

    记住一定要配合压缩文件内文档 《vim使用高手》同时使用,

    "非兼容模式
    set nocp
    "set backspace=indent,eol,start
    "set ai
    "底部标尺
    set ru
    "搜索时高亮显示结果
    set hls
    "输入搜索命令时,显示目前输入的模式的匹配位置
    set is
    "显示行号
    set number
    "使用:e命令的时候 可选项预览
    set wildmenu
    "文件默认编码
    set enc=utf-8
    "文件保存时使用的编码
    "fileencoding=utf-8
    "打开文件进行解码的猜测列表,优先以utf-8打开
    set fileencodings=utf-8,gbk
    "文件默认格式unix
    set ff=unix
    "缩进为4个空格宽度
    set tabstop=4
    "自动缩进使用的空格数
    set shiftwidth=4
    "编辑插入tab时,把tab算作的空格数
    set softtabstop=4
    "缩进使用空格
    set expandtab
    "自动缩进
    set autoindent
    "backspace键更正
    set backspace=2
    set nocompatible
    "鼠标捕捉
    set mouse=
    "打开语法高亮
    syntax on
    syntax enable
    set comments=sl:/*,mb:*,ex:*/
    "设置字典
    autocmd FileType javascript set dictionary=~/.vim/dict/javascript.dict
    set complete-=k complete+=k
    
    filetype plugin on
    au FileType php setlocal dict+=~/.vim/dict/php_funclist.txt
    au FileType php call AddPHPFuncList()
    function AddPHPFuncList()
        set dictionary-=~/.vim/dict/php_funclist.txt dictionary+=~/.vim/dict/php_funclist.txt
        set complete-=k complete+=k
    endfunction
    "默认配色为darkblue matrix可用
    color matrix 
    "darkplus django fruity inkpot darkbluefix industrial ironman matrix native summerfruit
    
    "显示标签栏 0: 从不 1: 大于1个时显示 2: 总是
    set showtabline=2
    
    " 重新载入配置
    map <leader>s :source ~/.vimrc<CR>
    
    "映射F12键为行号的开关
    map <F12> :set number!<CR>
    nmap <C-N> :tabnext<CR>
    nmap <C-P> :tabprevious<CR>
    
    "nnoremap <C-c> :update<CR>
    "cnoremap <C-c> <Esc>:update<CR>
    "inoremap <C-c> <Esc>:update<CR>
    
    " insert mode shortcut
    ""inoremap <C-h> <Left>
    ""inoremap <C-j> <Down>
    "inoremap <C-k> <Up>
    "inoremap <C-l> <Right>
    
    "inoremap ( ()<ESC>i
    "inoremap ) <c-r>=ClosePair(')')<CR>
    inoremap { {}<ESC>i
    inoremap } <c-r>=ClosePair('}')<CR>
    inoremap [ []<ESC>i
    inoremap ] <c-r>=ClosePair(']')<CR>
    inoremap < <><ESC>i
    inoremap > <c-r>=ClosePair('>')<CR>
    
    function ClosePair(char)
        if getline('.')[col('.') - 1] == a:char
            return "\<Right>"
        else
            return a:char
        endif
    endf
    " command line
    "cnoremap <C-A> <Home>
    "cnoremap <C-E> <End>
    "cnoremap <C-B> <Left>
    "cnoremap <C-F> <Right>
    
    " 打开php折叠
    let php_folding = 1 
    " 打开javascript折叠
    let b:javascript_fold=1
    " 打开javascript对dom、html和css的支持
    let javascript_enable_domhtmlcss=1
    
    filetype on
    au BufNewFile,BufRead *.as set filetype=actionscript
    " Multiple filetype for freemarker
    au BufNewFile,BufRead *.ftl set filetype=ftl.html
    au BufReadCmd *.jar,*.xpi,*.egg call zip#Browse(expand("<amatch>"))
    autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
    autocmd FileType css set foldmethod=marker
    autocmd FileType python filetype plugin indent on
    autocmd FileType python setlocal et sta sw=4 sts=4
    
    " 设置javascriptlint
    autocmd FileType javascript set makeprg=jslint\ %
    autocmd FileType javascript set errorformat=%f(%l):\ %m
    autocmd FileType javascript inoremap <silent> <F9> <C-O>:make<CR>
    autocmd FileType javascript map <silent> <F9> :make<CR>
    
    
    " vimwiki
    let g:vimwiki_use_mouse = 1
    let g:vimwiki_list = [{
    \'path': '~/Dropbox/document/vimwiki/',
    \'path_html': '~/Dropbox/document/vimwiki/html/',
    \'html_header': '~/Dropbox/document/vimwiki/template/header.tpl',
    \}]
    
    
    """""""""""""""""""""""""""""
    " TagList setting
    """""""""""""""""""""""""""""
    "Exuberant ctags程序的位置
    let Tlist_Ctags_Cmd="/usr/bin/ctags"
    let Tlist_Inc_Winwidth=0
    "在右侧窗口打开
    let Tlist_Use_Right_Window=1
    nnoremap <silent><F4> :TlistToggle<CR>
    "只显示当前文件的tag
    let Tlist_File_Fold_Auto_Close=1
    "如果Taglist是最后一个窗口则退出vim
    let Tlist_Exit_OnlyWindow = 1
    let Tlist_Auto_Highlight_Tag = 1
    let Tlist_Auto_Open = 0
    let Tlist_Auto_Update = 1
    let Tlist_Close_On_Select = 0
    let Tlist_Compact_Format = 0
    let Tlist_Display_Prototype = 0
    let Tlist_Display_Tag_Scope = 1
    let Tlist_Enable_Fold_Column = 0
    let Tlist_GainFocus_On_ToggleOpen = 1
    let Tlist_Hightlight_Tag_On_BufEnter = 1
    let Tlist_Max_Submenu_Items = 1
    let Tlist_Max_Tag_Length = 30
    let Tlist_Process_File_Always = 0
    let Tlist_Show_Menu = 0
    let Tlist_Show_One_File = 0
    let Tlist_Sort_Type = "order"
    let Tlist_Use_Horiz_Window = 0
    let Tlist_WinWidth = 38
    let tlist_php_settings = 'php;c:class;i:interfaces;d:constant;f:function'
    "-- ctags setting --
    set tags=tags
    set tags+=./tags " add current directory's generated tags file
    
    """"""""""""""""""""""""""""""
    " BufExplore settingr
    """"""""""""""""""""""""""""""
    let g:bufExplorerDefaultHelp=0       " Do not show default help.
    let g:bufExplorerShowRelativePath=1  " Show relative paths.
    let g:bufExplorerSortBy='mru'        " Sort by most recently used.
    let g:bufExplorerSplitRight=0        " Split left.
    let g:bufExplorerSplitVertical=1     " Split vertically.
    let g:bufExplorerSplitVertSize = 30  " Split width
    let g:bufExplorerUseCurrentWindow=1  " Open in new window.
    
    """"""""""""""""""""""""""""""
    " winManager setting
    """"""""""""""""""""""""""""""
    "let g:winManagerWindowLayout = \""BufExplorer,FileExplorer|TagList"
    let g:winManagerWindowLayout = "FileExplorer"
    let g:winManagerWidth = 30
    let g:defaultExplorer = 0
    nmap <C-W><C-F> :FirstExplorerWindow<CR>
    nmap <C-W><C-B> :BottomExplorerWindow<CR>
    nmap <silent> <leader>wm :WMToggle<CR> 
    
    " plugin - NERD_tree.vim 以树状方式浏览系统中的文件和目录
    " :ERDtree 打开NERD_tree         :NERDtreeClose    关闭NERD_tree
    " o 打开关闭文件或者目录         t 在标签页中打开
    " T 在后台标签页中打开           ! 执行此文件
    " p 到上层目录                   P 到根目录
    " K 到第一个节点                 J 到最后一个节点
    " u 打开上层目录                 m 显示文件系统菜单(添加、删除、移动操作)
    " r 递归刷新当前目录             R 递归刷新当前根目录
    "-----------------------------------------------------------------
    " F3 NERDTree 切换
    map <F3> :NERDTreeToggle<CR>
    imap <F3> <ESC>:NERDTreeToggle<CR>
    
    "-- omnicppcomplete setting --
    set completeopt=menu,menuone
    let OmniCpp_MayCompleteDot = 1 " autocomplete with .
    let OmniCpp_MayCompleteArrow = 1 " autocomplete with ->
    let OmniCpp_MayCompleteScope = 1 " autocomplete with ::
    let OmniCpp_SelectFirstItem = 2 " select first item (but don't insert)
    let OmniCpp_NamespaceSearch = 2 " search namespaces in this and included files
    let OmniCpp_ShowPrototypeInAbbr = 1 " show function prototype  in popup window
    let OmniCpp_GlobalScopeSearch=1
    let OmniCpp_DisplayMode=1
    let OmniCpp_DefaultNamespaces=["std"]
    
    "-----------------------------------------------------------------
    " plugin - NERD_commenter.vim   注释代码用的,
    " [count],cc 光标以下count行逐行添加注释(7,cc)
    " [count],cu 光标以下count行逐行取消注释(7,cu)
    " [count],cm 光标以下count行尝试添加块注释(7,cm)
    " ,cA 在行尾插入 /* */,并且进入插入模式。 这个命令方便写注释。
    " 注:count参数可选,无则默认为选中行或当前行
    "-----------------------------------------------------------------
    let NERDSpaceDelims=1       " 让注释符与语句之间留一个空格
    let NERDCompactSexyComs=1   " 多行注释时样子更好看
    
    
    "-----------------------------------------------------------------
    " plugin - DoxygenToolkit.vim  由注释生成文档,并且能够快速生成函数标准注释
    "-----------------------------------------------------------------
    let g:DoxygenToolkit_authorName="Asins - asinsimple AT gmail DOT com"
    let g:DoxygenToolkit_briefTag_funcName="yes"
    map <leader>da :DoxAuthor<CR>
    map <leader>df :Dox<CR>
    map <leader>db :DoxBlock<CR>
    map <leader>dc a /*  */<LEFT><LEFT><LEFT>
    
    "-----------------------------------------------------------------
    " plugin - NeoComplCache.vim    自动补全插件
    "-----------------------------------------------------------------
    let g:AutoComplPop_NotEnableAtStartup = 1
    let g:NeoComplCache_EnableAtStartup = 1
    let g:NeoComplCache_SmartCase = 1
    let g:NeoComplCache_TagsAutoUpdate = 1
    let g:NeoComplCache_EnableInfo = 1
    let g:NeoComplCache_EnableCamelCaseCompletion = 1
    let g:NeoComplCache_MinSyntaxLength = 3
    let g:NeoComplCache_EnableSkipCompletion = 1
    let g:NeoComplCache_SkipInputTime = '0.5'
    let g:NeoComplCache_SnippetsDir = $VIMFILES.'/snippets'
    " <TAB> completion.
    inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
    " snippets expand key
    imap <silent> <C-e> <Plug>(neocomplcache_snippets_expand)
    smap <silent> <C-e> <Plug>(neocomplcache_snippets_expand)
    
    " 设置注释
    "vmap <F2> <Esc><Esc>:call EnhancedCommentify('yes','comment',line("'<"),line("'>"))<CR>
    "取消注释
    "vmap <M-F2> <Esc><Esc>:call EnhancedCommentify('yes','decomment',line("'<"),line("'>"))<CR>
    " plugin - NERD_commenter.vim   注释代码用的,
    " " [count],cc 光标以下count行逐行添加注释(7,cc)
    " " [count],cu 光标以下count行逐行取消注释(7,cu)
    " " [count],cm 光标以下count行尝试添加块注释(7,cm)
    " " ,cA 在行尾插入 /* */,并且进入插入模式。 这个命令方便写注释。
    " " 注:count参数可选,无则默认为选中行或当前行
    " "-----------------------------------------------------------------
    let NERDSpaceDelims=1       " 让注释符与语句之间留一个空格
    let NERDCompactSexyComs=1   " 多行注释时样子更好看
    "
    "
    " "-----------------------------------------------------------------
    " " plugin - DoxygenToolkit.vim  由注释生成文档,并且能够快速生成函数标准注释
    " "-----------------------------------------------------------------
    let g:DoxygenToolkit_authorName="Asins - asinsimple AT gmail DOT com"
    let g:DoxygenToolkit_briefTag_funcName="yes"
    map <leader>da :DoxAuthor<CR>
    map <leader>df :Dox<CR>
    map <leader>db :DoxBlock<CR>
    map <leader>dc a /*  */<LEFT><LEFT><LEFT>
    
    let g:DoxygenToolkit_authorName="<*****@********>"
    let s:licenseTag = "Copyright(C)\<enter>"
    "let s:licenseTag = s:licenseTag . "For free\<enter>"
    let g:DoxygenToolkit_copyRightString="Copyright © 2010-2012 SINA Weibo,All Rights Reserved(http://www.weibo.com)"
    let s:licenseTag = s:licenseTag . "All right reserved\<enter>"
    let g:DoxygenToolkit_licenseTag = s:licenseTag
    let g:DoxygenToolkit_briefTag_funcName="yes"
    let g:doxygen_enhanced_color=1
  • 相关阅读:
    以相同类型的一个对象初始化另一个对象
    java之StringBuilder类详解
    java之StringBuffer类详解
    jquery在线引用地址
    java之抽象类
    Oracle动态执行表不可访问
    libvirt-qemu-TLS加密虚拟机传输实例分析
    查看系统是虚拟机还是物理机
    WorkStation 虚拟机迁移到 ESXi
    Django入门------常见问题
  • 原文地址:https://www.cnblogs.com/gaoj87/p/2871702.html
Copyright © 2020-2023  润新知