daniel-shimon on main
aliases: Fix $__ALIAS_NAME for … (compare)
daniel-shimon on main
chore: update mypy to 0.902 (#4… (compare)
cmd = ['xclip', '-selection', 'clipboard', '-t', content_type] p = Popen(cmd, stdin=PIPE) p.communicate(content)
I've been combing through the docs for xonsh and prompt-toolkit, as well as the source code, and haven't been able to figure this out: I would like to map the key sequence: ";;" to "escape" in ViInsertMode. I found where escape is defined in the prompt-toolkit code, but it doesn't seem to have a related function name like "event.current_buffer.open_in_editor". So I tried copying the code into my custom_keybindings() which causes a syntax error in unrelated lines. I expected more helpful errors.
@bindings.add(';', ';', filter=ViInsertMode()) def _back_to_navigation_mode(event): buffer = event.current_buffer vi_state = event.app.vi_state if vi_state.input_mode in (InputMode.INSERT, InputMode.REPLACE): buffer.cursor_position += buffer.document.get_cursor_left_position() vi_state.input_mode = InputMode.NAVIGATION if bool(buffer.selection_state): buffer.exit_selection()
The code I tried to adapt came from python-prompt-toolkit/prompt_toolkit/key_bindings/bindings/vi.py:421 I tried to see if I could make KEY_ALIASES work for this, but I obviously didn't understand it. Am I missing something obvious here?
Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/xonsh/__amalgam__.py", line 22504, in main args = premain(argv) File "/usr/local/lib/python3.9/site-packages/xonsh/__amalgam__.py", line 22440, in premain env = start_services(shell_kwargs, args) File "/usr/local/lib/python3.9/site-packages/xonsh/__amalgam__.py", line 22370, in start_services execer = Execer( File "/usr/local/lib/python3.9/site-packages/xonsh/__amalgam__.py", line 21467, in __init__ self.parser = Parser(**parser_args) File "/usr/local/lib/python3.9/site-packages/xonsh/__amalgam__.py", line 400, in __call__ obj = self._lazy_obj() File "/usr/local/lib/python3.9/site-packages/xonsh/__amalgam__.py", line 368, in _lazy_obj obj = d["load"]() File "/usr/local/lib/python3.9/site-packages/xonsh/__amalgam__.py", line 3388, in Parser from xonsh.parsers.v39 import Parser as p File "/usr/local/lib/python3.9/site-packages/xonsh/parsers/v39.py", line 10, in <module> from xonsh.parsers.base import Index ImportError: cannot import name 'Index' from 'xonsh.parsers.base' (/usr/local/lib/python3.9/site-packages/xonsh/parsers/base.py)
history show all -0and
history show -0to get all history and history for the current session, deduplicates the former and pipes all of it into fzf and then writes the selection into the place of the current prompt buffer
.xonshrcto check if it was executed as a login shell
When doing a multline input such as
>>> if True: ... print(1) ... else: ... print(2) ... 1
Is there a way to do
TAB to unindent by 4 spaces, or any similar feature?
For example, to enter the
else, I pressed backspace 4x, but I would have liked to unindent the cursor by hitting SHIFT+TAB.