mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-06-03 07:50:49 +00:00
Add bash completion for kill command
This commit is contained in:
parent
b2bb22d883
commit
bd2763d863
12
README.md
12
README.md
|
@ -270,8 +270,8 @@ over time*
|
||||||
|
|
||||||
### bash
|
### bash
|
||||||
|
|
||||||
Fuzzy completion can be triggered if the word before the cursor ends
|
Fuzzy completion for files and directories can be triggered if the word before
|
||||||
with the trigger sequence which is by default `**`.
|
the cursor ends with the trigger sequence which is by default `**`.
|
||||||
|
|
||||||
- `COMMAND [DIRECTORY/][FUZZY_PATTERN]**<TAB>`
|
- `COMMAND [DIRECTORY/][FUZZY_PATTERN]**<TAB>`
|
||||||
|
|
||||||
|
@ -299,6 +299,14 @@ cd **<TAB>
|
||||||
cd ~/github/fzf**<TAB>
|
cd ~/github/fzf**<TAB>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Fuzzy completion for PIDs are provided for kill command. In this case
|
||||||
|
there is no trigger sequence, just press tab key after kill command.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Can select multiple processes with <TAB> or <Shift-TAB> keys
|
||||||
|
kill -9 <TAB>
|
||||||
|
```
|
||||||
|
|
||||||
#### Settings
|
#### Settings
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|
|
@ -83,6 +83,18 @@ _fzf_dir_completion() {
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_fzf_kill_completion() {
|
||||||
|
local selected
|
||||||
|
tput sc
|
||||||
|
selected=$(ps -ef | sed 1d | fzf -m | awk '{print $2}' | tr '\n' ' ')
|
||||||
|
tput rc
|
||||||
|
|
||||||
|
if [ -n "$selected" ]; then
|
||||||
|
COMPREPLY=( "$selected" )
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
complete -F _fzf_opts_completion fzf
|
complete -F _fzf_opts_completion fzf
|
||||||
|
|
||||||
# Directory
|
# Directory
|
||||||
|
@ -108,3 +120,6 @@ for cmd in "
|
||||||
complete -F _fzf_all_completion -o default -o bashdefault $cmd
|
complete -F _fzf_all_completion -o default -o bashdefault $cmd
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Kill completion
|
||||||
|
complete -F _fzf_kill_completion -o nospace -o default -o bashdefault kill
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user