Copy and paste

is essential for writing code ;)

Nice alias:

alias cb='xclip -selection clipboard'

And also

alias cpath='echo -n "$(pwd)" | cb'

So you can quickly take the current directory and open it in another terminal emulator, or in say firefox.

But the best part is, you can use these from vim (this is unnecessary if you have vim compiled with +clipboard; use vim –version to check):

! cb

to cut

r ! cb -o

to paste.

I had trouble getting it to work because I had the alias in ~/.zshrc, which is not read when zsh is run non-interactive. Changing to ~/.zshenv fixes.

Advertisements
This entry was posted in zsh. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s