You could make this be something like

    if editor == 'vim'
        params = "..."
    else
        params = ''
    end
    pid = spawn "#{editor} #{params} #{filename}"

If we start adding rules for different editors, the lack of duplication will start to be more important.