Vim Editor Fundamentals

HackerSploit · Intermediate ·🔐 Cybersecurity ·7y ago

Key Takeaways

The video covers the fundamentals of the Vim editor, including basic navigation, editing, and configuration, with a focus on efficiently creating and changing text in a Linux environment.

Full Transcript

[Music] hey guys hack exploit here back again with another video and in this video we're going to be looking at the basics and the fundamentals of the vim editor now the reason i'm making this video is because a lot of you requested for this video after the nano fundamentals video and the reason being is i've used nano on the channel for a long time and so have a lot of you and now you guys want to move on to the vm editor and you asked me to essentially make a video explaining all of the basic commands that uh that you can use to get started and uh for those of you who will be wondering uh whether this is the entire scope of the video i'll be making on vim definitely not there is or are other topics that i want to cover in regards to vim so i'm going to be making another video uh we're essentially going to be talking about the tips and tricks that i use to increase uh my productivity with the vim editor so stay tuned for that as well for those of you who are advanced users if you are an advanced user you can definitely skip this video although you might want to stay in case i cover something that you might have forgotten or something that you did not know about or know of all right so without any further ado let's get started now the vim editor comes pre-installed in most linux distributions now i'm using ubuntu and of course you might be using kali whatever you're using really it should come pre-installed with it now if it isn't you can use the aptitude package manager to get it installed so you can use the sudo apt-get install uh vim and that'll essentially install it for you it's a couple of megabytes so you don't have to worry about anything there all right now when it comes down to using the vim editor opening files is extremely simple creating files is extremely simple you simply need to type in the syntax vim and the name of the file that you want to edit now if you're creating a new file very similar to that of to the way we have it with nano you can create a file with vim and i can essentially give the file a name so i found it create a file called file.txt and of course the extension can be whatever you uh it can be whatever you're trying to create it can be a c file a python file etc whatever it is really you're looking to do you can use that file extension so i'm going to enter and that is going to open up the file for us and of course with vim as as you have with any editor you need to save the file all right so when you talk about saving a file saving a file can be done by using the colon and interacting with the editor in regards to saving files always starts off with the colon all right that is something very important that you need to know with vim now when many people actually open up a file with them this is where they get really really confused so if you want to start if you want to exit out of the editing mode and you want to start interacting with the editor in regards to saving the file or exiting you start off with the colon all right so if i'm saving a file let me just increase the font size here so you guys can see what i'm typing exactly so if i want to save a file i hit colon and the lowercase w and i hit enter all right and it's going to tell you right over here file.txt is written okay so there you are it does not have any content and we'll be looking to add content all right so the file has been saved now when you want to edit your when you want to exit out of the vim editor it's really very simple all you need to do is hit the colon again and you can hit the q and a which essentially a will essentially close all files if you want to exit out of your editor you simply use the colon and the lowercase q and hit enter and that will get you out of the file that you're editing all right so let's open up the file once more since we've created it already and we can look at a few other things so now when talking about actually writing changes to the or writing to the file to do that we use the i command which stands for insert and it will give you this little dialog right over here called insert and this is very important because it lets you know what mode you're currently in so when i'm in insert mode i can start doing whatever i wanted so for example i can say hello uh this is a vim editor editor video and uh you know i can essentially write whatever i want if it is a python file i could start you know creating i can start coding or whatever and once you're done writing uh once you're done editing or configuring the file you then use the sk you use the escape key and that will get rid of the uh the insert dialog that was right over here and that means you are no longer you're able to start writing any any any uh changes to the file or you're not longer to you're no longer able to edit the file all right so that's uh something very important that you should take into into consideration all right so that is essentially interacting with a code and to do that as i mentioned use the i use the ico key on your keyboard make sure it's lower case and you're not you do not have the caps lock enabled all right so if i want to now save and exit the to save and close the file sorry i use the colon and i hit w and q and that will save and close the file for me and there we are all right so let me just open the file once more so we've looked at saving or we've looked at closing the file we've looked at saving and closing the file if now you want to be in a situation where and by the way navigation when in when in the insert mode is done using the keyboard is done using your arrow or your directional keys so if i want to if i had written something let's say i'd written this is a nano video and i know it's not but just stay with me so if i want to uh if i want to close the file without saving any changes i do that by typing in the colon queue and the exclamation mark right over here and that will essentially close the file without saving any of the new changes made to the file i'm going to enter and there you are so if i open up the vim open the file up with vim once more you can see that the second line was not saved all right so we've looked at closing all the files uh essentially saving a file saving and closing the file closing a singular file closing without saving any changes and there are a few uh keyboard commands that you can use without using the colon and that is the the capital z so you want to type in z two times so double z and that will essentially save and quit so you don't have to use the colon there make sure you have your caps lock enabled for that uh and uh that's pretty much it in regards to saving our saving files and exiting from there from the vim editor all right so now that we've talked about essentially creating a file uh closing the file saving saving and closing closing without saving we can now move on to navigation and editing the code itself all right so to do this what i'm going to do is i'm going to close out and exit out of this file and i have the proxychains.configuration file right over here on my desktop and that's the file we're going to be using for the purpose of this video now you might be thinking to yourself why exactly are you using the proxygens.configuration file well this is a real world file that allows you to configure the proxychain service and i thought why not use a real file to demonstrate how the vim can be used and how and how it's different from the nano editor all right so let's get started so i'm going to use vim and the proxychains.configuration file i'm going to enter and it opens it for us all right now let me just reduce the font size a little bit here so that we have a better idea of the code that we're editing so let's start off right at the top and we'll be looking to edit this configuration file okay so let's talk about editing i've already talked about insertion or inserting code so uh again you can use your your arrow keys right over here to navigate around the code i know that they are other navigational keys and that are those are denoted by the h j k and l keys i'll be talking about that in the next vm video the reason i don't want to do it right now is because that'll confuse a lot of things all right so let's focus on the basics so if i want to insert code on this particular line i'm going to hit i and then for example i can comment that line and once i'm done i hit escape to exit out of the insertion mode all right if i want to move on to the next line i can hit o that is a lowercase o and that will take me to the next line and it will take me into into the insertion mode right over here which means i can enter a new line so i can say this is a new line all right and once i'm done with the insertion 8 escape and that will insert the line for me which is fantastic if i want to go to the previous line which is the line on top i use the capital o and that will take me to the previous line right over here as you can see and again it'll take me into the in search it'll it will take me into the insert mode i'm going to hit escape because i don't want to insert any any particular new line all right now when you talk about deleting characters or a particular character for example uh if i add misspelled this line word if i had said lino of course on exit and i want to delete the uh the character the the character o all i need to do is go right to where it is and hit a lowercase s and that will get rid of the last character and i can correct it and hit escape and there we are all right so that is very very simple now if i want to delete an entire line to do that i hit the capital i use the uppercase s and that will delete a particular line right over here and if i want to delete this line as well i'm just going to do the same right over here and now i can just go all the way to the top and get rid of the changes that i made earlier all right now when we talk about undo and redo that uh those are denoted by the lowercase u which is for undoing the changes and a capital c or a capital r to redo the changes all right so if i want to undo the changes that i've made i just hit u and it's going to undo the change for me if i want to redo the change i use the control or the c sorry the capital c right over here and that re does uh or will essentially redo all the changes that i've made all right so to undo you use the u the lowercase u and to redo the changes you use the capital c all right so that is in regards to essentially editing your code when it comes down to navigation navigation is very very simple of course moving on to different lines so for example uh if i wanted to let me just make sure this code is as clean as possible so if i wanted to uh to essentially move to the start of a line i can use the zero the zero key and that will take me to the start of the line which is very important if i want to move to the end of the line i use the dollar sign and that'll take me to the end of the line excellent stuff right there so if i wanted to edit the start of the line i use the zero command and i can enter my changes right over here and of course since it's taken me into the insertion mode so i'll just redo the changes oh sorry undo the changes there and now you can see the real power of of the vm editor now once you're seeing how intuitive it is it becomes you're now seeing the true power all right so that is how to move this to the start and to the end of the line now when you talk about moving to the first line or or essentially to the first line yes the first line to do that you simply type in wg and that will take you to the top line right over here all right uh or the first line sorry now uh when i start when i was essentially talking to you about the different uh trip tricks that you can use uh i'll get to that in a second so that is moving to a particular line now one thing i haven't covered so far is your clipboard and how you can copy and paste uh data et cetera now when you're talking about copying with vim if you are using an editor you can use your mouse i'll talk about copying well if you want to copy we essentially you can use the uh the uh you can use the the double y command right over here and that and that will copy uh and of course uh once you want to paste essentially you need to just go right over here and hit p and that will paste it for you now that's very basic now if you are using a graphical user interface or of course and i i've mentioned i've mentioned this before and let me just get rid of this line right over here well that actually did not delete at the entire line but i'll just get rid of it right over here uh and i'll get out of the insertion mode so uh copying can be done in various ways as i mentioned it can be denoted by the uh the the the two y's or yy which is all in lowercase or you can if you're using a visual editor or a graphical user interface with a mouse pointer which is very unlikely if you are working in in a server environment so you can right click and you can right click and copy and you can also paste it you can definitely try that out all right now that is for copying and pasting your pasting is very simple of course as i mentioned copying is as follows let me just do it one more time so you can get an idea of what i'm talking about if i wanted to copy this line at the bottom the sock the sox5 line i can just hit the double y and to paste it i simply hit the p right over here and it pastes it for me i can undo the change right over there and voila when i'm talking about copying and pasting it really is very simple of course it depends on whether you're not using an editor i'll be talking about selecting individual blocks of code in the next video we'll be looking at replacing that's where we get really interesting or we get really deep into the theme editor now i'm going to give you guys a few tips that will really help you now now with nano i should have actually mentioned that when talking about code lines all right code lines are very very important now when you're talking about enabling code lines in the vm editor which is something a lot of you guys actually asked me to uh to show in this video so if you want to enable code lines all you need to do is make sure you you you enter the colon and we're saying we're now interacting with the editor on on a configuration level so we're saying set and we want to say set number and once we hit enter it's going to give us our various code lines all right and now uh when you're talking about navigating to a particular line in your code for example i want to move to line uh line 40. to do this i i use the colon once more and i type in the line i want to go to in this case i'm going to go to line 40 i'm going to hit enter and there we are it takes me directly to line 40 which is excellent i do recommend when working with code that you do enable your uh you and you do enable your code lines now if you want to disable them if you're not a fan of them you simply need to type set no number and that will get rid of them for you all right so that pretty much is going to be it for this video i know i haven't covered a lot but hopefully i've covered all the basics and the fundamentals of the vim editor now in the next vm video i'll be covering the different tips and tricks that you can use that will actually improve your productivity when using the tool all right so that's pretty much gonna be it for this video guys thank you so much for watching if you have any questions or suggestions let me know in the comments section on my social networks or on my website and i'll be seeing you in the next video peace guys [Music] you

