-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
162 lines (119 loc) · 3.17 KB
/
.vimrc
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
source ~/.myvim/jvimrc
source ~/.myvim/mvnvimrc
source ~/.myvim/svnvimrc
let g:projectBaseDir=''
"
" VSTreeExplore mappings
"
map <F3> :wtko
map <F4> :wtjo
"
" ant mappings
"
map <F5> :call RunAntScript("default", "src/lib")<CR>
map <F6> :call RunAntScript("all", "src/lib")<CR>
map <F7> :call RunAntScript("run", "src/lib")<CR>
map <F8> :call RunAntScript("run-hprof", "src/lib")<CR>
map <F9> :call RunAntScript("clean", "src/lib")<CR>
"
" mvn mappings
"map <F5> :!mvn compile<CR>
"map <F6> :!mvn install<CR>
"map <F7> :!mvn test<CR>
"map <F9> :!mvn clean<CR>
"
" Java mappings
"
map <C-j>np :call NewConfigurableProperty()<CR>
map <C-j>al :call AddLogger()<CR>
map <C-j>no :call NewObject()<CR>
map <C-j>gs :call GettersAndSetters()<CR>
map <C-j>go :call GettersOnly()<CR>
map <C-j>si :call SortImports()<CR>
map <C-j>ns :call NewService()<CR>
map <C-j>nts :call NewService()<CR>
map <C-j>ac :call AddToConstructor()<CR>
map <C-j>rc :new ~/.myvim/jvimrc<CR>
" insert comment
map <C-j>ic O/* */hhi
map <C-j>lc :call ProjectLineCount()<CR>
map <C-j>xml :call AddXMLHeader()<CR>
"
" Maven mappings
"
map <C-m>pp :call AddPomProjectStartTag()<CR>
"
" SVN mappings
"
map <C-c>c :call SVNcommit()<CR>
map <C-c>u :call SVNupdate()<CR>
map <C-c>r :call SVNcheckoutRevision()<CR>
"
" project specific stuff
"
function! NewConfigurableProperty()
let name=input("Enter new property name: ")
let default=input("Enter default value of " . name . ": ")
" set mark on current spot
execute 'normal mP'
" open Configuration.java for editing
execute 'e ' . g:projectBaseDir . '/src/main/com/datashark/config/Configuration.java'
" go to beginning of file, find SettingNames, go to end brace under
" SettingNames, and add new SettingName.
execute 'normal gg/SettingNamesj^%kA,i' . name . ''
" find static default-initialization block
execute 'normal gg/^\tstatic\s*$j^%kodefaults.put(SettingNames.' . name . ', "' . default . '");:w'
" return to initial mark
execute 'normal `P'
endfunction
function! AddLogger()
" ensure tidiness (at the top at least...)
execute 'normal gg=Ggg'
" add import statement
execute 'normal joimport org.apache.log4j.Logger;'
" copy class name to register n
execute 'normal /^public\ \(\w\+\ \)\?class0/classW"nyE'
" add logger declaration/initialization
execute 'normal gg=G/^{ostatic Logger log = Logger.getLogger(n.class.getName());'
" save
execute 'normal :w'
endfunction
function! AddXMLHeader()
execute 'normal maggO<?xml version="1.0" encoding="UTF-8"?>`a'
endfunction
function! ProjectLineCount()
execute '!clear; find . -name "*.java" | xargs cat | grep -v "^\s*$" | wc -l'
endfunction
function! NewService()
execute 'normal /^{%'
execute 'normal Opublic void do() throws Exception { }'
execute 'normal yyPP'
execute 'normal 0f(iInitj'
execute 'normal 0f(iStartj'
execute 'normal 0f(iStopj'
execute 'normal :w``'
endfunction
function! NewThreadedService()
execute 'normal /^{%'
execute 'normal Opublic void do() throws Exception { }'
execute 'normal yyPPP'
execute 'normal 0f(iWorkj'
execute 'normal 0f(iInitj'
execute 'normal 0f(iStartj'
execute 'normal 0f(iStopj'
execute 'normal :w``'
endfunction