mirror of
https://github.com/alexpasmantier/television.git
synced 2025-07-29 06:11:37 +00:00
fix(nushell): append to existing nu keybindings instead of replacing them (#635)
## 📺 PR Description Fixes #628 ## Checklist <!-- a quick pass through the following items to make sure you haven't forgotten anything --> - [ ] my commits **and PR title** follow the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) format - [ ] if this is a new feature, I have added tests to consolidate the feature and prevent regressions - [ ] if this is a bug fix, I have added a test that reproduces the bug (if applicable) - [ ] I have added a reasonable amount of documentation to the code where appropriate
This commit is contained in:
parent
ecf05a0148
commit
7079d48aa7
19
justfile
19
justfile
@ -75,21 +75,10 @@ alias b := build
|
||||
# Build the project in release mode
|
||||
br: (build 'release')
|
||||
|
||||
|
||||
# test the zsh shell completion script in debug mode
|
||||
# Run: `source <(just generate-zsh-completion)` directly in zsh
|
||||
@generate-zsh-completion:
|
||||
cargo run -- init zsh | sed 's/tv /.\/target\/debug\/tv /'
|
||||
|
||||
# test the fish shell completion script in debug mode
|
||||
# Run: `source <(just generate-fish-completion)` directly in fish
|
||||
@generate-fish-completion:
|
||||
cargo run -- init fish | sed '2,$ s/tv /.\/target\/debug\/tv /'
|
||||
|
||||
# test the bash shell completion script in debug mode
|
||||
# Run: `source <(just generate-bash-completion)` directly in bash
|
||||
@generate-bash-completion:
|
||||
cargo run -- init bash | sed 's/tv /.\/target\/debug\/tv /'
|
||||
# Generate a dev shell integration script for local development
|
||||
@generate-dev-shell-integration shell='zsh':
|
||||
cargo run -- init {{ shell }} | sed 's/tv /.\/target\/debug\/tv /' > dev_shell_integration.{{ shell }}
|
||||
echo 'To activate {{ shell }} dev integration, run: `source dev_shell_integration.{{ shell }}`'
|
||||
|
||||
# Update the project's changelog
|
||||
@update-changelog:
|
||||
|
16
television/utils/shell/README.md
Normal file
16
television/utils/shell/README.md
Normal file
@ -0,0 +1,16 @@
|
||||
# Developing locally
|
||||
|
||||
In order to develop locally on the shell integration scripts, here are a couple of steps to follow:
|
||||
|
||||
0. Clone the repo, make sure you're up to date and have the [just](https://github.com/casey/just) command runner installed.
|
||||
1. Make your changes to any one of the shell scripts (`television/utils/shell/`)
|
||||
2. Generate a dev version of the script by running:
|
||||
```sh
|
||||
just generate-dev-shell-integration zsh
|
||||
```
|
||||
(or `fish`, `bash`, etc. depending on the shell you are using)
|
||||
3. Source the generated script in your shell:
|
||||
```sh
|
||||
source dev_shell_integration.zsh
|
||||
```
|
||||
4. Test the changes by using the shell integration keybindings or commands in your terminal.
|
@ -1,4 +1,4 @@
|
||||
function __tv_parse_commandline --description 'Parse the current command line token and return split of existing filepath, and tv query'
|
||||
function __tv_parse_commandline --description 'Parse the current command line token and return split of existing filepath, and query'
|
||||
# credits to the junegunn/fzf project
|
||||
# https://github.com/junegunn/fzf/blob/9c1a47acf7453f9dad5905b7f23ad06e5195d51f/shell/key-bindings.fish#L53-L131
|
||||
|
||||
|
@ -29,29 +29,31 @@ def tv_shell_history [] {
|
||||
}
|
||||
|
||||
# Bind custom keybindings
|
||||
|
||||
$env.config = (
|
||||
$env.config
|
||||
| upsert keybindings [
|
||||
{
|
||||
name: tv_completion,
|
||||
modifier: Control,
|
||||
keycode: char_t,
|
||||
mode: [vi_normal, vi_insert, emacs],
|
||||
event: {
|
||||
send: executehostcommand,
|
||||
cmd: "tv_smart_autocomplete"
|
||||
}
|
||||
}
|
||||
{
|
||||
name: tv_history,
|
||||
modifier: Control,
|
||||
keycode: char_r,
|
||||
mode: [vi_normal, vi_insert, emacs],
|
||||
event: {
|
||||
send: executehostcommand,
|
||||
cmd: "tv_shell_history"
|
||||
}
|
||||
}
|
||||
]
|
||||
| upsert keybindings (
|
||||
$env.config.keybindings
|
||||
| append [
|
||||
{
|
||||
name: tv_completion,
|
||||
modifier: Control,
|
||||
keycode: char_t,
|
||||
mode: [vi_normal, vi_insert, emacs],
|
||||
event: {
|
||||
send: executehostcommand,
|
||||
cmd: "tv_smart_autocomplete"
|
||||
}
|
||||
}
|
||||
{
|
||||
name: tv_history,
|
||||
modifier: Control,
|
||||
keycode: char_r,
|
||||
mode: [vi_normal, vi_insert, emacs],
|
||||
event: {
|
||||
send: executehostcommand,
|
||||
cmd: "tv_shell_history"
|
||||
}
|
||||
}
|
||||
]
|
||||
)
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user