Original Description

Hey guys! HackerSploit here back again with another video, in this video, I will be showing you the fundamentals of the Vim editor. Vim is a highly configurable text editor for efficiently creating and changing any kind of text. It is included as "vi" with most UNIX systems and with Apple OS X 🔗 HackerSploit Website: https://hsploit.com/ ⭐Help Support HackerSploit by using the following links: 🔗 NordVPN: https://nordvpn.org/hacker Use the link above or the code below for 77% Off your order Promo Code: hacker Patreon: http://patreon.com/hackersploit I Hope you enjoy/enjoyed the video. If you have any questions or suggestions feel free to ask them in the comments section or on my social networks. 🔗 HackerSploit Website: https://hsploit.com/ 🔹 Support The Channel NordVPN Affiliate Link: https://nordvpn.org/hacker Patreon: http://patreon.com/hackersploit 🔹 Get Our Courses Get a special discount on our courses: The Complete Deep Web Course 2018: https://www.udemy.com/the-complete-deep-web-course-2017/?couponCode=DWCBP2017 🔹 SOCIAL NETWORKS - Connect With Us! ------------------------------- Facebook: https://www.facebook.com/HackerSploit/ Twitter: https://twitter.com/HackerSploit Instagram: https://www.instagram.com/hackersploit/ Patreon: http://patreon.com/hackersploit -------------------------------- Thanks for watching! Благодаря за гледането Kiitos katsomisesta Danke fürs Zuschauen! 感谢您观看 Merci d'avoir regardé Grazie per la visione Gracias por ver شكرا للمشاهدة دیکھنے کے لیے شکریہ देखने के लिए धन्यवाद #Hacking#Vim#Kali
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from HackerSploit · HackerSploit · 0 of 60

