mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
Merge pull request #3163 from con-f-use/master
Remove hard coded Alt+. binding
This commit is contained in:
commit
610d4c1fe8
2 changed files with 23 additions and 28 deletions
23
news/bashism_altdot.rst
Normal file
23
news/bashism_altdot.rst
Normal file
|
@ -0,0 +1,23 @@
|
|||
**Added:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Changed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Deprecated:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Removed:**
|
||||
|
||||
* <news item>
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* Removed obsolte "Alt+." keybinding in xontrib-bashisms that was causing built-in binding to malfunction.
|
||||
|
||||
**Security:**
|
||||
|
||||
* <news item>
|
|
@ -3,10 +3,6 @@ import shlex
|
|||
import sys
|
||||
import re
|
||||
|
||||
from prompt_toolkit.keys import Keys
|
||||
from prompt_toolkit.filters import Condition, EmacsInsertMode, ViInsertMode
|
||||
|
||||
from xonsh.platform import ptk_shell_type
|
||||
|
||||
__all__ = ()
|
||||
|
||||
|
@ -43,30 +39,6 @@ def bash_preproc(cmd, **kw):
|
|||
return re.sub(r"!([!$^*]|[\w]+)", replace_bang, cmd)
|
||||
|
||||
|
||||
@events.on_ptk_create
|
||||
def custom_keybindings(bindings, **kw):
|
||||
if ptk_shell_type() == "prompt_toolkit2":
|
||||
handler = bindings.add
|
||||
|
||||
@Condition
|
||||
def last_command_exists():
|
||||
return len(__xonsh__.history) > 0
|
||||
|
||||
else:
|
||||
handler = bindings.registry.add_binding
|
||||
|
||||
@Condition
|
||||
def last_command_exists(cli):
|
||||
return len(__xonsh__.history) > 0
|
||||
|
||||
insert_mode = ViInsertMode() | EmacsInsertMode()
|
||||
|
||||
@handler(Keys.Escape, ".", filter=last_command_exists & insert_mode)
|
||||
def recall_last_arg(event):
|
||||
arg = __xonsh__.history[-1].cmd.split()[-1]
|
||||
event.current_buffer.insert_text(arg)
|
||||
|
||||
|
||||
def alias(args, stdin=None):
|
||||
ret = 0
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue