<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Keshav Mohta</title>
    <description>The latest articles on DEV Community by Keshav Mohta (@xkeshav).</description>
    <link>https://dev.to/xkeshav</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F610217%2F201f140a-797c-4a74-91b6-9a174656117f.png</url>
      <title>DEV Community: Keshav Mohta</title>
      <link>https://dev.to/xkeshav</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/xkeshav"/>
    <language>en</language>
    <item>
      <title>Delet node_modules in Windows using PowerShell</title>
      <dc:creator>Keshav Mohta</dc:creator>
      <pubDate>Fri, 21 Apr 2023 15:24:56 +0000</pubDate>
      <link>https://dev.to/xkeshav/delet-nodemodules-in-windows-using-powershell-3c0a</link>
      <guid>https://dev.to/xkeshav/delet-nodemodules-in-windows-using-powershell-3c0a</guid>
      <description>&lt;p&gt;Powershell have many great features, here I am telling how to delete node_modules in windows using powershell&lt;/p&gt;

&lt;p&gt;as we know, in Linux/ MacOs we can delete node_modules using &lt;code&gt;rm-rf&lt;/code&gt; but this lacks in windows, so create powershell script or just run the command to delete node_modules&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;navigate to the project root from powershell and run this command
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight postscript"&gt;&lt;code&gt;&lt;span class="nf"&gt;Get-ChildItem&lt;/span&gt; &lt;span class="nf"&gt;-Path&lt;/span&gt; &lt;span class="nf"&gt;$ProjectRootPath&lt;/span&gt; &lt;span class="nf"&gt;-Include&lt;/span&gt; &lt;span class="nf"&gt;"node_modules"&lt;/span&gt; &lt;span class="nf"&gt;-Recurse&lt;/span&gt; &lt;span class="nf"&gt;-Directory&lt;/span&gt; &lt;span class="nf"&gt;|&lt;/span&gt; &lt;span class="nf"&gt;Remove-Item&lt;/span&gt; &lt;span class="nf"&gt;-Recurse&lt;/span&gt; &lt;span class="nf"&gt;-Force&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or if you want to make a script which runs from outside of project&lt;/p&gt;

&lt;p&gt;then save below script in your powershell profile&lt;/p&gt;

&lt;p&gt;to check your profile location type&lt;/p&gt;

&lt;p&gt;$Profile&lt;/p&gt;

