Sunday, June 11, 2017

Re: save and load a micro

Le dimanche 11 juin 2017 04:52:22 UTC+2, Sand Glass a écrit :
> I will often do the following things next days.
> So I want to record the commands as a macro. But I don't know how to save the macro to a file and load the macro next time, so that I open a file just hit a key, can do the repeat things.
> input bin file:
> 0000000: 00ff ffff ffff ff00 39f6 3412 7856 3412 ........9.4.xV4.
> 0000010: 191a 0103 8059 3278 eaee 91a3 544c 9926 .....Y2x....TL.&
> 0000020: 0f50 5400 0000 0101 0101 0101 0101 0101 .PT.............
> 0000030: 0101 0101 0101 08e8 0030 f270 5a80 b058 .........0.pZ..X
> 0000040: 8a00 22c4 3100 001e 0000 00fc 004e 4f56 ..".1........NOV
> 0000050: 4153 5441 520a 2020 2020 0000 0011 0000 ASTAR. ......
> 0000060: 0000 0000 0000 0000 0000 0000 0000 0011 ................
> 0000070: 0000 0000 0000 0000 0000 0000 0000 015b ...............[
> 0000080: 0203 1cd0 4161 2309 0707 6703 0c00 1000 ....Aa#...g.....
> 0000090: 203c 67d8 5dc4 0178 c002 e10f 08e8 0030 <g.]..x.......0
> 00000a0: f270 5a80 b058 8a00 20c2 3100 001e 0000 .pZ..X.. .1.....
> 00000b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
> 00000c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
> 00000d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
> 00000e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
> 00000f0: 0000 0000 0000 0000 0000 0000 0000 00a7 ................
> 0000100: 0a .
>
> output txt file:
> 0x00,0xff ,0xff,0xff ,0xff,0xff ,0xff,0x00 ,0x39,0xf6 ,0x34,0x12 ,0x78,0x56 ,0x34,0x12,
> 0x19,0x1a ,0x01,0x03 ,0x80,0x59 ,0x32,0x78 ,0xea,0xee ,0x91,0xa3 ,0x54,0x4c ,0x99,0x26,
> 0x0f,0x50 ,0x54,0x00 ,0x00,0x00 ,0x01,0x01 ,0x01,0x01 ,0x01,0x01 ,0x01,0x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x00 ,0x00,0x00 ,0x00,0x00 ,0x00,0x00 ,0x00,0x00 ,0x00,0x00 ,0x00,0xa7


Try this :
0,$ call setline(line('.'),substitute(join(map(split(getline('.'),'\s')[1:-3], '"0x".v:val[:1]." 0x".v:val[2:]')),'\s',',',"g"))

--
--
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: