Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Some good ideas there. I wonder if the autocomplete for `kill` could be scripted for other shells.


zsh has completion for kill, pkill, etc. out of the box. The default for kill is to only shown processes from the current pty, but you can change that with something like:

  zstyle ':completion:*:*:kill:*:processes' command 'ps xo pid,user:10,cmd'
I also filter some processes that I almost never want to kill to clean it a bit up:

  zstyle ':completion:*:*:kill:*:processes' command 'ps xo pid,user:10,cmd | grep -Ev "(ps xo|firefox|/bin/zsh|-zsh|runsv)"'
As with most things in zsh, you can make it as fancy as you want, but this is enough for me.

zsh is really powerful, but the downside is that a lot of these things have a bit of a "magic incantation factor" unless you're pretty familiar with zsh scripting. I guess this is why people use oh-my-zsh and things like that.


The main issue I always have is that as soon as I have to use another system or ssh into another system I lose all of that.


Can't have it all I'm afraid. For this reason I keep my zshrc contained to one file so I can easily move it around, but it does require zsh to be available in the first place of course.

All things considered, I'd rather optimize for the 99% of the time I'm on my local machine than the 1% I'm on a remote machine.


If you're an fzf user, its integration for `kill *<tab>` has been a game changer.


I’m just curious why you need to kill stuff so often. I think I probably do it once a month at most.


Not the person you responded to, but I probably kill an octave or matlab terminal daily. Oops, it turns out this matrix is too big to solve directly. Oops, norm2 takes forever and norm1 would have been good enough.


I didn't mean to imply that I use it "so often," just that it makes it much easier when I do.

I have to `kill -9` neovim once or twice per week due to <https://neovim.discourse.group/t/how-to-debug-intermittent-n...>, that's probably the most frequent culprit.

I really need to compile a debug version and help get that sorted.


I suspect they're talking about fzf in general, using `kill` as an example, rather than saying they `kill` stuff often. But I could have misinterpreted their comment.


tbf, thats an existing bash-complete-ism, fzf.bash just makes it cooler.


My own, personal, use-case is to completely nuke `bash-complet*` off my machine.

To me, bash-completion is horrible. I am looking for a tarball to unwind, and I only remember that it it started with "foo-" and it sure did not end in ".tar" (trying to save keystrokes, y'know). Trying C-i does not pull up anything. Argghh. I am on a machine with bash-completion!

---

I often hit C-a then "a" to get an invalid command (still saved to my hist), or C-a C-k if I think there is nothing else going into the kill-ring. bash-completion absolutely messes with me.

If it works for You, that is great. I really dislike it.


Huh, I had no idea. Just `kill <tab>` then? Will give it a shot next time I'm ak.


`kill <tab>` will list all pids, `killall <tab>` lists every process name.

fzf.bash just turns `kill` into `ps (args) | fzf`, and does not yet have an equivalent for `killall`.


Fish autocompletes kill, fg, bg, killall, etc out-of-the-box already.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: