Coder Social home page Coder Social logo

nvim-github-codesearch's Introduction

nvim-github-codesearch

nvim-github-codesearch is a neovim plugin that allows you to submit searches against the Github Code Search API and display the results within neovim. The results can be displayed either as a quickfix list or within Telescope (telescope is entirely optional).

Demo

Demo

Installation

Here is how to install nvim-github-codesearch using packer

  -- it is critical to have the 'run' key provided because this
  -- plugin is a combination of lua and rust, 
  -- with out this parameter the plugin will miss the compilation step entirely
  use {'napisani/nvim-github-codesearch', run = 'make'}

Install using lazy.nvim

  {'napisani/nvim-github-codesearch', build = 'make'}

Configuration + Usage

Here is how to setup this plugin:

local gh_search = require("nvim-github-codesearch")
gh_search.setup({
  -- an optional table entry to explicitly configure the API key to use for Github API requests.
  -- alternatively, you can configure this parameter by export an environment variable named "GITHUB_AUTH_TOKEN"
  github_auth_token = "<YOUR GITHUB API KEY>",

  -- this table entry is optional, if not provided "https://api.github.com" will be used by default
  -- otherwise this parameter can be used to configure a different Github API URL.
  github_api_url = "https://api.github.com",

  -- whether to use telescope to display the github search results or not
  use_telescope = false,
})

-- Usage

-- this will display a prompt to enter search terms
gh_search.prompt()

-- this will submit a search for the designated query without displaying a prompt
gh_search.search("some query")

-- removes any temp files created by nvim-github-codesearch
gh_search.cleanup()

What to enter into the prompt

the text that is captured from the prompt will get parsed and urlencoded, then sent directly to the Github code search API.

The first part of the query is just the search terms, followed by key-value pairs of restrictions. IE:

join_all language:rust

System.out.println user:napisani in:readme

Acceptable search terms are well documented here: https://docs.github.com/en/rest/search?apiVersion=2022-11-28#search-code

Dependencies

As of right now, the current version nvim-github-codesearch assumes that the machine its being installed on already has cargo/rust installed and available on the PATH. If you don't already have rust setup on your machine, please run the one-liner shell command available on the official rust docs to install it before installing nvim-github-codesearch: https://www.rust-lang.org/tools/install

Nix (optional)

if you use nix you can build the app using this command

nix-shell
make

nvim-github-codesearch's People

Contributors

afidegnum avatar howarddo2208 avatar jamylak avatar napisani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nvim-github-codesearch's Issues

build takes too long

