All Projects → MilesCranmer → Gso

MilesCranmer / Gso

Licence: mit
🏃 Google StackOverflow in Vim. Copy-pastes the code directly in your script.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Gso

S2s
Coding time Compile. A tool to write code fastest.
Stars: ✭ 254 (+238.67%)
Mutual labels:  automation, autocomplete
Mobly
E2E test framework for tests with complex environment requirements.
Stars: ✭ 424 (+465.33%)
Mutual labels:  automation, google
Puppeteer
Headless Chrome Node.js API
Stars: ✭ 75,197 (+100162.67%)
Mutual labels:  automation, developer-tools
Google It Automation With Python
Repository to keep track of Google IT Automation with Python provided by Coursera
Stars: ✭ 86 (+14.67%)
Mutual labels:  automation, google
Ferrum
Headless Chrome Ruby API
Stars: ✭ 1,009 (+1245.33%)
Mutual labels:  automation, developer-tools
Nake
Magic script-based C# task runner for .NET Core
Stars: ✭ 183 (+144%)
Mutual labels:  automation, developer-tools
Budibase
Budibase is an open-source low-code platform for creating internal apps in minutes. Supports PostgreSQL, MySQL, MSSQL, MongoDB, Rest API, Docker, K8s 🚀
Stars: ✭ 8,071 (+10661.33%)
Mutual labels:  automation, developer-tools
Fw
workspace productivity booster
Stars: ✭ 269 (+258.67%)
Mutual labels:  automation, developer-tools
Sosl
StackOverflow Search Library
Stars: ✭ 10 (-86.67%)
Mutual labels:  stackoverflow, google
Puppeteer Api Zh cn
📖 Puppeteer中文文档(官方指定的中文文档)
Stars: ✭ 697 (+829.33%)
Mutual labels:  automation, developer-tools
Google It Automation
google it automation with python professional certificate
Stars: ✭ 81 (+8%)
Mutual labels:  automation, google
Puphpeteer
A Puppeteer bridge for PHP, supporting the entire API.
Stars: ✭ 1,014 (+1252%)
Mutual labels:  automation, developer-tools
Cutcode
A browser extension that enables double click to copy code snippet from stack overflow.
Stars: ✭ 163 (+117.33%)
Mutual labels:  stackoverflow, developer-tools
Phantomas
Headless Chromium-based web performance metrics collector and monitoring tool
Stars: ✭ 2,191 (+2821.33%)
Mutual labels:  automation, developer-tools
Pyment
Format and convert Python docstrings and generates patches
Stars: ✭ 577 (+669.33%)
Mutual labels:  google, developer-tools
Influx Prompt
An interactive command-line InfluxDB cli with auto completion.
Stars: ✭ 42 (-44%)
Mutual labels:  developer-tools, autocomplete
Http Prompt
An interactive command-line HTTP and API testing client built on top of HTTPie featuring autocomplete, syntax highlighting, and more. https://twitter.com/httpie
Stars: ✭ 8,329 (+11005.33%)
Mutual labels:  developer-tools, autocomplete
Seer
🗜 A customizable devtool solution
Stars: ✭ 72 (-4%)
Mutual labels:  developer-tools
Ansible For Network Engineers
Репозиторий книги "Ansible для сетевых инженеров". Книга в процессе переноса на readthedocs и обновления содержания на Ansible 2.9!
Stars: ✭ 74 (-1.33%)
Mutual labels:  automation
Laboratory
Achieving confident refactoring through experimentation with Python 2.7 & 3.3+
Stars: ✭ 1,179 (+1472%)
Mutual labels:  developer-tools

GSO

Googling Stack Overflow Screencast

Thank you Daniel, Brionius, and bytecode77!

GSO now work exclusively in Python 3. Confirmed to work in NeoVim.

(GSO now also prints the answer URL.)

Installation

(If you just want to try, there are demo keys at the bottom of this page. They are shared, so play nice.)

Make sure your vim supports python scripting (vim --version | grep +python3 should return something). If this doesn't work, the vim-nox-py2 package on ubuntu has this (sudo apt-get install vim-nox-py2), else, look to SO.

Then, install python dependencies:

pip3 install google-api-python-client Cython py-stackexchange lxml

If there are issues with installing lxml, it's probably to do with a missing libxml library. The lxml site has some help for this.