&lt;p&gt;it will give the full path of the profile, normally ends with &lt;strong&gt;.ps1&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;open that profile and paste below code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight postscript"&gt;&lt;code&gt;&lt;span class="nf"&gt;#&lt;/span&gt; &lt;span class="nf"&gt;delete&lt;/span&gt; &lt;span class="nf"&gt;node&lt;/span&gt; &lt;span class="nf"&gt;modules&lt;/span&gt; &lt;span class="nf"&gt;from&lt;/span&gt; &lt;span class="nf"&gt;a&lt;/span&gt; &lt;span class="nf"&gt;given&lt;/span&gt; &lt;span class="nf"&gt;path&lt;/span&gt;
&lt;span class="nf"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;xnm&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;CmdletBinding&lt;/span&gt;&lt;span class="s"&gt;()&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="nf"&gt;param&lt;/span&gt; &lt;span class="s"&gt;(
[Parameter(Mandatory=$true, HelpMessage="Please enter the project path where node_modules are placed", Position=0)]
[String] $ProjectRootPath
)&lt;/span&gt;
    &lt;span class="kr"&gt;if&lt;/span&gt; &lt;span class="s"&gt;(!($ProjectRootPath | Test-Path))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
        &lt;span class="nf"&gt;Write-Error&lt;/span&gt; &lt;span class="nf"&gt;"Path&lt;/span&gt; &lt;span class="nf"&gt;is&lt;/span&gt; &lt;span class="kr"&gt;not&lt;/span&gt; &lt;span class="nf"&gt;correct.&lt;/span&gt; &lt;span class="nf"&gt;retry"&lt;/span&gt; &lt;span class="nf"&gt;-ErrorAction&lt;/span&gt; &lt;span class="nf"&gt;Stop&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nf"&gt;Read-Host&lt;/span&gt; &lt;span class="nf"&gt;-Prompt&lt;/span&gt; &lt;span class="nf"&gt;"Press&lt;/span&gt; &lt;span class="nf"&gt;any&lt;/span&gt; &lt;span class="nf"&gt;key&lt;/span&gt; &lt;span class="nf"&gt;to&lt;/span&gt; &lt;span class="nf"&gt;continue&lt;/span&gt; &lt;span class="nf"&gt;to&lt;/span&gt; &lt;span class="nf"&gt;delete&lt;/span&gt; &lt;span class="nf"&gt;node_modules&lt;/span&gt; &lt;span class="kr"&gt;or&lt;/span&gt; &lt;span class="nf"&gt;CTRL+C&lt;/span&gt; &lt;span class="nf"&gt;to&lt;/span&gt; &lt;span class="nf"&gt;quit"&lt;/span&gt;
    &lt;span class="nf"&gt;Write-Host&lt;/span&gt; &lt;span class="nf"&gt;"Deleting&lt;/span&gt; &lt;span class="nf"&gt;node_modules&lt;/span&gt; &lt;span class="nf"&gt;..."&lt;/span&gt;
    &lt;span class="nf"&gt;Get-ChildItem&lt;/span&gt; &lt;span class="nf"&gt;-Path&lt;/span&gt; &lt;span class="nf"&gt;$ProjectRootPath&lt;/span&gt; &lt;span class="nf"&gt;-Include&lt;/span&gt; &lt;span class="nf"&gt;"node_modules"&lt;/span&gt; &lt;span class="nf"&gt;-Recurse&lt;/span&gt; &lt;span class="nf"&gt;-Directory&lt;/span&gt; &lt;span class="nf"&gt;|&lt;/span&gt; &lt;span class="nf"&gt;Remove-Item&lt;/span&gt; &lt;span class="nf"&gt;-Recurse&lt;/span&gt; &lt;span class="nf"&gt;-Force&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;now save and restart powershell ( yet to finf how to reload on same session )&lt;/p&gt;

&lt;p&gt;now type &lt;strong&gt;xnm&lt;/strong&gt;  and it will ask for project root path here just give path name  and it will ask to continue and when execution done. it will remove node_modules from your project path.&lt;/p&gt;

&lt;p&gt;Hope it helps &lt;/p&gt;

</description>
      <category>powershell</category>
      <category>windows</category>
      <category>nodemodule</category>
    </item>
    <item>
      <title>How to set permanent Aliases in Windows</title>
      <dc:creator>Keshav Mohta</dc:creator>
      <pubDate>Thu, 24 Nov 2022 18:31:38 +0000</pubDate>
      <link>https://dev.to/xkeshav/how-to-set-permanent-aliases-in-windows-4214</link>
      <guid>https://dev.to/xkeshav/how-to-set-permanent-aliases-in-windows-4214</guid>
      <description>&lt;p&gt;alias are easy way to do long command short, in Unix there are .bashrc file where we can set alias but in Windows I did not find such thing straight forward, so here is the approach to do so.&lt;/p&gt;

&lt;h2&gt;
  
  
  approach 1
&lt;/h2&gt;

&lt;p&gt;usually we can open command prompt ( win key + R ) and type &lt;em&gt;cmd&lt;/em&gt; and set alias using &lt;code&gt;doskey&lt;/code&gt;, for eg.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;doskey ll=dir&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;and now when run &lt;code&gt;ll&lt;/code&gt; it will list all files of that folder.&lt;/p&gt;

&lt;p&gt;which works good but problem in this approach is&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;we have to set every alias separately&lt;/li&gt;
&lt;li&gt;these alias are temporary and only for the active session, as soon as we close the command prompt, alias are gone.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  approach 2
&lt;/h2&gt;

