5 vim tips for faster machine learning (2024)

  • ByYochay Ettun

5 vim tips for faster machine learning (1)

When you think of Vim, you don’t typically think machine learning. But, when used strategically, it can save a lot of time on data science tasks. Vim is one of the most popular tools for editing code. It’s fast, efficient and lean. It’s also very customizable so data scientists can configure it to their own workflow. Whether you’re a data scientist or data engineer, learning to use Vim and optimizing its capabilities could speed up code editing and speed up data science tasks.

And, if you are comfortable enough with the Vim key binding and shell commands, you can use Vim to do almost everything you need to do as a data scientist. For instance, data scientists can easily use Vim to edit CSV files, or to run multiple shell commands on a server for data analysis at one time.

But, there’s a common narrative about Vim. Many say it’s outdated, and confusing. The most common complaint – many people have trouble exiting it.

5 vim tips for faster machine learning (2)

The year is 2019 and Vim remains one of the most used textual editors. Especially if you’re working with servers and debugging through the CLI, Vim is the go-to.

So in order to make things easier, here are five tips to help you use Vim more efficiently, and hopefully save you time so that you can build high impact machine learning models.

1.:w !sudo tee %

If there’s one thing that can save you trouble and time on Vim – it’s this command. We’ve all been there. Entering a file and editing it, only to get that dreadful red alert:

This file is read only!

5 vim tips for faster machine learning (3)

At this point, most people will just exit and re-enter with sudo. But, what if you edit your Python script and have to add a lot of lines? With the use of this command, you can save your script from within Vim without exiting it.

Here’s a breakdown of the command:

:w is write

! – Vim to run a command line

sudo– use sudo

tee % – write the current file into the filename presented.

And just like that, your problem is solved.

2. cursor movements

Even though Vim is being used in the command line and with no GUI, I still see many people using the mouse to select words or sentences from Vim. Sometimes, I’ll even see people using Vim character…. by…… character. It’s painfully slow, especially if you have a large file with over 200K lines. Vim was built for speed, and one of the best things that drastically improved my Vim speed was the usage of cursor movements.

If you’ve ever played Dangerous Dave online, then you know how to use arrows to go down, up or side to side. But, there is a much better way to navigate the cursor.

Cursor movements include some interesting commands such as:

$– go to the end of the line

W– go to the end of the current words until the space

B – go the the beginning of the word until space

Once you master the cursor movement you’ll notice how Vim is actually like a command language.

dw– delete word

yB – yank the beginning of the word

3. The power of change

Let’s say that you run a machine learning experiment, and the parameter of git commit id was wrong. Now you’d need to edit a config file with a 40 character variable. Believe it or not, most people press “i” to get into insert mode and delete the characters one by one. If you are someone that does this, this tip could save you a lot of time. I present to you, the change mode “c”. By pressing “c” and using the right arrow cursor movement, it will delete all the way up to the cursor. Not only that but it will bring you directly to insert mode. If you want to change the variable, you will just go to the first character of the word and type “cw”. Just like that it will change the word. If it’s in between two quotation marks, you can even delete whatever text is inside. For example, if I want to change “cnvrgrocks” I can type ci” – and it will delete the words between the quotation marks and put you in insert mode.

5 vim tips for faster machine learning (4)

There’s also the C, which will change from your current position to the end of the line (same as c$) which is one of the more powerful commands you could use.

4. A “.” can go a long way

This is one of the strongest commands Vim has to offer. The use of a simple “.” will redo the last command you did. For instance, if you change a change a CSV header from user to , type ct,customer

Now you can go to another header, stand on the word user, original_user, type “.” and it will change it to “customer” with one click! Therefore, if you deleted, yanked, pasted, moved as your last command, it comes back without effort.

5. :%s/foo/bar/g

A “.” can go a long way, but sometimes it doesn’t go quite far enough. Now let’s say you want to change the name of a variable in your experiment output data. You’d like to change anything that says “Artificial” to say “Organic“. Instead of manually changing each word in each column individually, you can just type this command

:%s/Artificial/Organic/g 

Like that, “Artificial” will be changed to “Organic” everywhere in the CSV. The command is much like search and replace in your known GUI text editor.

