I'm trying to minimize using of mouse. Copying text in terminal is the mostly inconvenient activity for mouse avoiding. Now, tmux helping me to obtain this purpose. However, I regularly needs to copy text currently entered to bash prompt. Currently entered text means that I typed some symbols in prompt, but didn't press Enter. tmux way for this purpose needs for too much keyboard shortcuts. I'd like some script, that copying current text from prompt to clipboard. I want to add this script to ~/.bashrc and assign keyboard shortcut to. How to write this script?
Bash script for copying text currently entered to prompt
bash;terminal;bash script
copy_buffer() {  printf %s $READLINE_LINE | xclip -sel clipboard}bind -x '\C-[c: copy_buffer'Would store the current buffer to the clipboard selection upon pressing Alt-C.Also note that bash (like all shells), has support for copy-paste inside the prompt. For instance Ctrl+U would kill the full buffer and paste (yank) it, leaving it in the yank buffer for you to yank it again later on would you want to.See zsh or tcsh for more advanced features.