1

I make a set of move into my register q. the move like:

enter image description here

and I want to save it in a file so that I can use it in the future. But when I open that file again,its contents become

enter image description here

Can't I save these non-printing char in a file correctly? What should I do for this?

I have changed set such as encoding,fileencoding,fileencodings,termencoding,isprint,doesn't work at all

romainl
  • 186,200
  • 21
  • 280
  • 313
zhzhy
  • 19
  • 2
  • [Please do not upload images of code/data/errors.](//meta.stackoverflow.com/q/285551) – Friedrich Jun 29 '23 at 08:40
  • 1
    I can't write it,it has non-printing char,it will show only char like '??'. – zhzhy Jun 29 '23 at 09:19
  • https://stackoverflow.com/q/4376539/7976758 Found in https://stackoverflow.com/search?q=%5Bvim%5D+save+macro+file – phd Jun 29 '23 at 09:29

1 Answers1

1

Those characters are useless artifacts of how Vim handles keystrokes during recording. They serve no purpose whatsoever so you can safely get rid of them before you paste.

For example, these are the random keystrokes I recorded in register q:

bi-<Esc>ea-<Esc>

and this the content of register q (^[ is a literal Esc, not ^ followed by [):

bi-^[<80><fd>aea-^[<80><fd>a

These things are just useless garbage that shouldn't be there in the first place:

bi-^[<80><fd>aea-^[<80><fd>a
     ^^^^^^^^^     ^^^^^^^^^

In fact, they are not even used by Vim for anything, so you can—and should—remove them manually after you dump the register in another buffer, before you write it to disk:

bi-^[ea-^[
romainl
  • 186,200
  • 21
  • 280
  • 313