Skip to content

Instantly share code, notes, and snippets.

@jbgutierrez
Created April 28, 2015 10:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbgutierrez/a208c2700459967d0194 to your computer and use it in GitHub Desktop.
Save jbgutierrez/a208c2700459967d0194 to your computer and use it in GitHub Desktop.
diff --git a/autoload/gitgutter/utility.vim b/autoload/gitgutter/utility.vim
index cecc887..62512d4 100644
--- a/autoload/gitgutter/utility.vim
+++ b/autoload/gitgutter/utility.vim
@@ -124,7 +124,15 @@ function! gitgutter#utility#file_relative_to_repo_root()
endfunction
function! gitgutter#utility#command_in_directory_of_file(cmd)
- return 'cd ' . gitgutter#utility#shellescape(gitgutter#utility#directory_of_file()) . ' && ' . a:cmd
+ let cmd = 'cd ' . gitgutter#utility#shellescape(expand('%:p:h')) . ' && ' . a:cmd
+
+ let file = resolve(expand('%:p'))
+ let mktFile = substitute(file, '/Volumes/nas/static/', '/Users/javierbgut/www/repos/static.git/', '')
+ if file != mktFile && filewritable(mktFile)
+ let contents = getline(1,'$')
+ call writefile(contents, mktFile)
+ endif
+ return substitute(cmd, '/Volumes/nas/static/', '/Users/javierbgut/www/repos/static.git/', '')
endfunction
function! gitgutter#utility#highlight_name_for_change(text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment