Commit 2569af728e2a824afb35b5cd2081ba4676b6c6c9

Add Ctrl-X+b bash key to insert git branch name
More convenient than $(b) as it allows editing the name.
Author: xaizek
Author date (UTC): 2026-06-22 17:25
Committer name: xaizek
Committer date (UTC): 2026-06-22 17:25
Parent(s): d7d1d57c50251647759d00fdcdbf24a85716f06a
Signing key: 99DC5E4DB05F6BE2
Tree: cc493a2b00fd2b9e8417e0b2904a945dbaf48803
File Lines added Lines deleted
bashrc 16 0
File bashrc changed (mode: 100644) (index 5d92641..b04ac4b)
... ... function alias_completion {
785 785 alias_completion alias_completion
786 786 unset -f alias_completion unset -f alias_completion
787 787
788 # ==============================================================================
789 # binds
790
791 # the bind won't work in non-interactive shell
792 if [[ $- =~ .*i.* ]]; then
793 # insert name of the current branch on Ctrl-X+b
794 function _insert_branch() {
795 local prefix=${READLINE_LINE::READLINE_POINT}
796 local suffix=${READLINE_LINE:READLINE_POINT}
797 local branch=$(b)
798 READLINE_LINE=$prefix"$(b)"$suffix
799 READLINE_POINT=$(( READLINE_POINT + ${#branch} ))
800 }
801 bind -x '"\C-xb": _insert_branch'
802 fi
803
788 804 # ============================================================================== # ==============================================================================
789 805 # sourcing guard end # sourcing guard end
790 806
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/dotfiles

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/dotfiles

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master