Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Command imports - [i]imports (supported languages only)

Find imports/uses/includes that match the search term.

Example: search for imports that match co, but not std or regex.

rxedit utilities.rs i::co--std,regex

Output:

use crate::common::{CheckLineRange, LineStatus};
use crate::constants::{DEBUGGING, RE_SPLIT_NEGATIVES_NAMES};
    use crate::common::ConditionResult;
    use crate::common::GetLine;
    use crate::common::StopOrAddChecker;
    use crate::constants::Direction;
    use crate::common::LineStatus;
    use crate::constants::Direction;

Example: search for imports “far in the file”

Another example if we want to look for imports that are past the reasonable start of the file, line 100 in the example below. Sometimes however, with Python, this is done to avoid circular import dependencies, so we’ll use the ::o “show owner” flag as well.

rxedit utils.py i::::wl=100../o

Search flags

NameFormatExampleDescription
insensitivei::icase-insentive search
afterA(\d+)::A16Show NUM lines after each match.
beforeB(\d+)::B5Show NUM lines before each match.
contextC(\d+)::C5Show NUM lines before and after each match.
fixed_stringF::Ftreat search as regular string, not a regex
use_grep_shortcodesg::gexpands shortcodes (..→.*, ~~s.→ +)
no_use_grep_shortcodesG::Gdoes not expand grep shortcodes
show_ownero::oshow “owner” of the line
set keysk=([a-z]+)(?:.|/|$)::sk=importan/ set key to a value that can be used with wk=. in later commands
where_keywk=([a-z]+)(?:.|/|$)::wk=mykey/puts an extra criteria to other commands
where_linenumwl=([-0-9A-Ca-chtHT,.]+)::wl=..5,8,-1/limit line number range

Notes:

Imports are available when the file extension is recognized as a supported language. If not, this will become a noop.

The search mechanism behaves like declarations name matching, because the names are basically expected to be alphanumeric.

Name matching is a bit complicated (AND A WORK IN PROGRESS).

Imports names are matched against each level but the last.
That’s because this is matching against the modules imported rather than what is imported from a module.

So i::std would match use std::fs; but i::fs would not because fs is the last bit.

SEE ALSO

shortcodes, chaining, languages, noop