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 and

Hide already visible lines that do not match the pattern/conditions given.

Python example: show only classes and special __ methods.

rxedit pysample.py d:: 'and::__|class '

Output

class Calculator:
    def __init__(self, name: str):

Using wk=... where key

rxedit pysample.py d:: d::_::sk=underscores and::::wk=underscores

This is a bit contrived, but the second d:: is setting key=underscores to all declarations that have _ in their name.

and will then remove any lines that do NOT have key=underscores set.

Output

def do_init(func):
    def __init__(self, name: str):
    def show_history(self) -> None:

keep classes as well, but only within first 20 lines

rxedit pysample.py d:: d::_::sk=keep d::::wt=c.sk=keep and::::wk=keep.wl=..20

  • d:: - show all declarations
  • d::_::sk=keep - set any declarations with _ in their names as key=keep
  • d::::wt=c.sk=keep - use wt=c i..e where type = class to set any class to key=keep
  • and::::wk=keep.wl=..20 only show visible lines where key=keep and within lines 1 to 20.

Output:

def do_init(func):
class Calculator:
    def __init__(self, name: str):

and flags

NameFormatExampleDescription
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.
insensitivei::icase-insentive search
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
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

SEE ALSO

shortcodes, chaining, noop