mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-21 23:01:05 +00:00
feat: new <C-A> and <C-E> keybindings to select entire line for the input component (#2439)
This commit is contained in:
parent
2d210ae557
commit
51de941f79
4 changed files with 40 additions and 35 deletions
52
.github/workflows/draft.yml
vendored
52
.github/workflows/draft.yml
vendored
|
|
@ -176,6 +176,32 @@ jobs:
|
||||||
name: yazi-${{ matrix.arch }}.snap
|
name: yazi-${{ matrix.arch }}.snap
|
||||||
path: yazi-${{ matrix.arch }}.snap
|
path: yazi-${{ matrix.arch }}.snap
|
||||||
|
|
||||||
|
snap:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [build-snap]
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
pattern: yazi-*.snap
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
|
- name: Setup snapcraft
|
||||||
|
run: sudo snap install --classic snapcraft
|
||||||
|
|
||||||
|
- name: Push snap to candidate channel
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
env:
|
||||||
|
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
|
||||||
|
run: |
|
||||||
|
parallel 'snapcraft push -v --release latest/candidate {}' ::: yazi-*.snap
|
||||||
|
|
||||||
|
- name: Push snap to edge channel
|
||||||
|
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
env:
|
||||||
|
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
|
||||||
|
run: |
|
||||||
|
parallel 'snapcraft push -v --release latest/edge {}' ::: yazi-*.snap
|
||||||
|
|
||||||
draft:
|
draft:
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
permissions:
|
permissions:
|
||||||
|
|
@ -232,29 +258,3 @@ jobs:
|
||||||
name: Nightly Build
|
name: Nightly Build
|
||||||
body: ${{ env.NIGHTLY_BODY }}
|
body: ${{ env.NIGHTLY_BODY }}
|
||||||
target_commitish: ${{ github.sha }}
|
target_commitish: ${{ github.sha }}
|
||||||
|
|
||||||
snap:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [build-snap]
|
|
||||||
steps:
|
|
||||||
- uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
pattern: yazi-*.snap
|
|
||||||
merge-multiple: true
|
|
||||||
|
|
||||||
- name: Setup snapcraft
|
|
||||||
run: sudo snap install --classic snapcraft
|
|
||||||
|
|
||||||
- name: Push snap to candidate channel
|
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
|
||||||
env:
|
|
||||||
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
|
|
||||||
run: |
|
|
||||||
parallel 'snapcraft push -v --release latest/candidate {}' ::: yazi-*.snap
|
|
||||||
|
|
||||||
- name: Push snap to edge channel
|
|
||||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
||||||
env:
|
|
||||||
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
|
|
||||||
run: |
|
|
||||||
parallel 'snapcraft push -v --release latest/edge {}' ::: yazi-*.snap
|
|
||||||
|
|
|
||||||
|
|
@ -237,9 +237,13 @@ keymap = [
|
||||||
{ on = "a", run = "insert --append", desc = "Enter append mode" },
|
{ on = "a", run = "insert --append", desc = "Enter append mode" },
|
||||||
{ on = "A", run = [ "move eol", "insert --append" ], desc = "Move to the EOL, and enter append mode" },
|
{ on = "A", run = [ "move eol", "insert --append" ], desc = "Move to the EOL, and enter append mode" },
|
||||||
{ on = "v", run = "visual", desc = "Enter visual mode" },
|
{ on = "v", run = "visual", desc = "Enter visual mode" },
|
||||||
{ on = "V", run = [ "move bol", "visual", "move eol" ], desc = "Enter visual mode and select all" },
|
|
||||||
{ on = "r", run = "replace", desc = "Replace a single character" },
|
{ on = "r", run = "replace", desc = "Replace a single character" },
|
||||||
|
|
||||||
|
# Selection
|
||||||
|
{ on = "V", run = [ "move bol", "visual", "move eol" ], desc = "Select from BOL to EOL" },
|
||||||
|
{ on = "<C-A>", run = [ "move eol", "visual", "move bol" ], desc = "Select from EOL to BOL" },
|
||||||
|
{ on = "<C-E>", run = [ "move bol", "visual", "move eol" ], desc = "Select from BOL to EOL" },
|
||||||
|
|
||||||
# Character-wise movement
|
# Character-wise movement
|
||||||
{ on = "h", run = "move -1", desc = "Move back a character" },
|
{ on = "h", run = "move -1", desc = "Move back a character" },
|
||||||
{ on = "l", run = "move 1", desc = "Move forward a character" },
|
{ on = "l", run = "move 1", desc = "Move forward a character" },
|
||||||
|
|
|
||||||
|
|
@ -4,16 +4,15 @@ use yazi_shared::event::CmdCow;
|
||||||
use crate::input::{Input, InputMode, op::InputOp};
|
use crate::input::{Input, InputMode, op::InputOp};
|
||||||
|
|
||||||
impl Input {
|
impl Input {
|
||||||
#[inline]
|
|
||||||
pub fn visual(&mut self, _: CmdCow) {
|
pub fn visual(&mut self, _: CmdCow) {
|
||||||
let snap = self.snap_mut();
|
if self.snap().mode != InputMode::Normal {
|
||||||
if snap.mode != InputMode::Normal {
|
self.escape(());
|
||||||
return;
|
|
||||||
} else if snap.value.is_empty() {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
snap.op = InputOp::Select(snap.cursor);
|
let snap = self.snap_mut();
|
||||||
render!();
|
if !snap.value.is_empty() {
|
||||||
|
snap.op = InputOp::Select(snap.cursor);
|
||||||
|
render!();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -277,6 +277,8 @@ impl<'a> Executor<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
InputMode::Insert => {
|
InputMode::Insert => {
|
||||||
|
on!(visual);
|
||||||
|
|
||||||
on!(backspace);
|
on!(backspace);
|
||||||
on!(kill);
|
on!(kill);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue