This file is indexed.

/usr/share/doc/newbiedoc/newbiedoc.berlios.de/wiki/Beginner's_guide_to_Vi_Improved_(Vim).html is in newbiedoc 0.8.0-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
				<meta name="keywords" content="Beginner's guide to Vi Improved (Vim),Manager,GPLv2,GPLv3,Index" />
		<title>Beginner's guide to Vi Improved (Vim) - NewbieDOC</title>
		
                
	</head>
<body  class="mediawiki ns-4 ltr page-NewbieDOC_Beginner_s_guide_to_Vi_Improved_Vim">
	<div id="globalWrapper">
		<div id="column-content">
	<div id="content">
		<a name="top" id="top"></a>
				<h1 class="firstHeading">Beginner's guide to Vi Improved (Vim)</h1>
		<div id="bodyContent">
			<h3 id="siteSub">From NewbieDOC</h3>
			<div id="contentSub"></div>
			<!-- Bad Behavior 2.0.11 run time: 16.783 ms --><dl><dt>Jesse Goerz
</dt><dd>jwgoerz@users.sourceforge.net (author)
</dd><dt><a href="http://newbiedoc.berlios.de/wiki/User:Manager" title="User:Manager">Chris Lale</a>
</dt><dd>chrislale AT users DOT berlios DOT de (publisher)
</dd></dl>
<p><b>Revision History</b>
</p><p><b>Go to <a href="Index.html" title="NewbieDOC:Index">NewbieDOC index</a></b>
</p>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3"><hr/>
</td></tr>
<tr>
<td rowspan="2" valign="top">Revision v0.1
</td><td valign="top">6 January 2002
</td><td valign="top">Revised by Jesse Goerz
</td></tr>
<tr>
<td colspan="2" valign="top">Initial Release. <a href="http://newbiedoc.sourceforge.net/text_editing/vim.html.en" class="external free.html" title="http://newbiedoc.sourceforge.net/text_editing/vim.html.en" rel="nofollow">http://newbiedoc.sourceforge.net/text_editing/vim.html.en</a>
</td></tr>
<tr>
<td colspan="3"> <hr/>
</td></tr>
<tr>
<td rowspan="2" valign="top">Revision v0.2
</td><td valign="top">1 February 2006
</td><td valign="top">Revised by <a href="http://newbiedoc.berlios.de/wiki/User:Manager" title="User:Manager">Chris Lale</a>
</td></tr>
<tr>
<td colspan="2" valign="top">Revised for NewbieDOC wiki by converting source to wikitext. Modified the top of the document slightly, including the Abstract.
</td></tr>
<tr>
<td colspan="3"> <hr/>
</td></tr>
<tr>
<td rowspan="2" valign="top">Revision v0.3
</td><td valign="top">27th November 2007
</td><td valign="top">Revised by <a href="http://newbiedoc.berlios.de/wiki/User:Manager" title="User:Manager">Chris Lale</a>
</td></tr>
<tr>
<td colspan="2" valign="top">Reformatted for newbiedoc package.
</td></tr>
<tr>
<td colspan="3"> <hr/>
<p><br />
</p>
<table style="border-color:silver;border-style:solid;border-width:1px 1px 1px 1px;width:100%;text-align:left;margin-bottom:1em;background:#f9f9f9;padding:.3em">
<tr>
<td> <a href="http://newbiedoc.berlios.de/wiki/Image:Newbiedoc-32.png" class="image.html" title="Image:Newbiedoc-32.png"><img alt="Image:Newbiedoc-32.png" src="../images/7/76/Newbiedoc-32.png" width="32" height="32" border="0" /></a>
</td><td> <b></b>
</td><td> <b>Stable document</b>
</td></tr>
<tr>
<td>
</td><td>
</td><td style="width:100%">You can comment on this document by clicking on the <a href="http://newbiedoc.berlios.de/wiki?title=NewbieDOC_talk:Beginner's_guide_to_Vi_Improved_(Vim)&amp;action=edit" class="external text.html" title="http://newbiedoc.berlios.de/wiki?title=NewbieDOC_talk:Beginner's_guide_to_Vi_Improved_(Vim)&amp;action=edit" rel="nofollow"><b>discussion</b></a> tab.
<p>You can edit the live version of this document: <a href="http://newbiedoc.berlios.de/wiki/Beginner's_guide_to_Vi_Improved_(Vim)" class="external text.html" title="http://newbiedoc.berlios.de/wiki/Beginner's_guide_to_Vi_Improved_(Vim)" rel="nofollow">Beginner's guide to Vi Improved (Vim)</a>
</p>
</td></tr></table>
<p><br />
<b>Abstract</b>
</p><p>This document will cover the console version of vim from Debian. Although much of what is discussed here will also apply to gvim, it may or may not work with gvim.
</p><p><br />
</p>
<table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
<ul>
<li class="toclevel-1"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Introduction"><span class="tocnumber">1</span> <span class="toctext">Introduction</span></a></li>
<li class="toclevel-1"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Installing_vim"><span class="tocnumber">2</span> <span class="toctext">Installing vim</span></a></li>
<li class="toclevel-1"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Vim.27s_built_in_help"><span class="tocnumber">3</span> <span class="toctext">Vim's built in help</span></a>
<ul>
<li class="toclevel-2"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Tutor_me.21"><span class="tocnumber">3.1</span> <span class="toctext">Tutor me!</span></a></li>
<li class="toclevel-2"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Navigating_vim.27s_help"><span class="tocnumber">3.2</span> <span class="toctext">Navigating vim's help</span></a></li>
</ul>
</li>
<li class="toclevel-1"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Modeful_editing"><span class="tocnumber">4</span> <span class="toctext">Modeful editing</span></a>
<ul>
<li class="toclevel-2"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Normal_mode"><span class="tocnumber">4.1</span> <span class="toctext">Normal mode</span></a></li>
<li class="toclevel-2"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Visual_mode"><span class="tocnumber">4.2</span> <span class="toctext">Visual mode</span></a></li>
<li class="toclevel-2"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Select_mode"><span class="tocnumber">4.3</span> <span class="toctext">Select mode</span></a></li>
<li class="toclevel-2"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Insert_mode"><span class="tocnumber">4.4</span> <span class="toctext">Insert mode</span></a></li>
<li class="toclevel-2"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Command_line_mode"><span class="tocnumber">4.5</span> <span class="toctext">Command line mode</span></a></li>
<li class="toclevel-2"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Ex_mode"><span class="tocnumber">4.6</span> <span class="toctext">Ex mode</span></a></li>
</ul>
</li>
<li class="toclevel-1"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Common_commands"><span class="tocnumber">5</span> <span class="toctext">Common commands</span></a>
<ul>
<li class="toclevel-2"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Movement_commands"><span class="tocnumber">5.1</span> <span class="toctext">Movement commands</span></a></li>
<li class="toclevel-2"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Search_commands"><span class="tocnumber">5.2</span> <span class="toctext">Search commands</span></a></li>
<li class="toclevel-2"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Simple_editing.2Fcombination_commands"><span class="tocnumber">5.3</span> <span class="toctext">Simple editing/combination commands</span></a>
<ul>
<li class="toclevel-3"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Deleting.2Fselecting_parts_of_a_line"><span class="tocnumber">5.3.1</span> <span class="toctext">Deleting/selecting parts of a line</span></a></li>
<li class="toclevel-3"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Deleting.2Fselecting_spanning_multiple_lines"><span class="tocnumber">5.3.2</span> <span class="toctext">Deleting/selecting spanning multiple lines</span></a></li>
<li class="toclevel-3"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Cut.2C_copy.2C_and_paste"><span class="tocnumber">5.3.3</span> <span class="toctext">Cut, copy, and paste</span></a></li>
<li class="toclevel-3"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Spell_checking"><span class="tocnumber">5.3.4</span> <span class="toctext">Spell checking</span></a></li>
<li class="toclevel-3"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Find_and_replace"><span class="tocnumber">5.3.5</span> <span class="toctext">Find and replace</span></a></li>
</ul>
</li>
</ul>
</li>
<li class="toclevel-1"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Personalizing_vim"><span class="tocnumber">6</span> <span class="toctext">Personalizing vim</span></a>
<ul>
<li class="toclevel-2"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#vimrc_files"><span class="tocnumber">6.1</span> <span class="toctext">vimrc files</span></a></li>
<li class="toclevel-2"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Color_Schemes"><span class="tocnumber">6.2</span> <span class="toctext">Color Schemes</span></a></li>
<li class="toclevel-2"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Syntax_highlighting"><span class="tocnumber">6.3</span> <span class="toctext">Syntax highlighting</span></a></li>
<li class="toclevel-2"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Abbreviations"><span class="tocnumber">6.4</span> <span class="toctext">Abbreviations</span></a></li>
</ul>
</li>
<li class="toclevel-1"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Mapping_Keys"><span class="tocnumber">7</span> <span class="toctext">Mapping Keys</span></a></li>
<li class="toclevel-1"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Writing_Functions"><span class="tocnumber">8</span> <span class="toctext">Writing Functions</span></a></li>
<li class="toclevel-1"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Programming_with_vim"><span class="tocnumber">9</span> <span class="toctext">Programming with vim</span></a></li>
<li class="toclevel-1"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Example_maps_and_vimrc_files"><span class="tocnumber">10</span> <span class="toctext">Example maps and vimrc files</span></a></li>
<li class="toclevel-1"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#References_and_links"><span class="tocnumber">11</span> <span class="toctext">References and links</span></a></li>
<li class="toclevel-1"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Contributors"><span class="tocnumber">12</span> <span class="toctext">Contributors</span></a></li>
<li class="toclevel-1"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Appendix_A:_My_examples"><span class="tocnumber">13</span> <span class="toctext">Appendix A: My examples</span></a>
<ul>
<li class="toclevel-2"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Example_A-1._My_.7E.2F.vimrc"><span class="tocnumber">13.1</span> <span class="toctext">Example A-1. My ~/.vimrc</span></a></li>
<li class="toclevel-2"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Example_A-2._My_.7E.2F.vim_custom.2Fbash-vimrc"><span class="tocnumber">13.2</span> <span class="toctext">Example A-2. My ~/.vim_custom/bash-vimrc</span></a></li>
<li class="toclevel-2"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Example_A-3._My_.7E.2F.vim_custom.2Fphp-vimrc"><span class="tocnumber">13.3</span> <span class="toctext">Example A-3. My ~/.vim_custom/php-vimrc</span></a></li>
<li class="toclevel-2"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Example_A-4._My_.7E.2F.vim_custom.2Fc-vimrc"><span class="tocnumber">13.4</span> <span class="toctext">Example A-4. My ~/.vim_custom/c-vimrc</span></a></li>
<li class="toclevel-2"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Example_A-5._My_.7E.2F.vim_custom.2Fsgml-vimrc"><span class="tocnumber">13.5</span> <span class="toctext">Example A-5. My ~/.vim_custom/sgml-vimrc</span></a></li>
</ul>
</li>
<li class="toclevel-1"><a href="Beginner's_guide_to_Vi_Improved_(Vim).html#Appendix_B:_Licence"><span class="tocnumber">14</span> <span class="toctext">Appendix B: Licence</span></a></li>
</ul>
</li>
</ul>
</td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
<p><br />
</p>
<a name="Introduction"></a><h2> <span class="mw-headline">1  Introduction </span></h2>
<p>Learning vim can be a bit of a trial but it is well worth it in the long run. The most important thing you can do is read the section Vim's built in help. Once you figure out how to use vim's built-in help effectively, you'll learn vim much more comfortably.
</p><p>No introduction to vim would be complete without a warning. Vim is not a difficult editor to learn but it won't be like any other editor you've used. In the beginning you'll find that the movement and editing commands can be quite irritating. However, with a bit of patience and perseverance you will become quite adept at using it.
</p><p>If it is so irritating why would you want to learn how to use it? Good question. My primary motivation to learn vim was watching someone who was good with vim edit a configuration file. Without moving his hands from the keyboard he cut large blocks of text and moved them around quite rapidly. This simple textual explanation just doesn't do justice to what I witnessed that day. Vim offers you the ability to rapidly search, edit, copy, and "read in" files in far less time then your average editor. Vim can also do things you just can't do in other editors. Once you get good enough, vim saves you a lot of time over conventional editors.
</p><p>Before we move on to the next section I would like to pass on a couple quick tips.
</p>
<div style='border-color:silver;border-style:solid;border-width:1px 1px 1px 1px;width:100%;text-align:left;margin-bottom:1em;background:#f9f9f9;'><div style='clear:both;height:.5em'>&nbsp;</div><div style='float:left;border:0;text-align:left;padding-left:.5em'><a href='http://newbiedoc.berlios.de/wiki/Image:120px-Crystal_Clear_Ktip_32.png' class='image' title=''><img alt='Tip' src='../images/d/dc/120px-Crystal_Clear_Ktip_32.png' border='0'/></a></div><div style='float:left;border:0;text-align:left;padding-left:.5em'> <b>Tip:&nbsp;</b> </div><div style='padding-left:11em;padding-right:1em;border:0;text-align:left;'> Beware the caps-lock key!</div><div style='clear:both;height:.5em'>&nbsp;</div>
     </div>
