zoukankan      html  css  js  c++  java
  • 个人使用的.vimrc 供大家参考

    
    

    set nocompatible
    source $VIMRUNTIME/vimrc_example.vim
    source $VIMRUNTIME/mswin.vim
    behave mswin

    
    

    set diffexpr=MyDiff()
    function MyDiff()
    let opt = '-a --binary '
    if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
    if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
    let arg1 = v:fname_in
    if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
    let arg2 = v:fname_new
    if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
    let arg3 = v:fname_out
    if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
    let eq = ''
    if $VIMRUNTIME =~ ' '
    if &sh =~ '\<cmd'
    let cmd = '"' . $VIMRUNTIME . '\diff"'
    let eq = '""'
    else
    let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
    endif
    else
    let cmd = $VIMRUNTIME . '\diff'
    endif
    silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
    endfunction

    """"""""""""""""""""" 编码设置 """""""""""""""""""""""""" 
    if has("multi_byte") 
      " 可自动识别的文件类型为带 BOM 字符的 Unicode 文件、UTF-8 编码的文件和 GBK 编码的文件。 
      "set bomb 
      set fileencodings=ucs-bom,utf-8,chinese,taiwan,japan,korea,latin1 
      " CJK environment detection and corresponding setting 
      if v:lang =~ "^zh_CN" 
        " Simplified Chinese, on Unix euc-cn, on MS-Windows cp936 
        set encoding=chinese
        set termencoding=chinese
        if &fileencoding == '' 
          set fileencoding=chinese
        endif 
      elseif v:lang =~ "^zh_TW" 
        " Traditional Chinese, on Unix euc-tw, on MS-Windows cp950 
        set encoding=taiwan 
        set termencoding=taiwan 
        if &fileencoding == '' 
          set fileencoding=taiwan 
        endif 
      elseif v:lang =~ "^ja_JP" 
        " Japanese, on Unix euc-jp, on MS-Windows cp932 
        set encoding=japan 
        set termencoding=japan 
        if &fileencoding == '' 
          set fileencoding=japan 
        endif 
      elseif v:lang =~ "^ko" 
        " Korean on Unix euc-kr, on MS-Windows cp949 
        set encoding=korea 
        set termencoding=korea 
        if &fileencoding == '' 
          set fileencoding=korea 
        endif 
      endif 
       " Detect UTF-8 locale, and override CJK setting if needed 
      if v:lang =~ "utf8$" || v:lang =~ "UTF-8$" 
        set encoding=utf-8 
      endif 
    else 
      echoerr 'Sorry, this version of (g)Vim was not compiled with "multi_byte"' 
    endif
    " 指定菜单语言
    set encoding=utf-8
    set termencoding=utf-8
    set langmenu=zh_CN.UTF-8
    language message zh_CN.UTF-8
    source $VIMRUNTIME/delmenu.vim
    source $VIMRUNTIME/menu.vim
    "Chinese in Linux encoding
    set fileencodings=ucs-bom,utf-8,cp936,gb18030,gb2312,big5,latin-1
    " 设置新文件的编码为 UTF-8
    set fileencoding=utf8
    "标题栏显示编码类型
    auto BufEnter * let &titlestring = hostname() . ":" . expand("%:p") . " (" . &fenc . ")"
    "设置为智能缩进
    set smartindent
    " 解决自动换行格式下, 如高度在折行之后超过窗口高度结果这一行看不到的问题
    set display=lastline
    "启动时不显示 捐赠提示
    set shortmess=atI
    "Table为4
    set tabstop=4
    set cindent shiftwidth=4
    set autoindent shiftwidth=4
    "SuperTable
    let g:SuperTabRetainCompletionType=2
    let g:SuperTabDefaultCompletionType="<C-X><C-O>"
    "zencoding
    let g:user_zen_settings = { 
      \  'indentation' : '  ', 
      \  'perl' : { 
      \    'aliases' : { 
      \      'req' : 'require ' 
      \    }, 
      \    'snippets' : { 
      \      'use' : "use strict\nuse warnings\n\n", 
      \      'warn' : "warn \"|\";", 
      \    } 
      \  } 
      \} 
     
      let g:user_zen_expandabbr_key = '<c-e>'    "设置为ctrl+e展开
      let g:use_zen_complete_tag = 1
    " 插入模式下上下左右移动光标
    inoremap <c-h> <left>
    inoremap <c-l> <right>
    inoremap <c-j> <c-o>gj
    inoremap <c-k> <c-o>gk
    """""""""" 自动补全命令 """"""""""
    autocmd Filetype c      set omnifunc=ccomplete#Complete
    autocmd Filetype html   set omnifunc=htmlcomplete#CompleteTags
    autocmd Filetype xml    set omnifunc=xmlcomplete#CompleteTags
    autocmd Filetype python set omnifunc=pythoncomplete#CompleteTags
    autocmd Filetype tex    set omnifunc=syntaxcomplete#Complete
    autocmd FileType css set omnifunc=csscomplete#CompleteCSS
    "语法高亮显示
    execute pathogen#infect()
    syntax enable
    syntax on
    colorscheme desert
    setlocal cursorline
    set cuc
    set nobackup
    set ai
    set si
    set showcmd
    "fencview编码识别
    let g:fencview_autodetect = 0
    let g:fencview_checklines = '*'
    let g:fenview_progressbar = 1
    " F9、F10去除、显示工具、菜单栏 
    map <F9> <Esc>:set go=<CR> 
    map <F10> <Esc>:set go=mT<CR> 
    " F11全屏,F12还原窗口 
    map <F11> <Esc>:simalt ~x<CR> 
    map <F12> <Esc>:set columns=80 lines=21<cr>
    " 自动换行 
    set wrap 
    "设定显示行数
    set number
    "设置文件保存格式
    set fileformats=dos,unix
    " 命令行补全
    set wildmenu
    "拼写检查
    set spell
    set title
    set showcmd
    filetype on 
    filetype plugin on
    filetype indent on
    set completeopt=longest,menu
    " 自动补全括号,包括大括号
    :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>
    :inoremap " ""<ESC>i
    :inoremap ' ''<ESC>i
    function ClosePair(char)
    if getline('.')[col('.') - 1] == a:char
    return "\<Right>"
    else
    return a:char
    endif
    endf

    这个用到三个插件: fencview      zencoding    supertab

    fencview :     https://github.com/vim-scripts/FencView.vim

    zencoding    https://github.com/mattn/zencoding-vim

    supertab       https://github.com/ervandew/supertab

    这个vimrc的编码是utf-8编码的, vim vimrc      输入命令set fenc=utf-8  ,然后把上面的代码粘贴。

  • 相关阅读:
    C#神奇的扩展方法
    OCIEnvCreate 失败,返回代码为 -1,但错误消息文本不可用
    xslt格式化日期的方法
    c# 对象存cookie
    Oracle Client安装报错:引用数据不可用于验证此操作系统分发的先决条件
    Web.config中设置启用webservice远程调试访问 参数看不到
    ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务
    IIS无法加载字体文件(*.woff,*.svg)的解决办法
    word 里面没输入法
    photoshop cc 2018破解补丁(pscc2018注册机) 附使用方法
  • 原文地址:https://www.cnblogs.com/dying/p/3092880.html
Copyright © 2011-2022 走看看