Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute Vim commands in a file, like .vimrc?

Tags:

file

vim

vi

list

I need to create a file with a list of commands (in particular key mappings) that I may sometimes need, like a .vimrc that I can execute inside Vim when I need them.

like image 462
Martín Fixman Avatar asked May 04 '10 00:05

Martín Fixman


People also ask

How do I make a vim file executable?

After making sure that Vim has detected the new file attributes using :checktime, the script removes the FileChangedShell autocmd again so that Vim acts normally for future file attribute changes. Now you can type :Xbit to make the file executable.

How do I open a vimrc file in vim?

Opening vimrc Using file name completion, you could type :e $M then press Tab until you see the desired variable. If you only want to see the path, type :echo $M then press Tab to see the variable, and press Enter. In gvim, the Edit menu includes "Startup Settings" which will use $MYVIMRC to edit your vimrc file.

How do I run a command in vim?

Go to command mode Esc , then run :! unix_command . Anything run from the : prompt starting with a bang ! will be run as a unix shell command. You'll be shown the output and allowed to hit a key to get back to your work in vim.


1 Answers

Try :source file

like image 60
D.Shawley Avatar answered Sep 30 '22 17:09

D.Shawley