<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>vscode on tkainrad</title>
    <link>https://tkainrad.dev/tags/vscode/</link>
    <description>Recent content in vscode on tkainrad</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Fri, 04 Dec 2020 00:00:00 +0000</lastBuildDate>
    
        <atom:link href="https://tkainrad.dev/tags/vscode/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>Automatically add &lt;kbd&gt;-tags with a Single Regex</title>
      <link>https://tkainrad.dev/posts/automatically-add-kbd-tags-with-a-single-regex/</link>
      <pubDate>Fri, 04 Dec 2020 00:00:00 +0000</pubDate>
      
      <guid>https://tkainrad.dev/posts/automatically-add-kbd-tags-with-a-single-regex/</guid>
      <description>&lt;h1 id=&#34;introduction&#34;&gt;Introduction&lt;/h1&gt;
&lt;p&gt;Until about a year ago, I had the same approach to regular expressions as most developers: Doing trial and error until the damn thing was working.&lt;/p&gt;
&lt;p&gt;Then came &lt;a href=&#34;https://keycombiner.com&#34;&gt;KeyCombiner&lt;/a&gt; and with it some very specific challenges around parsing text that contains keyboard shortcuts. One of these challenges is writing blog posts about KeyCombiner:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://tkainrad.dev/posts/a-collection-of-all-keyboard-shortcuts-i-use/&#34;&gt;A Collection of all Keyboard Shortcuts I use&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tkainrad.dev/posts/learning-all-vscode-shortcuts-evolved-my-developing-habits/&#34;&gt;Learning all VSCode shortcuts evolved my developing habits&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://tkainrad.dev/posts/how-i-learned-50-new-keyboard-shortcuts-in-42-minutes/&#34;&gt;How I learned 50 new keyboard shortcuts in 42 minutes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These posts contain &lt;em&gt;a lot&lt;/em&gt; of keyboard shortcuts that should be highlighted via &amp;lt;kbd&amp;gt; tags. By now, these tags are supported by most static site generators and blogging platforms, such as DEV.to. However, typing them in manually is extremely tedious. Initially, I felt quite smart when I added a user snippet in VSCode:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-json&#34; data-lang=&#34;json&#34;&gt;&lt;span style=&#34;color:#c30&#34;&gt;&amp;#34;kbd&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#a00;background-color:#faa&#34;&gt;:&lt;/span&gt; {
    &lt;span style=&#34;color:#309;font-weight:bold&#34;&gt;&amp;#34;scope&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#c30&#34;&gt;&amp;#34;markdown&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#309;font-weight:bold&#34;&gt;&amp;#34;prefix&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#c30&#34;&gt;&amp;#34;kbd&amp;#34;&lt;/span&gt;,
    &lt;span style=&#34;color:#309;font-weight:bold&#34;&gt;&amp;#34;body&amp;#34;&lt;/span&gt;: [
        &lt;span style=&#34;color:#c30&#34;&gt;&amp;#34;&amp;lt;kbd&amp;gt;$0&amp;lt;/kbd&amp;gt;&amp;#34;&lt;/span&gt;
    ],
    &lt;span style=&#34;color:#309;font-weight:bold&#34;&gt;&amp;#34;description&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#c30&#34;&gt;&amp;#34;Insert HTML kbd tags&amp;#34;&lt;/span&gt;
}&lt;span style=&#34;color:#a00;background-color:#faa&#34;&gt;,&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This lets me type &lt;code&gt;kbd&lt;/code&gt;, press &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;space&lt;/kbd&gt; and hit &lt;kbd&gt;enter&lt;/kbd&gt; to put my cursor in-between an opening and a closing &lt;code&gt;&amp;lt;kbd&amp;gt;&lt;/code&gt; tag. However, it does not help with copy-pasted text, which is an essential use case for me. I write the first draft of my posts in Notion, as described in &lt;a href=&#34;https://tkainrad.dev/posts/managing-my-personal-knowledge-base/&#34;&gt;my post about personal knowledge management&lt;/a&gt;. Even if this were not an issue, it&amp;rsquo;s still quite a lot of keys to hit for just adding two tags. Another solution would be to write a script in some interpreted language and do all kinds of fancy things to this text. The problem is, this script will likely end up like many single-purpose scripts do: Abandoned and buggy.&lt;/p&gt;
&lt;p&gt;So, I needed a better, more timeless solution: Regular Expressions.&lt;br&gt;
Fear not, I won&amp;rsquo;t try to teach you general regex syntax. Instead, I will show how to use it for this particular use case.
I will explain in detail how and why this works, but you can also just copy-paste &lt;a href=&#34;#final-regex&#34;&gt;the final regex&lt;/a&gt; and apply it for yourself. One of the best tools for putting the regex to work is Visual Studio Code, but any editor that supports regex-based replace operations will do.&lt;/p&gt;
&lt;h1 id=&#34;how-to&#34;&gt;How-To&lt;/h1&gt;
&lt;p&gt;Suppose we have the following text:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Modifier keys, such as ctrl, shift, alt, and cmd do nothing by themselves but can be used in combination with other keys. To paste without the original formatting, use ctrl+shift+v. Debugging is controlled via f5, f6, f10, and f11.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;What we want to have is this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Modifier keys, such as &lt;kbd&gt;ctrl&lt;/kbd&gt;, &lt;kbd&gt;shift&lt;/kbd&gt;, &lt;kbd&gt;alt&lt;/kbd&gt;, and &lt;kbd&gt;cmd&lt;/kbd&gt;  do nothing by themselves but can be used in combination with other keys. To paste without the original formatting, use &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;shift&lt;/kbd&gt;+&lt;kbd&gt;v&lt;/kbd&gt;. Debugging is controlled via &lt;kbd&gt;f5&lt;/kbd&gt;, &lt;kbd&gt;f6&lt;/kbd&gt;, &lt;kbd&gt;f10&lt;/kbd&gt;, and &lt;kbd&gt;f11&lt;/kbd&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The next sections will describe how we get there.&lt;/p&gt;
&lt;h2 id=&#34;modifiers-and-f-keys&#34;&gt;Modifiers and F-keys&lt;/h2&gt;
&lt;p&gt;We can already go pretty far with this regex that uses or operators (&lt;code&gt;|&lt;/code&gt;) to match a predefined set of strings:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;(f1|f2|f3|f4|f5|f6|f7|f8|f9|f10|f11|f12|backspace|tab|enter|shift|ctrl|cmd|alt|capslock|pageup|pagedown|ins|del|option|meta)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Putting the expression in brackets &lt;code&gt;()&lt;/code&gt; means that it is a capture group. Capture groups are an essential concept when working with regular expressions. One of their greatest features is that we get to reference them by number in the replacement string:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-html&#34; data-lang=&#34;html&#34;&gt;&amp;lt;&lt;span style=&#34;color:#309;font-weight:bold&#34;&gt;kbd&lt;/span&gt;&amp;gt;$1&amp;lt;/&lt;span style=&#34;color:#309;font-weight:bold&#34;&gt;kbd&lt;/span&gt;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This means we will replace a match of the first capture group with itself (&lt;code&gt;$1&lt;/code&gt;) surround by the desired tags.&lt;/p&gt;
&lt;p&gt;The above text will become:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Modifier keys, such as &lt;kbd&gt;ctrl&lt;/kbd&gt;, &lt;kbd&gt;shift&lt;/kbd&gt;, &lt;kbd&gt;alt&lt;/kbd&gt;, and &lt;kbd&gt;cmd&lt;/kbd&gt;  do nothing by themselves but can be used in combination with other keys. To paste without the original formatting, use &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;shift&lt;/kbd&gt;+v. Debugging is controlled via &lt;kbd&gt;f5&lt;/kbd&gt;, &lt;kbd&gt;f6&lt;/kbd&gt;, &lt;kbd&gt;f10&lt;/kbd&gt;, and &lt;kbd&gt;f11&lt;/kbd&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This is a good start, but we are not quite there yet. Non-modifier keys that are part of key combinations do not yet have the proper tags. We will deal with them in the next section. But before, we can shorten our expression a bit, by switching out the f-keys with a single sub-expression: &lt;code&gt;f([2-9]|1[0-2]?)&lt;/code&gt;. This will match any &lt;code&gt;f&lt;/code&gt;-character followed by either &lt;code&gt;2-9&lt;/code&gt; or a sequence of &lt;code&gt;1&lt;/code&gt; and &lt;code&gt;0-2&lt;/code&gt;. It is equal to typing out the f-keys, but a little more fun. So we end up with this expression:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;(f([2-9]|1[0-2]?)|backspace|tab|enter|shift|ctrl|cmd|alt|capslock|pageup|pagedown|ins|del|option|meta)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;regular-keys-in-combinations&#34;&gt;Regular keys in combinations&lt;/h2&gt;
&lt;p&gt;Matching regular keys is a bit more tricky. We cannot just match any &lt;code&gt;v&lt;/code&gt; characters in our text. One approach is to match any single alphanumeric character that is preceded by a &lt;code&gt;+&lt;/code&gt;-sign. To do this, we need to use something called &lt;em&gt;Lookarounds&lt;/em&gt;, more more specifically, a &lt;em&gt;Lookbehind&lt;/em&gt;: &lt;code&gt;(?&amp;lt;=\+)&lt;/code&gt;
The nice thing about lookarounds is that they do not increase the matched character sequence. Instead, they specify what must (or must not) come before or after the matched part, which is very useful when applying replacement operations. Adding this to our expression results in the following:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;((?&amp;lt;=\+)[\w\d]{1}|f([2-9]|1[0-2]?)|backspace|tab|enter|shift|ctrl|cmd|alt|capslock|pageup|pagedown|ins|del|option|meta)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Using this expression, we end up with the desired text already:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Modifier keys, such as &lt;kbd&gt;ctrl&lt;/kbd&gt;, &lt;kbd&gt;shift&lt;/kbd&gt;, &lt;kbd&gt;alt&lt;/kbd&gt;, and &lt;kbd&gt;cmd&lt;/kbd&gt;  do nothing by themselves but can be used in combination with other keys. To paste without the original formatting, use &lt;kbd&gt;ctrl&lt;/kbd&gt;+&lt;kbd&gt;shift&lt;/kbd&gt;+&lt;kbd&gt;v&lt;/kbd&gt;. Debugging is controlled via &lt;kbd&gt;f5&lt;/kbd&gt;, &lt;kbd&gt;f6&lt;/kbd&gt;, &lt;kbd&gt;f10&lt;/kbd&gt;, and &lt;kbd&gt;f11&lt;/kbd&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;However, we shouldn&amp;rsquo;t celebrate too early. There are still some issues and special cases to take care of:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;What happens if a modifier appears within another word, such as &lt;em&gt;ins&lt;/em&gt; in &lt;em&gt;&lt;strong&gt;ins&lt;/strong&gt;ert&lt;/em&gt;?&lt;/li&gt;
&lt;li&gt;What happens if we apply this to text that already has some &lt;code&gt;&amp;lt;kbd&amp;gt;&lt;/code&gt; tags?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The answer to both questions is clear: Terrible things will happen. We will have to go a bit deeper.&lt;/p&gt;
&lt;h2 id=&#34;avoiding-false-positives&#34;&gt;Avoiding False Positives&lt;/h2&gt;
&lt;p&gt;Now that we already know the &lt;em&gt;Lookaround&lt;/em&gt; concept, this is relatively easy. We will ensure that the expression only matches occurrences surrounded by one of these characters: &lt;code&gt;[\+ .,\n]&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;(?&amp;lt;=[\+ .,\n])(backspace|tab|enter|shift|ctrl|cmd|alt|capslock|pageup|pagedown|ins|del|option|meta|f([2-9]|1[0-2]?)|(?&amp;lt;=\+)[\w\d]{1})(?=[\+ .,\n])
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;achieving-idempotence&#34;&gt;Achieving Idempotence&lt;/h2&gt;
&lt;p&gt;An idempotent operation is one that can be applied more than once without changing the outcome. To achieve idempotence, we will make use of another advantage of our beloved lookarounds: They can be stacked one after another. All we have to do is make sure that our matches are not already preceded by a &lt;code&gt;&amp;lt;kbd&amp;gt;&lt;/code&gt; tag, using a negative &lt;em&gt;Lookbehind&lt;/em&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;(?&amp;lt;!&amp;lt;kbd&amp;gt;)(?&amp;lt;=[\+ .,\n])(backspace|tab|enter|shift|ctrl|cmd|alt|capslock|pageup|pagedown|ins|del|option|meta|f([2-9]|1[0-2]?)|(?&amp;lt;=\+)[\w\d]{1})(?=[\+ .,\n])
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We could add a negative &lt;em&gt;Lookahead&lt;/em&gt; for the closing tag, too, but it is not needed.&lt;/p&gt;
&lt;h2 id=&#34;final-regex&#34;&gt;Final regex&lt;/h2&gt;
&lt;p&gt;That&amp;rsquo;s it. We have a regular expression that we can use in VSCode and other editors to automatically surround all occurences of keys with &lt;code&gt;&amp;lt;kbd&amp;gt;&lt;/code&gt; tags. To use it, search for this expression with the &lt;em&gt;Use Regular Expression&lt;/em&gt; (&lt;kbd&gt;alt&lt;/kbd&gt;+&lt;kbd&gt;r&lt;/kbd&gt;)-toggle enabled:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;(?&amp;lt;!&amp;lt;kbd&amp;gt;)(?&amp;lt;=[\+ .,\n])(backspace|tab|enter|shift|ctrl|cmd|alt|capslock|pageup|pagedown|ins|del|option|meta|f([2-9]|1[0-2]?)|(?&amp;lt;=\+)[\w\d]{1})(?=[\+ .,\n])
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then, replace all occurrences  string:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre style=&#34;background-color:#f0f3f3;-moz-tab-size:4;-o-tab-size:4;tab-size:4&#34;&gt;&lt;code class=&#34;language-html&#34; data-lang=&#34;html&#34;&gt;&amp;lt;&lt;span style=&#34;color:#309;font-weight:bold&#34;&gt;kbd&lt;/span&gt;&amp;gt;$1&amp;lt;/&lt;span style=&#34;color:#309;font-weight:bold&#34;&gt;kbd&lt;/span&gt;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you want to go one step further, you could even apply this in a build pipeline, e.g., after pushing to GitHub Pages or GitLab Pages. Personally, I like to do it myself in VSCode. These are very satisfying 30 seconds of work before publishing a new blog post.&lt;/p&gt;
&lt;h1 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h1&gt;
&lt;p&gt;Hopefully, I could help a bit to improve the bad reputation of regular expressions. But I will let you in on a little secret. Just like everyone else, I have a hard time remembering the syntax.
The good thing is, I have a superpower to overcome this: KeyCombiner&amp;rsquo;s instant shortcut lookup. Whenever I press &lt;kbd&gt;super&lt;/kbd&gt;+&lt;kbd&gt;c&lt;/kbd&gt;, I have instant access to the shortcuts of the active application, all other shortcuts that I like to use, and even regex syntax:&lt;/p&gt;
&lt;figure class=&#34;center-figure&#34;&gt;
    &lt;img src=&#34;https://tkainrad.dev/images/keycombiner/lookup-regex.gif&#34;
         alt=&#34;Instant shortcut lookup of KeyCombiner&amp;amp;rsquo;s free to use desktop app.&#34;/&gt; &lt;figcaption&gt;
            &lt;p&gt;Instant shortcut lookup of KeyCombiner&amp;rsquo;s free to use &lt;a href=&#34;https://keycombiner.com/desktop/&#34;&gt;desktop app&lt;/a&gt;.&lt;/p&gt;
        &lt;/figcaption&gt;
