Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
anki-code authored Feb 18, 2024
1 parent 2104889 commit dfc7524
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -915,12 +915,17 @@ def custom_keybindings(bindings, **kw):
# Press F3 to insert the grep command
@bindings.add(Keys.F3) # or for Mac try `@bindings.add("c-k") # control+k`
def say_hi(event):
def add_grep(event):
event.current_buffer.insert_text('| grep -i ')
# Clear line by pressing `Escape` key
@bindings.add("escape")
def clear_line(event):
event.current_buffer.delete_before_cursor(1000)
```
See also: [More about key bindings](https://python-prompt-toolkit.readthedocs.io/en/master/pages/advanced_topics/key_bindings.html).
See also: [more about key bindings](https://python-prompt-toolkit.readthedocs.io/en/master/pages/advanced_topics/key_bindings.html), [event.current_buffer](https://python-prompt-toolkit.readthedocs.io/en/stable/pages/reference.html#prompt_toolkit.buffer.Buffer).
# [Xontrib](https://xon.sh/tutorial_xontrib.html) - extension or plugin for xonsh
Expand Down

0 comments on commit dfc7524

Please sign in to comment.