C Programming Tutorial 18 - Vim Basics - Part 2

submitted by mkenny400 on 03/19/18 1

In the last video we talked about some tricks when it comes to moving around in Vim. This video is going to teach you some even more important things to help improve your efficiency. The first thing I wanted to talk about was different ways to quit the application. The very first is :q! This is how you quit without saving. If you wanted to save your changes you could have used :wq, for write and quit, or a short cut is just ZZ without the colon. You should also know that anytime we have a : in our command it allows us to type out a larger command where we actually have to press enter. The other commands we learned in the last video we didn't have to press enter and they didn't show up on the screen like this. Now let's reopen it. What if you want to be able to temporarily close Vim without having to decide to save your changes or not? Kind of like just keeping it open in a new tab or something? Well you could always open a second terminal, which we may do at some point, ha! But the more professional way is to use ctrl c. This will put Vim in the background and to bring it back up you type fg, for foreground. Occasionally when working with vim, you might close the program wrong or your computer shuts down and the next time you try to open a file it gives you a warning message saying you were in the middle of working on the file. If that ever comes up, you'll probably want to hit R for recover. We haven't experienced that yet and as long as you are careful you should be able to avoid it as well. Now, whenever you mess something up big time in VIM, you can undo using u You can redo using ctrl r You can cut using dd This will put whatever into the clipboard. The clipboard is the place where things go when you copy or paste them. yeah, I have no idea where the clipboard actually is, but it's there. To paste after the cursor p You could also use a capital P to paste before the line. To delete the remainder of the line, use d$ Remember from the last video, $ is the end of the line. to copy the line you are on, use yy (think yank) You can often mix these commands with numbers. So to copy 4 lines, use 4yy. That should be enough commands to get you started. Now, like I said, I'm still a complete beginner with Vim, so be patient with me. I'll share a page with you that has been helpful to me. vim.rtorr.com/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Support me! www.patreon.com/calebcurry Subscribe to my newsletter: eepurl.com/-8qtH Donate!: bit.ly/DonateCTVM2. ~~~~~~~~~~~~~~~Additional Links~~~~~~~~~~~~~~~ More content: CalebCurry.com Facebook: www.facebook.com/CalebTheVideoMaker Google+: plus.google.com/+CalebTheVideoMaker2 Twitter: twitter.com/calebCurry Amazing Web Hosting - www.dreamhost.com/r.cgi?1487063 (The best web hosting for a cheap price!)

Leave a comment

Be the first to comment

Collections with this video
Email
Message
×
Embed video on a website or blog
Width
px
Height
px
×
Join Huzzaz
Start collecting all your favorite videos
×
Log in
Join Huzzaz

facebook login
×
Retrieve username and password
Name
Enter your email address to retrieve your username and password
(Check your spam folder if you don't find it in your inbox)

×