Instant configuration restoring

The configuration we have seen in this chapter might take some time to set up manually, but, once everything is configured, we can create a script that will restore the Vim configuration instantly.

For this, we paste all the commands issued up to now into a bash script that can be run to bring Vim to the exact same configuration. All that is missing from this script is the vimrc file from the home folder, which we can also restore through a technique called heredocs. Just type cat, redirect the output to vimrc, and use heredoc as input, delimited by eof:

Instant configuration restoring
cat > ~/.vimrc << EOF
...
<vimrc content>
...
EOF

Using heredocs is a common technique for manipulating large chunks of text inside bash scripts. Basically it treats a section of code like a separate file (in our case everything after the cat and until the EOF). With this script, we can restore all the Vim configurations we have done and we can also run it on any computer we work on, so that we get our Vim set up in no time!

We hope you have enjoyed this material and see you in the chapter!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.156.140