1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
我的博客已迁移到xdoujiang.com请去那边和我交流
一、.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:jimmygong@taomee.com"
)
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:jimmygong@taomee.com"
)
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
二、效果图
|
1
|
<br>
|
本文转自 xdoujiang 51CTO博客,原文链接:http://blog.51cto.com/7938217/1656174,如需转载请自行联系原作者