← Previous Next →
1 How To Install Kali Linux 2.0 On Virtual Box
How To Install Kali Linux 2.0 On Virtual Box
HackerSploit
2 100 Subscriber Q&A! - How I Learned Ethical Hacking
100 Subscriber Q&A! - How I Learned Ethical Hacking
HackerSploit
3 BlackArch Linux Review - Better Than Kali Linux?
BlackArch Linux Review - Better Than Kali Linux?
HackerSploit
4 How to Access the Deep Web Safely | Deep Web Starter Guide 1.0
How to Access the Deep Web Safely | Deep Web Starter Guide 1.0
HackerSploit
5 Wireshark Tutorial for Beginners - Installation
Wireshark Tutorial for Beginners - Installation
HackerSploit
6 Wireshark Tutorial for Beginners - Overview of the environment
Wireshark Tutorial for Beginners - Overview of the environment
HackerSploit
7 Wireshark Tutorial for Beginners - Capture options
Wireshark Tutorial for Beginners - Capture options
HackerSploit
8 Wireshark Tutorial for Beginners - Filters
Wireshark Tutorial for Beginners - Filters
HackerSploit
9 Complete Ethical Hacking Course - Become a Hacker Today - #1 Hacking Terminology
Complete Ethical Hacking Course - Become a Hacker Today - #1 Hacking Terminology
HackerSploit
10 Complete Ethical Hacking Course #2 - Installing Kali Linux
Complete Ethical Hacking Course #2 - Installing Kali Linux
HackerSploit
11 Parrot OS 3.5 Review | The Best Kali Linux Alternative
Parrot OS 3.5 Review | The Best Kali Linux Alternative
HackerSploit
12 Nmap Tutorial For Beginners - 1 - What is Nmap?
Nmap Tutorial For Beginners - 1 - What is Nmap?
HackerSploit
13 Katoolin | How To Install Pentesting Tools On Any Linux Distro
Katoolin | How To Install Pentesting Tools On Any Linux Distro
HackerSploit
14 Nmap Tutorial For Beginners - 2 - Advanced Scanning
Nmap Tutorial For Beginners - 2 - Advanced Scanning
HackerSploit
15 Nmap Tutorial For Beginners - 3 - Aggressive Scanning
Nmap Tutorial For Beginners - 3 - Aggressive Scanning
HackerSploit
16 Zenmap Tutorial For Beginners
Zenmap Tutorial For Beginners
HackerSploit
17 How To Setup Proxychains In Kali Linux - #1 - Stay Anonymous
How To Setup Proxychains In Kali Linux - #1 - Stay Anonymous
HackerSploit
18 How To Setup Proxychains In Kali Linux - #2 - Change Your IP
How To Setup Proxychains In Kali Linux - #2 - Change Your IP
HackerSploit
19 How To Change Mac Address In Kali Linux | Macchanger
How To Change Mac Address In Kali Linux | Macchanger
HackerSploit
20 How To Setup And Use anonsurf On Kali Linux | Stay Anonymous
How To Setup And Use anonsurf On Kali Linux | Stay Anonymous
HackerSploit
21 Ubuntu 17.04 "Zesty Zapus" Review - Bye Unity
Ubuntu 17.04 "Zesty Zapus" Review - Bye Unity
HackerSploit
22 VPN And DNS For Beginners | Kali Linux
VPN And DNS For Beginners | Kali Linux
HackerSploit
23 Tails OS Installation And Review - Access The Deep Web/Dark Net
Tails OS Installation And Review - Access The Deep Web/Dark Net
HackerSploit
24 Steganography Tutorial - Hide Messages In Images
Steganography Tutorial - Hide Messages In Images
HackerSploit
25 The Lazy Script - Kali Linux 2017.1 - Automate Penetration Testing!
The Lazy Script - Kali Linux 2017.1 - Automate Penetration Testing!
HackerSploit
26 Best Linux Distributions For Penetration Testing
Best Linux Distributions For Penetration Testing
HackerSploit
27 Netcat Tutorial - The Swiss Army Knife Of Networking - Reverse Shell
Netcat Tutorial - The Swiss Army Knife Of Networking - Reverse Shell
HackerSploit
28 Gaining Access - Web Server Hacking - Metasploitable - #1
Gaining Access - Web Server Hacking - Metasploitable - #1
HackerSploit
29 Web Server Hacking - FTP Backdoor Command Execution With Metasploit - #2
Web Server Hacking - FTP Backdoor Command Execution With Metasploit - #2
HackerSploit
30 How To Install Kali Linux On VMware  - Complete Guide 2018
How To Install Kali Linux On VMware - Complete Guide 2018
HackerSploit
31 Q&A #1 - Best Cyber-security Certifications?
Q&A #1 - Best Cyber-security Certifications?
HackerSploit
32 Terminator - Kali Linux - Multiple Terminals
Terminator - Kali Linux - Multiple Terminals
HackerSploit
33 Shodan Search Engine Tutorial - Access Routers,Servers,Webcams + Install CLI
Shodan Search Engine Tutorial - Access Routers,Servers,Webcams + Install CLI
HackerSploit
34 Q&A #2 - Mr Robot?
Q&A #2 - Mr Robot?
HackerSploit
35 Metasploit Community Web GUI  - Installation And Overview
Metasploit Community Web GUI - Installation And Overview
HackerSploit
36 Linux Expl0rer - Forensics Toolbox - Installation & Configuration
Linux Expl0rer - Forensics Toolbox - Installation & Configuration
HackerSploit
37 QuasarRAT - The Best Windows RAT? - Remote Administration Tool for Windows
QuasarRAT - The Best Windows RAT? - Remote Administration Tool for Windows
HackerSploit
38 Metasploit For Beginners - #1 - The Basics - Modules, Exploits & Payloads
Metasploit For Beginners - #1 - The Basics - Modules, Exploits & Payloads
HackerSploit
39 Metasploit For Beginners - #2 - Understanding Metasploit Modules
Metasploit For Beginners - #2 - Understanding Metasploit Modules
HackerSploit
40 Kali Linux Quick Tips - #1 - Adding a non-root user
Kali Linux Quick Tips - #1 - Adding a non-root user
HackerSploit
41 Metasploit For Beginners - #3 - Information Gathering - Auxiliary Scanners
Metasploit For Beginners - #3 - Information Gathering - Auxiliary Scanners
HackerSploit
42 Spectre Meltdown Vulnerability  - How To Check Your System
Spectre Meltdown Vulnerability - How To Check Your System
HackerSploit
43 Metasploit For Beginners - #4 - Basic Exploitation
Metasploit For Beginners - #4 - Basic Exploitation
HackerSploit
44 ARP Spoofing With arpspoof - MITM
ARP Spoofing With arpspoof - MITM
HackerSploit
45 WordPress Vulnerability Scanning With WPScan
WordPress Vulnerability Scanning With WPScan
HackerSploit
46 Generating A PHP Backdoor with weevely
Generating A PHP Backdoor with weevely
HackerSploit
47 Nikto Web Vulnerability Scanner - Web Penetration Testing - #1
Nikto Web Vulnerability Scanner - Web Penetration Testing - #1
HackerSploit
48 How To Install Kali Linux On Windows 10 - Windows Subsystem For Linux
How To Install Kali Linux On Windows 10 - Windows Subsystem For Linux
HackerSploit
49 Stacer - System Optimizer And Monitoring Tool For Linux
Stacer - System Optimizer And Monitoring Tool For Linux
HackerSploit
50 Kali Linux 2018.1 - Kernel Updates & Patches
Kali Linux 2018.1 - Kernel Updates & Patches
HackerSploit
51 MITM With Ettercap - ARP Poisoning
MITM With Ettercap - ARP Poisoning
HackerSploit
52 Password Cracking With John The Ripper - RAR/ZIP & Linux Passwords
Password Cracking With John The Ripper - RAR/ZIP & Linux Passwords
HackerSploit
53 How To Detect Rootkits On Kali Linux - chkrootkit & rkhunter
How To Detect Rootkits On Kali Linux - chkrootkit & rkhunter
HackerSploit
54 Channel Updates - How To Post Questions & Video Suggestions
Channel Updates - How To Post Questions & Video Suggestions
HackerSploit
55 Web App Penetration Testing - #1 - Setting Up Burp Suite
Web App Penetration Testing - #1 - Setting Up Burp Suite
HackerSploit
56 Web App Penetration Testing - #2 - Spidering & DVWA
Web App Penetration Testing - #2 - Spidering & DVWA
HackerSploit
57 Cl0neMast3r - GitHub Repository Cloning Tool
Cl0neMast3r - GitHub Repository Cloning Tool
HackerSploit
58 Kali Linux On Windows 10 Official - WSL - Installation & Configuration
Kali Linux On Windows 10 Official - WSL - Installation & Configuration
HackerSploit
59 DoS/DDoS Protection - How To Enable ICMP, UDP & TCP Flood Filtering
DoS/DDoS Protection - How To Enable ICMP, UDP & TCP Flood Filtering
HackerSploit
60 Web App Penetration Testing - #3 - Brute Force With Burp Suite
Web App Penetration Testing - #3 - Brute Force With Burp Suite
HackerSploit

