-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEDITING
More file actions
90 lines (56 loc) · 1.8 KB
/
Copy pathEDITING
File metadata and controls
90 lines (56 loc) · 1.8 KB
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
A) Viewing and editing source files
vim is the recommended text editor, mainly because of the ability to enable row
folding via the manual insertion of markers. Since the files in this
repository can be quite large, row folding is an essential feature of the
development side of LOTW. The instructions below are specific to vim's runtime
configuration file, .vimrc.
B) Enabling row folding
To browse the source code as intended, the following lines must be included in
your .vimrc:
set foldmethod=marker
set foldmarker=«,»
set foldlevelstart=0
To quickly toggle between opened and closed row folds with the Enter key, add this line:
nmap <enter> za
### Inserting fold markers
These instructions will enable the easy insertion of fold markers into your
code (from both normal and insert mode).
To insert an open fold marker, invoked with Alt+o, add these lines:
execute "set <M-o>=\eo"
nnoremap <M-o> a//«<esc>
inoremap <M-o> //«
To insert a close fold marker, invoked with Alt+c, add these lines:
execute "set <M-c>=\ec"
nnoremap <M-c> a//»<esc>
inoremap <M-c> //»
To insert both an open and close fold marker, with a space in between,
invoked with Alt+f, add these lines:
execute "set <M-f>=\ef"
nnoremap <M-f> a//«<enter><enter>//»<esc>
inoremap <M-f> //«<enter><enter>//»
Advanced vim tricks:
***************************************************
Getting rid of blank lines between non-blank lines:
:g/^ *$/d
blah hoo
[many spaces..]
[many spaces..]
[many spaces..]
faaa fooo
[many spaces..]
[many spaces..]
sloom
...becomes:
blah hoo
faaa fooo
sloom
***************************************************
Putting make whitespace separated words onto their own lines:
:s/\s\+/\r/g
one two three 4444
...becomes
one
two
three
4444
***************************************************