RANZI:
--------------------------------------------------------------------------------
Hi,
I want to define a shortcut to insert a custom string from (text) cursor.

Because, my text editor is configured to replace "real tab" with "2 spaces" and
this shortcut will be associated to one real tab.

It is possible ?

Thank's.
--------------------------------------------------------------------------------


Hi,
I usually use a dummy regex replacement, when a real tab is needed in such
setting (convert to spaces...);
e.g. write T, select it, call search and replace dialog and replace 
T 
with 
          
(regular expressions, selected text only)

Of course, it is not practical for regular, repeated usage.

It can be achieved with a simple script, e.g.


cite:
--------------------------------------------------------------------------------
/////////// save e.g. under ...\PSPad\Script\JScript\insert_tab.js ////////

var module_name = "insert_tab";
var module_ver = "1";

function insert_real_tab(){
if (editorsCount()<1){return;}
var actEd = newEditor();
actEd.assignActiveEditor();
actEd.selText(" "); // insert real tab
}


function Init(){
addMenuItem("insert real tab", "", "insert_real_tab","Shift+Alt+T"); // adapt
shortcut
}
--------------------------------------------------------------------------------


It behaves like the key press - the tab is inserted at the cursor position, if a
selection is present, it is replaced with the inserted character.

(I initially thought, it might be possible to insert tab etc. from Tools - ASCII
table, but apparently it isn't supported.)


hth,
  vbr

-- 
<https://forum.pspad.com/read.php?2,73887,73889>
PSPad freeware editor https://www.pspad.com

Odpovedet emailem