Configure tmux to copy to system clipboard

I am a full-stack Ruby on Rails developer with experience in PostgreSQL, Docker, Heroku, and performance optimization. I love exploring new technology stacks and have recently developed an interest in mobile app development using Flutter. My skills in test-driven development and fixing security vulnerabilities have helped me deliver high-quality, reliable code. I am also currently learning about machine learning and its applications in real-world problem-solving. I bring a unique combination of technical expertise, creative problem-solving, and a passion for learning to any team. I am committed to delivering elegant and efficient software solutions and excited to contribute to an innovative and dynamic team that shares this vision.
Tmux is a terminal multiplexer. It lets you switch easily between several programs in one terminal, detach them (they keep running in the background) and reattach them to a different terminal.
I love Tmux because using Tmux + Neovim makes a great IDE.
Depending on which Terminal app you are using, some things in Linux if you copy content from within the Tmux session, you can't paste them outside of Tmux, which can be a big pain most of the time.
To solve that problem we are going to install Xclip, it is a command line utility that is designed to run on any system with an X11 implementation and it allows you to use clipboard from your command line.
Install Xclip
sudo apt install xclip
Configure Tmux to use Xclip
Put following script in your tmux configuration file vim ~/.tmux.conf
#for copying to sys clipboard
bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard"
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard"
bind -T copy-mode-vi C-j send-keys -X copy-pipe-and-cancel "xclip -i -f -selection primary | xclip -i -selection clipboard"
Reload your tmux session usually prefix + r . And your clipboard from tmux session should work again.

