• .vimrc


    " leader
    let mapleader = ","
    nnoremap <leader>ev :vsplit ~/.vimrc<cr>
    nnoremap <leader>sv :source ~/.vimrc<cr>

    " syntax
    syntax on

    " tablewidth
    set tabstop=4
    set softtabstop=4
    set shiftwidth=4

    " indent
    set autoindent
    set cindent

    " show line number
    set nu

    " regular expression
    nnoremap / /v

    " hilight search results
    set hlsearch

    " cursorline
    set cursorline

    " color scheme
    "colo molokai
    " hilight function name
    "autocmd BufNewFile,BufRead * :syntax match cfunctions "<[a-zA-Z_][a-zA-Z_0-9]*>[^()]*)("me=e-2
    autocmd BufNewFile,BufRead * :syntax match cfunctions "<[a-zA-Z_][a-zA-Z_0-9]*>s*("me=e-1
    hi cfunctions ctermfg=81
    "hi Type ctermfg=118 cterm=none
    "hi Structure ctermfg=118 cterm=none
    "hi Macro ctermfg=161
    "hi PreCondit ctermfg=161
    "hi CursorLine cterm=underline

    set t_Co=256
       hi Boolean         ctermfg=135
       hi Character       ctermfg=144
       hi Number          ctermfg=135
       hi String          ctermfg=144
       hi Conditional     ctermfg=161               
       hi Constant        ctermfg=135               
       hi Cursor          ctermfg=16  
       hi Debug           ctermfg=225               
       hi Define          ctermfg=81
       hi Delimiter       ctermfg=241

       hi DiffChange      ctermfg=181
       hi DiffDelete      ctermfg=162

       hi Directory       ctermfg=118               
       hi Error           ctermfg=219 ctermbg=89
       hi ErrorMsg        ctermfg=199 ctermbg=none cterm=bold
       hi Exception       ctermfg=118               
       hi Float           ctermfg=135
       hi FoldColumn      ctermfg=67  
       hi Folded          ctermfg=67  
       hi Function        ctermfg=118
       hi Identifier      ctermfg=208
       hi Ignore          ctermfg=244
       hi IncSearch       ctermfg=193

       hi Keyword         ctermfg=161               
       hi Label           ctermfg=229               cterm=none
       hi Macro           ctermfg=193
       hi SpecialKey      ctermfg=81

       hi MatchParen      ctermfg=16   
       hi ModeMsg         ctermfg=229
       hi MoreMsg         ctermfg=229
       hi Operator        ctermfg=161

       " complete menu
       hi Pmenu           ctermfg=81  
       hi PmenuThumb      ctermfg=81

       hi PreCondit       ctermfg=118               
       hi PreProc         ctermfg=118
       hi Question        ctermfg=81
       hi Repeat          ctermfg=161               
       hi Search          ctermfg=250

       " marks column
       hi SignColumn      ctermfg=118
       hi SpecialChar     ctermfg=161               
       hi SpecialComment  ctermfg=245               
       hi Special         ctermfg=81  
       hi SpecialKey      ctermfg=245

       hi Statement       ctermfg=161               
       hi StatusLine      ctermfg=238
       hi StatusLineNC    ctermfg=244
       hi StorageClass    ctermfg=208
       hi Structure       ctermfg=81
       hi Tag             ctermfg=161
       hi Title           ctermfg=166
       hi Todo            ctermfg=231    

       hi Typedef         ctermfg=81
       hi Type            ctermfg=81                cterm=none
       hi Underlined      ctermfg=244               cterm=underline

       hi VertSplit       ctermfg=244    
       hi WarningMsg      ctermfg=231    
       hi WildMenu        ctermfg=81  

       hi Comment         ctermfg=59
       hi CursorLine                                 cterm=none
       hi CursorLineNr    ctermfg=yellow
       hi LineNr          ctermfg=250    
       hi NonText         ctermfg=250

    " abbreviate
    "iab main #include <stdio.h>
    "<CR>
    "<CR>int main(int argc, const char *argv[])
    "<CR>{
    "<CR>return 0; }
    "iab p printf("%d ", );

    " auto compile
    "autocmd BufWritePost *.c :call Compile()
    "map <C-M> :call Compile()
    func! Compile()
        if &filetype == 'c'
            exec "w"
            exec "! clear; rm -f %<; gcc % -o %< -g -Wall -lm -lpthread; ./%<;"
        endif

    "    exec "w"
    "    exec "! clear; rm -f %<; echo [Assemble %]; as % -o %<.o; echo [Link %<.o]; ld %<.o -o %<; echo [Run %<]; ./%<;"
    "    exec "w"
    "    exec "! clear; rm -f %<; echo [Assemble %]; nasm -f elf hello.s; echo [Link %<.o]; ld -s -o %< %<.o; echo [Run %<]; ./%<;"
    endfunc

    " Man
    set laststatus=0
    source $VIMRUNTIME/ftplugin/man.vim
    nnoremap K :Man <C-R><C-W><cr>:res<cr>:set nonu<cr>:<Esc>
    nnoremap 1K :Man 1 <C-R><C-W><cr>:res<cr>:set nonu<cr>:<Esc>
    nnoremap 2K :Man 2 <C-R><C-W><cr>:res<cr>:set nonu<cr>:<Esc>
    nnoremap 3K :Man 3 <C-R><C-W><cr>:res<cr>:set nonu<cr>:<Esc>
    nnoremap 4K :Man 4 <C-R><C-W><cr>:res<cr>:set nonu<cr>:<Esc>
    nnoremap 5K :Man 5 <C-R><C-W><cr>:res<cr>:set nonu<cr>:<Esc>
    nnoremap 6K :Man 6 <C-R><C-W><cr>:res<cr>:set nonu<cr>:<Esc>
    nnoremap 7K :Man 7 <C-R><C-W><cr>:res<cr>:set nonu<cr>:<Esc>
    nnoremap 8K :Man 8 <C-R><C-W><cr>:res<cr>:set nonu<cr>:<Esc>
    nnoremap 9K :Man 9 <C-R><C-W><cr>:res<cr>:set nonu<cr>:<Esc>

    " Rename tabs to show tab number.
    " (Based on http://stackoverflow.com/questions/5927952/whats-implementation-of-vims-default-tabline-function)
    if exists("+showtabline")
        function! MyTabLine()
            let s = ''
            let wn = ''
            let t = tabpagenr()
            let i = 1
            while i <= tabpagenr('$')
                let buflist = tabpagebuflist(i)
                let winnr = tabpagewinnr(i)
                let s .= '%' . i . 'T'
                let s .= (i == t ? '%1*' : '%2*')
                let s .= ' '
                let wn = tabpagewinnr(i,'$')

                let s .= '%#TabNum#'
                let s .= i
                " let s .= '%*'
                let s .= (i == t ? '%#TabLineSel#' : '%#TabLine#')
                let bufnr = buflist[winnr - 1]
                let file = bufname(bufnr)
                let buftype = getbufvar(bufnr, 'buftype')
                if buftype == 'nofile'
                if file =~ '/.'
                    let file = substitute(file, '.*/ze.', '', '')
                endif
                else
                    let file = fnamemodify(file, ':p:t')
                endif
                if file == ''
                    let file = '[No Name]'
                endif
                let s .= ' ' . file . ' '
                let i = i + 1
            endwhile

            let s .= '%T%#TabLineFill#%='
            let s .= (tabpagenr('$') > 1 ? '%999XX' : 'X')
            return s
        endfunction

        set stal=2
        set tabline=%!MyTabLine()
        highlight link TabNum Special
    endif

  • 相关阅读:
    关于雷达(Radar)信道
    关于High CPU及基本排查
    UCS内存问题排查
    ASA-ACL类型
    思科室外AP无法注册到WLC
    WLC-Right to Use Licensing
    无线连接网络-FAST SSID Change
    ASA升级
    ASA密码恢复流程
    Mobility Express部署外部镜像服务器
  • 原文地址:https://www.cnblogs.com/liubaocheng999/p/3279828.html
Copyright © 2020-2023  润新知