<p><br />
Because vim uses the keyboard as a primary means of navigation, you need to make sure the caps-lock key is not depressed. If you're trying to move around in vim and strange things are happening, check to make sure the caps-lock key is not depressed.
</p>
<div style='border-color:silver;border-style:solid;border-width:1px 1px 1px 1px;width:100%;text-align:left;margin-bottom:1em;background:#f9f9f9;'><div style='clear:both;height:.5em'>&nbsp;</div><div style='float:left;border:0;text-align:left;padding-left:.5em'><a href='http://newbiedoc.berlios.de/wiki/Image:120px-Crystal_Clear_Ktip_32.png' class='image' title=''><img alt='Tip' src='../images/d/dc/120px-Crystal_Clear_Ktip_32.png' border='0'/></a></div><div style='float:left;border:0;text-align:left;padding-left:.5em'> <b>Tip:&nbsp;</b> </div><div style='padding-left:11em;padding-right:1em;border:0;text-align:left;'> Tapping the Escape key twice in quick succession will clear any commands you have begun to type incorrectly.</div><div style='clear:both;height:.5em'>&nbsp;</div>
     </div>
<a name="Installing_vim"></a><h2> <span class="mw-headline">2  Installing vim </span></h2>
<p>To install vim on Debian simply become the root user and type this at the command line:
</p>
<pre># apt-get install vim vim-rt
</pre>
<p>The package vim contains the executable, and the vim-rt package contains all the files necessary to get syntax highlighting to work.
</p>
<div style='border-color:silver;border-style:solid;border-width:1px 1px 1px 1px;width:100%;text-align:left;margin-bottom:1em;background:#f9f9f9;'><div style='clear:both;height:.5em'>&nbsp;</div><div style='float:left;border:0;text-align:left;padding-left:.5em'><a href='http://newbiedoc.berlios.de/wiki/Image:120px-Crystal_Clear_Ktip_32.png' class='image' title=''><img alt='Tip' src='../images/d/dc/120px-Crystal_Clear_Ktip_32.png' border='0'/></a></div><div style='float:left;border:0;text-align:left;padding-left:.5em'> <b>Tip:&nbsp;</b> </div><div style='padding-left:11em;padding-right:1em;border:0;text-align:left;'> If you want to install the graphical version of vim install the packages vim-gtk and vim-rt.</div><div style='clear:both;height:.5em'>&nbsp;</div>
     </div>
<div style='border-color:silver;border-style:solid;border-width:1px 1px 1px 1px;width:100%;text-align:left;margin-bottom:1em;background:#f9f9f9;'><div style='clear:both;height:.5em'>&nbsp;</div><div style='float:left;border:0;text-align:left;padding-left:.5em'><a href='http://newbiedoc.berlios.de/wiki/Image:120px-Crystal_Clear_Ktip_32.png' class='image' title=''><img alt='Tip' src='../images/d/dc/120px-Crystal_Clear_Ktip_32.png' border='0'/></a></div><div style='float:left;border:0;text-align:left;padding-left:.5em'> <b>Tip:&nbsp;</b> </div><div style='padding-left:11em;padding-right:1em;border:0;text-align:left;'> Programming - If you're going to be doing programming, you'll also want to install the package exuberant-ctags.</div><div style='clear:both;height:.5em'>&nbsp;</div>
     </div>
