# Refer to buffer(mouse) in csh



## Seeker (Dec 4, 2009)

With mouse, I've selected some text in terminal.
Now it is in "some" buffer, "somwhere".
How do I refer to it in csh shell?
Ie: (_I will now act, like "$" holds a value of buffer_)

```
# echo $
```


----------



## graudeejs (Dec 4, 2009)

You hit middle mouse button, and text will be posted....
It's not shell specific
It works all over FreeBSD and Linux, probably on other unixes as well, not sure though

It works under X as well


----------



## SirDice (Dec 4, 2009)

Shift-Ins usually works too.


----------



## expl (Dec 4, 2009)

There is no buffer in the mechanics of mouse copy/paste. When you press the 3rd button the daemon responsible for the mouse c/p will just directly read from the text that is selected and write it into input, thats why you will not be able to paste if the selection is lost. When X11 server is running the daemon responsible is the "mouse" driver that is part of the X11, when there is no X running (on FreeBSD) I think its "moused" that is handling it. So to wrap it up, in order to access the "virtual buffer" your script/app has to be able to get text selections, when you are running X11 that is possible by using xlib calls.


----------



## Seeker (Dec 4, 2009)

Guys. I am already constantly using middle mouse button for pasting.

It is just that I am tired of opening a file with vi, then pressing "i" and then pressing middle mouse button, to put some text in file.
and closing file with ":x"

I would rather do this (_Acting, like "$" holds a value of buffer_):

```
# echo $ >> file.txt
```


----------



## graudeejs (Dec 4, 2009)

Under X you can use x11/xclip
I don't think it works without X [check dependencies in Makefile]


----------



## aragon (Dec 4, 2009)

Seeker said:
			
		

> I would rather do this (_Acting, like "$" holds a value of buffer_):
> 
> ```
> # echo $ >> file.txt
> ```


Try this:


```
cat >>file.txt
```

After that hit middle click to paste the contents and finish it off with Ctrl+D on a newline.


----------



## Seeker (Dec 4, 2009)

aragon said:
			
		

> Try this:
> 
> 
> ```
> ...



Works like a charm!


----------



## jrick (Dec 5, 2009)

Seeker said:
			
		

> Guys. I am already constantly using middle mouse button for pasting.
> 
> It is just that I am tired of opening a file with vi, then pressing "i" and then pressing middle mouse button, to put some text in file.
> and closing file with ":x"
> ...



http://tools.suckless.org/sselp, get it by installing x11/sselp.


----------

