File tree 1 file changed +33
-0
lines changed
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ function ! BashMakeFunction ()
2
+ " save the name under curson in the "a" register
3
+ normal ! " ayiw
4
+ " write the function
5
+ " start inserting above the line
6
+ normal ! O
7
+ " paste the name of the function (from the "a" register)
8
+ " now we have: function-name
9
+ normal ! " ap
10
+ " append the "()" and the "{"
11
+ " now we have: function-name() {
12
+ normal ! a () {
13
+ " add a line with the semicolon (null command in Bash)
14
+ " now we have:
15
+ " function-name() {
16
+ " :
17
+ normal ! o :
18
+ " add the closing brace
19
+ " now we have:
20
+ " function-name() {
21
+ " :
22
+ " }
23
+ normal ! o }
24
+ " dedent if necessary the closing brace
25
+ " now we have:
26
+ " function-name() {
27
+ " :
28
+ " }
29
+ normal ! <<
30
+ endfunction
31
+
32
+ nnoremap ,mf :call BashMakeFunction()<cr>
33
+
1
34
function ! BashExtractVariable ()
2
35
let name = input (" Variable name: " )
3
36
if name == ' '
You can’t perform that action at this time.
0 commit comments