Ver código fonte

nixpkgs/elvish: add Ctrl-W binding for location

Thomas Dy 1 mês atrás
pai
commit
a12f128ada

+ 19 - 0
.config/nixpkgs/elvish/elvish-mode-bindings.patch

@@ -0,0 +1,19 @@
+diff --git a/pkg/cli/modes/mode.go b/pkg/cli/modes/mode.go
+index c1def4f5..0ce3ce69 100644
+--- a/pkg/cli/modes/mode.go
++++ b/pkg/cli/modes/mode.go
+@@ -17,9 +17,13 @@ var ErrFocusedWidgetNotCodeArea = errors.New("focused widget is not a code area"
+ // FocusedCodeArea returns a CodeArea widget if the currently focused widget is
+ // a CodeArea. Otherwise it returns the error ErrFocusedWidgetNotCodeArea.
+ func FocusedCodeArea(a cli.App) (tk.CodeArea, error) {
+-	if w, ok := a.FocusedWidget().(tk.CodeArea); ok {
++	widget := a.FocusedWidget()
++	if w, ok := widget.(tk.CodeArea); ok {
+ 		return w, nil
+ 	}
++	if w, ok := widget.(tk.ComboBox); ok {
++		return w.CodeArea(), nil
++	}
+ 	return nil, ErrFocusedWidgetNotCodeArea
+ }
+ 

+ 2 - 0
.config/nixpkgs/elvish/flake.nix

@@ -24,6 +24,8 @@
 
           subPackages = [ "cmd/elvish" ];
 
+          patches = [ ./elvish-mode-bindings.patch ];
+
           vendorHash = "sha256-eCA+vdAFOiCUSrapB6vcL3aF/0MuK3Vx6P2vuDdk9v8=";
         };
       in {

+ 1 - 0
.config/nixpkgs/elvish/lib/config.elv

@@ -29,6 +29,7 @@ if (has-external delta) {
 use readline-binding
 set edit:completion:binding[Ctrl-W] = $edit:close-mode~
 set edit:completion:binding[Tab] = $edit:completion:accept~
+set edit:location:binding[Ctrl-W] = $edit:kill-word-left~
 
 var max-len = 30