Populate repo
This commit is contained in:
19
tmux/.tmux/plugins/tmux-cowboy/LICENSE.md
Normal file
19
tmux/.tmux/plugins/tmux-cowboy/LICENSE.md
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (C) Bruno Sutic
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
24
tmux/.tmux/plugins/tmux-cowboy/README.md
Normal file
24
tmux/.tmux/plugins/tmux-cowboy/README.md
Normal file
@ -0,0 +1,24 @@
|
||||
# tmux-cowboy
|
||||
|
||||
~~Just kill that damned stale process!~~ Send a signal to a process running
|
||||
inside a current pane.
|
||||
|
||||
Useful when you're annoyed by the stale program and just want to get rid of it.
|
||||
|
||||
NOTE: this plugin calls a `kill -9 <pid>` command and that's potentially
|
||||
dangerous. Use this plugin at your own responsibility. That said, I'm using
|
||||
this on my personal computer. If there are bugs I'll be the first to know.
|
||||
|
||||
### Key bindings
|
||||
|
||||
- <kbd>prefix</kbd> <kbd> * </kbd> - end the process running in the current
|
||||
pane with `kill -9`
|
||||
|
||||
### FAQ
|
||||
|
||||
Q: What's with the name? Why "cowboy"?<br/>
|
||||
A: Because you go pew-pew killing those bad processes.
|
||||
|
||||
### License
|
||||
|
||||
[MIT](LICENSE.md)
|
9
tmux/.tmux/plugins/tmux-cowboy/cowboy.tmux
Executable file
9
tmux/.tmux/plugins/tmux-cowboy/cowboy.tmux
Executable file
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
SCRIPTS_DIR="${CURRENT_DIR}/scripts"
|
||||
|
||||
main() {
|
||||
tmux bind-key "*" run-shell "$SCRIPTS_DIR/kill.sh KILL"
|
||||
}
|
||||
main
|
26
tmux/.tmux/plugins/tmux-cowboy/scripts/kill.sh
Executable file
26
tmux/.tmux/plugins/tmux-cowboy/scripts/kill.sh
Executable file
@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SIGNAL="${1:-KILL}"
|
||||
|
||||
pane_pid() {
|
||||
tmux display-message -p "#{pane_pid}"
|
||||
}
|
||||
|
||||
pid() {
|
||||
local pane_pid="$(pane_pid)"
|
||||
|
||||
ps -ao "ppid pid" |
|
||||
sed "s/^ *//" |
|
||||
grep "^${pane_pid}" |
|
||||
cut -d' ' -f2- |
|
||||
head -n 1
|
||||
}
|
||||
|
||||
main() {
|
||||
local pid="$(pid)"
|
||||
|
||||
if [ -n "$pid" ]; then
|
||||
kill -${SIGNAL} $pid
|
||||
fi
|
||||
}
|
||||
main
|
Reference in New Issue
Block a user