&lt;/figure&gt;

</description>
    </item>
    
    <item>
      <title>Learning all VSCode shortcuts evolved my developing habits</title>
      <link>https://tkainrad.dev/posts/learning-all-vscode-shortcuts-evolved-my-developing-habits/</link>
      <pubDate>Sun, 15 Nov 2020 00:00:00 +0000</pubDate>
      
      <guid>https://tkainrad.dev/posts/learning-all-vscode-shortcuts-evolved-my-developing-habits/</guid>
      <description>&lt;h1 id=&#34;preface&#34;&gt;Preface&lt;/h1&gt;
&lt;p&gt;I spent a few hours spread over the last couple of weeks to learn every single one of VSCode&amp;rsquo;s keyboard shortcuts, specifically the 149 shortcuts from the &lt;a href=&#34;https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf&#34;&gt;official keyboard shortcuts reference&lt;/a&gt;. These are also present in &lt;a href=&#34;https://keycombiner.com/collections/vscode/&#34;&gt;KeyCombiner&amp;rsquo;s searchable table of VSCode shortcuts&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Admittedly, I started this challenge to write a blog post about it afterward and as a way to promote &lt;a href=&#34;https://keycombiner.com/&#34;&gt;KeyCombiner&lt;/a&gt; via content marketing. The blog post I had in mind would be similar to my previous one, &lt;a href=&#34;https://tkainrad.dev/posts/how-i-learned-50-new-keyboard-shortcuts-in-42-minutes/&#34;&gt;documenting my process of learning 50 new web application shortcuts in 42 minutes&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But, as it usually happens only in romantic comedies, my intentions changed over time. This article turned out much different. It is not about the learning process but about how this challenge changed some of the developing habits I had for many years. Workflows that I grew used to during many projects, different IDEs, and even varying programming languages suddenly evolved.&lt;/p&gt;

