Say, I want to run "echo hello" when I press
How can I write the script?
Is there any way to do it nicely?
I'm thinking about creating a custom command.
Are you thinking of something like this?
and reading in the contents of a shell command (in this case the
You can do that with this command:
Or, if you don't care about the output:
You can put this in your
I have some commands that I want to run on the current file. If you want to save any changes first, and then pass the file name as an argument, you can do it like this:
You can define a command using 'command'. e.g. add this to your .vimrc:
Then you can run this command in command mode:
To see more complicated examples, just run
It tells me NERDTree command is defined in .../nerdtree/plugin/NERD_tree.vim, then you can find how NERDTree command is defined.