I was using lazy to install this plugin, but the build time took too long and reach timeout. Maybe you should add a workaround, or reduce the compile time somehow. Here's my log:

    โ— nvim-github-codesearch 0.13ms ๐Ÿ“Œ build
        cargo build --release
           Compiling autocfg v1.1.0
           Compiling proc-macro2 v1.0.56
           Compiling unicode-ident v1.0.8
           Compiling quote v1.0.26
           Compiling libc v0.2.141
           Compiling cfg-if v1.0.0
           Compiling memchr v2.5.0
           Compiling version_check v0.9.4
           Compiling pin-project-lite v0.2.9
           Compiling syn v1.0.109
           Compiling futures-core v0.3.28
           Compiling log v0.4.17
           Compiling core-foundation-sys v0.8.4
           Compiling futures-task v0.3.28
           Compiling futures-channel v0.3.28
           Compiling futures-sink v0.3.28
           Compiling parking_lot_core v0.9.7
           Compiling bytes v1.4.0
           Compiling smallvec v1.10.0
           Compiling scopeguard v1.1.0
           Compiling futures-util v0.3.28
           Compiling pin-utils v0.1.0
           Compiling unicase v2.6.0
           Compiling slab v0.4.8
           Compiling lock_api v0.4.9
           Compiling tokio v1.27.0
           Compiling futures-io v0.3.28
           Compiling itoa v1.0.6
           Compiling once_cell v1.17.1
           Compiling io-lifetimes v1.0.10
           Compiling bitflags v1.3.2
           Compiling rustix v0.37.11
           Compiling indexmap v1.9.3
           Compiling tracing-core v0.1.30
           Compiling fnv v1.0.7
           Compiling serde_derive v1.0.160
           Compiling num-traits v0.2.15
           Compiling http v0.2.9
           Compiling httparse v1.8.0
           Compiling native-tls v0.2.11
           Compiling hashbrown v0.12.3
           Compiling fastrand v1.9.0
           Compiling serde v1.0.160
           Compiling syn v2.0.15
           Compiling tinyvec_macros v0.1.1
           Compiling tinyvec v1.6.0
           Compiling percent-encoding v2.2.0
           Compiling try-lock v0.2.4
           Compiling lazy_static v1.4.0
           Compiling want v0.3.0
           Compiling signal-hook-registry v1.4.1
           Compiling socket2 v0.4.9
           Compiling mio v0.8.6
           Compiling num_cpus v1.15.0
           Compiling parking_lot v0.12.1
           Compiling errno v0.3.1
           Compiling core-foundation v0.9.3
           Compiling security-framework-sys v2.8.0
           Compiling unicode-normalization v0.1.22
           Compiling security-framework v2.8.2
           Compiling http-body v0.4.5
           Compiling getrandom v0.2.9
           Compiling form_urlencoded v1.1.0
           Compiling mime_guess v2.0.4
           Compiling num-integer v0.1.45
           Compiling proc-macro-error-attr v1.0.4
           Compiling httpdate v1.0.2
           Compiling unicode-bidi v0.3.13
           Compiling ryu v1.0.13
           Compiling tempfile v3.5.0
           Compiling anyhow v1.0.70
           Compiling serde_json v1.0.96
           Compiling tower-service v0.3.2
           Compiling idna v0.3.0
           Compiling rand_core v0.6.4
           Compiling proc-macro-error v1.0.4
           Compiling async-trait v0.1.68
           Compiling ppv-lite86 v0.2.17
           Compiling mime v0.3.17
           Compiling thiserror v1.0.40
           Compiling url v2.3.1
           Compiling aho-corasick v0.7.20
           Compiling rand_chacha v0.3.1
           Compiling iana-time-zone v0.1.56
           Compiling encoding_rs v0.8.32
           Compiling ipnet v2.7.2
           Compiling regex-syntax v0.6.29
           Compiling cc v1.0.79
           Compiling base64 v0.21.0
           Compiling either v1.8.1
           Compiling pkg-config v0.3.26
           Compiling itertools v0.10.5
           Compiling chrono v0.4.24
           Compiling rand v0.8.5
           Compiling task-local-extensions v0.1.4
           Compiling bstr v0.2.17
           Compiling mlua v0.6.6
           Compiling futures-macro v0.3.28
           Compiling tokio-macros v2.0.0
           Compiling thiserror-impl v1.0.40
           Compiling regex v1.7.3
           Compiling retry-policies v0.1.2
           Compiling md5 v0.7.0
           Compiling urlencoding v2.1.2
           Compiling tracing-attributes v0.1.23
           Compiling tracing v0.1.37
           Compiling mlua_derive v0.6.0
           Compiling futures-executor v0.3.28
           Compiling futures v0.3.28
           Compiling tokio-util v0.7.7
           Compiling tokio-native-tls v0.3.1
           Compiling h2 v0.3.17
           Compiling serde_urlencoded v0.7.1
           Compiling hyper v0.14.26
           Compiling hyper-tls v0.5.0
           Compiling reqwest v0.11.16
           Compiling reqwest-middleware v0.2.1
           Compiling reqwest-retry v0.2.2
           Compiling github_search v0.1.0 (/Users/tanhopdo/.local/share/nvim/lazy/nvim-github-codesearch)
            Finished release [optimized] target(s) in 2m 19s
        
        Process was killed because it reached the timeout

fzf-lua

do you have any plan to support fzf-lua as an alternative to telescope?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.