Linux下vim配置文件(无第三方插件版本)
来源:互联网 发布:桌面壁纸软件那个好 编辑:程序博客网 时间:2024/06/07 17:23
vim_settings_without_plugins
"==============================================================" Copyright (c) 2015 Abodu.com Inc. All Rights Reserved"" FNAME: vimrc_without_plugins" Brief: vim settings" Authr: jealdean" VERNO: 1.0.2.16" CHGON: 2015-05-14 20:18:26" Lastest_Update_At:[ http://www.github.com/jealdean/abodu ]"=============================================================="GLOBAL-VARIABLESlet g:mapleader=';'let g:GV_AUTHOR='RollStone'let g:GV_EMAIL='jealdean@outlook.com'let g:GV_COMPANY=' All Rights Reserved By www.abodu.com '"GENERAL_SETTINGS:{{{1"Basic: {{{2set nu noet bs=2 sts=4 ts=4 sw=4 tw=80set nobk noeb wrap lbr hiddenset is nohls sc sm acd ttm=100set nolist listchars=tab:\¦\ set ai si ww=h,l,>,<"when use 'tab' auto-complete will skip files with these suffixesset wig=*.bak,*.o,*.e,*~,*.sw*set errorformat=%f:%l:%m cot=longest,menu"Colors:{{{2set t_Co=256"let g:solarized_termcolors=256colo default" Encodings:{{{2set encoding=utf-8set fenc=utf-8set fencs=utf-8,ucs-bom,gb18030,gbk,gb2312,cp936,chinese"Folds:{{{2set fen fdc=2 fdl=0 fdm=markernnoremap <space> @=((foldclosed(line('.'))<0)?'zc':'zo')<cr>"Status_line:{{{2"always show status lineset ls=2 stl=%F[%1*%M%*%n%R%H%w%m%h][%l,%v,%p%%]\ %=set stl+=\ %0([%{&ft},%{&fileformat},%{&fileencoding}][%{strftime('%Y%m%d-%H:%M:%S')}]%)"FUNCTIONS:{{{1"global variables for funcslet g:DectectFloor=10let g:VernoFloor=100"HCF:HeaderCommentFlaglet g:HCF_PROGRAMS="^/.*$" "'//' or '/*',just check the first <s:DectectFloor> lineslet g:HCF_SCRIPTS="^#!/.*$" "just check the first linelet g:HCF_VIMS="^\".*$" " '\"',just check the first <s:DectectFloor> lineslet g:HCI_AUTHR='AUTHR'let g:HCI_BRIEF='BRIEF'let g:HCI_CHGON='CHGON'let g:HCI_CREAT='CREAT'let g:HCI_EMAIL='EMAIL'let g:HCI_FNAME='FNAME'let g:HCI_VERNO='VERNO'"UD_Add: {{{2 func! UD_Add() let n = 1 "Check:HeaderCommentFlag exist while n < g:DectectFloor let line = getline(n) if ( n==1 && line =~ g:HCF_SCRIPTS ) return endif if ( line =~ g:HCF_PROGRAMS || line =~ g:HCF_VIMS) return endif let n+=1 endwhile "Dectect: GuardLineAndFic let lGLS='/*' let lGLE=' */' let lPF =' *!' let lfn=buffer_name('%') if lfn=~ '\.sh$' let lGLE='' let lPF ='#' let lGLS='#!/bin/sh' elseif lfn =~ '\.pl$' let lGLE='' let lPF ='#' let lGLS='#!/bin/perl' endif "make some local variables let lGL=lPF.'==============================================================' let lCP=lPF.' Copyright (c) '.strftime('%Y').' '.g:GV_COMPANY let lPF=lPF.' ' let lAuthor =lPF.g:HCI_AUTHR.': '.g:GV_AUTHOR let lDesc =lPF.g:HCI_BRIEF.': ' let lEmail =lPF.g:HCI_EMAIL.': '.g:GV_EMAIL let lLuTime =lPF.g:HCI_CHGON.': '.strftime('%Y-%m-%d %T') let lCrTime =lPF.g:HCI_CREAT.': '.strftime('%Y-%m-%d %T') let lName =lPF.g:HCI_FNAME.': '.expand('%:t') let lVersion=lPF.g:HCI_VERNO.': 1.0.0.0' call append(0,[lGLS,lGL,lName,lDesc,lAuthor,lEmail,lVersion \,lCrTime,lLuTime,lPF,lCP,lGL,lGLE])endfunc" UD_CommentToggle: {{{2func! UD_CommentToggle() range let lfn=buffer_name('%') let save_cursor=getpos('.') let patSPACES='\(\s\+\)\?' let patSOMECHARS='\(.*\)' ".{html,xml,htm,xhtml} if ( lfn =~? '\.html$' || lfn =~? '\.xml$' || lfn =~ '\.htm' || lfn =~ '\.xhtml$' ) let CCB='<!-- ' let CCE=' -->' let curLine=getline('.') if (curLine =~ CCB.'.*$' && curLine =~ CCE.'.*$' ) "remove execute a:firstline.','.a:lastline.'s;'.CCB.';;' execute a:firstline.','.a:lastline.'s;'.CCE.';;' else "add comments execute a:firstline.','.a:lastline.'s;^'.patSPACES.'\(.*\)'.patSPACES.'$;'.CCB.'\2'.CCE.';' endif exe "silent!: normal :nohls\<cr>" return endif "OtherFiles_CommonHandler let CommentChar='#' "for perl,shell,makefile and other unknown files if ( lfn =~? '\.c$' || lfn =~? '\.h$' || lfn =~ '\.cpp' \|| lfn =~ '\.hpp$' || lfn =~ '\.cc'|| lfn =~ '\.java$'|| lfn =~ '\.go$' ) "\.{c,cpp,h,hpp,cc,java,C,go} let CommentChar='//' elseif ( lfn =~? '\.sql$') ".sql let CommentChar='--' elseif ( lfn =~ '\.vim$' || lfn =~ '\.vimrc$' ) "\.{vim,vimrc} let CommentChar='"' endif "the first line is very important ,for: "the following lines do the same action with the firstline if getline(a:firstline) =~ '^'.patSPACES.CommentChar.'.*$' exe "silent :".a:firstline.','.a:lastline.' s;^'.patSPACES.CommentChar.patSOMECHARS.';\1\2;' else exe "silent :".a:firstline.','.a:lastline.' s;^;'.CommentChar . ';' endif call setpos('.', save_cursor) exe "silent!: normal :nohls\<cr>"endfunc "UD_CommentToggleinoremap <silent> <C-C> <esc>:call UD_CommentToggle()<CR>:nohls<CR>noremap <silent> <C-C> :call UD_CommentToggle()<CR>:nohls<CR>vnoremap <silent> <C-C> :call UD_CommentToggle()<CR>:nohls<CR>"end of UD_CommentToggle}}}"UD_UpdateInfo:{{{2func! UD_UpdateInfo() let n=1 let updated=0 while n<g:DectectFloor let acl=getline(n) "for filename changes if (acl =~? 'name' || acl =~? g:HCI_FNAME || acl =~? 'filename'|| acl =~? 'title') let nacl=substitute(acl,':.*$',': '.expand('%:t'),'g') call setline(n,nacl) let updated = 1 "for last change time elseif (acl =~? 'lutime' || acl =~? g:HCI_CHGON || acl =~? 'lastchangeat') let nacl=substitute(acl,':.*$',': '.strftime('%Y-%m-%d %T'),'g') call setline(n,nacl) let updated = 2 "for version automatic increase a little number elseif (acl =~? 'version' || acl =~? g:HCI_VERNO || acl =~? 'revision') let theLastDotPos=strridx(acl,'.')+1 "get minmum version number and increase it by 1 let minVerNo=str2nr(strpart(acl,theLastDotPos))+1 if minVerNo >= g:VernoFloor "if needs a secondMinVerNo increase let tempLine=strpart(acl,0,theLastDotPos-1) let secondLastDotPos=strridx(tempLine,'.')+1 let secondMinVerNo=str2nr(strpart(tempLine,secondLastDotPos))+1 if secondMinVerNo >= g:VernoFloor let secTmpLine=strpart(acl,0,secondLastDotPos-1) let thirdLastDotPos=strridx(secTmpLine,'.')+1 let thirdMinVerNo=str2nr(strpart(secTmpLine,thirdLastDotPos))+1 let newLine=strpart(acl,0,thirdLastDotPos).thirdMinVerNo.'.0.0' else let newLine=strpart(acl,0,secondLastDotPos).secondMinVerNo.'.0' endif else let newLine=strpart(acl,0,theLastDotPos).minVerNo endif call setline(n,newLine) let updated = 3 endif let n+=1 endwhile if updated == 0 call UD_Add() endifendfunc"MAPPINGS:{{{1"AutoCommandif has("autocmd") au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif au BufEnter * :lch %:p:h au InsertEnter * set cul "cuc au InsertLeave * set nocuc "nocul au BufRead,BufNewFile {make,Make,*mk}* set ft=make noet au BufNewFile,BufNew *.{sh,awk,pl,java,c,cc,cpp,C,h,hpp} silent call UD_Add() au BufWritePre,FileWritePre,FileAppendPre *.{sh,awk,pl,java,c,cc,cpp,C,h,hpp},*vimrc silent call UD_UpdateInfo() au FileType html,xml,json set mps+=<:> au FileType c,cpp,java,make set cinoptions={0,1s,t0,n-2,p2s,(03s,=.5s,>1s,=1s,:1s au FileType c,cpp set ai si ci fdm=syntax fdl=0 errorformat=%f:%l:%m path+=.,include,../include,/usr/includeendif " has (autocmd)""Other mappings"<F1> - OVERRIDE Linux Help ShortKeymap <F4> <esc>:exec "help ".expand("<cword>")<cr>"<F2> remove the multi-blanklinesmap <F2> :silent! g/^\n\{1,\}$/d<cr>"<F3> - trim trail whitespacemap <F3> :silent! g/^[ \n]\+$/d<cr> "<F4> - Open/Close Insert Paste set pastetoggle=<F4>
0 0
- Linux下vim配置文件(无第三方插件版本)
- vim配置文件(无插件)
- vim配置文件(无插件依赖)
- Linux下为不同版本python安装第三方库
- Linux下vim配置文件
- Linux下vim配置文件
- Linux下vim插件
- linux下的VIM配置文件
- Linux下vim的配置文件
- LINUX下VIM插件安装
- Linux下python版本的更新以及第三方包的安装
- linux下的第三方工具
- Linux下安装EPEL第三方源
- linux下QT添加第三方库
- linux下vim和bash配置文件
- 【Vim】无插件vim配置
- 第三方插件
- 一:第三方插件
- @PostConstruct 的使用
- linux shell 之if
- c语言内存组成
- codeblocks调试出现问题原因
- IOC的形象解释
- Linux下vim配置文件(无第三方插件版本)
- c# wpf 加密文本
- HBASE failed to start master 解决方案
- MyEclipse中的android环境配置
- LeetCode 144 : Binary Tree Preorder Traversal
- C++ primer plus 练习 7.8b
- hdu 1233 还是畅通工程
- 数值的二进制输出
- 策略模式(Strategy)