Guest User

Untitled

a guest
Jul 18th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. function! Command_T_Local() "Go to the root of the git repo, then CommandT
  2. "Ask git for the root of the git repo (as a relative '../../' path)
  3. let git_top = system('git rev-parse --show-cdup')
  4. let git_fail = 'fatal: Not a git repository'
  5. if strpart(git_top, 0, strlen(git_fail)) == git_fail
  6. " Above line says we are not in git repo. Ugly. Better version?
  7. call Command_T_Work()
  8. else
  9. " Move working dir to root of repo, then CommandT
  10. execute ":cd ./" . git_top
  11. CommandT
  12. endif
  13. endfunction
  14. function! Command_T_Work() "Go from the ~/work repo
  15. cd ~/work
  16. CommandT
  17. endfunction
  18. nnoremap <LEADER>fow :call Command_T_Work()<cr>
  19. nnoremap <LEADER>fop :call Command_T_Local()<cr>
Add Comment
Please, Sign In to add comment