Guest User

Untitled

a guest
Jul 19th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. function update_bundle_path() {
  2. if [[ -f .bundle/config ]]; then
  3. if [[ ! -f .bundle/path || .bundle/path -ot .bundle/config ]]; then
  4. ruby -rbundler -e 'puts Bundler.bundle_path' > .bundle/path
  5. fi
  6. fi
  7. }
  8.  
  9. push chpwd_functions update_bundle_path
  10.  
  11. function accept-line-with-bundler() {
  12. if [[ -r .bundle/path ]]; then
  13. set -- ${=BUFFER}
  14. if [[ -x $(< .bundle/path)/bin/$1 ]]; then
  15. BUFFER="bundle exec $BUFFER"
  16. fi
  17. fi
  18. zle accept-line
  19. }
  20.  
  21. bindkey '^M' accept-line-with-bundler
Add Comment
Please, Sign In to add comment