Leverage shell commands to quickly edit text on Visual Studio Code
- Get link
- X
- Other Apps
I really like vi. When I started using Visual Studio Code as my main editor shortly after it hit version 1, one thing I felt missing in Code was the ability to quickly edit text using various commands already available on your shell. For example, let’s say you’re editing a section of text that looks like following.
Contributors:
- Mike, 3 PRs
- Elizabeth, 5 PRs
- Robert, 2 PRs
- Mary, 10 PRs
If you want to order the contributors by the amount of contributions, in vi, you can utilise shell’s sort command:
- Select the list of contributors
- Execute a shell command
sort -t, -k 2 -n -ron the visual mode
Then you’ll get
Contributors:
- Mary, 10 PRs
- Elizabeth, 5 PRs
- Mike, 3 PRs
- Robert, 2 PRs
If you want to drop the number of PRs from the list, you can just pipe the sort output to cut command (e.g. sort -t, -k 2 -n -r | cut -d, -f1), because it’s just a shell command!
Contributors:
- Mary
- Elizabeth
- Mike
- Robert
You can leverage all the powerful commands available on your shell! And, this is exactly what Edit with Shell Command extension offers you on Code; Editing selected text with commands available on your shell.
Here is how it works ⬇️ (Example text is different from the above)

You can also just insert shell commands output at the cursor position instead of modifying text in the editor.
If you often come across situations where you feel, “Ah… it would be a piece of cake if I can use foo command on the shell”, give the extension a try on your Code 👍
- Get link
- X
- Other Apps
Comments
zx
ReplyDeleteLetras Diferentes
ReplyDeleteis a simple and enjoyable tool for anyone who wants to make their text more creative and eye-catching. I like how easy it is to explore different font styles and find an option that matches the mood of my content. The interface feels clean and straightforward, so it is easy to use even for first-time visitors. I find it particularly helpful for creating social media bios, captions, usernames, comments, and personalized messages. Trying different styles is also fun because each option can give ordinary text a completely different feel. Overall, Letras Diferentes provides a smooth and convenient experience for anyone looking to add a personal touch to their text.
This is a useful practical tip for Visual Studio Code users who are comfortable with shell commands and want to bring some of the efficiency of vi-style text editing into their regular workflow. The example of sorting contributor data and then using cut to remove unwanted information clearly demonstrates how powerful simple command-line tools can be when combined through pipes.
ReplyDeleteThe Edit with Shell Command extension is particularly interesting because it allows developers to apply familiar shell utilities directly to selected text instead of switching between the editor and terminal. These productivity techniques can be valuable when working across different development environments, including projects built with a Dot NET Full Stack Course technology stack.
I also like the focus on using existing shell capabilities rather than introducing a completely new text-processing workflow. The ability to combine commands such as sort and cut can make repetitive editing tasks much faster, especially when working with structured text. For developers working with modern web applications, an ASP.NET Core ReactJS Full Stack Course can similarly provide a broader development context where tools such as Visual Studio Code become part of the everyday workflow.
ReplyDelete