# ^Xa to insert all matches
zle -C all-matches complete-word _generic
bindkey '^Xa' all-matches
zstyle ':completion:all-matches:*' old-matches only
zstyle ':completion:all-matches::::' completer _all_matches

UPDATE: The snippet above brings insert-completions to zsh. Thanks, Trevor Joynson, who has provided the solution in comment.

Command insert-completions (see man bash) is the feature I most miss in bash.

[insert-completions] Insert all completions of the text before point that would have been generated by possible-completions.

Its default binding is M-*, a.k.a, Alt-Shift-8 or Meta-Shift-8.

It is useful for simple batch operations, such as removing all git branches starting with feature/.

After I switched to zsh, I have been looking for a similar command, but for no results. However, I just discovered the zsh way to select multiple completions recently, using accept-and-hold (see man zshzle).

[accept-and-hold] Push the contents of the buffer on the buffer stack and execute it.

The default binding is M-a (a.k.a, Alt-a or Meta-a). If the command line has input content ls, M-a executes the line ls without clearing the input.

It seems unrelated. But if completion menu is activated and a menu item is selected (the simplest way is Tab twice), accept-and-hold accepts the current menu item without closing completing menu. So it is possible to select multiple items by navigating to wanted items, and type M-a to select them.

RVM has since moved to using .profile, so just put the “cd .” in .profile and it will work

— Mikael Wikman commented below

Original Article

Tmux is a terminal multiplexer. I switched to Tmux from GNU Screen recently.

I work on several Ruby projects. I use RVM to manage gem set for different projects, and use rvmrc file to switch gem set automatically. I usually start a Tmux session for a project in its root directory, so all the windows and panes in the session use the project root as default directory. The problem is, the new created shell in the session does not load .rvmrc in the root directory. I have to force loading the file using “cd .