Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute a file everytime before opening Vim

Tags:

vim

vi

I have recently started using vim and I really like it. I have added a few easy mappings in my vimrc file.

But the problem is I get to use a lot of remote machines a lot of time and I can't copy my vimrc on to them but most of the times I won't have enough permissions to do that.

So, I was wondering if there is any way I can put all my vim mappings in a file and tell vim to run it every time it loads, just like a vimrc?

like image 794
Durga Swaroop Avatar asked Nov 17 '25 05:11

Durga Swaroop


1 Answers

The action that is "parsing" the .vimrc is called source.

In runtime, you can reapply/reparse your .vimrc by using

  :source ~/.vimrc

So if you can somehow copy your .vimrc, even if not in your home, but a folder like /tmp you should be able to source it from there, with

:source /tmp/.vimrc

This question has more details and solutions.

like image 91
Xavier T. Avatar answered Nov 18 '25 21:11

Xavier T.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!