Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function! Command_T_Local() "Go to the root of the git repo, then CommandT
- "Ask git for the root of the git repo (as a relative '../../' path)
- let git_top = system('git rev-parse --show-cdup')
- let git_fail = 'fatal: Not a git repository'
- if strpart(git_top, 0, strlen(git_fail)) == git_fail
- " Above line says we are not in git repo. Ugly. Better version?
- call Command_T_Work()
- else
- " Move working dir to root of repo, then CommandT
- execute ":cd ./" . git_top
- CommandT
- endif
- endfunction
- function! Command_T_Work() "Go from the ~/work repo
- cd ~/work
- CommandT
- endfunction
- nnoremap <LEADER>fow :call Command_T_Work()<cr>
- nnoremap <LEADER>fop :call Command_T_Local()<cr>
Add Comment
Please, Sign In to add comment