问题
I'm on a Mac and when I am in TextMate editing a ruby file I can simply hit Command-R to execute the file and see the results in a new window. Is there something similar to this using MacVim?
It's really important that I be able to open up a NEW window. Reason is because in the current window I might have more than one full page of info. If that happens I can't scroll through it.
回答1:
You could create your own mapping to do it:
map <D-r> :w<CR>:!ruby %<CR>
%
is the current file. If your file starts with #!/path/to/ruby
you can omit the explicit call to ruby
in your mapping.
Haven't tested the <D-r>
mapping - no mac here. It's likely configuration dependent.
回答2:
The following question has the answer to exactly what I was looking for
https://superuser.com/questions/133886/vim-displaying-code-output-in-a-new-window-a-la-textmate
来源:https://stackoverflow.com/questions/3811572/command-r-like-functionality-in-macvim