zoukankan      html  css  js  c++  java
  • vimrc

    没地方保存,先放这里

    " {{{
    " DesCRiption: zoro的vimrc文件
    " Last Change: 2011-09-07
    " Author:      Zoro
    " Version:     0.1
    "}}}
    " 关闭 vi 兼容模式
    let performance_mode=0
    source $VIMRUNTIME/vimrc_example.vim
    source $VIMRUNTIME/mswin.vim
    behave mswin
    set nocompatible

    function! MySys()
        if has("win32")
            return "win32"
        elseif has("unix")
            return "unix"
        else
            return "mac"
        endif
    endfunction

    " 检测文件类型
    filetype on
    " 检测文件类型插件
    filetype plugin on
    " 不设定在插入状态无法用退格键和 Delete 键删除回车符
    set backspace=indent,eol,start
    set whichwrap+=<,>,h,l
    " 显示行号
    set number
    " 上下可视行数
    set scrolloff=6
    " 设定 tab 长度为 4
    set tabstop=4
    " 设置按BackSpace的时候可以一次删除掉4个空格
    set softtabstop=4
    " 设定 << 和 >> 命令移动时的宽度为 4
    set shiftwidth=4
    set smarttab



    "设置历史最大记录
    set history=400

    "Highlight current
    if has("gui_running")
        if exists("&cursorline")
            set cursorline
        endif
    endif

    "Set to auto read when a file is changed from the outside
    if exists("&autoread")
        set autoread
    endif

    "Have the mouse enabled all the time:
    if exists("&mouse")
        set mouse=a
    endif

    "Set mapleader
    let mapleader = ","
    let g:mapleader = ","

    "Fast saving
    nmap <leader>x :xa!<cr>
    nmap <leader>w :w!<cr>

    " => Colors and Font
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "Enable syntax hl
    if MySys()=="unix"
        if v:version<600
            if filereadable(expand("$VIM/syntax/syntax.vim"))
                syntax on
            endif
        else
            syntax on
        endif
    else
        syntax on
    endif

    " set encoding=utf-8
    set fileencodings=ucs-bom,utf-8,iso8859-1,gbk,default,latin

    if has("gui_running")
        set guioptions-=m
        set guioptions-=T
        set guioptions-=l
        set guioptions-=L
        set guioptions-=r
        set guioptions-=R

        if MySys()=="win32"
            "start gvim maximized
            if has("autocmd")
                au GUIEnter * simalt ~x
            endif
        endif
        "let psc_style='cool'
        if v:version > 601
            "colorscheme ps_color
            "colorscheme default
            colorscheme desert
            set guifont=Consolas:h10
        endif
    else
        if v:version > 601
            "set background=dark
            colorscheme default
            "colorscheme desert "elflord
            set guifont=Consolas:h10
        endif
    endif

    "Highlight current
    if has("gui_running")
        if exists("&cursorline")
            set cursorline
        endif
    endif

    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " => Fileformat
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "Favorite filetype
    set ffs=unix,dos,mac

    nmap <leader>fd :se ff=dos<cr>
    nmap <leader>fu :se ff=unix<cr>

    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " => VIM userinterface
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "Set 7 lines to the curors - when moving vertical..
    set so=7

    "Turn on WiLd menu
    set wildmenu

    "Always show current position
    set ruler

    "The commandbar is 2 high
    set cmdheight=2

    "Show line number
    set nu

    "Do not redraw, when running macros.. lazyredraw
    set lz

    "Change buffer - without saving
    set hid

    "Set backspace
    set backspace=eol,start,indent

    "Bbackspace and cursor keys wrap to
    set whichwrap+=<,>,h,l

    "Ignore case when searching
    "set ignorecase
    set incsearch

    "Set magic on
    set magic

    "No sound on errors.
    set noerrorbells
    set novisualbell
    set t_vb=

    "show matching bracet
    set showmatch

    "How many tenths of a second to blink
    set mat=8

    "Highlight search thing
    set hlsearch

    """"""""""""""""""""""""""""""
    " => Statusline
    """"""""""""""""""""""""""""""
    "Format the statusline
    " Nice statusbar
    if performance_mode
    else
        set laststatus=2
        set statusline=
        "set statusline+=%2*%-3.3n%0*/ " buffer number
        set statusline+=%f/ " file name
        set statusline+=%1*%h%m%r%w%0* " flags
        set statusline+=%2*0x%-8B " current char
        set statusline+=%-8b
        set statusline+=%-14.(%l,%c%V%)/%5p%% " offset
        set statusline+=%= " right align
        set statusline+=%0*[
        if v:version >= 600
            set statusline+=%{strlen(&ft)?&ft:'none'}, " filetype
            set statusline+=%{&encoding}, " encoding
        endif
        set statusline+=%{&fileformat}]%1* " file format
        if filereadable(expand("$VIM/vimfiles/plugin/vimbuddy.vim"))
            set statusline+=/ %{VimBuddy()} " vim buddy
        endif

    "    " special statusbar for special windows
    "    if has("autocmd")
    "        au FileType qf
    "                    / if &buftype == "quickfix" |
    "                    / setlocal statusline=%2*%-3.3n%0* |
    "                    / setlocal statusline+=/ /[Compiler/ Messages/] |
    "                    / setlocal statusline+=%=%2*/ %<%P |
    "                    / endif
    "
    "        fun! FixMiniBufExplorerTitle()
    "            if "-MiniBufExplorer-" == bufname("%")
    "                setlocal statusline=%2*%-3.3n%0*
    "                setlocal statusline+=/[Buffers/]
    "                setlocal statusline+=%=%2*/ %<%P
    "            endif
    "        endfun
    "
    "        if v:version>=600
    "            au BufWinEnter *
    "                        / let oldwinnr=winnr() |
    "                        / windo call FixMiniBufExplorerTitle() |
    "                        / exec oldwinnr . " wincmd w"
    "        endif
    "    endif
    "
    "    " Nice window title
    "    if has('title') && (has('gui_running') || &title)
    "        set titlestring=
    "        set titlestring+=%f/ " file name
    "        set titlestring+=%h%m%r%w " flags
    "        set titlestring+=/ -/ %{v:progname} " program name
    "    endif
    endif

    "设置状态栏根据不同状态显示不同颜色
    function! InsertStatuslineColor(mode)
        if a:mode == 'i'
            hi statusline guibg=peru
        elseif a:mode == 'r'
            hi statusline guibg=blue
        else
            hi statusline guibg=red
        endif
    endfunction
    au InsertEnter * call InsertStatuslineColor(v:insertmode)
    au InsertLeave * hi statusline guibg=#9932CC guifg=white
    hi statusline guibg=#696969 guifg=#B8860B

    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " => Moving around and tab
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "Map space to / and c-space to ?
    map <space> /

    "Smart way to move btw. window
    map <C-j> <C-W>j
    map <C-k> <C-W>k
    map <C-h> <C-W>h
    map <C-l> <C-W>l

    "Tab configuration
    map <leader>tn :tabnew %<cr>
    map <leader>tc :tabclose<cr>
    map <leader>tm :tabmove

    if v:version>=700
        set switchbuf=usetab
    endif

    if exists("&showtabline")
        set stal=2
    endif

    "Moving fast to front, back and 2 sides ;)
    imap <m-$> <esc>$a
    imap <m-0> <esc>0i
    imap <D-$> <esc>$a
    imap <D-0> <esc>0i

    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " => General Autocommand
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    "Switch to current dir
    map <leader>cd :cd %:p:h<cr>


    """"""""""""""""""""""""""""""
    " => Indent
    """"""""""""""""""""""""""""""
    "Auto indent
    set ai

    "Smart indet
    set si

    "C-style indenting
    if has("cindent")
        set cindent
    endif

    "Wrap line
    set wrap

    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    " => Spell checking
    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
    map <leader>sn ]
    map <leader>sp [
    map <leader>sa zg
    map <leader>s? z=

    "Fast reloading of the .vimrc
    map <silent> <leader>ss :source $VIM/_vimrc<cr>
    "Fast editing of .vimrc
    map <silent> <leader>ee :e $VIM/_vimrc<cr>
    "When .vimrc is edited, reload it
    autocmd! bufwritepost .vimrc source $VIM/_vimrc

    " autoload _vimrc
    autocmd! bufwritepost _vimrc source %

    " use chinese help
    set helplang=cn

    " NERDTree
    map <F10> :NERDTreeToggle<CR>

    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

    " => Plugin configuration

    """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

    " taglist
    let Tlist_Show_One_File = 1
    let Tlist_Exit_OnlyWindow = 1
    let Tlist_Use_Right_Window = 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_Exit_OnlyWindow = 0
    let Tlist_File_Fold_Auto_Close = 1
    let Tlist_GainFocus_On_ToggleOpen = 1
    let Tlist_Hightlight_Tag_On_BufEnter = 1
    let Tlist_Inc_Winwidth = 0
    map <silent> <F9> :TlistToggle<cr>

    map <F11> <Esc>:call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)<CR>
    imap <F11> <Esc>:call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)<CR>

    set runtimepath+=E:\vim-php-manual
    autocmd BufNewFile,Bufread *.module,*.inc,*.php set keywordprg="help"
    "cs add F:\php5\cscope.out
    "map <C-g> :cs find g <C-R>=expand("<cword>")<CR>
    "set tags+=/server/php-src/tags
    map ca :Calendar<cr>
    map <silent> <leader>bb :cd ..<cr>

    update

  • 相关阅读:
    LeetCode——003 Longest Substring Without Repeating Characters
    LeetCode——002 Add Two Numbers
    LeetCode——001 Two Sum
    【日常训练】Hockey(CodeForces-96C)
    【日常训练】数据中心(CSP 201812-4)
    【赛后补题】Lucky Probability(CodeForces 110D)
    「Leetcode」14. Longest Common Prefix(Java)
    「Leetcode」13. Roman to Integer(Java)
    「日常训练」Magic Stones(CodeForces-1110E)
    「日常训练」Jongmah(Codeforces-1110D)
  • 原文地址:https://www.cnblogs.com/zoro/p/2171703.html
Copyright © 2011-2022 走看看