Download presentation
Presentation is loading. Please wait.
Published byBeate Hofmann Modified over 6 years ago
1
vim Basics Understanding And Using the vim Text Editor
Greg Gómez Tech Days 2018 June 7, 2018
2
$ Agenda_ This is a basic over view of some of the most basic vim commands. Basically, how to get out if you find yourself using vim. We won’t cover fun things like customization... ... or colors. :/ But I will talk a little about vim’s personality.
3
$ History_ Please keep in mind that vi and vim are different, although the terms are frequently interchanged. This presentation is about vim.
4
$ History_ vim is a port of vi, written by Bill Joy in 1976.
Ported to the Amiga in 1991. And moved beyond in the years that followed. Vi IMproved = vim. An early text editor Which is why it is the way it is. (Because no mouses). (Or is it mice?) (Mices?)
5
$ History_ It also comes from a time before terms like ‘copy’ and ‘paste’ were widely used. So it uses terms like ’yank’ and ‘put.’ Or perhaps ‘yank’ was backfilled for the ‘Y’ key? Open files are called buffers.
6
$ History_ Things like that contribute to the sense of quirkiness with vim. Which can be charming... ... and frustrating.
7
$ History_ The de facto standard UNIX editor
Installed on most (all?) flavors and versions of Linux.
8
$ History_ So, if you’re doing any kind of U*X DevOps, it’s likely you’ll find yourself using vim at some point.
9
$ History_ Also, if you’re using git (and who isn’t?), you may find yourself stuck in vim when you commit. Even on Windows(!)
10
$ The Basics_ You may find yourself using vim whether you want to or not. E.g.: you’ve committed to git and you didn’t set an alternative editor.
11
$ Yikes! I’m using vim!_
12
$ The Basics_ Don’t panic. Don’t start typing blindly.
This can quickly get you stuck. Old standbys like CTRL-C may not work.
13
Do use your arrow keys to see if you can get around.
$ The Basics_ Do use your arrow keys to see if you can get around.
14
$ vim’s Modes_ Because vim was born in the times before mouses, it evolved a way of manipulating text without the ability to select it. That’s the modal interface. Also, efficiency: the idea is keep typing as simple as possible. That’s why there’s an emphasis on ‘home row’ keys.
15
Normal mode: Navigation Deletion, copy, paste, etc.
$ vim’s Modes_ Normal mode: Navigation Deletion, copy, paste, etc.
16
$ vim’s Modes_ Insert Mode: Inserting new text
And most other things like backspace, delete, etc. (And some other functions such as deleting text, movement, etc.)
17
$ vim’s Modes_ Visual Mode:
Used mainly to select blocks of text to yank, or to manipulate in other ways.
18
$ The Basics_ Basic workflow: Navigate to where you want to edit.
Enter Insert Mode by pressing the letter i. Make your changes Backspace, delete and arrow keys should work as expected. When you’re ready to save: Press the escape key to exit Insert Mode. You’re now in normal mode. Press the colon key to enter Command-Line Mode Press w and the Enter key to save. Press q and Enter to exit.
19
$ How to exit_ If you just want to get out, do this:
Press the Escape Key. I usually do this a few times, just to be sure. Type a colon ( : ). Type the letter q (lowercase, please). Press the Enter Key. That should do it.
20
$ Urg I get an error when I do that!_
If you get this error when you try to quit: E37: No write since last change (add ! to override) This happens because the buffer has been changed (edited) and not saved. Press the Escape Key. Type a colon ( : ). Type the letter q (lowercase, please) followed by !. Press the Enter Key. That should do it.
21
$ In fact, q! is probably your best bet to get out of vim._
Press the Escape Key. Type a colon ( : ). Type the letter q (lowercase, please) followed by !. Press the Enter Key. That should do it. :q!
22
$ Other features of vim._
Lots! Extremely customizable. Powerful and useful editing features. Plugin ecosystem that makes it even more more.
23
Questions?
24
Greg Gómez Tech Days 2018 June 7, 2018
Thanks! Greg Gómez Tech Days 2018 June 7, 2018
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.