• gvim代码补全


    gvim 代码自动提示 插件

    插件名:AutoComplPop 

    下载地址:http://www.vim.org/scripts/script.php?script_id=1879

    gvim 代码模板补全 插件

    插件名:snipMate 

    下载地址:http://www.vim.org/scripts/script.php?script_id=2540

     

    通过vim字典补全,实现php函数名自动补全 字典到网上搜索下载

    将下面内容加入.vimrc文件中即可

    au FileType php call AddPHPFuncList()

    function AddPHPFuncList()

        set dictionary-=$VIM/vimfiles/extra/php_funclist.txt dictionary+=$VIM/vimfiles/extra/php_funclist.txt

        set complete-=k complete+=k

    endfunction

    使用方式(关键字+<tab>

     

    "代码自动补全  (按快捷键Ctrl+X+O

    set autoindent

    autocmd FileType python set omnifunc=pythoncomplete#Complete

    autocmd FileType javascrīpt set omnifunc=javascrīptcomplete#CompleteJS

    autocmd FileType html set omnifunc=htmlcomplete#CompleteTags

    autocmd FileType css set omnifunc=csscomplete#CompleteCSS

    autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags

    autocmd FileType php set omnifunc=phpcomplete#CompletePHP

    autocmd FileType c set omnifunc=ccomplete#Complete

     

    关键字补全 (快捷键 Ctrl+P

     

    vim中实现括号和引号自动补全

    将下面内容加入.vimrc文件中即可

     

    inoremap ( ()<Esc>i

    inoremap [ []<Esc>i

    inoremap { {<CR>}<Esc>O

    autocmd Syntax html,vim inoremap < <lt>><Esc>i| inoremap > <c-r>=ClosePair('>')<CR>

    inoremap ) <c-r>=ClosePair(')')<CR>

    inoremap ] <c-r>=ClosePair(']')<CR>

    inoremap } <c-r>=CloseBracket()<CR>

    inoremap " <c-r>=QuoteDelim('"')<CR>

    inoremap ' <c-r>=QuoteDelim("'")<CR>

     

    function ClosePair(char)

     if getline('.')[col('.') - 1] == a:char

     return "\<Right>"

     else

     return a:char

     endif

    endf

     

    function CloseBracket()

     if match(getline(line('.') + 1), '\s*}') < 0

     return "\<CR>}"

     else

     return "\<Esc>j0f}a"

     endif

    endf

     

    function QuoteDelim(char)

     let line = getline('.')

     let col = col('.')

     if line[col - 2] == "\\"

     "Inserting a quoted quotation mark into the string

     return a:char

     elseif line[col - 1] == a:char

     "Escaping out of the string

     return "\<Right>"

     else

     "Starting a string

     return a:char.a:char."\<Esc>i"

     endif

    endf

     

    前望
  • 相关阅读:
     随机选择数据库记录的方法
    交叉查询
    Delphi编辑器颜色设置
    Delphi Dll中多线程无法使用Synchronize同步的解决方法(转)
    Delphi FTP例子源码
    DELPHI之备忘四
    界面美化代码
    使Form响应滚轮事件
    配色卡
    Delphi http传输备忘
  • 原文地址:https://www.cnblogs.com/ybbqg/p/2490617.html
Copyright © 2020-2023  润新知