<a name="Vim.27s_built_in_help"></a><h2> <span class="mw-headline">3  Vim's built in help </span></h2>
<p>Learning the way the help system system works in any application you use is always a good idea. In vim, it isn't just a good idea, it's essential. When I first started using vim I put it off for the longest time. I wish I wouldn't have done that!
</p>
<a name="Tutor_me.21"></a><h3> <span class="mw-headline">3.1  Tutor me! </span></h3>
<p>Thanks to vim's hard working developers vim has a very extensive built-in help system. As part of their work they developed a tutor which will walk you through the basics.
</p><p>To start the tutor simply type this command at the console:
</p>
<pre>$ vimtutor
</pre>
<p>Vim should start and look something like this:
</p>
<pre>===============================================================================
=    W e l c o m e   t o   t h e   V I M   T u t o r    -    Version 1.4      =
===============================================================================

Vim is a very powerful editor that has many commands, too many to
explain in a tutor such as this.  This tutor is designed to describe
enough of the commands that you will be able to easily use Vim as
an all-purpose editor.

The approximate time required to complete the tutor is 25-30 minutes,
depending upon how much time is spent with experimentation.

The commands in the lessons will modify the text.  Make a copy of this
file to practice on (if you started &quot;vimtutor&quot; this is already a copy).

It is important to remember that this tutor is set up to teach by
use.  That means that you need to execute the commands to learn them
properly.  If you only read the text, you will forget the commands!

Now, make sure that your Shift-Lock key is NOT depressed and press
the   j   key enough times to move the cursor so that Lesson 1.1
completely fills the screen.</pre>
<p>Simply follow along with the tutor. Below is the outline of what the tutor covers in case you are already familiar with vim. I recommend you continue using the tutor until you can complete it "out of sequence." In other words, you ought to be able to jump around throughout the tutor, doing sections at random, before continuing with the rest of this document.
</p>
<ol><li>Moving the cursor
<ol><li>Entering and exiting vim
</li><li>Text editing-deletion
</li><li>ext editing-insertion 
</li></ol>
</li><li>Deletion commands
<ol><li>More deletion commands
</li><li>On commands and objects
</li><li>Exceptions to command-object
</li><li>The undo command 
</li></ol>
</li><li>The put command
<ol><li>the replace command
</li><li>The change command
</li><li> More changes using "c" 
</li></ol>
</li><li>Location and file status
<ol><li>The search command
</li><li>Matching parentheses search
</li><li>A way to change errors 
</li></ol>
</li><li>How to execute an external command
<ol><li>More on writing files
</li><li>A selective write command
</li><li>Retrieving and merging files 
</li></ol>
</li><li>The open command
<ol><li>The append command
</li><li>Another version of replace
</li><li>Set option 
</li></ol>
</li><li>Online help commands 
</li></ol>
<a name="Navigating_vim.27s_help"></a><h3> <span class="mw-headline">3.2  Navigating vim's help </span></h3>
<p>Vim has an extensive help system. The most basic command is:
</p>
<pre>:help
</pre>
<p>This command will take you to vim's help text. Throughout the help files you will see tags like this: |bars|. By positioning your cursor over these tags and hitting CTRL-] you can jump directly to the subject. To get back to your original position simply type CTRL-t.
</p>
<div style='border-color:silver;border-style:solid;border-width:1px 1px 1px 1px;width:100%;text-align:left;margin-bottom:1em;background:#f9f9f9;'><div style='clear:both;height:.5em'>&nbsp;</div><div style='float:left;border:0;text-align:left;padding-left:.5em'><a href='http://newbiedoc.berlios.de/wiki/Image:120px-Crystal_Clear_Ktip_32.png' class='image' title=''><img alt='Tip' src='../images/d/dc/120px-Crystal_Clear_Ktip_32.png' border='0'/></a></div><div style='float:left;border:0;text-align:left;padding-left:.5em'> <b>Tip:&nbsp;</b> </div><div style='padding-left:11em;padding-right:1em;border:0;text-align:left;'> You can quit the help window by typing&nbsp;:q.</div><div style='clear:both;height:.5em'>&nbsp;</div>
     </div>
<p>A variation of the above command is this:
</p>
<pre>:help subject
</pre>
<p>Where subject is the information you are looking for. One thing to note about the above command is that it takes you to the subject reference. What this means is that this type of help is aimed at users who are already familiar with vim's help syntax. The vimtutor command in the Tutor me! section covers this in Lesson 2 of the vimtutor. You did do the vimtutor didn't you?
</p>
<div style='border-color:silver;border-style:solid;border-width:1px 1px 1px 1px;width:100%;text-align:left;margin-bottom:1em;background:#f9f9f9;'><div style='clear:both;height:.5em'>&nbsp;</div><div style='float:left;border:0;text-align:left;padding-left:.5em'><a href='http://newbiedoc.berlios.de/wiki/Image:120px-Crystal_Clear_Ktip_32.png' class='image' title=''><img alt='Tip' src='../images/d/dc/120px-Crystal_Clear_Ktip_32.png' border='0'/></a></div><div style='float:left;border:0;text-align:left;padding-left:.5em'> <b>Tip:&nbsp;</b> </div><div style='padding-left:11em;padding-right:1em;border:0;text-align:left;'> You can also access vim's help by pressing the F1 function key.</div><div style='clear:both;height:.5em'>&nbsp;</div>
     </div>
<p>Vim's help also contains some quick reference links which you can locate by typing:
</p>
<pre>:help quickref
</pre>
<p>If you're looking for less terse explanations a good place to start is with the vim introduction. In addition to the introduction you can find more detailed help with this command:
</p>
<pre>:help doc-file-list
</pre>
<a name="Modeful_editing"></a><h2> <span class="mw-headline">4  Modeful editing </span></h2>
<p>If you haven't noticed by now, vim is a modeful editor. Vim has 6 different basic modes of operation. The modes are Normal, Visual, Select, Insert, Command line, and Ex. Each mode is suited to a particular purpose. The following sections will cover the basics of each of these modes.
</p>
<div style='border-color:silver;border-style:solid;border-width:1px 1px 1px 1px;width:100%;text-align:left;margin-bottom:1em;background:#f9f9f9;'><div style='clear:both;height:.5em'>&nbsp;</div><div style='float:left;border:0;text-align:left;padding-left:.5em'><a href='http://newbiedoc.berlios.de/wiki/Image:120px-Crystal_Clear_Ktip_32.png' class='image' title=''><img alt='Tip' src='../images/d/dc/120px-Crystal_Clear_Ktip_32.png' border='0'/></a></div><div style='float:left;border:0;text-align:left;padding-left:.5em'> <b>Tip:&nbsp;</b> </div><div style='padding-left:11em;padding-right:1em;border:0;text-align:left;'> If you are not sure which mode you are in simply tap the Escape key twice and you will be put into Normal mode.</div><div style='clear:both;height:.5em'>&nbsp;</div>
     </div>
