Noilinux simple .vimrc configuration

 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set nu "设置行标号
set tabstop=4 "这一条以及以下三条都把缩进设为4
set shiftwidth=4
set softtabstop=4
set autochdir  "自动切换到当前目录
set mouse=a "激活鼠标
set cursorline "行高亮
set t_Co=256
set autoindent

 
" 映射全选+复制 ctrl+a
map <C-A> ggVG"+Y
map! <C-A> <Esc>ggVG"+Y
"""""配置退出命令""""'"
:inoremap kj <esc>
"""""""""""""""""""""C,C++ 按F5编译运行"""""""""""""""""""""
map <F5> :call CompileRunGcc()<CR>
func! CompileRunGcc()
    exec "w"
    if &filetype == 'c'
        exec "!g++ % -o %<"
        exec "! ./%<"
    elseif &filetype == 'cpp'
        exec "!g++ % -o %<"
        exec "! ./%<"
    elseif &filetype == 'java'
        exec "!javac %"
        exec "!java %<"
    elseif &filetype == 'sh'
        :!./%
    endif
endfunc
"""""""""""""""""""C,C++的调试""""""""""""""""""""""""""""""
map <F8> :call Rungdb()<CR>
func! Rungdb()
    exec "w"
    exec "!g++ % -g -o %<"
    exec "!gdb ./%<"
endfunc
"""""""""""""""""""""""补全功能"""""""""""""""""""""""""""""
inoremap ' ''<ESC>i
inoremap " ""<ESC>i
inoremap ( ()<ESC>i
inoremap [ []<ESC>i
inoremap { {<CR>}<ESC>O
"设置跳出自动补全的括号
func SkipPair()
    if getline('.')[col('.') - 1] == ')' || getline('.')[col('.') - 1] == ']' || getline('.')[col('.') - 1] == '"' || getline('.')[col('.') - 1] == "'" || getline('.')[col('.') - 1] == '}'
        return "\<ESC>la"
    else
        return "\t"
    endif
endfunc
" 将tab键绑定为跳出括号
inoremap <TAB> <c-r>=SkipPair()<CR>

Guess you like

Origin blog.csdn.net/onlyfirer/article/details/127113424