zoxide/contrib/completions/zoxide.elv

112 lines
4.3 KiB
Plaintext
Raw Normal View History

2021-05-03 21:03:23 +00:00
2021-08-15 11:56:56 +00:00
use builtin;
use str;
2022-01-20 21:44:28 +00:00
set edit:completion:arg-completer[zoxide] = {|@words|
fn spaces {|n|
2021-08-15 11:56:56 +00:00
builtin:repeat $n ' ' | str:join ''
2021-05-03 21:03:23 +00:00
}
2022-01-20 21:44:28 +00:00
fn cand {|text desc|
2021-10-20 18:31:06 +00:00
edit:complex-candidate $text &display=$text' '(spaces (- 14 (wcswidth $text)))$desc
2021-05-03 21:03:23 +00:00
}
2021-10-20 18:31:06 +00:00
var command = 'zoxide'
2021-08-15 11:56:56 +00:00
for word $words[1..-1] {
if (str:has-prefix $word '-') {
2021-05-03 21:03:23 +00:00
break
}
2021-10-20 18:31:06 +00:00
set command = $command';'$word
2021-05-03 21:03:23 +00:00
}
2021-10-20 18:31:06 +00:00
var completions = [
2021-05-03 21:03:23 +00:00
&'zoxide'= {
2021-08-15 11:56:56 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
cand -V 'Print version information'
cand --version 'Print version information'
2021-05-03 21:03:23 +00:00
cand add 'Add a new directory or increment its rank'
2023-01-07 17:28:10 +00:00
cand edit 'Edit the database'
2021-05-03 21:03:23 +00:00
cand import 'Import entries from another application'
cand init 'Generate shell configuration'
cand query 'Search for a directory in the database'
cand remove 'Remove a directory from the database'
}
&'zoxide;add'= {
2021-08-15 11:56:56 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
cand -V 'Print version information'
cand --version 'Print version information'
2021-05-03 21:03:23 +00:00
}
2023-01-07 17:28:10 +00:00
&'zoxide;edit'= {
cand -h 'Print help information'
cand --help 'Print help information'
cand -V 'Print version information'
cand --version 'Print version information'
cand decrement 'decrement'
cand delete 'delete'
cand increment 'increment'
cand reload 'reload'
}
&'zoxide;edit;decrement'= {
cand -h 'Print help information'
cand --help 'Print help information'
cand -V 'Print version information'
cand --version 'Print version information'
}
&'zoxide;edit;delete'= {
cand -h 'Print help information'
cand --help 'Print help information'
cand -V 'Print version information'
cand --version 'Print version information'
}
&'zoxide;edit;increment'= {
cand -h 'Print help information'
cand --help 'Print help information'
cand -V 'Print version information'
cand --version 'Print version information'
}
&'zoxide;edit;reload'= {
cand -h 'Print help information'
cand --help 'Print help information'
cand -V 'Print version information'
cand --version 'Print version information'
}
2021-05-03 21:03:23 +00:00
&'zoxide;import'= {
cand --from 'Application to import from'
cand --merge 'Merge into existing database'
2021-08-15 11:56:56 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
cand -V 'Print version information'
cand --version 'Print version information'
2021-05-03 21:03:23 +00:00
}
&'zoxide;init'= {
2022-04-10 22:11:51 +00:00
cand --cmd 'Changes the prefix of the `z` and `zi` commands'
cand --hook 'Changes how often zoxide increments a directory''s score'
cand --no-cmd 'Prevents zoxide from defining the `z` and `zi` commands'
2021-08-15 11:56:56 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
cand -V 'Print version information'
cand --version 'Print version information'
2021-05-03 21:03:23 +00:00
}
&'zoxide;query'= {
cand --exclude 'Exclude the current directory'
2021-05-08 03:05:34 +00:00
cand --all 'Show deleted directories'
2021-05-03 21:03:23 +00:00
cand -i 'Use interactive selection'
cand --interactive 'Use interactive selection'
cand -l 'List all matching directories'
cand --list 'List all matching directories'
cand -s 'Print score with results'
cand --score 'Print score with results'
2021-08-15 11:56:56 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
cand -V 'Print version information'
cand --version 'Print version information'
2021-05-03 21:03:23 +00:00
}
&'zoxide;remove'= {
2021-08-15 11:56:56 +00:00
cand -h 'Print help information'
cand --help 'Print help information'
cand -V 'Print version information'
cand --version 'Print version information'
2021-05-03 21:03:23 +00:00
}
]
$completions[$command]
}