Implementing these five tips can drastically improve your Vim speed. Once you’ve learned to speed up the process you’ll learn to love Vim. It’s a powerful tool, especially if you are a data scientist working and debugging your code on servers. If you want to see some more tips and tricks, you can use this resource – https://vim.fandom.com

Top MLOps guides and news in your inbox every month

PrevPreviousHow to compile TensorFlow 1.12 on Ubuntu 16.04 using Docker

NextUsing Chest X-ray’s and deep learning to predict health conditionsNext

Recent Posts
  • This Month in MLOps and LLMOps
  • Beyond ChatGPT: Building a LangChain-Powered App with Intel® Tiber™ AI Studio, Part 2
  • Beyond ChatGPT: Building a LangChain-Powered App with Intel® Tiber™ AI Studio, Part 1
  • Unlocking Efficient Deep Learning: Intel® Tiber™ AI Studio MetaGPU Sharing
  • Enhance Large Language Models Leveraging RAG and MinIO on Intel® Tiber™ AI Studio
  • Easily build an automated video transcription AI pipeline with Whisper in Intel® Tiber™ AI Studio
  • Unlocking AI’s Potential: Supercharging Enterprises with LLMs, cnvrg, Intel Developer Cloud, and Redis
  • The Anatomy of an AI Blueprint: A step by step guide
  • How to create your own low code AI solution with Intel® Tiber™ AI Blueprints

You might also like

  • The Ultimate Guide to Building a Scalable Machine Learning Infrastructure
  • How to apply LSTM using PyTorch
  • Deep Learning Guide: How to Accelerate Training using PyTorch with CUDA
  • Getting Started with Sentiment Analysis using Python
  • How to Apply Hyperparameter Tuning to any AI Project
  • How to use random forest for regression: notebook, examples and documentation
  • The Definitive Guide to Semantic Segmentation for Deep Learning in Python
  • The essential guide to resource optimization with bin packing
  • How to build CNN in TensorFlow: examples, code and notebooks
Build Your Vision: How To Create Your Own AutoML Computer Vision Pipeline
Easily summarize medical research papers with ready-to-use AI Blueprints
How to setup Docker and Nvidia-Docker 2.0 on Ubuntu 18.04
Docker for machine learning and reproducible data science
5 vim tips for faster machine learning (2024)
Top Articles
Compare Today’s Mortgage and Refinance Rates in Seattle, WA - NerdWallet
Etherscan Information Center
Katie Pavlich Bikini Photos
Gamevault Agent
Pieology Nutrition Calculator Mobile
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Craigslist Mexico Cancun
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Doby's Funeral Home Obituaries
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Select Truck Greensboro
Things To Do In Atlanta Tomorrow Night
Non Sequitur
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Craigslist In Flagstaff
Shasta County Most Wanted 2022
Energy Healing Conference Utah
Testberichte zu E-Bikes & Fahrrädern von PROPHETE.
Aaa Saugus Ma Appointment
Geometry Review Quiz 5 Answer Key
Allybearloves
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Vera Bradley Factory Outlet Sunbury Products
Pixel Combat Unblocked
Cvs Sport Physicals
Mercedes W204 Belt Diagram
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Where Can I Cash A Huntington National Bank Check
Facebook Marketplace Marrero La
Nobodyhome.tv Reddit
Topos De Bolos Engraçados
Sand Castle Parents Guide
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hampton In And Suites Near Me
Hello – Cornerstone Chapel
Stoughton Commuter Rail Schedule
Otter Bustr
Selly Medaline
Latest Posts
Article information

Author: Twana Towne Ret

Last Updated:

Views: 5809

Rating: 4.3 / 5 (64 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Twana Towne Ret

Birthday: 1994-03-19

Address: Apt. 990 97439 Corwin Motorway, Port Eliseoburgh, NM 99144-2618

Phone: +5958753152963

Job: National Specialist

Hobby: Kayaking, Photography, Skydiving, Embroidery, Leather crafting, Orienteering, Cooking

Introduction: My name is Twana Towne Ret, I am a famous, talented, joyous, perfect, powerful, inquisitive, lovely person who loves writing and wants to share my knowledge and understanding with you.