title: Is it possible to know the user that is running a node from inside the 80-template.html and 10-function.html files on Node-RED?
body: <p>Node-RED uses the <code>Ace editor</code> and the <code>Ace editor</code> has a vim mode that can be activated. For activating vim mode on Node-RED we need to do the following 4 steps:</p>
  <ol>
  <li>Download the file <code>keybindings-vim.js</code> on <a href="https://github.com/ajaxorg/ace-builds/tree/master/src-min-noconflict" rel="nofollow noreferrer">this GitHub</a> page.</li>
  <li>Save the file <code>keybindings-vim.js</code> on <code>/usr/local/lib/node_modules/node-red/node_modules/@node-red/editor-client/public/vendor/ace</code> (for Linux users).</li>
  <li>Go inside the <code>80-template.html</code> or <code>10-function.html</code> code located on <code>/usr/local/lib/node_modules/node-red/node_modules/@node-red/nodes/core/function/</code> and change the following piece of code:</li>
  </ol>
  <pre><code>//// add this block ////
      this.editor.setKeyboardHandler(&quot;ace/keyboard/vim&quot;); 
      setTimeout(function() {
          let panel = $(&quot;.ace_text-input&quot;);
          panel.focus();
      },600);
  ////
      RED.library.create({
          url:&quot;templates&quot;, // where to get the data from
          type:&quot;template&quot;, // the type of object the library is for
          editor:that.editor, // the field name the main text body goes to
          fields:['name','format','output','syntax'],
          ext: &quot;txt&quot;
      });
      this.editor.focus();
  
  
  </code></pre>
  <ol start="4">
  <li>Restart the service that is running Node-RED.</li>
  </ol>
  <p>These steps work perfectly fine for activating the vim mode on specific Node-RED nodes. However,
  by changing directly the <code>80-template.html</code> or <code>10-function.html</code> files I'm going to apply those changes globally on the system. That means that the vim mode will be activated for all users of the system who are using different instances of Node-RED. I'd like to activate the vim mode in a way that only my user has access to it. Is it possible?</p>
  <p>The solution that I thought would be finding a way of getting the name of the user who's logged on Node-RED. The pseudocode would be something like this:</p>
  <pre><code>    const user = object.getUser();
      if ( user === 'myuser' ){
          this.editor.setKeyboardHandler(&quot;ace/keyboard/vim&quot;); 
          setTimeout(function() {
              let panel = $(&quot;.ace_text-input&quot;);
              panel.focus();
          },600);
      }
  
      RED.library.create({
          url:&quot;templates&quot;, // where to get the data from
          type:&quot;template&quot;, // the type of object the library is for
          editor:that.editor, // the field name the main text body goes to
          fields:['name','format','output','syntax'],
          ext: &quot;txt&quot;
      });
      this.editor.focus();
  
  
  </code></pre>
  <p>Is there any command that allows me to get the name of the Node-RED user that's running the node? Or is there any alternative answer for limiting the vim mode only to a specific instance of Node-RED that is running on the system?</p>