Thursday, September 21, 2017

Re: how to quickly change block data order

On 2017-09-21, Sand Glass wrote:
> I have the following situation. I want to change it
> ####################
> b390 62b3 9062 b390 61b2
> 8f61 b28e 5fb2 8d5d b18c 5aaf 8955 ad86
> 50ab 834a a97f 45a7 7c3f a579 3aa3 7635
> a174 30a0 722d 9e6f 2a9e 6e27 9d6c 249c
> 6b23 9b6b 219b 6a20 9b69 1f9b 681f 9a68
> 1e9a 681d 9a68 1d9a 681d 9a67 1d99 671d
> 9967 1d9a 671d 9a68 1d9a 681d 9a68 1d9a
> 681d 9a68 1d9a 681d 9a68 1d9a 681d 9a68
> 1d9a 681d 9a68 1d9a 681d 9a68 1d9a 681d
> bda5 8dbd a58d
> ####################
> to
> ####################
> b390 62b3 9062 b390 61b2 8f61 b28e 5fb2
> 8d5d b18c 5aaf 8955 ad86 50ab 834a a97f
> 45a7 7c3f a579 3aa3 7635 a174 30a0 722d
> 9e6f 2a9e 6e27 9d6c 249c 6b23 9b6b 219b
> 6a20 9b69 1f9b 681f 9a68 1e9a 681d 9a68
> 1d9a 681d 9a67 1d99 671d 9967 1d9a 671d
> 9a68 1d9a 681d 9a68 1d9a 681d 9a68 1d9a
> 681d 9a68 1d9a 681d 9a68 1d9a 681d 9a68
> 1d9a 681d 9a68 1d9a 681d bda5 8dbd a58d
> ####################
> Accually there are many lines (ten thousand more) data need to
> change their order. How can I do it?

It appears that you want to change the formatting of those lines,
not their order. One way to do that is the following, which assumes
for simplicity that there is nothing in the buffer but your data.

Get rid of the indentation of the first line:

gg0dw

Clear any 'formatoptions':

:set fo=

Set the 'textwidth' to the width of your data:

:set tw=39

Fill all the lines to that 'textwidth':

gggqG

See also:

:help gq

Regards,
Gary

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: