zoukankan      html  css  js  c++  java
  • vim的学习笔记(3)

    这个是一个更详细的vim的配置了

    也是我非常喜欢的

    不过vim下函数还是不能高亮啊。。。。

    可以直接把这文件复制下来覆盖vimrc用了= =

    " All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
    " /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
    " you can find below.  If you wish to change any of those settings, you should
    " do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
    " everytime an upgrade of the vim packages is performed.  It is recommended to
    " make changes after sourcing debian.vim since it alters the value of the
    " 'compatible' option.
    
    " This line should not be removed as it ensures that various options are
    " properly set to work with the Vim-related packages available in Debian.
    runtime! debian.vim
    
    " Uncomment the next line to make Vim more Vi-compatible
    " NOTE: debian.vim sets 'nocompatible'.  Setting 'compatible' changes numerous
    " options, so any other options should be set AFTER setting 'compatible'.
    "set compatible
    
    " Vim5 and later versions support syntax highlighting. Uncommenting the next
    " line enables syntax highlighting by default.
    if has("syntax")
      syntax on
    endif
    
    " If using a dark background within the editing area and syntax highlighting
    " turn on this option as well
    "set background=dark
    
    " Uncomment the following to have Vim jump to the last position when
    " reopening a file
    "if has("autocmd")
    "  au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
    "endif
    
    " Uncomment the following to have Vim load indentation rules and plugins
    " according to the detected filetype.
    "if has("autocmd")
    "  filetype plugin indent on
    "endif
    
    " The following are commented out as they cause vim to behave a lot
    " differently from regular Vi. They are highly recommended though.
    "set showcmd        " Show (partial) command in status line.
    "set showmatch        " Show matching brackets.
    "set ignorecase        " Do case insensitive matching
    "set smartcase        " Do smart case matching
    "set incsearch        " Incremental search
    "set autowrite        " Automatically save before commands like :next and :make
    "set hidden             " Hide buffers when they are abandoned
    "set mouse=a        " Enable mouse usage (all modes)
    
    " Source a global configuration file if available
    if filereadable("/etc/vim/vimrc.local")
      source /etc/vim/vimrc.local
    endif
    
    
    "当文件在外部被修改时,自动重新读取
    set autoread
    
    "设定默认解码
    set fenc=utf-8
    set fencs=utf-8,usc-bom,euc-jp,gb18030,gbk,gb2312,cp936
    
    "history文件中需要记录的行数
    set history=500
    
    "在处理未保存或只读文件的时候,弹出确认
    set confirm
    
    "与windows共享剪贴板
    set clipboard+=unnamed 
    
    "侦测文件类型
    filetype on
    
    "载入文件类型插件
    filetype plugin on 
    
    "为特定文件类型载入相关缩进文件
    filetype indent on 
    
    set completeopt=longest,menu
    
    
    "保存全局变量
    set viminfo+=! 
    
    "带有如下符号的单词不要被换行分割
    set iskeyword+=_,$,@,%,#,- 
    
    "不要生成swap文件,当buffer被丢弃的时候隐藏它
    setlocal noswapfile 
    set bufhidden=hide 
    
    "字符间插入的像素行数目
    set linespace=0
    
    "增强模式中的命令自动完成操作
    set wildmenu
    
    "在状态行上显示光标所在位置的行号和列号
    set ruler 
    set rulerformat=%20(%2*%<%f%=\ %m%r\ %3l\ %c\ %p%%%) 
    
    "命令行(在状态行下)的高度,默认为1,这里是2
    set cmdheight=2
    
    "通过使用:commands命令,告诉我们文件的哪一行被改变过
    set report=0
    
    "在被侵害的窗口间显示空白,便于阅读
    set fillchars=vert:\ ,stl:\ ,stlnc:\ 
    
    "在搜索时,输入的词句的逐字符高亮
    set incsearch
    
    "输入:set list 命令是应该是显示些啥?
    set listchars=tab:\|\ ,trail:.,extends:>,precedes:<,eol:$ 
    
    "不要闪烁
    set novisualbell
    
    "状态行显示的内容(包括文件类型和解码)
    "set statusline=%F%m%r%h%w\[POS=%l,%v][%p%%]\%{strftime(\"%d/%m/%y\ -\ %H:%M\")} 
    
    "总是显示状态行
    "set laststatus=2
    
    "自动格式化
    set formatoptions=tcrqn 
    
    set hlsearch
    
    
    "半透明设置
    au GUIEnter * call libcallnr("vimtweak.dll", "SetAlpha", 234)
    
    "把空格变成 : 
    nmap <space> :
    
    
    "显示命令
    set showcmd
    
    set magic
    
    set ai              " 自动缩进
    set si              " 智能缩进
    
    
    
    
    
    
    
    inoremap <leader>1 ()<esc>:let leavechar=")"<cr>i
    inoremap <leader>2 []<esc>:let leavechar="]"<cr>i
    inoremap <leader>3 {}<esc>:let leavechar="}"<cr>i
    inoremap <leader>4 {<esc>o}<esc>:let leavechar="}"<cr>O
    inoremap <leader>q ''<esc>:let leavechar="'"<cr>i
    inoremap <leader>w ""<esc>:let leavechar='"'<cr>i
    
    
    :inoremap ( ()<ESC>i
    :inoremap ) <c-r>=ClosePair(')')<CR>
    :inoremap { {<CR>}<ESC>O
    :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
    endfunction
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    set nobackup
    "set ecnoding=utf-8
    "set encoding=utf-8 fileencoding=ucs-bom,utf-8,cp936
    
    set tags=/home/hjw951/arm/linux-2.6.12/tags
    
    
    
    
    
    
    
    syntax enable
    set guifont=Courier_New:h11:cANSI
    colorscheme evening
    syntax on
    set tabstop=4      "制表符为4
    "统一缩进为4
    set softtabstop=4   
    set shiftwidth=4
    
    set cindent      "使用C样式的缩进
    
    set showmatch            "高亮显示匹配的括号
    set matchtime=5          "匹配括号高亮的时间(0.1s)
    set smartindent            "为C程序提供自动缩进
    set shiftwidth=4        "»»ÐÐʱ,œ»ŽíʹÓÃ4žö¿Õžñ
    set autoindent            "继承前一行的缩进方式,特别适用于多行注释
    set ai!                    "ÉèÖÃ×Ô¶¯Ëõœø
    
    set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s
    set nu
    if &term=="xterm"
        set t_Co=8
         set t_Sb=^[[4%dm
        set t_Sf=^[[3%dm
    endif
    
    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
  • 相关阅读:
    vi/vim键盘图
    PostgreSQL学习----命令或问题小结
    PostgreSQL学习----模式schema
    OSM
    Spring基础(9) : 自动扫描
    Spring基础(8) : properties配置文件
    Spring基础(8) : 延迟加载,Bean的作用域,Bean生命周期
    Spring基础(7) : Bean的名字
    Spring基础(6) : 普通Bean对象中保存ApplicationContext
    Spring基础(5): 构造函数注入无法处理循环依赖
  • 原文地址:https://www.cnblogs.com/louzhang/p/2575110.html
Copyright © 2011-2022 走看看