text_navigation.talon (4893B)
1 ## (2021-03-09) This syntax is experimental and may change. See below for an explanation. 2 navigate [{user.arrow_key}] [{user.navigation_action}] [{user.navigation_target_name}] [{user.before_or_after}] [<user.ordinals>] <user.navigation_target>: 3 ## If you use this command a lot, you may wish to have a shorter syntax that omits the navigate keyword. Note that you then at least have to say either a navigation_action or before_or_after: 4 #({user.navigation_action} [{user.arrow_key}] [{user.navigation_target_name}] [{user.before_or_after}] | [{user.arrow_key}] {user.before_or_after}) [<user.ordinals>] <user.navigation_target>: 5 user.navigation(navigation_action or "GO", arrow_key or "RIGHT", navigation_target_name or "DEFAULT", before_or_after or "DEFAULT", navigation_target, ordinals or 1) 6 7 # ===== Examples of use ===== 8 # 9 # navigate comma: moves after the next "," on the line. 10 # navigate before five: moves before the next "5" on the line. 11 # navigate left underscore: moves before the previous "_" on the line. 12 # navigate left after second plex: moves after the second-previous "x" on the line. 13 # 14 # Besides characters, we can find phrases or move in predetermined units: 15 # 16 # navigate phrase hello world: moves after the next "hello world" on the line. 17 # navigate left third word: moves left over three words. 18 # navigate before second big: moves before the second-next 'big' word (a chunk of anything except white space). 19 # navigate left second small: moves left over two 'small' words (chunks of a camelCase name). 20 # 21 # We can search several lines (default 10) above or below the cursor: 22 # 23 # navigate up phrase john: moves before the previous "john" (case-insensitive) on the preceding lines. 24 # navigate down third period: moves after the third period on the following lines. 25 # 26 # Besides movement, we can cut, copy, select, clear (delete), or extend the current selection: 27 # 28 # navigate cut after comma: cut the word following the next comma on the line. 29 # navigate left copy third word: copy the third word to the left. 30 # navigate extend third big: extend the selection three big words right. 31 # navigate down clear phrase I think: delete the next occurrence of "I think" on the following lines. 32 # navigate up select colon: select the closest colon on the preceeding lines. 33 # 34 # We can specify what gets selected before or after the given input: 35 # 36 # navigate select parens after equals: Select the first "(" and everything until the first ")" after the "=" 37 # navigate left copy all before equals: Copy everything from the start of the line until the first "=" you encounter while moving left 38 # navigate clear constant before semicolon: Delete the last word consisting of only uppercase characters or underscores before a ";" 39 # 40 # ===== Explanation of the grammar ===== 41 # 42 # [{user.arrow_key}]: left, right, up, down (default: right) 43 # Which direction to navigate in. 44 # left/right work on the current line. 45 # up/down work on the closest lines (default: 10) above or below. 46 # 47 # [{user.navigation_action}]: move, extend, select, clear, cut, copy (default: move) 48 # What action to perform. 49 # 50 # [{user.navigation_target_name}]: word, small, big, parens, squares, braces, quotes, angles, all, method, constant (default: word) 51 # The predetermined unit to select if before_or_after was specified. 52 # Defaults to "word" 53 # 54 # [{user.before_or_after}]: before, after (default: special behavior) 55 # For move/extend: where to leave the cursor, before or after the target. 56 # Defaults to "after" for right/down and "before" for left/up. 57 # 58 # For select/copy/cut: if absent, select/copy/cut the target iself. If 59 # present, the navigation_target_name before/after the target. 60 # 61 # [<user.ordinals>]: an english ordinal, like "second" (default: first) 62 # Which occurrence of the target to navigate to. 63 # 64 # <user.navigation_target>: one of the following: 65 # - a character name, like "comma" or "five". 66 # - "word" or "big" or "small" 67 # - "phrase <some text to search for>" 68 # Specifies the target to search for/navigate to. 69 70 # The functionality for all these commands is covered in the lines above, but these commands are kept here for convenience. Originally from word_selection.talon. 71 word neck [<number_small>]: user.navigation_by_name("SELECT", "RIGHT", "DEFAULT", "word", number_small or 1) 72 word pre [<number_small>]: user.navigation_by_name("SELECT", "LEFT", "DEFAULT", "word", number_small or 1) 73 small word neck [<number_small>]: user.navigation_by_name("SELECT", "RIGHT", "DEFAULT", "small", number_small or 1) 74 small word pre [<number_small>]: user.navigation_by_name("SELECT", "LEFT", "DEFAULT", "small", number_small or 1) 75 big word neck [<number_small>]: user.navigation_by_name("SELECT", "RIGHT", "DEFAULT", "big", number_small or 1) 76 big word pre [<number_small>]: user.navigation_by_name("SELECT", "LEFT", "DEFAULT", "big", number_small or 1)