<p>To get more information on modes type:
</p>
<pre>:help vim-modes
</pre>
<a name="Normal_mode"></a><h3> <span class="mw-headline">4.1  Normal mode </span></h3>
<p>Normal mode is the mode vim normally starts in. Normal mode is also known as command mode. Be careful not to confuse this with Command line mode.
</p><p>Normal mode is where you use most of the built in commands and is primarily used to move the cursor around.
</p><p>To get some basic information about normal mode type:
</p>
<pre>:help normal-mode
</pre>
<a name="Visual_mode"></a><h3> <span class="mw-headline">4.2  Visual mode </span></h3>
<p>Visual mode is a nice way to select large blocks of text so that you can perform other operations on them. You enter visual mode by pressing v (lowercase v), V (capital V), or CTRL-V. The v command highlights the block of text by character, the V command highlights text by the line, and the CTRL-V highlights the text by block.
</p><p>Once you enter visual mode you can use the movement keys (h, k, j, l, w ...) to change which text is highlighted. You can then enter a sequence of Normal commands to manipulate the text. You can also enter Command line mode by typing the&nbsp;: (colon) and then entering a command.
</p><p>If you enter command line mode from visual mode you'll notice this in the "status bar":
</p>
<pre>:'&lt;,'&gt;
</pre>
<p>This is just vim's notation for selecting that block of text. Don't backspace over it. It will be part of the command you enter.
</p><p>As an example, open vim and create a new document, or simply use vimtutor and manipulate that file. Type several sentences on several different lines. Press V to enter "linewise" visual mode. Use your cursor/movement keys to select the first line and type: gU. This should change the entire selected text to all uppercase letters. Once the text is highlighted you can also use the (y)ank and (d)elete commands to "copy" or "cut" the text so you can paste it elsewhere with the (p)aste command. Experiment with it a little. You'll use these commands a lot.
</p><p>TODO. Need some useful examples of visual mode. Anyone want to coauthor?
</p><p>To get more information on what's possible type:
</p>
<pre>:help visual-mode
</pre>
<a name="Select_mode"></a><h3> <span class="mw-headline">4.3  Select mode </span></h3>
<p>TODO. Need some useful examples of select mode. Anyone want to coauthor?
</p><p>To get more information on what's possible type:
</p>
<pre>:help select-mode
</pre>
<a name="Insert_mode"></a><h3> <span class="mw-headline">4.4  Insert mode </span></h3>
<p>Insert mode is the mode in which the letters you type are input into the document. This mode resembles a regular editor. There are other options which will allow you to do additional things as well. For instance, if you use vim with languages which have accented characters that do not appear on your keyboard you can use the digraph option to type those characters.
</p><p>To use digraphs you need to issue the command:
</p>
<pre>:set digraph
</pre>
<p>Note	
</p><p>If you get an error after using this command your version of vim was not compiled with digraph support. The default version of vim in Debian has digraph support.
</p><p>Digraphs are used by typing a character, the Backspace key, and then another character. These combinations of characters are called maps. You can see which digraph maps are available to you by typing:
</p>
<pre>:digraph
</pre>
<p>Here is the output of that command:
</p>
<pre>
~! ¡ 161   c| ¢ 162   $$ £ 163   ox ¤ 164   e= ¤ 164   Y- ¥ 165   || ¦ 166   pa § 167
&quot;&quot; ¨ 168   cO © 169   a- ª 170   &lt;&lt; «&nbsp;171   -, ¬ 172   -- ­ 173   rO ® 174   -= ¯ 175
~o ° 176   +- ± 177   22 ² 178   33 ³ 179   '' ´ 180   ju µ 181   pp ¶ 182   ~. · 183
,, ¸ 184   11 ¹ 185   o- º 186   &gt;&gt;&nbsp;» 187   14 ¼ 188   12 ½ 189   34 ¾ 190   ~? ¿ 191
A` À 192   A' Á 193   A^ Â 194   A~ Ã 195   A&quot; Ä 196   A@ Å 197   AA Å 197   AE Æ 198
C, Ç 199   E` È 200   E' É 201   E^ Ê 202   E&quot; Ë 203   I` Ì 204   I' Í 205   I^ Î 206
I&quot; Ï 207   D- Ð 208   N~ Ñ 209   O` Ò 210   O' Ó 211   O^ Ô 212   O~ Õ 213   O&quot; Ö 214
/\ × 215   OE × 215   O/ Ø 216   U` Ù 217   U' Ú 218   U^ Û 219   U&quot; Ü 220   Y' Ý 221
Ip Þ 222   ss ß 223   a` à 224   a' á 225   a^ â 226   a~ ã 227   a&quot; ä 228   a@ å 229
aa å 229   ae æ 230   c, ç 231   e` è 232   e' é 233   e^ ê 234   e&quot; ë 235   i` ì 236
i' í 237   i^ î 238   i&quot; ï 239   d- ð 240   n~ ñ 241   o` ò 242   o' ó 243   o^ ô 244
o~ õ 245   o&quot; ö 246  &nbsp;:- ÷ 247   oe ÷ 247   o/ ø 248   u` ù 249   u' ú 250   u^ û 251
u&quot; ü 252   y' ý 253   ip þ 254   </pre>
<p>The columns are arranged so that the first character is typed followed by a backspace and then the second character is typed. For example, to get the ¡ (an upside down exclamation point) character I would simply type ~-Backspace-!.
</p>
<div style='border-color:silver;border-style:solid;border-width:1px 1px 1px 1px;width:100%;text-align:left;margin-bottom:1em;background:#f9f9f9;'><div style='clear:both;height:.5em'>&nbsp;</div><div style='float:left;border:0;text-align:left;padding-left:.5em'><a href='http://newbiedoc.berlios.de/wiki/Image:Attach.png' class='image' title=''><img alt='Note' src='../images/c/c1/Attach.png' border='0'/></a></div><div style='float:left;border:0;text-align:left;padding-left:.5em'> <b>Note:&nbsp;</b> </div><div style='padding-left:11em;padding-right:1em;border:0;text-align:left;'> These mappings seem to change between systems and versions of vim. Make sure you double check what your maps are so you get what you expect.</div><div style='clear:both;height:.5em'>&nbsp;</div>
     </div>
<div style='border-color:silver;border-style:solid;border-width:1px 1px 1px 1px;width:100%;text-align:left;margin-bottom:1em;background:#f9f9f9;'><div style='clear:both;height:.5em'>&nbsp;</div><div style='float:left;border:0;text-align:left;padding-left:.5em'><a href='http://newbiedoc.berlios.de/wiki/Image:120px-Crystal_Clear_Ktip_32.png' class='image' title=''><img alt='Tip' src='../images/d/dc/120px-Crystal_Clear_Ktip_32.png' border='0'/></a></div><div style='float:left;border:0;text-align:left;padding-left:.5em'> <b>Tip:&nbsp;</b> </div><div style='padding-left:11em;padding-right:1em;border:0;text-align:left;'> If you use these characters frequently you may wish to explore the langmap option as well. For more information type the command&nbsp;:help langmap.</div><div style='clear:both;height:.5em'>&nbsp;</div>
     </div>
<p>To get more information on what's possible with digraphs type:
</p>
<pre>:help digraphs
</pre>
<p>To get more information on what's possible with insert mode type:
</p>
<pre>:help insert-mode
</pre>
<a name="Command_line_mode"></a><h3> <span class="mw-headline">4.5  Command line mode </span></h3>
<p>Command line mode is entered by typing&nbsp;: (the colon). Once typed the "status bar" along the bottom of the console shows the colon and whatever you type. All the previous&nbsp;:help commands you have typed are examples.
</p>
<div style='border-color:silver;border-style:solid;border-width:1px 1px 1px 1px;width:100%;text-align:left;margin-bottom:1em;background:#f9f9f9;'><div style='clear:both;height:.5em'>&nbsp;</div><div style='float:left;border:0;text-align:left;padding-left:.5em'><a href='http://newbiedoc.berlios.de/wiki/Image:120px-Crystal_Clear_Ktip_32.png' class='image' title=''><img alt='Tip' src='../images/d/dc/120px-Crystal_Clear_Ktip_32.png' border='0'/></a></div><div style='float:left;border:0;text-align:left;padding-left:.5em'> <b>Tip:&nbsp;</b> </div><div style='padding-left:11em;padding-right:1em;border:0;text-align:left;'> Command line mode is entered from Normal mode. If you type the colon and can't seem to get into command line mode try tapping the escape key twice and then type the colon.</div><div style='clear:both;height:.5em'>&nbsp;</div>
     </div>
<p>Command line mode contains a "history" much like the shell does. By typing the beginning of your command and then using the arrow keys you can scroll through a list of the previous commands you entered.
</p><p>Command line mode also has "tab-completion" much like the shell does. By typing the beginning of your command and then the TAB key the command line will complete the available commands for you.
</p><p>To get more information on what's possible with command line mode type:
</p>
<pre>:help cmdline-mode
</pre>
<a name="Ex_mode"></a><h3> <span class="mw-headline">4.6  Ex mode </span></h3>
<p>TODO. Anyone want to coauthor?
</p><p>TODO. Need some useful examples of ex mode.
</p>
<a name="Common_commands"></a><h2> <span class="mw-headline">5  Common commands </span></h2>
<p>The most common commands used in vim are covered in the Tutor me! section. You did the tutor right? The following sections contain some additional commands.
</p>
<a name="Movement_commands"></a><h3> <span class="mw-headline">5.1  Movement commands </span></h3>
<p>Movement commands
</p>
<dl><dt>G
</dt><dd>Move to the end of the file. 
</dd><dt>gg
</dt><dd>Move to the beginning of the file. 
</dd><dt>CTRL-b
</dt><dd>Move back a page. 
</dd><dt>CTRL-f
</dt><dd>Move forward a page. 
</dd><dt>CTRL-u
</dt><dd>Scroll up. 
</dd><dt>CTRL-d
</dt><dd>Scroll down.
</dd></dl>
<div style='border-color:silver;border-style:solid;border-width:1px 1px 1px 1px;width:100%;text-align:left;margin-bottom:1em;background:#f9f9f9;'><div style='clear:both;height:.5em'>&nbsp;</div><div style='float:left;border:0;text-align:left;padding-left:.5em'><a href='http://newbiedoc.berlios.de/wiki/Image:120px-Crystal_Clear_Ktip_32.png' class='image' title=''><img alt='Tip' src='../images/d/dc/120px-Crystal_Clear_Ktip_32.png' border='0'/></a></div><div style='float:left;border:0;text-align:left;padding-left:.5em'> <b>Tip:&nbsp;</b> </div><div style='padding-left:11em;padding-right:1em;border:0;text-align:left;'> If you don't like the way the scrolling works you can adjust it with the scroll, scrolloff, and scrolljump options. Type&nbsp;:help scroll for more information. The vimrc files section explains how to make these adjustments permanent.</div><div style='clear:both;height:.5em'>&nbsp;</div>
     </div>
<dl><dt>CTRL-e
</dt><dd>Expose another line at the top. Useful for scrolling the screen without moving your cursor from its position. 
</dd><dt>CTRL-y
</dt><dd>Expose another line at the bottom. Useful for scrolling the screen without moving your cursor from its position. 
</dd><dt>}
</dt><dd>Move forward a paragraph. Useful for moving through documents which have blank lines separating paragraphs or blocks. An easy way to distinguish between this and { is to remember it points in the direction you wish to go. 
</dd><dt>{
</dt><dd>Move backward a paragraph. Useful for moving through documents which have blank lines separating paragraphs or blocks. 
</dd><dt>)
</dt><dd>Move forward a sentence. An easy way to distinguish between this and ( is to remember it points in the direction you wish to go 
</dd><dt>(
</dt><dd>Move backward a sentence. 
</dd><dt>:number
</dt><dd>Where number is a decimal number indicating the line number you wish to jump/move to. 
</dd><dt>'0
</dt><dd>Vim creates a "bookmark" each time you exit Vim. The last "bookmark" is '0. So if you have a file you haven't edited in a long time and can't remember where you left off simply type this command and it will take you to the place you last edited. You can find out what marks are set by typing&nbsp;:marks. 
</dd></dl>
<p>Reference 
</p>
<pre>:help navigation 
</pre>
<p>and 
</p>
<pre>:help motion 
</pre>
<p>for more information on motion commands.
</p>
<a name="Search_commands"></a><h3> <span class="mw-headline">5.2  Search commands </span></h3>
<p>Search commands
</p>
<dl><dt>/text
</dt><dd>Search forward in the document for text. If found, vim will move the cursor to that position in the file. Once / is typed, text will show up in the status bar as you type it. 
</dd><dt>?text
</dt><dd>Search backward in the document for text. If found, vim will move the cursor to that position in the file. Once&nbsp;? is typed, text will show up in the status bar as you type it.
</dd></dl>
<div style='border-color:silver;border-style:solid;border-width:1px 1px 1px 1px;width:100%;text-align:left;margin-bottom:1em;background:#f9f9f9;'><div style='clear:both;height:.5em'>&nbsp;</div><div style='float:left;border:0;text-align:left;padding-left:.5em'><a href='http://newbiedoc.berlios.de/wiki/Image:120px-Crystal_Clear_Ktip_32.png' class='image' title=''><img alt='Tip' src='../images/d/dc/120px-Crystal_Clear_Ktip_32.png' border='0'/></a></div><div style='float:left;border:0;text-align:left;padding-left:.5em'> <b>Tip:&nbsp;</b> </div><div style='padding-left:11em;padding-right:1em;border:0;text-align:left;'> Normally the search commands stop at the end or beginning of the file depending on which direction you are searching. You can force the search to "wrap around" the file using the wrapscan option. Type&nbsp;:help wrapscan for more information.</div><div style='clear:both;height:.5em'>&nbsp;</div>
     </div>
<dl><dt>*
</dt><dd>This is a search command which will find the next occurance (forward) of the word the cursor is currently on. 
</dd><dt>n
</dt><dd>Find the (n)ext occurance of the previous search. It will use the same direction (i.e. forward vs. backwards) of the previous search as well. 
</dd></dl>
<p>There are several options which allow you to enhance your searching. The hlsearch option highlights the text of the search. The incsearch option highlights and shows possible matches as you type the text. You can get more information on these options by typing 
</p>
<pre>:help hlsearch 
</pre>
<p>and 
</p>
<pre>:help incsearch
</pre>
<p>The vimrc files section explains how to make these adjustments permanent.
</p>
<a name="Simple_editing.2Fcombination_commands"></a><h3> <span class="mw-headline">5.3  Simple editing/combination commands </span></h3>
<a name="Deleting.2Fselecting_parts_of_a_line"></a><h4> <span class="mw-headline">5.3.1  Deleting/selecting parts of a line </span></h4>
<dl><dt>dfx
</dt><dd>Delete forward until you find x (inclusive). If x is found, vim will delete everything from the current cursor position to and including x.
</dd><dd>This one and its variations <b>dFx</b>, <b>dtx</b>, and <b>dTx</b> are very useful when editing mark-up languages like html and sgml. It is especially useful in deleting and changing quoted attributes within mark-up tags.
</dd><dd>This is a combination of the (d)elete command and the (f)ind motion command. You may also substitute other commands for the delete portion of that command, such as visual by character, or yank. 
</dd><dt>dFx
</dt><dd>Delete backward until you find x (inclusive). If x is found, vim will delete everything from the current cursor position to and including x. 
</dd><dt>dtx
</dt><dd>Delete forward until you find x (exclusive). If x is found, vim will delete everything from the current cursor position to, but not including x. 
</dd><dt>dTx
</dt><dd>Delete backward until you find x (exclusive). If x is found, vim will delete everything from the current cursor position to, but not including x. 
</dd></dl>
<a name="Deleting.2Fselecting_spanning_multiple_lines"></a><h4> <span class="mw-headline">5.3.2  Deleting/selecting spanning multiple lines </span></h4>
<dl><dt>d/x
</dt><dd>Delete forward until you find x (exclusive). If x is found, vim will delete everything from the current cursor position to, but not including x, spanning multiple lines if necessary.
</dd><dd>x doesn't have to be one character. It's most likely to be a word or several characters. If you're editing your email, you could use this to delete all text up to your signature by executing d/--.
</dd><dd>This is a combination of the (d)elete command and the (/) search forward motion command. You may also substitute other commands for the delete portion of that command, such as visual by character, Visual by line, or yank. 
</dd><dt>d?x
</dt><dd>Delete backward until you find x (exclusive). If x is found, vim will delete everything from the current cursor position to, but not including x, spanning multiple lines if necessary. 
</dd></dl>
<a name="Cut.2C_copy.2C_and_paste"></a><h4> <span class="mw-headline">5.3.3  Cut, copy, and paste </span></h4>
<dl><dt>V-any_motion_command
</dt><dd>V selects the text by the line. Simply use j, k, or the paragraph motion commands ({, }) to select the block of text. Now type d to delete (cut) it, y to yank (copy) it, and p to paste it. 
</dd></dl>
<a name="Spell_checking"></a><h4> <span class="mw-headline">5.3.4  Spell checking </span></h4>
<p>TODO
</p>
<pre>   TODO. 
</pre>
<a name="Find_and_replace"></a><h4> <span class="mw-headline">5.3.5  Find and replace </span></h4>
<p>This topic is covered extremely well by Sven Guckes. You can read the document here: <a href="http://www.math.fu-berlin.de/~guckes/vi/subst.html" class="external free.html" title="http://www.math.fu-berlin.de/~guckes/vi/subst.html" rel="nofollow">http://www.math.fu-berlin.de/~guckes/vi/subst.html</a> 
</p><p>Do you have a simple editing option you use frequently? Please add it to the discussion/talk page <a href="http://newbiedoc.berlios.de/index.php?title=Talk:Beginner%27s_guide_to_Vi_Improved_%28Vim%29&amp;action=edit" class="external free.html" title="http://newbiedoc.berlios.de/index.php?title=Talk:Beginner%27s_guide_to_Vi_Improved_%28Vim%29&amp;action=edit" rel="nofollow">http://newbiedoc.berlios.de/index.php?title=Talk:Beginner%27s_guide_to_Vi_Improved_%28Vim%29&amp;action=edit</a>.
</p>
<a name="Personalizing_vim"></a><h2> <span class="mw-headline">6  Personalizing vim </span></h2>
<a name="vimrc_files"></a><h3> <span class="mw-headline">6.1  vimrc files </span></h3>
<p>Vim is a very customizable editor. Many of the options you can set require you to type in a command like this:
</p>
<pre>:set autoindent
</pre>
<p>This is the option to set autoindent which keeps the indentation level you are currently at when you hit the enter key. Rather than retype this command every time you want this option enabled, vim has a resource file it checks to see which options you would like set when vim starts. Technically, there are two such files, /etc/vimrc, and ~/.vimrc. Within these files you can set standard options which will automatically be set when you start vim.
</p><p>The /etc/vimrc is the system wide configuration file and shouldn't really be edited unless you know what you are doing or you're the administrator for that machine. The ~/.vimrc file is located in your home directory (that's what the ~/ means, in case you were wondering) and is meant specifically for the purpose of customization.
</p>
<div style='border-color:silver;border-style:solid;border-width:1px 1px 1px 1px;width:100%;text-align:left;margin-bottom:1em;background:#f9f9f9;'><div style='clear:both;height:.5em'>&nbsp;</div><div style='float:left;border:0;text-align:left;padding-left:.5em'><a href='http://newbiedoc.berlios.de/wiki/Image:Flag.png' class='image' title=''><img alt='Warning' src='../images/7/76/Flag.png' border='0'/></a></div><div style='float:left;border:0;text-align:left;padding-left:.5em'> <b>Warning:&nbsp;</b> </div><div style='padding-left:11em;padding-right:1em;border:0;text-align:left;'> Before editing a vimrc file it's a good idea to back it up just in case you mess it up beyond repair.</div><div style='clear:both;height:.5em'>&nbsp;</div>
     </div>
<p>You can see a list of available options that can be set by typing the following command:
</p>
<pre>:set all
</pre>
<p>The output of that command looks something like this:
</p>
<pre>
autoindent          noincsearch         scroll=18           textwidth=0
noautowrite         noinfercase         noscrollbind        notildeop
background=dark     noinsertmode        scrolljump=1        timeout
backspace=2         isprint=@,161-255   scrolloff=0         timeoutlen=1000
nobackup            joinspaces          nosecure            notitle
backupext=~         key=                selectmode=         titlelen=85
nobinary            keymodel=           shell=/bin/bash     titlestring=
nocindent           keywordprg=man      shellcmdflag=-c     nottimeout
cinoptions=         langmap=            shellquote=         ttimeoutlen=-1
cmdheight=1         laststatus=1        shellxquote=        ttybuiltin
columns=98          nolazyredraw        noshiftround        ttyfast
nocompatible        nolinebreak         shiftwidth=4        ttymouse=xterm
noconfirm           lines=38            noshortname         ttyscroll=999
cpoptions=aABceFs   nolisp              showbreak=          ttytype=xterm
dictionary=         nolist              noshowcmd           undolevels=1000
nodigraph           listchars=eol:$     noshowfulltag       updatecount=200
display=            magic               showmatch           updatetime=4000
noedcompatible      makeprg=make        showmode            verbose=0
endofline           matchtime=5         sidescroll=0        viminfo='20,&quot;50
equalalways         maxfuncdepth=100    nosmartcase         visualbell
equalprg=           maxmapdepth=1000    nosmartindent       warn
noerrorbells        maxmem=5120         nosmarttab          noweirdinvert
noexpandtab         modelines=5         startofline         wildcharm=^@
noexrc              nomodified          statusline=         wildignore=
fileencoding=ansi   more                swapfile            nowildmenu
fileformat=unix     mouse=              swapsync=fsync      wildmode=full
filetype=           mousemodel=extend   switchbuf=          winheight=1
formatoptions=tcq   mousetime=500       syntax=             winminheight=1
formatprg=        nonumber              tabstop=4           wrap
nogdefault          nopaste               tagbsearch          wrapmargin=0
grepprg=grep -n     pastetoggle=        taglength=0         wrapscan
helpheight=20       patchmode=          tagrelative         write </pre>
<p>As you can see there are a lot of options to set/unset. To get more information on what an option does simply type&nbsp;:help name_of_option replacing name_of_option with the option you're interested in.
</p><p>Once you decide how you want an option to be set you can add it to your ~/.vimrc file. Using the autoindent example above, simply add this line to your vimrc file:
</p>
<pre>set autoindent "this sets the autoindent option
" set noautoindent
</pre>
<p>Comments are created in vimrc files using the " (quote) character. As you can see I put a comment next to the autoindent option and also added a "commented out" option which disables the previous noautoindent option I had set. Most of the options follow this convention; if you wish to disable it, simply put no in front of the option.
</p><p>For more information about vimrc files type:
</p>
<pre>:help vimrc
</pre>
<a name="Color_Schemes"></a><h3> <span class="mw-headline">6.2  Color Schemes </span></h3>
<p>TODO. Need some useful examples of color schemes. Anyone want to coauthor?
</p><p>For more information about color schemes type:
</p>
<dl><dd>help 
</dd></dl>
<a name="Syntax_highlighting"></a><h3> <span class="mw-headline">6.3  Syntax highlighting </span></h3>
<p>If you installed the vim-rt package described in Installing vim, all you have to do to enable syntax highlighting is add syntax on to your .vimrc file. The highlighting syntax is chosen based on filename extension so it happens pretty much automatically.
</p><p>You can change the default colors of a syntax highlight by using the highlight command. For example, to change all comments to the color green type:
</p>
<pre>:highlight Comment ctermfg=green
</pre>
<p>The second argument to that command is the group name. To make the setting permanent simply add it to your .vimrc.
</p>
<div style='border-color:silver;border-style:solid;border-width:1px 1px 1px 1px;width:100%;text-align:left;margin-bottom:1em;background:#f9f9f9;'><div style='clear:both;height:.5em'>&nbsp;</div><div style='float:left;border:0;text-align:left;padding-left:.5em'><a href='http://newbiedoc.berlios.de/wiki/Image:Attach.png' class='image' title=''><img alt='Note' src='../images/c/c1/Attach.png' border='0'/></a></div><div style='float:left;border:0;text-align:left;padding-left:.5em'> <b>Note:&nbsp;</b> </div><div style='padding-left:11em;padding-right:1em;border:0;text-align:left;'> In order for the color change to work the highlight command should come after the syntax on command in your .vimrc.</div><div style='clear:both;height:.5em'>&nbsp;</div>
     </div>
<p>To see what group names are available to be changed type:
</p>
<pre>:help group-name
</pre>
<p>The available colors can be found by typing:
</p>
<pre>:help cterm-colors
</pre>
<div style='border-color:silver;border-style:solid;border-width:1px 1px 1px 1px;width:100%;text-align:left;margin-bottom:1em;background:#f9f9f9;'><div style='clear:both;height:.5em'>&nbsp;</div><div style='float:left;border:0;text-align:left;padding-left:.5em'><a href='http://newbiedoc.berlios.de/wiki/Image:Attach.png' class='image' title=''><img alt='Note' src='../images/c/c1/Attach.png' border='0'/></a></div><div style='float:left;border:0;text-align:left;padding-left:.5em'> <b>Note:&nbsp;</b> </div><div style='padding-left:11em;padding-right:1em;border:0;text-align:left;'> Some colors may not be available. Reference&nbsp;:help xterm-colors and&nbsp;:help xiterm for more information.</div><div style='clear:both;height:.5em'>&nbsp;</div>
     </div>
<p>TODO. Need some useful examples of customized syntax. Anyone want to coauthor?
</p><p>For more information about syntax highlighting type:
</p>
<pre>:help syntax
</pre>
<a name="Abbreviations"></a><h3> <span class="mw-headline">6.4  Abbreviations </span></h3>
<p>Abbreviations are just shortcuts you type which expand to longer versions of themselves. You can create an abbreviation simply by typing:
</p>
<pre>:ab dmv Department of Motor Vehicles
</pre>
<p>Abbreviations take the form:
</p>
<pre>:ab abbreviation Full text, spaces are ok
</pre>
<p>What happens is when you type the abbreviation in vim, as soon as you hit the space bar it is expanded to the full text. The abbreviation dmv in the prior example would expand to "Department of Motor Vehicles." If you close vim these settings are lost unless you commit them to your .vimrc file.
</p><p>Unless you are only using the abbreviation on a small document, abbreviations are usually added to your personal .vimrc file. This is accomplished by adding the abbreviation like this:
</p>
<pre>ab abbreviation Everything after abbreviation will be input
</pre>
<div style='border-color:silver;border-style:solid;border-width:1px 1px 1px 1px;width:100%;text-align:left;margin-bottom:1em;background:#f9f9f9;'><div style='clear:both;height:.5em'>&nbsp;</div><div style='float:left;border:0;text-align:left;padding-left:.5em'><a href='http://newbiedoc.berlios.de/wiki/Image:120px-Crystal_Clear_Ktip_32.png' class='image' title=''><img alt='Tip' src='../images/d/dc/120px-Crystal_Clear_Ktip_32.png' border='0'/></a></div><div style='float:left;border:0;text-align:left;padding-left:.5em'> <b>Tip:&nbsp;</b> </div><div style='padding-left:11em;padding-right:1em;border:0;text-align:left;'> To find out which abbreviations you currently have defined, just type&nbsp;:ab and hit enter and the abbreviation definition will show up in the "status bar."</div><div style='clear:both;height:.5em'>&nbsp;</div>
     </div>
<p>For more information about abbreviations type:
</p>
<pre>:help ab
</pre>
<a name="Mapping_Keys"></a><h2> <span class="mw-headline">7  Mapping Keys </span></h2>
<p>Mapping keys is one of the most useful and productive operations that vim performs. Mapping keys is just a method to map a complex command to a particular keystroke or sequence of keystrokes. If you find yourself routinely performing the same commands to edit a document there is a good possibility you could create a map to make your editing easier.
</p><p>For instance, if you write html, xml, or sgml documents in a text editor you know it can become quite tedious typing out all those tags all the time. Markup language tags may also include attributes which you also have to type in or cut and paste from other locations. This can slow your work down quite a bit. There are gui programs which sort of solve this but many of them can't always give you the control you need and you end up resorting to hand editing the file anyway. The simple solution in vim is to create a map.
</p><p>There are several different types of maps you can create but the two we will concentrate on are Normal mode and Insert mode maps. Normal mode maps begin with the command map and look something like this:
</p>
<pre>map keyboard_key command_to_execute
</pre>
<p>Insert mode maps begin with the command map! and look something like this:
</p>
<pre>map! keyboard_key command_to_execute
</pre>
<div style='border-color:silver;border-style:solid;border-width:1px 1px 1px 1px;width:100%;text-align:left;margin-bottom:1em;background:#f9f9f9;'><div style='clear:both;height:.5em'>&nbsp;</div><div style='float:left;border:0;text-align:left;padding-left:.5em'><a href='http://newbiedoc.berlios.de/wiki/Image:Flag.png' class='image' title=''><img alt='Warning' src='../images/7/76/Flag.png' border='0'/></a></div><div style='float:left;border:0;text-align:left;padding-left:.5em'> <b>Warning:&nbsp;</b> </div><div style='padding-left:11em;padding-right:1em;border:0;text-align:left;'> Avoid re-mapping the F1 key as this is always mapped to vim's help.</div><div style='clear:both;height:.5em'>&nbsp;</div>
     </div>
<p>The complexity of the map is pretty much limited to your imagination. Here is a simple map you might use to open a letter:
</p>
<pre>map &lt;F2&gt; iTo whom it may concern, &lt;CR&gt;&lt;CR&gt;&lt;TAB&gt;
</pre>
<p>This is a Normal mode map set to use the F2 key. It won't work when you're in insert mode. When you press the F2 key, vim executes the insert command (because it's still in Normal mode), it then types all the letters as it sees them (because now it's in Insert mode) until it hits CR. This is how you type a Carriage Return in maps. So vim executes a carriage return. It then executes the next carriage return and then indents that line with one tab. At this point the map is finished. If you would like to test this map go ahead and copy the map into vim by typing&nbsp;: and then pasting the map into the status bar. Press Return. Now try pressing the F2 key and see what it does. One thing to notice is the map exits while in insert mode. This allows you to start typing immediately.
</p>
<div style='border-color:silver;border-style:solid;border-width:1px 1px 1px 1px;width:100%;text-align:left;margin-bottom:1em;background:#f9f9f9;'><div style='clear:both;height:.5em'>&nbsp;</div><div style='float:left;border:0;text-align:left;padding-left:.5em'><a href='http://newbiedoc.berlios.de/wiki/Image:120px-Crystal_Clear_Ktip_32.png' class='image' title=''><img alt='Tip' src='../images/d/dc/120px-Crystal_Clear_Ktip_32.png' border='0'/></a></div><div style='float:left;border:0;text-align:left;padding-left:.5em'> <b>Tip:&nbsp;</b> </div><div style='padding-left:11em;padding-right:1em;border:0;text-align:left;'> If you forgot what maps you have or just want to see what maps you have defined you can simply type:&nbsp;:map or&nbsp;:map! and hit enter. The defined maps will show up in the "status bar."</div><div style='clear:both;height:.5em'>&nbsp;</div>
     </div>
<div style='border-color:silver;border-style:solid;border-width:1px 1px 1px 1px;width:100%;text-align:left;margin-bottom:1em;background:#f9f9f9;'><div style='clear:both;height:.5em'>&nbsp;</div><div style='float:left;border:0;text-align:left;padding-left:.5em'><a href='http://newbiedoc.berlios.de/wiki/Image:120px-Crystal_Clear_Ktip_32.png' class='image' title=''><img alt='Tip' src='../images/d/dc/120px-Crystal_Clear_Ktip_32.png' border='0'/></a></div><div style='float:left;border:0;text-align:left;padding-left:.5em'> <b>Tip:&nbsp;</b> </div><div style='padding-left:11em;padding-right:1em;border:0;text-align:left;'> To make maps permanent add them to your .vimrc file.</div><div style='clear:both;height:.5em'>&nbsp;</div>
     </div>
<p>Earlier I talked about how maps can make working with markup languages easier. Here are several example Insert mode maps which can be used to create headings in html:
</p>
<pre>map! ,h1 &lt;H1&gt;&lt;/H1&gt;&lt;ESC&gt;2ba
map! ,h2 &lt;H2&gt;&lt;/H2&gt;&lt;ESC&gt;2ba
map! ,h3 &lt;H3&gt;&lt;/H3&gt;&lt;ESC&gt;2ba</pre>
<p>We will focus on the first map. This map is executed while you are typing in insert mode. After you type ,h1 vim types &lt;H1&gt;&lt;/H1&gt; for you. It then sees the escape command which just like any other time you're in insert mode takes you back to Normal mode. Vim then sees the command to move back 2 words (2b) which puts the cursor on the "&gt;" of the first &lt;H1&gt; tag. Vim then sees the a command so it moves one space to the right and enters insert mode. At this point the map is finished, your tags have been written, you are in insert mode and ready to type the heading. The beauty of maps like this is you never leave insert mode (at least from your perspective) and you type only 3 characters and get many more. Once you get used to your personal maps it's easy to forget about all the tags and concentrate more on your content.
</p><p>If you would like to try these maps out simply copy and paste them into vim like the previous example.
</p><p>There are several things you should notice about the previous examples. Insert mode maps are generally used to enter portions of text which are repetitive or time consuming. They work extremely well for inserting markup text and then positioning your cursor where you would logically type next. They take care of "closing" tags for you which can cut down on nesting errors and ill formed documents.
</p><p>When creating maps, selection of your assigned keystrokes is pretty much up to you. I would recommend you avoid re-mapping standard commands as this makes it difficult for you to transition to someone else's machine unless you carry around a copy of your .vimrc on a floppy (which I've often thought about&nbsp;:) ). When you choose a sequence of commands for Insert mode choose a sequence which is unlikely to be typed. In the previous example I chose the "," because in almost every type of document it is always followed by a space. The reason for this is vim has to pause for a second whenever the first character of one of its maps is pressed. It does this to see if you are typing a map or just a sequence of characters that just happens to start with the mapped character. By choosing the comma, every time I type a comma and then the following space, vim knows almost immediately that I don't want a map.
</p><p>For more complex map examples see the section Example maps and vimrc files.
</p><p>For more information about mapping keys type:
</p>
<pre>:help key-mapping
</pre>
<a name="Writing_Functions"></a><h2> <span class="mw-headline">8  Writing Functions </span></h2>
<p>TODO. Need some useful examples. Anyone want to coauthor?
</p><p>For more information about built-in functions type:
</p>
<pre>:help functions
</pre>
<p>For more information about user defined functions type:
</p>
<pre>:help user-functions
</pre>
<a name="Programming_with_vim"></a><h2> <span class="mw-headline">9  Programming with vim </span></h2>
<p>This subject is covered very well by a document at the Linux Documentation Project. Please reference the C-editing-with-VIM-HOWTO at <a href="http://www.tldp.org/HOWTO/C-editing-with-VIM-HOWTO" class="external free.html" title="http://www.tldp.org/HOWTO/C-editing-with-VIM-HOWTO" rel="nofollow">http://www.tldp.org/HOWTO/C-editing-with-VIM-HOWTO</a>.
</p>
<a name="Example_maps_and_vimrc_files"></a><h2> <span class="mw-headline">10  Example maps and vimrc files </span></h2>
<p>Following is my "system" using a combination of vimrc files and maps.
</p><p>What I did was create a basic .vimrc file in my home directory and map the function keys (except F1) to source each of the custom vimrc files. Here is my example ~/.vimrc.
</p><p>The custom vimrc files were placed in the ~/.vim_custom directory. Currently those files consist of vimrc files for editing shell scripts, php scripts, C/C++ programming, and sgml source files.
</p>
<ul><li>Here is my example <a href="http://newbiedoc.sourceforge.net/text_editing/vim.html.en#JESSE-SHELLRC" class="external text.html" title="http://newbiedoc.sourceforge.net/text_editing/vim.html.en.html#JESSE-SHELLRC" rel="nofollow">~/.vim_custom/bash-vimrc</a>
</li><li> Here is my example <a href="http://newbiedoc.sourceforge.net/text_editing/vim.html.en#JESSE-PHPRC" class="external text.html" title="http://newbiedoc.sourceforge.net/text_editing/vim.html.en.html#JESSE-PHPRC" rel="nofollow">~/.vim_custom/php-vimrc</a>
</li><li>Here is my example <a href="http://newbiedoc.sourceforge.net/text_editing/vim.html.en#JESSE-CRC" class="external text.html" title="http://newbiedoc.sourceforge.net/text_editing/vim.html.en.html#JESSE-CRC" rel="nofollow">~/.vim_custom/c-vimrc</a>
</li><li>Here is my example <a href="http://newbiedoc.sourceforge.net/text_editing/vim.html.en#JESSE-SGMLRC" class="external text.html" title="http://newbiedoc.sourceforge.net/text_editing/vim.html.en.html#JESSE-SGMLRC" rel="nofollow">~/.vim_custom/sgml-vimrc</a> 
</li></ul>
<div style='border-color:silver;border-style:solid;border-width:1px 1px 1px 1px;width:100%;text-align:left;margin-bottom:1em;background:#f9f9f9;'><div style='clear:both;height:.5em'>&nbsp;</div><div style='float:left;border:0;text-align:left;padding-left:.5em'><a href='http://newbiedoc.berlios.de/wiki/Image:Attach.png' class='image' title=''><img alt='Note' src='../images/c/c1/Attach.png' border='0'/></a></div><div style='float:left;border:0;text-align:left;padding-left:.5em'> <b>Note:&nbsp;</b> </div><div style='padding-left:11em;padding-right:1em;border:0;text-align:left;'> If you're going to copy and paste these into files please beware of the CTRL-D character. That character has to be typed into your file with this key combination: CTRL-V and then CTRL-D. It will display in the file like this: ^D. A quick way to convert all these is to do this:
<pre>:%s/\^D/CTRL-V CTRL-D/g
</pre>
Everything in that command is typed as printed on this document except CTRL-V CTRL-D which is typed as explained above.</div><div style='clear:both;height:.5em'>&nbsp;</div>
     </div>
<p>Each vimrc file calls a function which unmaps the function keys except for the F2 function key which is always mapped to re-source the base ~/.vimrc file. It then maps the function keys and any other custom maps specific to its purpose.
</p><p>I chose to do it this way for several reasons. The first reason was modularity. If I find someone else's vimrc file which includes some neat functions or mappings it's easy to incorporate them into my existing "system" without messing with what's already there. Second, I don't use the function keys for anything else so it seemed the logical thing to do. Third, it seemed to follow a sort of "menu" approach to doing things.
</p><p>If you have an approach to doing this which you like and would like to include it in this document please send in your vimrc/functions/mappings to newbiedoc-discuss@lists.sourceforge.net so we can add it to this document.
</p>
<a name="References_and_links"></a><h2> <span class="mw-headline">11  References and links </span></h2>
<ul><li>Vi Lovers home page <a href="http://www.thomer.com/thomer/vi/vi.html" class="external free.html" title="http://www.thomer.com/thomer/vi/vi.html" rel="nofollow">http://www.thomer.com/thomer/vi/vi.html</a>
</li><li><a href="http://www.vim.org" class="external free.html" title="http://www.vim.org" rel="nofollow">http://www.vim.org</a>
</li><li>C-editing-with-VIM-HOWTO <a href="http://www.linuxdoc.org/HOWTO/C-editing-with-VIM-HOWTO/index.html" class="external free.html" title="http://www.linuxdoc.org/HOWTO/C-editing-with-VIM-HOWTO/index.html" rel="nofollow">http://www.linuxdoc.org/HOWTO/C-editing-with-VIM-HOWTO/index.html</a>
</li><li>Vi Substitute Guide (HOWTO use the ":s" command) <a href="http://www.math.fu-berlin.de/~guckes/vi/subst.html" class="external free.html" title="http://www.math.fu-berlin.de/~guckes/vi/subst.html" rel="nofollow">http://www.math.fu-berlin.de/~guckes/vi/subst.html</a>
</li></ul>
<a name="Contributors"></a><h2> <span class="mw-headline">12  Contributors </span></h2>
<p>These folks have contributed in one way or another, I've tried to include what is was but chances are I screwed it up. If I did, my apologies, and thanks!
</p>
<ul><li>Allan M. Wind (d/x and d?x)
</li><li>Romain Lerallut (*) 
</li></ul>
<a name="Appendix_A:_My_examples"></a><h2> <span class="mw-headline">13  Appendix A: My examples </span></h2>
<a name="Example_A-1._My_.7E.2F.vimrc"></a><h3> <span class="mw-headline">13.1  Example A-1. My ~/.vimrc </span></h3>
<pre>
&quot; Global variable which holds the path to my customization files
&quot; You'll need to edit this so it matches your system
let g:VIM_CUSTOM = &quot;/home/jesse/.vim_custom/&quot;

set visualbell
set background=dark
set tabstop=4
set showmatch
set showcmd
set autowrite

&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;
&quot;                 Color scheme                   &quot;
&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;&quot;

&quot; Some custom color modifications.  reference&nbsp;:help highlight and&nbsp;:help cterm
highlight ModeMsg cterm=bold ctermfg=2 ctermbg=black	&quot; set mode message ( --INSERT-- ) to green
highlight StatusLine ctermfg=7 ctermbg=9		&quot; set the active statusline to black