[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
slackbook:vi [2012/09/12 21:50 (UTC)] – [Opening, Saving, and Quitting] Ok, so you've decided that you want to learn how to use **//vi//**. The first thing to do is learn how to open and save files. Opening files is actually pretty easy. Simply type the filename as an argument on the command-l mfillpotslackbook:vi [2012/09/16 15:10 (UTC)] – [Vi Cheat Sheet] Updated with original text and formatting mfillpot
Line 124: Line 124:
 ===== Moving Around ===== ===== Moving Around =====
  
-Moving around in vi is perhaps the hardest thing for a new user to learn. vi does not traditionally use the directional arrow keys for cursor movement, although in Slackware Linux that is an option. Rather, movement is simply another command issued in command-mode. The reason for this is rather simple. vi actually predates the inclusion of directional arrow keys on keyboards. Thus, movement of the cursor had to be accomplished by using the few keys available, so the right-hand "home row" keys of h, j, k, and l were chosen. These keys will move the cursor about whenever vi is in command mode. Here's a short table to help you remember how they work.+Moving around in **//vi//** is perhaps the hardest 
 +thing for a new user to learn. **//vi//** does not 
 +traditionally use the directional arrow keys for cursor movement, 
 +although in Slackware Linux that is an option. Rather, movement is 
 +simply another command issued in command-mode. The reason for this is 
 +rather simple. **//vi//** actually predates the 
 +inclusion of directional arrow keys on keyboards. Thus, 
 +movement of the cursor had to be accomplished by using the few 
 +keys available, so the right-hand //"home row"// keys of 
 +<key>'h'</key><key>'j'</key><key>'k'</key>, and 
 +<key>'l'</key> were chosen. These keys will move the cursor about 
 +whenever **//vi//** is in command mode. Here's a 
 +short table to help you remember how they work.
  
 ^Command ^ Result ^ ^Command ^ Result ^
Line 132: Line 144:
 |l|Move the cursor one character right| |l|Move the cursor one character right|
  
-Moving around is a little more powerful than that though. Like many command keys, these movement keys accept numerical arguments. For example, 10j will move the cursor down 10 lines. You can also move to the end or beginning of the current line with $ and ^, respectively. +Moving around is a little more powerful than that though. Like many 
 +command keys, these movement keys accept numerical arguments. For 
 +example, **10j** will move the cursor down 10 lines. You 
 +can also move to the end or beginning of the current line with 
 +<key>'$'</key> and <key>'^'</key>, respectively.
 ===== Editing A Document ===== ===== Editing A Document =====
  
-Now that we're able to open and save documents, as well as move around in them, it's time to learn how to edit them. The primary means of editing is to enter insert mode using either the i or a command keys. These either insert text at the cursor's current location, or append it after the cursor's current location. Once into insert mode, you can type any text normally and it will be placed into your document. You can return to command mode in order to save your changes by pressing the ESC key. +Now that we're able to open and save documents, as well as move around 
 +in them, it's time to learn how to edit them. The primary means of 
 +editing is to enter insert mode using either the <key>'i'</key> or 
 +<key>'a'</key> command keys.  These either insert text at the 
 +cursor's current location, or append it after the cursor's current 
 +location. Once into insert mode, you can type any text normally and it 
 +will be placed into your document.  You can return to command mode in 
 +order to save your changes by pressing the <key>'ESC'</key> key.
 ===== Vi Cheat Sheet ===== ===== Vi Cheat Sheet =====
  
-Since vi can be difficult to learn, I've prepared a short cheat sheat that should help you with the basics until you begin to feel comfortable.+Since **//vi//** can be difficult to learn, I've 
 +prepared a short cheat sheat that should help you with the basics until 
 +you begin to feel comfortable.
  
 ^ Command ^ Result ^ ^ Command ^ Result ^
Line 172: Line 195:
 |:w file|Save the current document as 'file'| |:w file|Save the current document as 'file'|
 |:x|Save and quit| |:x|Save and quit|
- 
 ====== Chapter Navigation ====== ====== Chapter Navigation ======
  
 slackbook:vi ()