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