Refactor make_vim_function