&lt;p&gt;To overcome both of the above mentioned problem, following are are steps to set permanent and multiple alias&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;first run below command in your command prompt

&lt;code&gt;echo %USERPROFILE%&lt;/code&gt;

, output of above is the base path , in my case it is &lt;strong&gt;C:/Users/User&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0484qh8nrka1hhcff7i1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0484qh8nrka1hhcff7i1.png" alt="userprofile" width="710" height="193"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;now create a new file name &lt;em&gt;alias&lt;/em&gt; on above location, you can name it on your ease, even with .txt extension also&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;now open this file in notepad or editor and add your daily use alias in it and save the file, mine are as below&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;type&lt;/span&gt; &lt;span class="nv"&gt;$*&lt;/span&gt;
..&lt;span class="o"&gt;=&lt;/span&gt;cd..
&lt;span class="nb"&gt;ls&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;dir&lt;/span&gt; &lt;span class="nv"&gt;$*&lt;/span&gt;
&lt;span class="nv"&gt;gs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;git status
&lt;span class="nv"&gt;gp&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;git push
&lt;span class="nv"&gt;gb&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;git branch
&lt;span class="nv"&gt;nrs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;npm run start
&lt;span class="nv"&gt;dev&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /d D:&lt;span class="se"&gt;\D&lt;/span&gt;eveloper
&lt;span class="nv"&gt;rct&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /d D:&lt;span class="se"&gt;\D&lt;/span&gt;eveloper&lt;span class="se"&gt;\r&lt;/span&gt;eact-project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note:&lt;br&gt;
    - you need to add &lt;em&gt;/d&lt;/em&gt; if you create an alias to navigate to any directory.&lt;br&gt;
    - path separator is forward slash *\ .&lt;br&gt;
    - there is no space around &lt;em&gt;=&lt;/em&gt; while creating alias.&lt;/p&gt;

&lt;p&gt;now next part is to how to make it permanent so that it is available whenever you open the command prompt.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;now open run win key + R and type &lt;code&gt;regedit&lt;/code&gt; ; it will open a new dialog window which is registry editor.&lt;/li&gt;
&lt;li&gt;navigate to &lt;strong&gt;Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor&lt;/strong&gt; File&lt;/li&gt;
&lt;li&gt;right click to this file and select New &amp;gt;&amp;gt; String Value and rename it to &lt;em&gt;Autorun&lt;/em&gt; and save it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqm0f0d5rhpv1rq05va6h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqm0f0d5rhpv1rq05va6h.png" alt="regedit dialog" width="800" height="715"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;now double click on this newly created &lt;em&gt;Autorun&lt;/em&gt; key, a window open where you have to put below value in value data field (the address will be full path of your alias file)
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DOSKEY /MACROFILE="C:\Users\User\alias"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxcqfz2vyfxqbqzxf9bx2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxcqfz2vyfxqbqzxf9bx2.png" alt="value of new key" width="547" height="237"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;close the regedit and command prompt for once.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now try your alias and thank me later. :)&lt;/p&gt;

&lt;p&gt;let me know if it was helpful or something incorrect while you try, I would be happy to help&lt;/p&gt;

&lt;p&gt;Cheers.&lt;/p&gt;

</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>VS code Life Saver Keyboard Shortcut</title>
      <dc:creator>Keshav Mohta</dc:creator>
      <pubDate>Sun, 10 Oct 2021 06:26:39 +0000</pubDate>
      <link>https://dev.to/xkeshav/vs-code-life-saver-keyboard-shortcut-4643</link>
      <guid>https://dev.to/xkeshav/vs-code-life-saver-keyboard-shortcut-4643</guid>
      <description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;This is my very first post and this is about the most loving IDE VS CODE and few keyboard shortcut which I use daily and also few addition things how to add new keyboard shortcut or how to change/update existing keyboard shortcut.&lt;/p&gt;

