Hi,, [EMAIL PROTECTED] wrote: > > J?rgen Kr?mer <[EMAIL PROTECTED]> [07-04-12 13:12]: >> Hi, >> >> [EMAIL PROTECTED] schrieb: >>> I am trying to automate this: >>> >>> There is a file, which contains one path/filename at each line. >>> Lines with equal files (contents wise) are grouped together. Groups >>> are separated by "# ---' (or whatever you want). >>> >>> To sort the lines of one group only I want to put the group into a >>> visual block (correcht naming?) as part of a macro. >> you don't need a visual block here. Say you have the following file >> >> # --- >> 3.txt >> 2.txt >> 1.txt >> # --- >> 6.txt >> 5.txt >> 4.txt >> # --- >> 9.txt >> 7.txt >> 8.txt >> # --- >> >> Then >> >> :g/^# ---/+1,/^# ---/-1!sort >> >> will sort it by file names inside your "groups". This command will emit >> an error message "E16: Invalid range" for the last marker, which you >> can safely ignore. > > Thanks for your reply ! :) > > "Sort" was only an example...is it possible > to mark the group visually ?
yes. While in normal mode enter /^# ---/+<CR>V/^# ---/- where <CR> means "Press the Return/Enter key". After that the lines between two consecutive markers are visually selected. Regards, Jürgen -- Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us. (Calvin)