VIM配置文件vimrc

本文分享了VIM配置文件vimrc的内容,包括安装完整VIM、vimrc下载及配置详解。讨论了编码设置、语法高亮、自动缩进、Python代码折叠、自动补全等功能,并提供了相关快捷键和实用技巧。
摘要由CSDN通过智能技术生成

分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow

               

VIM配置文件vimrc


Ubuntu 默认情况下只安装tiny-vim , 只要运行 sudo apt-get install vim 安装完整的vim就好了


.vimrc 下载

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Author: sunboy_2050" Version: 1.0" Last Change: 2011-11-11 11:11:11" http://blog.csdn.net/sunboy_2050"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" General""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""Get out of VI's compatible mode..set nocompatible" Platformfunction! MySys()  return "linux"endfunction"Sets how many lines of history VIM har to rememberset history=400" Chineseif MySys() == "windows"   "set encoding=utf-8   "set langmenu=zh_CN.UTF-8   "language message zh_CN.UTF-8   "set fileencodings=ucs-bom,utf-8,gb18030,cp936,big5,euc-jp,euc-kr,latin1endif"Enable filetype pluginfiletype plugin onfiletype indent on"Set to auto read when a file is changed from the outsideset autoread"Have the mouse enabled all the time:set mouse=a"Set mapleaderlet mapleader = ","let g:mapleader = ",""Fast savingnmap <silent> <leader>ww :w<cr>nmap <silent> <leader>wf :w!<cr>"Fast quitingnmap <silent> <leader>qw :wq<cr>nmap <silent> <leader>qf :q!<cr>nmap <silent> <leader>qq :q<cr>nmap <silent> <leader>qa :qa<cr>"Fast remove highlight searchnmap <silent> <leader><cr> :noh<cr>"Fast redrawnmap <silent> <leader>rr :redraw!<cr>" Switch to buffer according to file namefunction! SwitchToBuf(filename)    "let fullfn = substitute(a:filename, "^\\~/", $HOME . "/", "")    " find in current tab    let bufwinnr = bufwinnr(a:filename)    if bufwinnr != -1        exec bufwinnr . "wincmd w"        return    else        " find in each tab        tabfirst        let tab = 1        while tab <= tabpagenr("{1}quot;)            let bufwinnr = bufwinnr(a:filename)            if bufwinnr != -1                exec "normal " . tab . "gt"                exec bufwinnr . "wincmd w"                return            endif            tabnext            let tab = tab + 1        endwhile        " not exist, new tab        exec "tabnew " . a:filename    endifendfunction"Fast edit vimrcif MySys() == 'linux'    "Fast reloading of the .vimrc    map <silent> <leader>ss :source ~/.vimrc<cr>    "Fast editing of .vimrc    map <silent> <leader>ee :call SwitchToBuf("~/.vimrc")<cr>    "When .vimrc is edited, reload it    autocmd! bufwritepost .vimrc source ~/.vimrcelseif MySys() == 'windows'    " Set helplang    set helplang=cn    "Fast reloading of the _vimrc    map <silent> <leader>ss :source ~/_vimrc<cr>    "Fast editing of _vimrc    map <silent> <leader>ee :call SwitchToBuf("~/_vimrc")<cr>    "When _vimrc is edited, reload it    autocmd! bufwritepost _vimrc source ~/_vimrc    "Fast copying from linux    func! CopyFromZ()      autocmd! bufwritepost _vimrc      exec 'split y:/.vimrc'      exec 'normal 17G'      exec 's/return "linux"/return "windows"/'      exec 'w! ~/_vimrc'      exec 'normal u'      exec 'q'    endfunc    nnoremap <silent> <leader>uu :call CopyFromZ()<cr>:so ~/_vimrc<cr>endif" For windows versionif MySys() == 'windows'    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    endfunctionendif"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Colors and Fonts""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""Set font"if MySys() == "linux""  set gfn=Monospace\ 11"endif" Avoid clearing hilight definition in pluginsif !exists("g:vimrc_loaded")    "Enable syntax hl    syntax enable    " color scheme    if has("gui_running")        set guioptions-=T        set guioptions-=m        set guioptions-=L        set guioptions-=r        colorscheme darkblue_my        "hi normal guibg=#294d4a    else        "colorscheme desert_my"    endif " hasendif " exists(...)"Some nice mapping to switch syntax (useful if one mixes different languages in one file)map <leader>1 :set syntax=c<cr>map <leader>2 :set syntax=xhtml<cr>map <leader>3 :set syntax=python<cr>map <leader>4 :set ft=javascript<cr>map <leader>$ :syntax sync fromstart<cr>autocmd BufEnter * :syntax sync fromstart"Highlight current"if has("gui_running")"  set cursorline"  hi cursorline guibg=#333333"  hi CursorColumn guibg=#333333"endif"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Fileformats""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""Favorite filetypesset ffs=unix,dosnmap <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" Maximum window when GUI runningif has("gui_running")  set lines=9999  set columns=9999endif"Turn on WiLd menuset wildmenu"Always show current positionset ruler"The commandbar is 2 highset cmdheight=2"Show line numberset nu"Do not redraw, when running macros.. lazyredrawset lz"Change buffer - without saving"set hid"Set backspaceset backspace=eol,start,indent"Bbackspace 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值