This video teaches the fundamentals of the Vim editor, including basic navigation, editing, and configuration, with a focus on efficiently creating and changing text in a Linux environment. By the end of this video, viewers will be able to use Vim for basic text editing and navigation. Vim is a highly configurable text editor that is included with most UNIX systems and Apple OS X.

Key Takeaways
  1. Open a file in Vim by typing 'vim' followed by the file name
  2. Save a file in Vim by typing ':' followed by 'w' and pressing Enter
  3. Exit Vim by typing ':' followed by 'q' and pressing Enter
  4. Write changes to a file in Vim by using the 'i' command
  5. Use the 'i' command to insert text into the file
  6. Use the escape key to exit insert mode
  7. Use the colon and w and q to save and exit the file
  8. Use the colon and q and ! to close the file without saving changes
💡 The Vim editor is a powerful and highly configurable text editor that can be used for efficiently creating and changing text in a Linux environment.

Related Reads

📰
Secured MCP Complete Guide: OWASP Top 10, Best Practices, Security Guardrails, and Compliance
Secure your MCP with OWASP Top 10, best practices, and compliance using a practical reference architecture
Medium · AI
📰
Whose ASN Goes on Your Leased IPv4 Prefix?
Learn how to handle ASN for leased IPv4 prefixes in BGP routing
Dev.to · Artem Kohanevich
📰
Blank Identifier: Idiomatic Go or Vulnerability Trap?
Learn how blank identifiers in Go can be either idiomatic code or a vulnerability trap and why it matters for cybersecurity
Medium · Cybersecurity
📰
Kinetix Browser Review: The Ultimate Solution for Fast, Secure, and Private Web Surfing
Discover how Kinetix Browser provides fast, secure, and private web surfing using machine learning, and why it matters for online security
Medium · Machine Learning
Up next
OpenAI GPT 5 5 Cyber Just Got an Upgrade – Is it BETTER Than Mythos 5 ?
MaxonShire
Watch →