- Subject: Re: redo in jed CUA mode
- From: Guenter Milde <milde@xxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 17 Dec 2002 10:16:21 +0100 (CET)
On Thu, 12 Dec 2002 18:37:03 +0800 wrote Andy Sy <andy@xxxxxxxxxxx>:
> Ah, okay. I was expecting TAB to behaves as it
> would everywhere else, to just insert a tab character.
So was I, but...
> > When programming, I really appreciate this feature, as it indents e.g.
> > inserted lines automatically to the right level. Also, it is a kind of
> > syntax-check, as an unexpected indentation action is normally a sign for a
> > missing ")" or ";"!
Binding the Tab-Key to "self_insert_cmd" would result in the expected
behaviour. (But not in the one of Visual Studio...)
> With a highlighted region, the behavior I was expecting
> was that of Visual Studio - Tab indents everything in the
> highlighted region, Shift-Tab the opposite.
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...?
> How does one do this in CUA jed?
2 ways:
* personally, I use the versatile rectangle functions quite heavily:
In my extended cua.sl you find the bindings
% ^R: rectangles
...
setkey ("kill_rect", "^RX"); % delete and copy to rect-buffer
setkey ("open_rect", "^R "); % ^R Space: insert whitespace
To indent a region by a fixed amount, I mark a rectangle (mark at
current start of region-text, spot at last line of the region and at the
column the region shall start after the indent) and press ^R Space.
To dedent a region by a fixed amount, I mark the rectangle to be deleted
and press ^R X.
-> Fast, versatile (I can easily determine the number of spaces to
insert/delete) and efficient.
* Another option would be to define a function that inserts a tab (or TAB
spaces) in every line of the region (or just the current line, if no
region is defined) and bind it to the indent_line_hook (if you want the
indent_to_the_right_level feature in programming language modes) or the
Tab-Key (if you want the indent-by-fixed-amount feature in all modes).
% Insert TAB spaces in all lines of the region (or the current line, if
% no region is defined)
define tab_region_or_line()
{
!if(markp)
{
bol();
push_mark_eol();
}
narrow;
variable col = what_column();
bob();
while (down_1)
{
goto_column(col);
insert_spaces(TAB);
}
widen;
}
--
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]