Get API keys for Google Custom Search (scroll to API key), and Stack Apps. This is free, don't be intimidated by the forms! Enter whatever in the boxes, and the key generated for you will be compatible with this app. Trust me, it's worth it.

Put these into environment variables GOOGLE_KEY and SE_KEY, respectively (e.g., export GOOGLE_KEY="......").

(Vundle) Add this repo to your .vimrc file:

Plugin 'MilesCranmer/gso'

Then, just :PluginInstall in vim.

(optional) Map Ctrl-E to type ":GSO " for you, by putting the following in your .vimrc:

nnoremap <C-e> :GSO 

Usage

:GSO [(-l | --language) <language>] [-n | --no-text] [<search>...]

For example, in a file sort.py, run:

:GSO Do a bubble sort

And watch the python code get dumped below your cursor. GSO will append the language to your query by the file extension, but you can set it explicitly by:

:GSO -l haskell Generate a fibonacci sequence

FAQ

  • The Python compiled into my vim is saying it can't see googleapi-client, what do I do?

I have a similar problem and made a hack around it. Your gso should be installed into ~/.vim/gso. Edit the file ~/.vim/gso/plugin/gso.vim, and after each python << EOF, paste the following lines:

import sys
sys.path.append('....')

Replace the inside of the string with the "site-packages" directory where googleapi-client is installed. Make sure you use python 3 to install the packages, or optionally replace the python3 << EOF with python << EOF.

Tools

There is a shell utility in tools. It simply calls the GSO command and dumps the result to the /dev/stdout. Copy it to /usr/bin/gso (or anywhere on the PATH), then call it as you normally would:

➜  gso How to change the url of a git remote

GSO>>>
You can
git remote set-url origin git://new.url.here


(see git help remote) or you can just edit .git/config and change the 
URLs there. You're not in any danger of losing history unless you do 
something very silly (and if you're worried, just make a copy of your 
repo, since your repo is your history.)
<<<GSO

Docker

To pull and run (with your Google and Stack apps API keys, or the demo ones at the bottom):

docker run -it -e GOOGLE_KEY=$GOOGLE_KEY -e SE_KEY=$SE_KEY mcranmer/gso

Then, inside vim:

:GSO Flatten a list of lists

And it will dump the highest score answer to below your cursor.

TODO/Ideas

  • Unit tests. Apparently these are uncommon among vim plugins, so there is little built-in testing functionality, but since I am using a lot of python, I could just write regular python unittests on the gso module.
  • Automatic reading of code, triggered by a flag, so that you can dump the current line of code to the search query to help your results. This way, it's a little bit like an advanced man function.
  • Automatic piping of error messages to GSO, have it dump a solution to your error in the code. This might have to be linked to the build command, e.g., make. Then, if make produces a nonzero error message, you activate GSO at the cursor position. This could be something you toggle on and off. It could also just be called, e.g., by an empty :GSO command after an error. You could also add functionality to turn specific errors off if they are too basic (e.g., forgetting a semi-colon), or too common (e.g., generic seg fault).
  • (#1 TODO) Multi answer/multi question, as well as easy keystroke swapping. This would have GSO load up a bunch of answers/questions to the quickfix list, then you could use unimpaired.vim to quickly replace the pasted text below your cursor.
  • Answer preview, so you can see answers in a new pane, and swipe between them until you like one. Then you could hit some keystroke to dump it in.
  • General speedups (though this isn't really needed on an AWS instance, so I might not work on this for a while).
  • Comments for more languages built-in.
  • Improve the shell utility so it doesn't have to open vim, it just calls the python functions.
  • (crazy idea) Have something that recognizes what variables you are dealing with, tries to guess which ones to use in the dumped code, then does a search and replace. This could be so you can just rapid fire dump code without thinking much. It wouldn't be a negative, as you likely have to replace some variables manually anyway. The initial implementation could do simple things, such as seeing if you are inside a loop, then taking the looped over variable, and maybe replacing the most common variable in the pasted text with your looped one... But again, this is a crazy idea.

Other

This is the custom search engine that GSO uses: https://cse.google.com/cse/publicurl?cx=003962226882031433174:qk7rs-ca-bi

Currently, it searches the stackoverflow, superuser, tex, and unix forums.

SE: "NExeVkJzlom8ZUagXLcHQA(("

GOOGLE: "AIzaSyAk7sxnY_yHAP2OIdSOrgf9JysO8E_xJRo"

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].