src.elv.sh@v0.21.0-dev.0.20240515223629-06979efb9a2a/pkg/edit/init.elv (about)

     1  set after-command = [
     2    # Capture the most recent interactive command duration in $edit:command-duration
     3    # as a convenience for prompt functions. Note: The first time this is run is after
     4    # shell.sourceRC() finishes so the initial value of command-duration is the time
     5    # to execute the user's interactive configuration script.
     6    {|m|
     7      set command-duration = $m[duration]
     8    }
     9  ]
    10  
    11  set completion:arg-completer = [
    12    &sudo=       $complete-sudo~
    13    &doc:show=   {|@a| use doc; doc:-symbols }
    14    &doc:source= {|@a| use doc; doc:-symbols }
    15  ]
    16  
    17  set global-binding = (binding-table [
    18    &Ctrl-'['= $close-mode~
    19    &Alt-x=    $minibuf:start~
    20  ])
    21  
    22  set insert:binding = (binding-table [
    23    &Left=  $move-dot-left~
    24    &Right= $move-dot-right~
    25  
    26    &Ctrl-Left=  $move-dot-left-word~
    27    &Ctrl-Right= $move-dot-right-word~
    28    &Alt-Left=   $move-dot-left-word~
    29    &Alt-Right=  $move-dot-right-word~
    30    &Alt-b=      $move-dot-left-word~
    31    &Alt-f=      $move-dot-right-word~
    32  
    33    &Home= $move-dot-sol~
    34    &End=  $move-dot-eol~
    35  
    36    &Backspace= $kill-rune-left~
    37    &Ctrl-H=    $kill-rune-left~
    38    &Delete=    $kill-rune-right~
    39    &Ctrl-W=    $kill-word-left~
    40    &Ctrl-U=    $kill-line-left~
    41    &Ctrl-K=    $kill-line-right~
    42  
    43    &Ctrl-V= $insert-raw~
    44  
    45    &Alt-,=  $lastcmd:start~
    46    &Alt-.=  $insert-last-word~
    47    &Ctrl-R= $histlist:start~
    48    &Ctrl-L= $location:start~
    49    &Ctrl-N= $navigation:start~
    50    &Tab=    $completion:smart-start~
    51    &Up=     $history:start~
    52    &Down=   $end-of-history~
    53  
    54    &Alt-Enter={ insert-at-dot "\n" }
    55  
    56    &Ctrl-A= $apply-autofix~
    57  
    58    &Enter=   $smart-enter~
    59    &Ctrl-D=  $return-eof~
    60  ])
    61  
    62  set command:binding = (binding-table [
    63    &'$'= $move-dot-eol~
    64    &0=   $move-dot-sol~
    65    &D=   $kill-line-right~
    66    &b=   $move-dot-left-word~
    67    &h=   $move-dot-left~
    68    &i=   $close-mode~
    69    &a=   { $move-dot-right~; $close-mode~ }
    70    &j=   $move-dot-down~
    71    &k=   $move-dot-up~
    72    &l=   $move-dot-right~
    73    &w=   $move-dot-right-word~
    74    &x=   $kill-rune-right~
    75  ])
    76  
    77  set listing:binding = (binding-table [
    78    &Up=        $listing:up~
    79    &Down=      $listing:down~
    80    &PageUp=    $listing:page-up~
    81    &PageDown=  $listing:page-down~
    82    &Tab=       $listing:down-cycle~
    83    &Shift-Tab= $listing:up-cycle~
    84  ])
    85  
    86  set histlist:binding = (binding-table [
    87    &Ctrl-D= $histlist:toggle-dedup~
    88  ])
    89  
    90  set navigation:binding = (binding-table [
    91    &Left=     $navigation:left~
    92    &Right=    $navigation:right~
    93    &Up=       $navigation:up~
    94    &Down=     $navigation:down~
    95    &PageUp=   $navigation:page-up~
    96    &PageDown= $navigation:page-down~
    97    &Alt-Up=   $navigation:file-preview-up~
    98    &Alt-Down= $navigation:file-preview-down~
    99    &Enter=    $navigation:insert-selected-and-quit~
   100    &Alt-Enter= $navigation:insert-selected~
   101    &Ctrl-F=   $navigation:trigger-filter~
   102    &Ctrl-H=   $navigation:trigger-shown-hidden~
   103  ])
   104  
   105  set completion:binding = (binding-table [
   106    &Down=     $completion:down~
   107    &Up=       $completion:up~
   108    &Tab=      $completion:down-cycle~
   109    &Shift-Tab=$completion:up-cycle~
   110    &Left=     $completion:left~
   111    &Right=    $completion:right~
   112  ])
   113  
   114  set history:binding = (binding-table [
   115    &Up=       $history:up~
   116    &Down=     $history:down-or-quit~
   117    &Ctrl-'['= $close-mode~
   118  ])
   119  
   120  set lastcmd:binding = (binding-table [
   121    &Alt-,=  $listing:accept~
   122  ])
   123  
   124  set -instant:binding = (binding-table [
   125    &
   126  ])
   127  
   128  # TODO: Avoid duplicating the bindings here by having a base binding table
   129  # shared by insert and minibuf modes (like how the listing modes all share
   130  # listing:binding).
   131  set minibuf:binding = (binding-table [
   132    &Left=  $move-dot-left~
   133    &Right= $move-dot-right~
   134  
   135    &Ctrl-Left=  $move-dot-left-word~
   136    &Ctrl-Right= $move-dot-right-word~
   137    &Alt-Left=   $move-dot-left-word~
   138    &Alt-Right=  $move-dot-right-word~
   139    &Alt-b=      $move-dot-left-word~
   140    &Alt-f=      $move-dot-right-word~
   141  
   142    &Home= $move-dot-sol~
   143    &End=  $move-dot-eol~
   144  
   145    &Backspace= $kill-rune-left~
   146    &Ctrl-H=    $kill-rune-left~
   147    &Delete=    $kill-rune-right~
   148    &Ctrl-W=    $kill-word-left~
   149    &Ctrl-U=    $kill-line-left~
   150    &Ctrl-K=    $kill-line-right~
   151  
   152    &Ctrl-V= $insert-raw~
   153  
   154    &Alt-,=  $lastcmd:start~
   155    &Alt-.=  $insert-last-word~
   156    &Ctrl-R= $histlist:start~
   157    &Ctrl-L= $location:start~
   158    &Ctrl-N= $navigation:start~
   159    &Tab=    $completion:smart-start~
   160    &Up=     $history:start~
   161  ])