<?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>Forem: pookdeveloper</title>
    <description>The latest articles on Forem by pookdeveloper (@pookdeveloper).</description>
    <link>https://forem.com/pookdeveloper</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%2F128382%2Fb560419e-ed1d-4988-bcef-b51cd5130457.jpeg</url>
      <title>Forem: pookdeveloper</title>
      <link>https://forem.com/pookdeveloper</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/pookdeveloper"/>
    <language>en</language>
    <item>
      <title>🔧 Integrating tmux automatically in VS Code with persistent sessions</title>
      <dc:creator>pookdeveloper</dc:creator>
      <pubDate>Mon, 19 Jan 2026 10:13:43 +0000</pubDate>
      <link>https://forem.com/pookdeveloper/integrating-tmux-automatically-in-vs-code-with-persistent-sessions-95k</link>
      <guid>https://forem.com/pookdeveloper/integrating-tmux-automatically-in-vs-code-with-persistent-sessions-95k</guid>
      <description>&lt;p&gt;If you use VS Code as your editor but rely on tmux as the real source of truth for your terminal sessions, it's natural to want the integrated terminal to always land in the right tmux session — without manual commands or duplicated sessions.&lt;/p&gt;

&lt;h2&gt;
  
  
  🟢 The "native" solution (the obvious one)
&lt;/h2&gt;

&lt;p&gt;VS Code allows you to configure a terminal profile like this:&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="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"terminal.integrated.profiles.osx"&lt;/span&gt;&lt;span class="p"&gt;:&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;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="nl"&gt;"tmux-shell"&lt;/span&gt;&lt;span class="p"&gt;:&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;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="nl"&gt;"path"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"tmux"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="nl"&gt;"args"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"new-session"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"-A"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"-s"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"${workspaceFolderBasename}"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;//&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;span class="err"&gt;//&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;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"terminal.integrated.defaultProfile.osx"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"tmux-shell"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;What this does well:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One workspace → one tmux session&lt;/li&gt;
&lt;li&gt;Automatic persistence via &lt;code&gt;-A&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Simple, clean configuration&lt;/li&gt;
&lt;li&gt;No scripts involved&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For many setups, this is good enough and elegant.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔴 The real limitation
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;settings.json&lt;/code&gt; does not support conditional logic.&lt;/p&gt;

&lt;p&gt;Variables like &lt;code&gt;${workspaceFolderBasename}&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Are expanded&lt;/li&gt;
&lt;li&gt;❌ Cannot be transformed&lt;/li&gt;
&lt;li&gt;❌ Cannot use regex&lt;/li&gt;
&lt;li&gt;❌ Cannot be grouped or normalized&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Grouping multiple folders into a single session
&lt;/h3&gt;

&lt;p&gt;Imagine you have several related projects and you want to work on all of them within one shared tmux session to preserve context, panes, and layouts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fe-dashboard, fe-admin, be-api, be-auth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the native configuration, each folder forces its own tmux session, even if conceptually they all belong to the same "work context".&lt;/p&gt;

&lt;p&gt;You cannot express rules like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"If the folder starts with &lt;code&gt;fe-&lt;/code&gt; or &lt;code&gt;be-&lt;/code&gt;, use the &lt;code&gt;work&lt;/code&gt; session"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is simply not representable in VS Code's terminal configuration.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 The robust solution: move the logic to the shell
&lt;/h2&gt;

&lt;p&gt;VS Code injects environment variables such as &lt;code&gt;VSCODE_PID&lt;/code&gt; and &lt;code&gt;TERM_PROGRAM=vscode&lt;/code&gt;, which allow you to reliably detect when a terminal is launched from VS Code.&lt;/p&gt;

&lt;p&gt;From there, the shell decides.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example using fish:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if set -q VSCODE_PID; or test "$TERM_PROGRAM" = "vscode"
    if not set -q TMUX
        set -l folder_name (basename (pwd))

        if string match -qr "^fe-.*" -- $folder_name
            set folder_name "work"
        else if string match -qr "^be-.*" -- $folder_name
            set folder_name "work"
        else
            set folder_name "projects"
        end

        # tmux new-session -A -s $folder_name &amp;amp;&amp;gt;/dev/null
    end
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;VS Code becomes just a launcher.&lt;br&gt;&lt;br&gt;
The decision-making logic lives where it belongs: the shell.&lt;/p&gt;




&lt;h2&gt;
  
  
  🚀 Practical benefits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Group projects by meaning, not literal folder names&lt;/li&gt;
&lt;li&gt;Reuse tmux sessions even after closing VS Code&lt;/li&gt;
&lt;li&gt;Avoid session duplication&lt;/li&gt;
&lt;li&gt;Keep panes and layouts persistent&lt;/li&gt;
&lt;li&gt;No plugins, no extensions — just tmux and standard environment variables&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ⚠️ Notes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Applies to the integrated terminal, not external terminals&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;VSCODE_PID&lt;/code&gt; is not a formal API, but it has been stable for years&lt;/li&gt;
&lt;li&gt;The same pattern works in bash or zsh&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you use VS Code as your editor but tmux as your session manager, this integration removes friction and significantly improves day-to-day workflow.&lt;/p&gt;




&lt;p&gt;👉 &lt;strong&gt;How do you manage your terminal sessions across projects?&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>tmux</category>
    </item>
    <item>
      <title>How to break out of the forEach in Javascript/NodeJS</title>
      <dc:creator>pookdeveloper</dc:creator>
      <pubDate>Tue, 30 Jul 2019 08:39:07 +0000</pubDate>
      <link>https://forem.com/pookdeveloper/how-to-break-out-of-the-foreach-in-javascript-nodejs-1k86</link>
      <guid>https://forem.com/pookdeveloper/how-to-break-out-of-the-foreach-in-javascript-nodejs-1k86</guid>
      <description>&lt;p&gt;It’s simple.&lt;/p&gt;

&lt;p&gt;Use “some” or “every” instead of “forEach”&lt;/p&gt;

&lt;p&gt;Use of Array.prototype.some&lt;/p&gt;

&lt;p&gt;The some() method checks if at least one element of the array meets the condition implemented by the function provided.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AC4QUCuT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/hnuowjqtz95ey4tnjaxc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AC4QUCuT--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/hnuowjqtz95ey4tnjaxc.png" alt="" width="800" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The result should look like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;1 &lt;br&gt;
2&lt;br&gt;
"Result:" true&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;More info: &lt;a href="https://developer.mozilla.org/es/docs/Web/JavaScript/Referencia/Objetos_globales/Array/some"&gt;https://developer.mozilla.org/es/docs/Web/JavaScript/Referencia/Objetos_globales/Array/some&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Use of Array.prototype.every&lt;/p&gt;

&lt;p&gt;The every() method returns a Boolean, true if all the elements in the array pass the condition implemented by the given function and false if one does not fulfill it.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--a9aciXaO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/allhznsqvmisvx7ma4kj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--a9aciXaO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/allhznsqvmisvx7ma4kj.png" alt="" width="800" height="406"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The result should look like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;1 &lt;br&gt;
2 &lt;br&gt;
“Result:” false&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;More info: &lt;a href="https://developer.mozilla.org/es/docs/Web/JavaScript/Referencia/Objetos_globales/Array/every"&gt;https://developer.mozilla.org/es/docs/Web/JavaScript/Referencia/Objetos_globales/Array/every&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That’s all folks&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>foreach</category>
      <category>break</category>
      <category>exit</category>
    </item>
  </channel>
</rss>
