Skip to content
Browse files

Merge pull request #37 from kelan/master

Add ability to create/update the preview without bringing the browser to the foreground.
  • Loading branch information...
2 parents 4d5f9f7 + ed6fb17 commit fdab44e4d6f1cff08a51e7af45d24e1fbc84ba9d Matthias Guenther committed
Showing with 14 additions and 1 deletion.
  1. +4 −0 README.md
  2. +4 −0 plugin/hammer.vim/bootstrap.vim
  3. +2 −1 plugin/hammer.vim/lib/hammer.rb
  4. +4 −0 plugin/hammer.vim/lib/hammer/env.rb
View
4 README.md
@@ -57,6 +57,10 @@ __CONFIG VARIABLES__
The template to use.
Defaults to 'default', a GitHub-esque README template.
+* g:HAMMER\_BROWSER\_ARGS
+ Optional arguments to pass to the `browser` command. On OS X, it can be useful
+ to set this to '-g' to open the browser window in the background.
+
__INSTALL__
You may need to install other dependencies for your markup language (See Above)
View
4 plugin/hammer.vim/bootstrap.vim
@@ -27,6 +27,10 @@ if !exists('g:HAMMER_BROWSER')
end
endif
+if !exists('g:HAMMER_BROWSER_ARGS')
+ let g:HAMMER_BROWSER_ARGS = ''
+endif
+
if !exists('g:HAMMER_TEMPLATE')
let g:HAMMER_TEMPLATE = 'default'
endif
View
3 plugin/hammer.vim/lib/hammer.rb
@@ -83,9 +83,10 @@ def missing_dependencies
#
def open_browser path
browser_path = Shellwords.escape(Hammer::ENV.browser)
+ browser_args = Hammer::ENV.browser_args
file_path = Shellwords.escape(path)
- Vim.command "silent ! #{browser_path} #{file_path}"
+ Vim.command "silent ! #{browser_path} #{browser_args} #{file_path}"
Vim.command "redraw!"
end
View
4 plugin/hammer.vim/lib/hammer/env.rb
@@ -18,6 +18,10 @@ def browser
@browser = Vim.evaluate 'g:HAMMER_BROWSER'
end
+ def browser_args
+ @browser_args = Vim.evaluate 'g:HAMMER_BROWSER_ARGS'
+ end
+
def commands_path
@commands_path ||= File.join(install_path, "commands")
end

0 comments on commit fdab44e

Please sign in to comment.
Something went wrong with that request. Please try again.