[Geany] Shift Right (ala Nedit)
Andrew Janke
a.janke at xxxxx
Thu Mar 5 10:54:13 UTC 2009
>> I actually think this would be an awesome improvement and could go into
>> Geany but it still needs someone to write it. So, patches are welcome.
>
> Hmm...ok. Since I'd like to learn something, can somebody of you give
> me a near life case study for this feature? Even I guess I understood
> what it should do, I'm ot sure, why and when to use it.
Sure. I use this all the time for renaming bunches of tiles for example...
gordon:goo$ ls -1
20056311.21-10-2008-135441.3D_T1.mnc
20056385.21-10-2008-131827.2D_T2.mnc
20056385.21-10-2008-131827.3D_T1.mnc
20056436.22-10-2008-132614.2D_T2.mnc
20056436.22-10-2008-132614.3D_T1.mnc
20056543.24-10-2008-144859.2D_T2.mnc
20056543.24-10-2008-144859.3D_T1.mnc
...
These are a bunch of MRI images that I want to rename so that the date
(second "field") is in yyyymmdd format as per the first column. Yes I
could do this via some awful perl/shell/awk/sed script and if it was
something that I was to do all the time I would. The point is I deal
with 1000's of these files every week and each case is always slightly
different. So I find myself doing this:
gordon:goo$ EDITOR=nedit vidir . (I have an alias for this as opposed
to normally using vi)
Which gives me this.. (in nedit)
1 ./20056311.21-10-2008-135441.3D_T1.mnc
2 ./20056385.21-10-2008-131827.2D_T2.mnc
3 ./20056385.21-10-2008-131827.3D_T1.mnc
4 ./20056436.22-10-2008-132614.2D_T2.mnc
5 ./20056436.22-10-2008-132614.3D_T1.mnc
6 ./20056543.24-10-2008-144859.2D_T2.mnc
7 ./20056543.24-10-2008-144859.3D_T1.mnc
...
First, a quick vertical select and delete or two gives me this.
1 ./20056311.21102008-135441.3D_T1.mnc
2 ./20056385.21102008-131827.2D_T2.mnc
3 ./20056385.21102008-131827.3D_T1.mnc
4 ./20056436.22102008-132614.2D_T2.mnc
5 ./20056436.22102008-132614.3D_T1.mnc
6 ./20056543.24102008-144859.2D_T2.mnc
7 ./20056543.24102008-144859.3D_T1.mnc
...
Then select the "day" part and press <Ctrl>0 (6 times)
1 ./20056311.10200821-135441.3D_T1.mnc
2 ./20056385.10200821-131827.2D_T2.mnc
3 ./20056385.10200821-131827.3D_T1.mnc
4 ./20056436.10200822-132614.2D_T2.mnc
5 ./20056436.10200822-132614.3D_T1.mnc
6 ./20056543.10200824-144859.2D_T2.mnc
7 ./20056543.10200824-144859.3D_T1.mnc
And the same for the "year" and press <Ctrl>9 (2 times).
Now Save, quit and grin. I also use this sort of feature a lot for
reorganising chunks of code in "columns". Here for example is a bunch
of code that I am currently writing to export some DICOM images..
$d->{'0008'}{'0005'} = &create_element('0008', '0005', 'ISO_IR 100');
$d->{'0008'}{'0008'} = &create_element('0008', '0008',
'DERIVED\PRIMARY\RECON TOMO\EMISSION');
$d->{'0008'}{'0012'} = &create_element('0008', '0012', '20090303');
$d->{'0008'}{'0013'} = &create_element('0008', '0013', '224555');
$d->{'0008'}{'0014'} = &create_element('0008', '0014', '777.777.0.0.0');
$d->{'0008'}{'0016'} = &create_element('0008', '0016',
'1.2.840.10008.5.1.4.1.1.20');
$d->{'0008'}{'0018'} = &create_element('0008', '0018',
'777.777.0.0.0.1236080755.2932837459.1440010230.3400850238');
$d->{'0008'}{'0020'} = &create_element('0008', '0020', '');
$d->{'0008'}{'0021'} = &create_element('0008', '0021', '');
And say that I wanted to quickly swap the Element and Group fields
about (the hash references).
I should also note that in Nedit's case the Shift (column) Right and
Left functions are simply "overloaded" versions of the normal case.
ie:
Select text normally and shift right == indent
Vertical Select text and shift right == column shifting as per above.
a
More information about the Users
mailing list