Convert *.prj file list to space separated list e.g. for Unix editors

Help with writing and playing macros

Convert *.prj file list to space separated list e.g. for Unix editors

Postby Bego » Tue Jun 24, 2008 9:34 am

Hi Unix users, ;-)

some other discussion here brought me to the idea to write a SMALL+EASY macro maybe other (Unix) users might interest.
UE lacks some FTP functionality like direct CTAGS support on Unix systems.
I often work with UE-FTP "based" projects and sometimes I want ALL those files to be opened in a (Unix) editor like GVIM, that expects those filenames to be listed one by one with spaces as parameters.

So I wrote a macro that converts the [file] entries in a prj file:

Code: Select all
0=FTP::unix1\//home/myuser/prg/src/proj/met/KXY|DoX.c
1=FTP::unix1\//home/myuser/prg/src/proj/met/KXZ|DoY.c
2=FTP::unix1\//home/myuser/prg/src/proj/mod/BU|TestX.c
3=FTP::unix1\//home/myuser/prg/src/proj/met/VE|SaveY.c
4=FTP::unix1\//home/myuser/prg/src/proj/mod/VE|screen.c
5=FTP::unix1\/home/myuser/prg/src/proj/met/VE|SaveZ.c
6=FTP::unix1\//home/myuser/prg/src/proj/mod/VE2|objects.c
7=FTP::unix1\//home/myuser/prg/src/proj/mod/VE2|objects2.c
8=FTP::unix1\//home/myuser/prg/src/proj/que/VE3|Ins_object.c

(see: Sometimes there is only 1 backslash before home (!))

to a space separated list (copied to clipboard) for my (Unix) editor that then loads all those files.
The list looks like this then:

Code: Select all
/home/myuser/prg/src/proj/met/KXY/DoX.c /home/myuser/prg/src/proj/met/KXZ/DoY.c  ...


This macro I called prjFiles2Unix does the job. (Yes, there are no checks inside...)

Code: Select all
InsertMode
ColumnModeOff
HexOff
Top
PerlReOn
Find RegExp "^(.*)/home"
Replace All "/home"
Top
Find "^p"
Replace All " "
Find "|"
Replace All "/"
SelectAll
StartSelect
Copy

So copy the file list to a new UE tab and let run the macro.
In Unix I type (e.g.): "vim -g " and press the middle mouse button (paste) + ENTER.

I know this one is no rocket science. But sometimes small things make life easier...

rds Bego
User avatar
Bego
Master
Master
 
Posts: 358
Joined: Wed Nov 24, 2004 12:00 am
Location: Germany

Return to Macros