自家用的.vimrc配置文件
一、.vimrc配置文件 cat .vimrc set backupdir=/root/vimbackup set background=dark colorscheme desert syntax on set incsearch if has("autocmd") filetype plugin indent on endif set hlsearch autocmd BufReadPost * \ if line("‘\"") > 0 && line("‘\"") <= line("$") | \ exe "normal g`\"" | \ endif autocmd BufNewFile *.[ch],*.cpp,*.sh,*.java,*.php,*.py exec ":call SetTitle()" autocmd BufNewFile * normal G autocmd BufNewFile *.php normal k autocmd BufWrite *.[ch],*.cpp,*.sh,*.java,*.php,*.py exec ":!ctags -R *" autocmd BufNewFile,BufRead *.py set cinwords=if,elif,else,for,while,try,expect,finally,def,class autocmd BufNewFile,BufRead *.[ch],*.cpp set foldmethod=syntax func SetTitle() if &filetype == ‘sh‘ || &filetype == ‘python‘ call setline(1, "\#--------------------------------------------------") call append(line("."), "\#Author:jimmygong") call append(line(".")+1, "\#Email:[email protected]") call append(line(".")+2, "\#FileName:".expand("%")) call append(line(".")+3, "\#Function: ") call append(line(".")+4, "\#Version:1.0 ") call append(line(".")+5, "\#Created:".strftime("%Y-%m-%d")) call append(line(".")+6, "\#--------------------------------------------------") call append(line(".")+7, "") else call setline(1, "/**") call append(line("."), "--------------------------------------------------") call append(line(".")+1, "Author:jimmygong") call append(line(".")+2, "Email:[email protected]") call append(line(".")+3, "FileName:".expand("%")) call append(line(".")+4, "Function: ") call append(line(".")+5, "Version:1.0 ") call append(line(".")+6, "Created:".strftime("%Y-%m-%d")) call append(line(".")+7, "--------------------------------------------------") call append(line(".")+8, "**/") call append(line(".")+9, "") endif if &filetype == ‘php‘ call append(0, "<?php") call append(line("$"), "?>") endif if &filetype == ‘sh‘ call append(0, "\#!/bin/bash") elseif &filetype == ‘python‘ call append(0, "\#!/usr/bin/python") call append(1, "\# -*- coding: utf-8 -*-") endif endfunc 二、效果图
本文出自 “7928217” 博客,请务必保留此出处http://7938217.blog.51cto.com/7928217/1656174
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。