Skip to content

Find code snippets with context and click to navigate directly to results

s87jackson/contextFind

Repository files navigation

contextFind

CRAN_Status_Badge R CMD Check

The goal of contextFind is to help developers find relevant parts of their code, especially helpful when code expands beyond a single file, such as with Shiny applications.

The package includes an addin to bind contextFind() to a hotkey (e.g., Ctrl+Shift+F). This opens a mini shiny application with inputs for the search string, the directory, whether to search subdiretories, and how many lines of context to print before and after the found search string:

Clicking the contextFind button prints the results to the console. For each result (match), contextFind() provides a clickable labelled link indicating the file and line number of the result, followed by contextLines=2 lines before and after the occurrence, with the found string highlighted in yellow. The results are ordered with most recently modified files at the bottom of the list for ease of reading in the console.

Installation

You can install the latest version of contextFind from GitHub with:

devtools::install_github("s87jackson/contextFind")

or the CRAN stable release with:

install.packages("contextFind")

Use

After installing contextFind, restart RStudio, then set contextFind to a hotkey by selecting Tools >> Modify Keyboard Shortcuts:

Now typing Ctrl+Shift+F opens the gadget to perform the search. If text is higlighted when you type the hotkey, it will be passed to the gadget automatically. In the example below, we search for the string ‘selected’ and see the results:

About

Find code snippets with context and click to navigate directly to results

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published