&lt;div class=&#34;notices tip&#34;&gt;
    &lt;p&gt;In case you do want to see how detailed statistics about how KeyCombiner helped me to learn all VSCode shortcuts, have a look at this &lt;a href=&#34;https://keycombiner.com/training/collection/295/&#34;&gt;overview&lt;/a&gt;. It shows a timeline of how my knowledge evolved. It took 205 practice runs (=205 minutes ~ 3.5 hours) until I mastered the complete collection.&lt;/p&gt;

&lt;/div&gt;
&lt;h1 id=&#34;habits-are-hard-to-break&#34;&gt;Habits are Hard to Break&lt;/h1&gt;
&lt;p&gt;As software engineers, we like to think that we are continually learning and improving our skills. This is certainly true when it comes to the technologies we are using. However, our development habits, such as which features of our IDEs we use, are much more rigid. I believe most of our core workflows are formed early on and very hard to change.
I don&amp;rsquo;t have data to back this up, but when I look at myself, my co-workers, and other developers I know, this certainly seems true. If you think about it, it is not surprising, the same thing happens in other areas of life. For this very reason, you will find that developers who have studied or worked together will often use similar shortcuts, similar IDE features, and have similar limitations in their workflows.&lt;/p&gt;
&lt;p&gt;The usual way to combat this is reading books, blog posts, attending conferences, well, everything that is used in our industry to extend our knowledge. However, with fundamental developing habits, I have found that this works poorly. You might read about a neat feature of your IDE, or see someone demo their workflow, but when you are eventually sitting in front of your screen and writing code, it is easy to fall back to what we already know, what is already set up, and proven to work.&lt;/p&gt;
&lt;p&gt;After this experiment, I am convinced that keyboard shortcuts are the main factor in how we form our developing habits, and they can also stop us from evolving our habits.
Even before this challenge, I felt that I was good with shortcuts. I knew quite a few refactoring shortcuts, knew how to pause and stop program executing during debugging, was decent at jumping around between files, searching through my project, and all the other usual stuff. When I saw a co-worker using a shortcut that I didn&amp;rsquo;t know, I was quick to incorporate it into my workflow, too. After all, I was enough into shortcuts that I built a whole side-project around learning them.
&lt;strong&gt;The thing is, all new shortcuts that I learned were the ones that would augment my existing habits.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This is a hen and egg problem; if you don&amp;rsquo;t know the shortcuts, you will not start to change your habits and use new IDE features because, without shortcuts, they are too tedious to use or not at all usable. But if you don&amp;rsquo;t form new habits, you will not learn the shortcuts.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Without intending it, I think I found a way to break out of this cycle:
Learning all IDE shortcuts very well &lt;em&gt;before&lt;/em&gt; getting back to work. By learning &lt;em&gt;all&lt;/em&gt; shortcuts, you are not limited to what somebody shows you and might not be compatible with your situation. You can naturally include what makes sense, in addition to your existing skills.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The next section shows how this worked for me.&lt;/p&gt;
&lt;h1 id=&#34;evolving-my-habits&#34;&gt;Evolving my Habits&lt;/h1&gt;
&lt;p&gt;I started the learning process as it is usually done with KeyCombiner: By importing some shortcuts from the &lt;a href=&#34;https://keycombiner.com/collections/vscode/&#34;&gt;public collection of VSCode shortcuts&lt;/a&gt; into a personal collection. Intuitively, I started with the ones I already knew and some additional that seemed most useful to me. Back then I was still trying to show that I could learn all shortcuts very quickly with KeyCombiner. I didn&amp;rsquo;t expect that shortcuts that had nothing to do with my existing workflows will be the real deal.&lt;/p&gt;
&lt;p&gt;Some of the first combinations that I picked and that I did not know previously were &lt;kbd&gt;alt&lt;/kbd&gt;+&lt;kbd&gt;w&lt;/kbd&gt;/&lt;kbd&gt;r&lt;/kbd&gt;/&lt;kbd&gt;c&lt;/kbd&gt; for toggling find options (match whole word, regex, case sensitivity) because I was already using those features. This went on for a few days. I did a couple practice runs every day and added new shortcuts whenever KeyCombiner was saying that I mastered all of the previous ones.&lt;/p&gt;
&lt;p&gt;Eventually, I knew all shortcuts that seemed useful for how I was using VSCode back then. So I had to start adding shortcuts that had nothing to do with my existing habits. This brought up an interesting misconception. Often keyboard shortcuts are seen as a way to do things faster, compared to using the mouse. While that is true, I think there is an even more important aspect to shortcut usage in IDEs: Many features are not used at all, if you don&amp;rsquo;t know the shortcut!&lt;/p&gt;
&lt;p&gt;As I was learning new VSCode shortcuts every day, I started to use features that I previously didn&amp;rsquo;t even know of. One of the first things that suddenly made a lot of sense was &lt;em&gt;Select all Occurences of Find Match&lt;/em&gt; with &lt;kbd&gt;Alt&lt;/kbd&gt;+&lt;kbd&gt;Enter&lt;/kbd&gt; as default binding, especially when combined with regex search. I was so excited about it, that I even &lt;a href=&#34;https://twitter.com/ThomasKainrad/status/1305608337799761920&#34;&gt;tweeted a Gif&lt;/a&gt; showing how I use it to modify the CSV files that are the source for KeyCombiner&amp;rsquo;s public collection tables.&lt;/p&gt;
&lt;p&gt;The process worked both ways: Sometimes, while I was practicing a shortcut on KeyCombiner, it seemed apparent that this was useful and that I should include it into my workflow. Sometimes it hit me while coding that I had just learned a shortcut that can make the current task more efficient.&lt;/p&gt;
&lt;p&gt;In the following, I describe the most significant changes in my daily development habits. The list is far from complete though; there are many more small things that I picked up and frequently use now.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Editor and Panel Management&lt;/strong&gt;&lt;br&gt;
Since knowing all the shortcuts to switch focus between panels and move editors around, I am using VSCode&amp;rsquo;s powerful layouting capabilities much more. I have 3-5 editor panels open at pretty much all times, seeing many related pieces of code at once. Working this way by using the mouse is very impractical.
I switch between editor panels with keyboard shortcuts and move editors from one group to the other.&lt;/p&gt;
&lt;p&gt;There is one negative side-effect, though: I am starting to get annoyed when I use other IDEs (PyCharm, Eclipse), because they lack far behind VSCode when it comes to using multiple editors.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Multi-cursor Editing&lt;/strong&gt;&lt;br&gt;
If you don&amp;rsquo;t know the shortcut to add additional cursors, I doubt you will ever use this incredibly powerful feature of VSCode. It is a typical feature that only blends into your habits once you know the shortcuts.
The basic commands are &lt;kbd&gt;Ctrl&lt;/kbd&gt;+&lt;kbd&gt;Alt&lt;/kbd&gt;+&lt;kbd&gt;Up&lt;/kbd&gt;/&lt;kbd&gt;Down&lt;/kbd&gt; for adding cursors above/below. However, I found the commands to &lt;em&gt;Insert cursor at end of each line selected&lt;/em&gt; (&lt;kbd&gt;Shift&lt;/kbd&gt;+&lt;kbd&gt;Alt&lt;/kbd&gt;+&lt;kbd&gt;i&lt;/kbd&gt;), and the above-mentioned &lt;em&gt;Select all Occurences of Find Match&lt;/em&gt; (&lt;kbd&gt;Alt&lt;/kbd&gt;+&lt;kbd&gt;Enter&lt;/kbd&gt;) even more powerful. These commands are why I frequently paste text snippets into VSCode, apply a few operations, and then copy-paste it back into whatever application I was using.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Opening views by shortcut&lt;/strong&gt;&lt;br&gt;
I sometimes tried to do this before, but it never stuck. Now I finally switch to all views (Explorer, Debug, Search, Problems, etc.) with dedicated keyboard shortcuts. These shortcuts translate very nicely to other IDEs. After learning the VSCode default bindings, which are &lt;kbd&gt;Ctrl&lt;/kbd&gt;+&lt;kbd&gt;Shift&lt;/kbd&gt;+&lt;kbd&gt;&amp;lt;char&amp;gt;&lt;/kbd&gt;, I set the same bindings also for Eclipse and PyCharm. Especially &lt;kbd&gt;Ctrl&lt;/kbd&gt;+&lt;kbd&gt;Shift&lt;/kbd&gt;+&lt;kbd&gt;e&lt;/kbd&gt; for switching to the explorer view and &lt;kbd&gt;Ctrl&lt;/kbd&gt;+&lt;kbd&gt;Shift&lt;/kbd&gt;+&lt;kbd&gt;d&lt;/kbd&gt; for switching to the debug view are among my most used shortcuts now.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Making Selections&lt;/strong&gt;&lt;br&gt;
I hate to admit it, but I did not use shortcuts to expand and shrink AST selections before.  AST stands for &lt;em&gt;abstract syntax tree&lt;/em&gt;, which means that the IDE will take the current language&amp;rsquo;s syntax into account for modifying the selection. Finally, I picked up &lt;kbd&gt;Ctrl&lt;/kbd&gt;+&lt;kbd&gt;Shift&lt;/kbd&gt;+&lt;kbd&gt;left&lt;/kbd&gt;/&lt;kbd&gt;right&lt;/kbd&gt; to shrink and expand selections. Not all IDEs handle this in the same way, which can be a bit annoying, but it works well for the most frequent tasks, such as expanding the selection to enclose the current string, method, class, or HTML tag.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Folding&lt;/strong&gt;&lt;br&gt;
I have started to use folding much more.  For years, I have rarely used this feature that all IDEs support to a great extent. Now, I do it frequently. Folding is one of these things that are just not feasible with the mouse. Of course, if you need to fold code, &lt;a href=&#34;https://blog.codinghorror.com/the-problem-with-code-folding/&#34;&gt;chances are that you need to structure your code better&lt;/a&gt;. Many organizations even apply automatic code linters that will complain when methods or classes are too long. However, I have never seen someone recommend splitting up blog posts into multiple files.  The same goes for other non-code file types, such as JSON. All we have there is folding.&lt;/p&gt;
&lt;p&gt;I am not saying these are the things you should start to learn now, far from it. These are the things I personally integrated deep into my workflows after doing this challenge, without choosing them deliberately, but naturally. Who knows what you will pick up.&lt;/p&gt;
&lt;p&gt;Of course, some of the shortcuts I learned still seem a bit, let&amp;rsquo;s say nonessential, but a little useless knowledge never killed nobody.&lt;/p&gt;
&lt;h1 id=&#34;more-unexpected-benefits&#34;&gt;More Unexpected Benefits&lt;/h1&gt;
&lt;p&gt;In addition to finally breaking out of old habits and experiencing a real evolution of my IDE usage, there were some other, less significant, but still delightful second-order effects.&lt;/p&gt;
&lt;p&gt;As a shortcut enthusiast, I often had the problem that I needed to decide which binding to use for a particular operation and application pair. KeyCombiner&amp;rsquo;s public shortcut search helps to find out which binding is the convention for a particular operation, but it can still be tricky. For example, take the frequently used &lt;em&gt;Step Over&lt;/em&gt; operation used for debugging. &lt;a href=&#34;https://keycombiner.com/collecting/collections/public/search/?description=step+over&amp;amp;keys=&amp;amp;mac_keys=&amp;amp;submit=Search&#34;&gt;KeyCombiner shows that VSCode, Eclipse, and JetBrains IDEs all use a different default binding&lt;/a&gt;(&lt;kbd&gt;F6&lt;/kbd&gt;,&lt;kbd&gt;F8&lt;/kbd&gt;,&lt;kbd&gt;F10&lt;/kbd&gt;). Learning every single VSCode shortcut has freed me from this mental load of deciding what the best binding for a particular IDE operation is. I simply use VSCode&amp;rsquo;s bindings everywhere. There are good arguments for why VSCode is a good reference. With the rise of GitHub CodeSpaces and its thriving extensions marketplace, I think it is likely that it will emerge as the industry standard of IDEs within a few years. That&amp;rsquo;s the topic for a future post, though.&lt;/p&gt;
&lt;p&gt;Another effect is that I rarely use the mouse anymore when working in VSCode. This is not ideological for me. I hold no grudges against mouse usage. It just so happens that the need to touch it rarely comes up anymore.
I guess most people that can do this use Vim or some Vim extension for their IDE. I can say confidently that it also works to learn all the default shortcuts. However, if you aim to eliminate the mouse completely while using VSCode, you should probably still go for one of the popular Vim emulators.&lt;/p&gt;
&lt;p&gt;And finally, maybe most importantly, VSCode feels like home now. As someone who also uses other IDEs daily, it&amp;rsquo;s hard to develop a feeling towards a particular one that this is &lt;em&gt;your&lt;/em&gt; professional tool: &lt;em&gt;The&lt;/em&gt; place where the magic happens. Now that I have a complete picture of VSCode&amp;rsquo;s feature set, I feel that I have truly made it my own.&lt;/p&gt;
&lt;h1 id=&#34;conclusions&#34;&gt;Conclusions&lt;/h1&gt;
&lt;p&gt;Of course, you don&amp;rsquo;t have to learn all shortcuts of your IDE. I never thought I would either. You can pick up a new shortcut here or there. Read blog posts where developers show off their selection of favorite shortcuts or exchange favorites with your co-workers. That&amp;rsquo;s a perfectly fine approach, and it is how a large majority of developers tackle this topic. It is even a core idea of my own project KeyCombiner to build collections of selected keyboard shortcuts that can be learned, shared, and organized.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;But&lt;/em&gt;, you can also invest a few hours spread over a couple of weeks, stop making compromises, and learn &lt;em&gt;all the shortcuts&lt;/em&gt;.
There is no way of knowing beforehand how this will influence your habits, how it will amend your existing workflows, and which entirely new possibilities will open up for you.&lt;/p&gt;
</description>
    </item>
    
  </channel>
</rss>