jed-users mailing list

[2002 Date Index] [2002 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: Re: redo in jed CUA mode


On Wed, 18 Dec 2002 00:28:57 +0800 wrote Andy Sy <andy@xxxxxxxxxxx>:

> > Do you mean, Tab inserts a tab character (or TAB spaces) in every line of
> > the region at the current column position and Shift-Tab backward-deletes
> TAB
> > spaces...?
> 
> Not the current column position, but at the leftmost
> column of the highlighted region (and since it doesn't
> allow 'true' rectangular highlighting that means its
> always the first).
> 
> Shift Tab deletes TAB characters worth of spaces
> starting from the leftmost column.


How about this:

%!%+
%\function{fix_indent}
%\synopsis{Indent/Dedent the line/region by a fixed amount (TAB).}
%\usage{Void fix_indent([dedent=0])}
%\description
% By default, fix_indent prepends the line with whitespace of length TAB.
% If the optional argument dedent is non-zero, delete TAB spaces from
% the beginning of the line. If dedent > 1, delete also non-space chars.
%\seealso{insert_spaces, TAB, is_visible_mark}
%!%-
public define fix_indent() % (dedent=0)
{
   variable dedent = 0;
   if (_NARGS)
     dedent = ();
   push_spot();
   !if (is_visible_mark())
     push_mark();
   narrow;
   bob;
   do
     { bol;
        if (dedent)
          {
             push_mark;
             skip_white();
             if (dedent > 1 or what_column > TAB+1)
               goto_column(TAB+1);
             del_region;
          }
        else
          insert_spaces(TAB);
     }
   while (down_1);
   widen;
   pop_spot();
}


You can now bind

setkey ("fix_indent",  "^I");
setkey ("fix_indent(1)",   Key_Shift_Tab);
% or
% setkey ("fix_indent(2)",   Key_Shift_Tab);

to have the SciTE behaviour in jed.

Some modes change the keybindings, do

define global_mode_hook(mode)
{
   local_setkey ("fix_indent",  "^I");
   local_setkey ("fix_indent(1)",   Key_Shift_Tab);
}

to get back your favourites....

Günter

---
Milde at ife.et.tu-dresden.de


--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2002 date index] [2002 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]