5 Tasks You Didn't Know You Could do With Vim
Vim is the best text editor, as you know. Most Vim users are aware of the basic hotkeys, commands, and other Vim tricks; however, there are a number of useful tricks that are lesser-known.
5 Tasks You Didn't Know You Could do With Vim
Articles in Professional Tools | By August R. Garcia
Published | Last Update
Vim is the best text editor, as you know. Most Vim users are aware of the basic hotkeys, commands, and other Vim tricks; however, there are a number of useful tricks that are lesser-known.
6,518 views, 0 RAMs, and 0 comments
Vim is the best text editor, as you know. While there aretricks that you can do with more basic text editors like Gedit, Vim allows for more complex and efficient text editing. Most Vim users are aware ofthe basic hotkeys, commands, and other Vim tricks; however, there are a number of useful tricks that are lesser-known.
Video Overview
The video below demonstrates the tricks described below in video form. The high quality soundtrack is Bit Bit Loop by Kevin MacLeod, accessed from FreePD.
Vim has Built-in Word Completion
While you might think that a plugin is needed for word completion in Vim, there is in fact built-in word completion, which will suggest words based on the contents of your file. Here’s an easy demonstration:
- Put some content into a file
- Start typing a word that matches an existing word
- Press Ctrl+N
- That’s it.
See this screenshot for what this looks like:
Very nice. There are alsoa number of other auto-completion tricks worth learning about.
Paste from External Clipboard
When working with Vim, an internal clipboard is used for copying, cutting, and pasting. For example:
- The command “dd” will cut the current line (“yy” will copy it)
- The command “p” will paste that line
However, often you may need to paste content from an external source. To do this, use the key combination:
Ctrl+Shift+V
When doing this, make sure that you are in insert mode. Otherwise, it will interpret the contents of the copy-paste as if you were manually inputting those keys in that order.
Bonus:When using most rich text editors, like Google Drive, as well as other tools that support rich text likeGoogle Sheets, Ctrl+Shift+V will paste without formatting.
Vertical Highlighting
There are several ways to enter visual mode in Vim:
- Pressing “v” will enter the standard visual mode
- Pressing “V” will enter visual mode, highlighting full lines rather than individual characters
- Pressing “ctrl+v” will enter visual mode with support for vertical highlighting
This can be seen in the screenshot below:
Using this vertical highlighting, it is possible to do things like:
- Use “u” or “U” to adjust the case of the first letter in a line
- Use “I” once multiple lines are highlighted to enter insert mode, type something, then press ESC and that text will be entered on all highlighted lines.
- Bulk deletions to lines.
Note that using “$” to highlight to the end of all lines when in visual mode vertically, since lines may be of different lengths.
Showing Line Numbers in Vim
By default, Vim does not show line numbers. There are a few common ways to determine line number without them being shown on the left-hand side, such as:
- Using commands like 30gg to jump to particular lines; and
- Looking at the bottom-right corner to view the current column and number.
However, it is in fact possible to show line numbers in Vim. To do this, enter the following command:
- :set number
To remove line numbers, use this command:
- :set nonumber
How to Autoindent in Vim
Similarly to showing line numbers, this is an easy-to-use feature that many are unaware of. To enable, use the command:
- :set autoindent
And to disable, use this command:
- :set noautoindent
In Conclusion
What a great text editor. Use it to do things likeedit HTML and CSS,make a website, and other exciting tasks.








Edit History
• [2019-05-03 21:06 PDT] August R. Garcia (1 year ago)• [2019-05-03 21:06 PDT] August R. Garcia (1 year ago)
• [2019-05-03 21:06 PDT] August R. Garcia (1 year ago)
🕓 Posted at 03 May, 2019 21:06 PM PDT
- C U 7 Internet Marketing/SEO Tricks from the Slack Chat
- C U [Video] 28+ Methods to Make Money Online: The Ultimate Tier List from S-Tier through F-Tier
- C U Scriptable Headless Browsers 101: PhantomJS vs. Headless Chrome/Chromium vs. Headless Firefox
- C U [Video] The Ultimate Offpage SEO Tier List: 28+ Link Building Methods Ranked from S through F (and a Few Other...
- C U 5 Tasks You Didn't Know You Could do With Vim
- C U [Infographic] The Beginner's Vim Cheat Sheet
- C U 5 Tasks You Didn't Know Could be Done from the Developer Console
- C U A Review and Overview of the Charles Web Debugging Proxy Application
- C U The Complete Guide to Discord Text Formatting, Syntax Highlighting, and Tricks for Adding Colors
- C U SquirrelMail vs. RoundCube vs. Horde: Why does every web hosting company come with these three email clients?
August Garcia is some guy who used to sell Viagra on the Internet. He made this website to LARP as a sysadmin while posting about garbage like user-agent spoofing, spintax, the only good keyboard, virtual assitants from Pakistan, links with the rel="nofollow" attribute, proxies, sin, the developer console, literally every link building method, and other junk.
Available at arg@256kilobytes.com, via Twitter, or arg.256kilobytes.com. Open to business inquiries based on availability.
Post a New Comment
To leave a comment, login to your account or create an account.
Do you like having a good time?
Register an Account
You can also login to an existing account or reset your password. All use of this site is subject to the terms of service and privacy policy.
Read Quality Articles
Read some quality articles. If you can manage to not get banned for like five minutes, you can even post your own articles.
View Articles →
Argue with People on the Internet
Use your account to explain why people are wrong on the Internet forum.
View Forum →
Vandalize the Wiki
Or don't. I'm not your dad.
View Wiki →
Ask and/or Answer Questions
If someone asks a terrible question, post a LMGTFY link.
View Answers →
Make Some Money
Hire freelancers and/or advertise your goods and/or services. Hire people directly. We're not a middleman or your dad. Manage your own business transactions.