&lt;p&gt;before diving into the blog, let me clear what and how key binding works for user&lt;/p&gt;

&lt;p&gt;In this post or even in vs code the &lt;code&gt;+&lt;/code&gt; written in key binding is not a literal &lt;em&gt;+&lt;/em&gt; key but this is just a notation to display the key combination, also the key name shown as capital does not require to keep caps lock on or pressing with &lt;em&gt;Shift&lt;/em&gt; key, they are just lowercase letter. &lt;/p&gt;

&lt;p&gt;&lt;small&gt;fun fact: If you look at the keyboard, every letter written in capital on it.&lt;/small&gt;&lt;/p&gt;

&lt;p&gt;also in VS code when you press keyboard shortcut, it is displayed in the status bar, it doesn't exist, it will be displayed there.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--B5lT3OyZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hv5pbqudwtnytneiqki8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--B5lT3OyZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hv5pbqudwtnytneiqki8.png" alt="Key binding in vs code status bar" width="880" height="26"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Ctrl + B&lt;/code&gt; means press &lt;em&gt;Ctrl&lt;/em&gt; and &lt;em&gt;B&lt;/em&gt; key together, sometime these notation can be separated with space for e.g. &lt;code&gt;Ctrl B&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Ctrl + K Ctrl + S&lt;/code&gt; means &lt;/p&gt;

&lt;p&gt;. first press &lt;em&gt;Ctrl + K&lt;/em&gt;  together &lt;br&gt;
 . release the key &lt;br&gt;
 . now press &lt;em&gt;Ctrl + S&lt;/em&gt; together , &lt;/p&gt;

&lt;p&gt;in other way, keep &lt;code&gt;Ctrl&lt;/code&gt; key pressed while pressing &lt;em&gt;K&lt;/em&gt; and &lt;em&gt;S&lt;/em&gt; and &lt;em&gt;K&lt;/em&gt; and &lt;em&gt;S&lt;/em&gt; need not to be the capital &lt;/p&gt;

&lt;p&gt;&lt;code&gt;Ctrl + K Z&lt;/code&gt; means&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;first press &lt;em&gt;Ctrl&lt;/em&gt; and &lt;em&gt;K&lt;/em&gt; together &lt;/li&gt;
&lt;li&gt;release the keys &lt;/li&gt;
&lt;li&gt;now press &lt;em&gt;Z&lt;/em&gt; key only&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  1. Delete without changing the clipboard content
&lt;/h2&gt;

&lt;p&gt;Normally what we do to delete a line, just &lt;code&gt;Ctrl+ X&lt;/code&gt; as it does the job As this is how it works in most of application, but this has a flaw, not exactly a flaw but we can say limitation or side effect.&lt;/p&gt;

&lt;p&gt;This operation cut the line, so if we have something very important in our clipboard, okay what is the clipboard?&lt;br&gt;
whenever we do copy action ( using &lt;code&gt;Ctrl + C&lt;/code&gt; ) it is stored in the clipboard, so clipboard is a place where copy data being put and there is only single instance of copy data can be put, whenever we copy some other content, previous copied data being lost, so what usually we do, that first we copy 1 line and paste somewhere else and now copy next line and paste somewhere.&lt;/p&gt;

&lt;p&gt;so coming to the point, this &lt;code&gt;Ctrl + X&lt;/code&gt; overwrite your clipboard data and problem here either we do &lt;code&gt;Ctrl + Z&lt;/code&gt; and copy the same code block but sometimes we have something in clipboard which was copied from other place/application and in this case &lt;code&gt;Ctrl Z&lt;/code&gt; will not help through.&lt;/p&gt;

&lt;p&gt;So always use &lt;code&gt;Ctrl+K&lt;/code&gt; to delete the line without losing your clipboard data.&lt;/p&gt;

&lt;p&gt;in mac OS&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;Cmd + Shift + K&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;in Ubuntu/Windows&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;Ctrl + Shift+ K&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  3. Multi cursor key modifier
&lt;/h2&gt;

