1

I use vim and its netrw plugin to edit remote files too often. Many times, I had to close the current session and start a complete new session again later. But loading all those files (a lot of them) takes a lot of time and involvement (since I need to go to different dir and load those files one-by-one manually).

I need help to automate the file-loading process in the netrw. I tried to do it myself using execute and normal! but there seems to be some problem (as the search operation like execute 'normal! /root' does not seem to work).

I tried using <CR> and it gives me Trailing characters error.

I know the absolute path of the files that I want to load. How can I automate the file-loading process ?

zeekhuge
  • 1,594
  • 1
  • 13
  • 23

1 Answers1

1

You've already used the right term in your question: sessions can help with that. You create one via :mksession; this basically generates a Vim script that, when executed (via :source Session.vim) in a new Vim instance, will restore all current buffers. This also works with netrw's remote buffers - I only had to reload via :e! to fetch the contents again.

Note: There are plugins that further simplify session handling; I can recommend the vim-session plugin.

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324