Can I save the current window position and buffer in a register in VIM

Sometimes I split VIM into 4 windows and open different files in these windows. I want to know if I can save the current script to register and return it whenever I want?

+4
source share
2 answers

You can save it to a file. You can read about it here :help mksession

You can also use plugins to manage sessions, for example session.vim .

Now I do not know how to save it in the register, and not in the file.

+4
source

There is no easy way to get the functionality you are looking to store in a register, although there is built-in support for saving the current session for a file.

 :mks[ession][!] [file] 

:help mksession

Suppose you are editing, and this is the end of the day. You want to quit work and pick up where you left off the next day.

You can do this by saving the editing session and restoring it the next day. A Vim session contains all the information about what you are editing.

This includes things like a list of files, a window layout, global variables, options, and other information.

...

  *:mks* *:mksession* :mks[ession][!] [file] Write a Vim script that restores the current editing session. When [!] is included an existing file is overwritten. When [file] is omitted "Session.vim" is used. 

Additional documentation

+4
source

Source: https://habr.com/ru/post/1388559/


All Articles