Skip to content

Commit

Permalink
docs: fix keybindings in tips.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi committed Jan 30, 2024
1 parent ba8d893 commit 8165370
Showing 1 changed file with 27 additions and 44 deletions.
71 changes: 27 additions & 44 deletions docs/tips.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,21 @@ If you prefer sharp corners for the border, you can remove `:type(ui.Border.ROUN
Add the keybindings to your `keymap.toml`:

```toml
[manager]
prepend_keymap = [
{ on = [ "<C-s>" ], exec = 'shell "$SHELL" --block --confirm', desc = "Open shell here" },
# ...Your other keybindings if any
]
[[manager.prepend_keymap]]
on = [ "<C-s>" ]
exec = 'shell "$SHELL" --block --confirm'
desc = "Open shell here"
```

## Close input by once `<Esc>` press

You can change the `<Esc>` of input component from the default `escape` to `close` command, in your `keymap.toml`:

```toml
[input]
prepend_keymap = [
{ on = [ "<Esc>" ], exec = "close", desc = "Cancel input" },
# ...Your other keybindings if any
]
[[manager.prepend_keymap]]
on = [ "<Esc>" ]
exec = "close"
desc = "Cancel input"
```

to exiting input directly, without entering Vi mode, making it behave like a regular input box.
Expand All @@ -96,59 +94,44 @@ return {
Then bind it for `l` key, in your `keymap.toml`:

```toml
[manager]
prepend_keymap = [
{
on = [ "l" ],
exec = "plugin --sync smart-enter",
desc = "Enter the child directory, or open the file"
},

# ...Your other keybindings if any
]
[[manager.prepend_keymap]]
on = [ "l" ]
exec = "plugin --sync smart-enter"
desc = "Enter the child directory, or open the file"
```

## Drag and drop via [`dragon`](https://github.com/mwh/dragon)

Original post: https://github.com/sxyazi/yazi/discussions/327

```toml
[manager]
prepend_keymap = [
{ on = [ "<C-n>" ], exec = '''
shell 'dragon -x -i -T "$1"' --confirm
''' },

# ...Your other keybindings if any
]
[[manager.prepend_keymap]]
on = [ "<C-n>" ]
exec = '''
shell 'dragon -x -i -T "$1"' --confirm
'''
```

## Copy selected files to the system clipboard while yanking

Yazi allows multiple commands to be bound to a single key, so you can set `y` to not only do the `yank` but also execute a shell script:

```toml
[manager]
prepend_keymap = [
{ on = [ "y" ], exec = [ "yank", '''
shell --confirm 'echo "$@" | xclip -i -selection clipboard -t text/uri-list'
''' ] },

# ...Your other keybindings if any
]
[[manager.prepend_keymap]]
on = [ "y" ]
exec = [ "yank", '''
shell --confirm 'echo "$@" | xclip -i -selection clipboard -t text/uri-list'
''' ]
```

The above is available on X11, there is also a Wayland version (Thanks [@hurutparittya for sharing this](https://discord.com/channels/1136203602898194542/1136203604076802092/1188498323867455619) in Yazi's discord server):

```toml
[manager]
prepend_keymap = [
{ on = [ "y" ], exec = [ "yank", '''
shell --confirm 'for path in "$@"; do echo "file://$path"; done | wl-copy -t text/uri-list'
''' ] },

# ...Your other keybindings if any
]
[[manager.prepend_keymap]]
on = [ "y" ]
exec = [ "yank", '''
shell --confirm 'for path in "$@"; do echo "file://$path"; done | wl-copy -t text/uri-list'
''' ]
```

## No status bar
Expand Down

0 comments on commit 8165370

Please sign in to comment.