&lt;p&gt;since sublime text, multi cursor is my favourite utility, it helps to edit altogether on various places in file.&lt;/p&gt;

&lt;p&gt;in Mac OS multi cursor can be used pressing &lt;code&gt;Option&lt;/code&gt; key and in Windows it can be done using &lt;code&gt;Ctrl&lt;/code&gt; key but sometimes it do not seems to work (actually in Ubuntu it doesn't work) or may be you want to change the key combination for this operation, so follow below steps&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to settings of VS Code by pressing &lt;code&gt;Cmd + ,&lt;/code&gt; or &lt;code&gt;Ctrl + ,&lt;/code&gt; in open vs code instance&lt;/li&gt;
&lt;li&gt;Go to &lt;em&gt;Workspace&lt;/em&gt; tab if want this change only for this workspace and you have saved the workspace otherwise there would be only &lt;em&gt;User&lt;/em&gt; tab and you can make changes here.&lt;/li&gt;
&lt;li&gt;type in the search box  &lt;em&gt;"multi cursor modifier"&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;in result it would be &lt;code&gt;Alt&lt;/code&gt;, change it to &lt;strong&gt;CtrlCmd&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;you can verify the setting by opening &lt;em&gt;settings.json&lt;/em&gt; ( click on top right icon on the Setting page), there would be an entry as below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nl"&gt;"editor.multiCursorModifier"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ctrlCmd"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Move Line Up/Down
&lt;/h2&gt;

&lt;p&gt;many of times we need to move the line of code above or below some line and we usually do, Cut, and paste on the desired line but there is a easy keyboard shortcut&lt;/p&gt;

&lt;p&gt;in mac OS&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;Option + KeyDown&lt;/code&gt; and &lt;code&gt;Option + KeyUp&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;in Ubuntu&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;Alt + KeyDown&lt;/code&gt; and &lt;code&gt;Alt + KeyUp&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;KeyDown&lt;/strong&gt; key is &lt;code&gt;▼&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;KeyUp&lt;/strong&gt; key is &lt;code&gt;▲&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;if it does not work then open the keyboard setting and first find that what is the key shortcut defined by vs code&lt;br&gt;
to know the keyboard settings, you can click on setting icon in activity bar and click on Keyboard shortcut in the context menu or press &lt;code&gt;Ctrl+K Ctrl+ S&lt;/code&gt; ( keyboard shortcut for keyboard shortcut :p)&lt;/p&gt;

&lt;p&gt;now keyboard binding panel will be open, there you can search using keyboard recording ( which described at the end of the article ) or search there &lt;em&gt;Move Line Up&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;There you can see the key combination, if it is empty then  click on the row and it will ask to enter the desired key binding which might conflicts with other shortcut with same key binding and it will be displayed by vs code as soon as you write, either you choose some other combination or change the existing so be careful and wise here, also make sure that &lt;code&gt;when&lt;/code&gt;column should not be empty, if it is empty then fill it up by right click on row and choose  &lt;em&gt;Change When Expression&lt;/em&gt; option and write below line&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;editorTextFocus &amp;amp;&amp;amp; !editorReadonly&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  4. Select All Occurrences of a word or tag in a file
&lt;/h2&gt;

&lt;p&gt;Sometimes you need to select same word in the file then we can do it with below approaches&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Find and Replace&lt;/strong&gt; feature it with new name &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rename Symbol&lt;/strong&gt; feature from context menu&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;but sometimes you just want to select few occurrences of the word or string  and want to do some changes, for that use&lt;/p&gt;

&lt;p&gt;in mac OS&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;Cmd + D&lt;/code&gt;  &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;in Ubuntu&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;Ctrl + D&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;just select the word and press Cmd+ D, it will select the next occurrence in the file and also enable multi cursor , keep pressing &lt;code&gt;Ctrl + D&lt;/code&gt; and it will select the next occurrence and so on and if it reach to end of page, it will start selecting from top of the page.&lt;/p&gt;
&lt;h2&gt;
  
  
  5. Duplicate the line (Up or Down)
&lt;/h2&gt;

&lt;p&gt;many times we need to make few changes what written on previous line, so what we usually do, copy the line and paste on next line but there is a smart way to do it and use&lt;/p&gt;

&lt;p&gt;in mac OS&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;Shift + Option + Down key&lt;/code&gt;  &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;in Ubuntu&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;Alt + D&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;if you want to search in keyboard shortcuts search with 'Copy Line Up' and 'Copy Line Down', in Ubuntu it was very lengthy key combination , so I have changed the keyboard combination by simply click on the row and assign new key binding.&lt;/p&gt;

&lt;p&gt;whenever you set your key binding, you will see entry in &lt;strong&gt;keybindings.json&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"alt+d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"editor.action.copyLinesDownAction"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"when"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"editorTextFocus &amp;amp;&amp;amp; !editorReadonly"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and it will add new shortcut but if you want to remove the previous key combination then write below json also&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ctrl+shift+alt+down"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"-editor.action.copyLinesDownAction"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"when"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"editorTextFocus &amp;amp;&amp;amp; !editorReadonly"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;see the minus &lt;em&gt;-&lt;/em&gt; sign ahead of the command&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Cursor on Previous Position
&lt;/h2&gt;

&lt;p&gt;in VS code, we do not have bookmarking feature by default and sometimes we want to go back where was the last cursor position, so there is shortcut for that&lt;/p&gt;

&lt;p&gt;in mac OS &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;Control + -&lt;/code&gt; ( its minus sign )&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;in Ubuntu &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;Ctrl + Alt + -&lt;/code&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;every time you press this it will navigate back to the previous position of cursor or we can say cursor history, even it works across open files, suppose you click on file A line #20 then file B line # 20 then file A line # 40&lt;/p&gt;

&lt;p&gt;and now when you press &lt;code&gt;Option + -&lt;/code&gt; it will goes to file B line # 20 and again pressing &lt;code&gt;Option + -&lt;/code&gt; will takes to file A line #20&lt;/p&gt;

&lt;h4&gt;
  
  
  How to search with key binding
&lt;/h4&gt;

&lt;p&gt;suppose you want to know what it does when press &lt;code&gt;Alt + D&lt;/code&gt;, so go to keyboard setting panel and there is keyboard icon on right side of search input, when you hover it show the title &lt;code&gt;Record Keys&lt;/code&gt;. press this icon and now enter &lt;code&gt;Alt + D&lt;/code&gt; in the search box, it will show the result which action is binding with given keystroke. do not enter backspace here, it will record that too, so reset again, click again to keyboard icon, clear the input field and repeat the steps.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9NhPsMO1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://i.imgur.com/OFpQKqg.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9NhPsMO1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://i.imgur.com/OFpQKqg.gif" alt="key record in vsocde" width="880" height="429"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Recap
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;mac OS&lt;/th&gt;
&lt;th&gt;Windows/ Ubuntu&lt;/th&gt;
&lt;th&gt;action&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Cmd + Shift + K&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Ctrl + Shift+ K&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Deleting the line&lt;/strong&gt; without losing clipboard content&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Option + KeyUp&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Alt + KeyUp&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Move line Up&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Option + KeyDown&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Alt + KeyDown&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Move line  Down&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Option + Shift + KeyDown&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Alt + D&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Copy the line down&lt;/strong&gt; i.e. duplicate the line&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Cmd + D&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Ctrl + D&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Selecting next occurrence of the selected word&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;Ctr + -&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Alt + Ctrl + -&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;go to &lt;strong&gt;Previous cursor position&lt;/strong&gt; across the files&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Hope you Enjoy while reading. Please do comment if something is wrong or not working,&lt;/p&gt;

&lt;p&gt;Cheers!&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>keyboard</category>
      <category>productivity</category>
      <category>howto</category>
    </item>
  </channel>
</rss>
