Open Vim from a Rakefile?

rake, ruby

Solution

As in the article you referenced,


You can either:

Use `exec` to replace the current process with the new one (note that the Ruby/Rake process will end once you've called `exec`, and nothing after it will run).

Use `system` to create a subshell like 

s, but avoids the problem of trying to grab Vim's stdout. Unlike `exec`, after Vim terminates, Ruby will continue.

Problem

I am creating a journal application for personal notes and have the following in my `Rakefile`: ``` task :new do entry_name = "Entries/#{Time.now.to_s.gsub(/[-\ :]+/, '.').gsub(/.0500+/,'')}.md" `touch #{entry_name}` `echo "# $(date)" >> #{entry_name}` end ``` The last part I would like to include is the opening of the Vim text editor but I am unable to figure out how to open it as if I called it directly from the bash terminal. I have tried: ``` vim #{entry_name} ``` but unfortunately I think both of those open it as a background process. I have been referencing "6 Ways to Run Shell Commands in Ruby".

Original source