| Title: | Find Code Snippets with Context and Click to Navigate Directly to Results |
|---|---|
| Description: | Search across R files with contextual results, highlights and clickable links. Includes an add-in for further workflow enhancement. |
| Authors: | Steve Jackson [aut, cre] (ORCID: <https://orcid.org/0000-0002-3337-7846>) |
| Maintainer: | Steve Jackson <[email protected]> |
| License: | CC0 |
| Version: | 1.0.1 |
| Built: | 2026-06-05 07:01:49 UTC |
| Source: | https://github.com/s87jackson/contextfind |
Search R and Rmd Files for Matching Text, Get Context and Links
contextFind( search_text, path = ".", recursive = TRUE, contextLines = 2, verbose = TRUE )contextFind( search_text, path = ".", recursive = TRUE, contextLines = 2, verbose = TRUE )
search_text |
Text to search for |
path |
Root directory to search |
recursive |
Whether to recurse into subfolders |
contextLines |
Number of context lines around match |
verbose |
If TRUE (the default), prints the results to the console |
A list of lists, one for each match, with objects: file, match_line, mtime, and context. file is the file path in which the match was found, match_line is the line number for this particular match, mtime is a POSIXct datetime value indicating when the file was last modified, and context contains the number of lines before and after the found match (set by the contextLines parameter).
# Find custom functions in your codebase contextFind("<- function") # Get more context contextFind("<- function", contextLines = 3) # Explicitly set the search directory contextFind("<- function", path = getwd()) # Exclude subdirectories contextFind("<- function", recursive = FALSE)# Find custom functions in your codebase contextFind("<- function") # Get more context contextFind("<- function", contextLines = 3) # Explicitly set the search directory contextFind("<- function", path = getwd()) # Exclude subdirectories contextFind("<- function", recursive = FALSE)
Launches an interactive gadget for searching project files. The gadget allows the user to enter a search string, choose a directory, specify whether the search should be recursive, and how many lines of context to print. Results are displayed in the console with clickable links to matched lines.
contextFind_addin()contextFind_addin()
Invisibly returns the search results as a list (see contextFind()).