refactor vim functions