Skip to content

Instantly share code, notes, and snippets.

@fellipebrito
Last active December 29, 2015 05:06
Show Gist options
  • Save fellipebrito/e35f976c3d952d6f4714 to your computer and use it in GitHub Desktop.
Save fellipebrito/e35f976c3d952d6f4714 to your computer and use it in GitHub Desktop.
Dynamic browser search from a yanked text in VIM from a vagrant box
#!/usr/bin/expect -f
# Use: browser_search.sh <query-to-be-searched>
set QUERY [lindex $argv 0]
set username "YOUR_USERNAME"
set hostname "YOUR_HOSTNAME"
# In Case you need a password. You can use this var and uncomment lines bellow
# It is better to add your public ssh key in authorized keys in your HOST
set password "YOUR_PASSWORD"
spawn ssh ${username}@${hostname}
# expect "Password: "
# send "${password}\r"
expect "$ "
send "open https://www.google.com/#q=${QUERY}\r"
expect "$ "
send "exit\r"
map <Leader>bs :!browser_search.sh <C-r>"<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment