Files
fish-shell/tests/checks/vi.fish
Daniel Müller 5b39efc96d Support incrementing/decrementing the number below the cursor
Vim supports incrementing & decrementing the number below the cursor (or
after it) via Ctrl-a and Ctrl-x, respectively. Given fish's Vi mode
support, it makes sense to provide similar functionality when working on
the command line, to provide a more natural environment for Vim users.
With this change we add the necessary functionality.

Closes: #8320
Closes #11570
2025-07-03 14:38:42 +02:00

116 lines
2.9 KiB
Fish

# RUN: %fish --interactive %s
fish_vi_key_bindings
commandline '1'; commandline --cursor 0; fish_vi_dec
commandline --current-buffer
# CHECK: 0
commandline '0'; commandline --cursor 0; fish_vi_dec
commandline --current-buffer
# CHECK: -1
commandline -- '-1'; commandline --cursor 0; fish_vi_dec
commandline --current-buffer
# CHECK: -2
commandline -- '-1'; commandline --cursor 0; fish_vi_inc
commandline --current-buffer
# CHECK: 0
commandline '0'; commandline --cursor 0; fish_vi_inc
commandline --current-buffer
# CHECK: 1
commandline '123'; commandline --cursor 0; fish_vi_inc
commandline --current-buffer
# CHECK: 124
commandline '123'; commandline --cursor 0; fish_vi_dec
commandline --current-buffer
# CHECK: 122
commandline '123'; commandline --cursor 1; fish_vi_inc
commandline --current-buffer
# CHECK: 124
commandline '123'; commandline --cursor 1; fish_vi_dec
commandline --current-buffer
# CHECK: 122
commandline '123'; commandline --cursor 2; fish_vi_inc
commandline --current-buffer
# CHECK: 124
commandline '123'; commandline --cursor 2; fish_vi_dec
commandline --current-buffer
# CHECK: 122
commandline 'abc123'; commandline --cursor 1; fish_vi_inc
commandline --current-buffer
# CHECK: abc124
commandline 'abc123'; commandline --cursor 1; fish_vi_dec
commandline --current-buffer
# CHECK: abc122
commandline 'abc123def'; commandline --cursor 1; fish_vi_inc
commandline --current-buffer
# CHECK: abc124def
commandline 'abc123def'; commandline --cursor 1; fish_vi_dec
commandline --current-buffer
# CHECK: abc122def
commandline 'abc123def'; commandline --cursor 5; fish_vi_inc
commandline --current-buffer
# CHECK: abc124def
commandline 'abc123def'; commandline --cursor 5; fish_vi_dec
commandline --current-buffer
# CHECK: abc122def
commandline 'abc123def'; commandline --cursor 6; fish_vi_inc
commandline --current-buffer
# CHECK: abc123def
commandline 'abc123def'; commandline --cursor 6; fish_vi_dec
commandline --current-buffer
# CHECK: abc123def
commandline 'abc99def'; commandline --cursor 1; fish_vi_inc
commandline --current-buffer
# CHECK: abc100def
commandline 'abc99def'; commandline --cursor 1; fish_vi_dec
commandline --current-buffer
# CHECK: abc98def
commandline 'abc-99def'; commandline --cursor 1; fish_vi_inc
commandline --current-buffer
# CHECK: abc-98def
commandline 'abc-99def'; commandline --cursor 1; fish_vi_dec
commandline --current-buffer
# CHECK: abc-100def
commandline '2022-04-09'; commandline --cursor 7; fish_vi_inc
commandline --current-buffer
# CHECK: 2022-04-08
commandline 'to 2022-04-09'; commandline --cursor 4; fish_vi_inc
commandline --current-buffer
# CHECK: to 2023-04-09
commandline 'to 2022-04-09'; commandline --cursor 4; fish_vi_dec
commandline --current-buffer
# CHECK: to 2021-04-09
commandline 'to 2022-04-09'; commandline --cursor 11; fish_vi_dec
commandline --current-buffer
# CHECK: to 2022-04-10
commandline 'to 2022-04-09'; commandline --cursor 11; fish_vi_inc
commandline --current-buffer
# CHECK: to 2022-04-08