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
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="../img/favicon.ico">
<title>Quick Start - Vim</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.12.0/css/all.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.12.0/css/v4-shims.css">
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/hack-font@3.3.0/build/web/hack.min.css">
<link href='//rsms.me/inter/inter.css' rel='stylesheet' type='text/css'>
<link href='//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,400,300,600,700&subset=latin-ext,latin' rel='stylesheet' type='text/css'>
<link href="../css/bootstrap-custom.min.css" rel="stylesheet">
<link href="../css/base.min.css" rel="stylesheet">
<link href="../css/cinder.min.css" rel="stylesheet">
<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.18.0/build/styles/github.min.css">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<!-- Collapsed navigation -->
<div class="navbar-header">
<!-- Expander button -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- Main title -->
<a class="navbar-brand" href="..">Vim</a>
</div>
<!-- Expanded navigation -->
<div class="navbar-collapse collapse">
<!-- Main navigation -->
<ul class="nav navbar-nav">
<li >
<a href="..">Home</a>
</li>
<li >
<a href="../about/">About</a>
</li>
<li >
<a href="../intro/">Introduction</a>
</li>
<li class="active">
<a href="./">Quick Start</a>
</li>
<li >
<a href="../understanding/">Understanding Vim</a>
</li>
<li >
<a href="../references/">References</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li >
<a rel="prev" href="../intro/">
<i class="fas fa-arrow-left"></i> Previous
</a>
</li>
<li >
<a rel="next" href="../understanding/">
Next <i class="fas fa-arrow-right"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="container">
<div class="col-md-3"><div class="bs-sidebar hidden-print affix well" role="complementary">
<ul class="nav bs-sidenav">
<li class="first-level active"><a href="#quick-start">Quick Start</a></li>
<li class="second-level"><a href="#installation">Installation</a></li>
<li class="third-level"><a href="#macos">MacOS</a></li>
<li class="third-level"><a href="#windows">Windows</a></li>
<li class="third-level"><a href="#linux">Linux</a></li>
<li class="third-level"><a href="#verify-installation">Verify Installation</a></li>
<li class="second-level"><a href="#a-quick-adventure-making-a-todo-file">A Quick Adventure - Making A Todo File</a></li>
<li class="third-level"><a href="#creating-a-new-todo-list">Creating a New Todo List</a></li>
<li class="third-level"><a href="#navigating-the-cursor">Navigating the cursor</a></li>
<li class="third-level"><a href="#adding-a-todo">Adding a Todo</a></li>
<li class="third-level"><a href="#saving">Saving</a></li>
<li class="third-level"><a href="#exiting">Exiting</a></li>
<li class="third-level"><a href="#reopening-the-file">Reopening The File</a></li>
<li class="third-level"><a href="#mark-a-todo-as-done">Mark A Todo As Done</a></li>
<li class="third-level"><a href="#delete-a-todo">Delete A Todo</a></li>
<li class="second-level"><a href="#further-understanding-vim">Further Understanding Vim</a></li>
</ul>
</div></div>
<div class="col-md-9" role="main">
<h1 id="quick-start">Quick Start</h1>
<p>Welcome to the QuickStart guide for Vim. This guide will help you get the bare bones knowledge of using Vim and will get you to the point where you can embark on the long but fun, journey to using Vim as your main text editor!</p>
<h2 id="installation">Installation</h2>
<h6>Eric</h6>
<h3 id="macos">MacOS</h3>
<p>Using <a href="https://brew.sh/">homebrew</a>, you can install the latest version of Vim with <code>brew install vim</code>, though an older version comes pre-installed on MacOS if you don't wish to use homebrew.</p>
<h3 id="windows">Windows</h3>
<p>If you are on a Windows machine, navigate to <a href="https://www.vim.org">vim.org</a>, <a href="https://www.vim.org/download.php">downloads</a>, and select your version. Afterwards, it will be accessable from the <code>cmd</code> Terminal, or if chosen in the installation, can be launched from the Desktop Icon.</p>
<h3 id="linux">Linux</h3>
<h4 id="fedora">Fedora</h4>
<pre><code class="language-bash">sudo dnf install vim
</code></pre>
<h4 id="arch-linux">Arch Linux</h4>
<pre><code class="language-bash">sudo pacman -S vim
</code></pre>
<h4 id="debianubuntu">Debian/Ubuntu</h4>
<pre><code class="language-bash">sudo apt install vim
</code></pre>
<h3 id="verify-installation">Verify Installation</h3>
<p>Verify that Vim is installed by opening a terminal and running <code>vim</code>. If you see something like this, you are good to go! Now you can exit Vim by typing <code>:q</code>.</p>
<p><img alt="Vim Screenshot" src="../img/vim_window.png" /></p>
<h2 id="a-quick-adventure-making-a-todo-file">A Quick Adventure - Making A Todo File</h2>
<h3 id="creating-a-new-todo-list">Creating a New Todo List</h3>
<h6>Tyler</h6>
<p>Creating a new file with vim is really simple just type:</p>
<pre><code class="language-bash">vim todo.txt
</code></pre>
<p>Whenever you pass a file that doesn't exist vim creates it for you and opens it up for editing.</p>
<h3 id="navigating-the-cursor">Navigating the cursor</h3>
<h6>Tyler</h6>
<p>Vim does not support the usage of a mouse so movement of the cursor is handled entirely with the keyboard.
The basic movements of the cursor are as follows:</p>
<table>
<thead>
<tr>
<th>Command</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>h</code></td>
<td><code>(←)</code> Move the cursor left one character</td>
</tr>
<tr>
<td><code>j</code></td>
<td><code>(↓)</code> Move the cursor down one line</td>
</tr>
<tr>
<td><code>k</code></td>
<td><code>(↑)</code> Move the cursor up one line</td>
</tr>
<tr>
<td><code>l</code></td>
<td><code>(→)</code> Move the cursor right one character</td>
</tr>
</tbody>
</table>
<h3 id="adding-a-todo">Adding a Todo</h3>
<h6>Eric</h6>
<p>Now that you have opened a file in Vim, it's time to insert text. For now, press the <code>i</code> key to enter into Insert Mode. More details on the different modes will be covered a little further on. For now, lets practice adding some text to Vim.</p>
<p>Inserting text works just like any other text editor, so try and insert some text, following this format:</p>
<p><img alt="TODO List" src="../img/vimtodo.png" /></p>
<p>This will probably end up with something to the likes of:</p>
<pre><code>My Todos
- [ ] Eat Vegetables
- [ ] Take a Nap
- [ ] Learn Vim
</code></pre>
<h4 id="a-quick-aside-normal-vs-insert-mode">A Quick Aside: Normal vs Insert Mode</h4>
<h6>Logan</h6>
<p>Insert mode, used to actually type text into the document, can be accessed by pressing <code>i</code>. To exit this mode, press the <code>ESC</code> key.</p>
<p>For now, think of Normal Mode as the mode to move the text cursor around, and Insert Mode as how to actually insert text into the document (this will be further explained in <a href="../understanding/">Understanding Vim</a>).</p>
<h3 id="saving">Saving</h3>
<h6 id="authored-by-alaina-d">Authored by Alaina D</h6>
<p>Once you have added text to a file (see "Adding a Todo" if you are not sure how to insert text), you will want to save the file for later editing.</p>
<p>In Vim, there are three common ways to save a file:</p>
<ul>
<li>using <code>:w</code></li>
<li>using <code>:x</code></li>
<li>using <code>:wq</code></li>
</ul>
<p>Before you attempt any of the above commands, hit <code>ESC</code> (the "escape" key) to make sure Vim is in Normal mode. You should see a blank line in bottom of your terminal (hint: if the bottom of your terminal says "-- INSERT --", you are <strong>not</strong> in Normal mode).</p>
<p>The following is a screenshot of Vim in normal mode:</p>
<p><img alt="Vim Screenshot" src="../img/save_in_normal_mode.png" /></p>
<p>Once Vim is in normal mode, you can enter any of the previously mentioned "save" commands (<code>:w</code>, <code>:x</code>, or <code>:wq</code>), followed by the <code>ENTER</code> key. </p>
<p><strong>Note</strong>: These commands are case-sensitive (the letters in each command must be lower-case).
<br><br></p>
<h6 id="using-w">Using <code>:w</code></h6>
<p>The command <code>:w</code> will save (write) the file that you are currently editing. If you use <code>:w</code> to write (save) your file, your file will remain open in Vim. This command is great for saving a file that you would like to continue editing.</p>
<h6 id="using-x">Using <code>:x</code></h6>
<p>The command <code>:x</code> will save (write) the file that you are currently editing. If you use <code>:x</code> to write (save) your file, your file will only be saved <em>if</em> changes have been made to the file. This command will not change the modification timestamp of the file if you have not made changes to the file after opening it. If you use <code>:x</code> to save your file, Vim will exit when you hit enter. </p>
<h6 id="using-wq">Using <code>:wq</code></h6>
<p>The command <code>:wq</code> will save (write) the file that you are currently editing, <em>and</em> will exit Vim after the file is saved. If you want to save and quit Vim all in the same command, <code>:wq</code> should be your weapon of choice.
<br><br></p>
<p><strong>NOTE:</strong> <code>:wq</code> is not <strong><em>the only</em></strong> command to use to exit Vim--it is merely a convenient way to save a file and exit Vim at the same time.</p>
<h3 id="exiting">Exiting</h3>
<h6 id="trevor">Trevor</h6>
<p>The Command for exiting vim is <code>:q</code>. If the file has been edited since it was opened, <code>:q</code> will not work, instead giving a warning about unwritten changes. To bypass this, you can add an <code>!</code> to the command, making it <code>:q!</code>, which will quit without saving.</p>
<h3 id="reopening-the-file">Reopening The File</h3>
<h6>Tyler</h6>
<p>After saving (using <code>:w</code>, <code>:x</code>, <code>:wq</code>, etc.), re-open the todo file to prove that the changes made have been saved: </p>
<pre><code class="language-bash">vim todo.txt
</code></pre>
<h3 id="mark-a-todo-as-done">Mark A Todo As Done</h3>
<h6>Tyler</h6>
<p>Navigate the cursor between the brackets of the task you want to mark as done and enter Insert mode <code>i</code>.</p>
<p>Mark the task done by entering a capital X.</p>
<p>Then, enter Normal mode by pressing the <code>Escape</code> key, press <code>j</code> to go down a line to the next todo, and mark it as done the same way.</p>
<p><img alt="Vim Screenshot" src="../img/marked_todos.png" /></p>
<h3 id="delete-a-todo">Delete A Todo</h3>
<h6>Tyler</h6>
<p>One way to remove a todo from the list is to delete the entire line. To do this, get into Normal mode and navigate the cursor to the line you want to delete. Then, press the <code>d</code> key twice: <code>dd</code>, to remove the line.</p>
<p><img alt="Vim Screenshot" src="../img/deleted_todos.png" /></p>
<h2 id="further-understanding-vim">Further Understanding Vim</h2>
<p>Amazing! You've made it this far. Let's take a look at how you can do more by <a href="../understanding/">understanding Vim</a>.</p></div>
</div>
<footer class="col-md-12 text-center">
<hr>
<p>
<small>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</small>
</p>
</footer>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="../js/bootstrap-3.0.3.min.js"></script>
<script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@9.18.0/build/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script>var base_url = ".."</script>
<script src="../js/base.js"></script>
<div class="modal" id="mkdocs_keyboard_modal" tabindex="-1" role="dialog" aria-labelledby="keyboardModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="keyboardModalLabel">Keyboard Shortcuts</h4>
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
</div>
<div class="modal-body">
<table class="table">
<thead>
<tr>
<th style="width: 20%;">Keys</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td class="help shortcut"><kbd>?</kbd></td>
<td>Open this help</td>
</tr>
<tr>
<td class="next shortcut"><kbd>n</kbd></td>
<td>Next page</td>
</tr>
<tr>
<td class="prev shortcut"><kbd>p</kbd></td>
<td>Previous page</td>
</tr>
<tr>
<td class="search shortcut"><kbd>s</kbd></td>
<td>Search</td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
</body>
</html>
|