zoukankan      html  css  js  c++  java
  • all about vim

    传说是“史上最强.vimrc”:

    http://amix.dk/vim/vimrc.html

    我自己曾经的.vimrc

    if v:lang =~ "utf8$" || v:lang =~ "UTF-8$"
       set fileencodings=utf-8,latin1
    endif

    set nocompatible " Use Vim defaults (much better!)
    set bs=indent,eol,start " allow backspacing over everything in insert mode
    set viminfo='20,\"50 " read/write a .viminfo file, don't store more
                            " than 50 lines of registers
    set history=50 " keep 50 lines of command line history
    set ruler " show the cursor position all the time
    set smartindent " Judging former line's indent, smart select indent, for C-like language
    set cindent " 传说是 C-like, 谁用谁知道

    " 设定默认解码
    set encoding=utf-8
    " set fileencodings=utf-8, chinese,latin-1

    " Environment {
    " Setup Bundle Support {
    " The next two lines ensure that the ~/.vim/bundle/ system works
    runtime! autoload/pathogen.vim
    silent! call pathogen#helptags()
    silent! call pathogen#runtime_append_all_bundles()
    " }

    " }

    " General {
    set background=dark " Background become dark
    filetype plugin indent on " Automatically detect file types.
    syntax on " Highlight syntax
    set mouse=a " automatically enable mouse usage(使用)
    set virtualedit=onemore " allow for cursor beyond last character
    " set spell " spell checking on. Amazing! I found this set is not as usefull as I think.
    " Setting up the directoties {
    set backup " I saw...Someone said: backups are nice...so I set:)
    set backupdir=$HOME/.vimbackup// " but not when they clog .
    set directory=$HOME/.vimswap// " Same for swap files
    set viewdir=$HOME/.vimviews// " same for view files
    " Creating directories if they don't exist
    silent execute '!mkdir -p $HVOME/.vimbackup'
    silent execute '!mkdir -p $HOME/.vimswap'
    silent execute '!mkdir -p $HOME/.vimviews'

    " set undofile " STFW, persistent undo. I do think this's not a good feature.
    " set undodir=??? " Must, first, mkdir a directory, then replace ???
    " set undolevels=1000 "maximum number of changes that can be undone
    " }
    " }
     
    " Vim UI {
    colorscheme evening
    set showmode " display the current mode

    set cursorline " highlight current line
    hi cursorline guibg=#333333 " highlight bg color of current line
    hi CursorColumn guibg=#333333 " highlight cursor

    set backspace=indent,eol,start " backspace for dummys
    set number " Show line number
    set showmatch " 匹配模式,类似当输入一个"(" 时会匹配相应的")"
    set incsearch " find as you type search
    set ignorecase " case insensitive search
    " }

    " Formatting {
    set autoindent " Auto-implement current line's indent to next line
    autocmd FileType c,cpp,java,php,js,python,twig,xml,yml autocmd BufWritePre <buffer> :call setline(1,map(getline(1,"$"),'substitute(v:val,"\\s\\+$","","")'))
    " }

    " Only do this part when compiled with support for autocommands
    if has("autocmd")
      augroup redhat
        " In text files, always limit the width of text to 78 characters
        autocmd BufRead *.txt set tw=78
        " When editing a file, always jump to the last cursor position
        autocmd BufReadPost *
        \ if line("'\"") > 0 && line ("'\"") <= line("$") |
        \ exe "normal! g'\"" |
        \ endif
      augroup END
    endif

    if has("cscope") && filereadable("/usr/bin/cscope")
       set csprg=/usr/bin/cscope
       set csto=0
       set cst
       set nocsverb
       " add any database in current directory
       if filereadable("cscope.out")
          cs add cscope.out
       " else add database pointed to by environment
       elseif $CSCOPE_DB != ""
          cs add $CSCOPE_DB
       endif
       set csverb
    endif

    " Switch syntax highlighting on, when the terminal has colors
    " Also switch on highlighting the last used search pattern.
    if &t_Co > 2 || has("gui_running")
      syntax on
      set hlsearch
    endif

    if &term=="xterm"
         set t_Co=8
         set t_Sb=[4%dm
         set t_Sf=[3%dm
    endif

    set tabstop=4 " Set tab is 4 * space
    set shiftwidth=4 " 当行之间交错时,使用4个空格
    set nocp " vim不再兼容模式下工作。不在模仿vi
    set whichwrap=h,l " STFW
    set cin " /opt/curricula/2_vim_study_summary
    set sw=4 " STFW
    set cino=:0g0t0(sus " STFW
    set mousemodel=popup " 当右键单击窗口的时候,弹出快捷菜单。
    " set paste " 设置粘贴时不自动使用格式:set nopaste 取消. :help autoindent 时发现,此选项与其冲突因此注释掉了

    Vim,如果tab 和 space 混编会报错。

    Please google:"vim tab用空格代替".

    set expandtab     " 使用空格代替tab. 
    set tabstop=4     " 空格数量是4。 
    set shiftwidth=4  " 自动缩进的宽度。

    THISTHIS


    MORE,

    add: set list 

    键盘 的  delay速度调到delay速度  调整到适合自己,键盘的speed直接调整到最大,非常的爽

    这是比vim设定的一个更好的设定

    真的

    :help xxx, this is important.:wq

    # vim http://www.baidu.com/,这样就能编辑一个网页了

    vimium,chrome插件,好用

    ctrl+[可以代替Esc

    现在唯一想做的,就是ctag,这个非常有用,我却不会。

  • 相关阅读:
    Cisco 交换机配置的基本命令
    Mysql读写分离方案-Amoeba环境部署记录
    centos7下部署zabbix3.4+grafana
    Docker
    Linux 安装源码软件
    mysql 日志
    mysql导出导入数据
    mysql 数据库的备份和还原
    Mysql 数据库管理
    英语单词
  • 原文地址:https://www.cnblogs.com/kevin922/p/3072913.html
Copyright © 2011-2022 走看看