Comments (13)
yeah, that's doable, I need do some research on its code
from cliphist.
Greetings, I'm trying to integrate greenclip and cliphist, but I still do not know how to do it
(list (s-split "\t" (shell-command-to-string "clipster -c -o -n 5 | awk '{gsub(/^ +| +$/,\"\")} {print \"\" $0 \"\"}'")))
I think that line can be used to obtain the elements of the clipboard
from cliphist.
Pull request is welcomed.
I'm not sure how to use greepclip.
Looks you need run greeclip daemon
as clipboard server first. paste something, then run greenclip print
to list all items. I noticed line-feed
is changed into "\n" (one slash, one "n" character).
Check below code:
(autoload 'cliphist-flycut-read-items "cliphist-flycut" nil)
(autoload 'cliphist-parcellite-read-items "cliphist-parcellite" nil)
(autoload 'cliphist-clipit-read-items "cliphist-clipit" nil)
For example, you could use cliphist-clipit-read-items
as sample,
(split-string (shell-command-to-string "greenclip history") "[\r\n]+")
could be a good start.
from cliphist.
Hi. I use greenclip
but am really new to Emacs (my elisp-fu nearly doesn't exist), so the best I can do right now is to provide some information.
As stated with examples in greenclip
's readme, an ideal way to retrieve an item from clipboard is with the command:
greenclip print | sed '/^$/d' | ???????????? | xargs -r -d'\n' -I '{}' greenclip print '{}'
where ????????? is our entry-selection program of choice. It would be nice if we can somehow "pipe" that into ivy
:) The last greenclip print
just re-copy the selected text and put it on top list again.
from cliphist.
I made this with my little knowledge. It kinda works on its own. The problem is that when item
is big, and contain vague characters like $
, some shells (like fish-shell
) will not like it and error out.
(defun ivy-greenclip ()
"Select an item from clipboard history and re-copy it"
(interactive)
(let* ((history (split-string (shell-command-to-string "greenclip print | sed '/^$/d'") "[\r\n]+")))
(ivy-read "Copy item from entry: "
history
:action (lambda (item)
(shell-command (concat "greenclip print '" item "'"))))))
greenclip
replaces \n and \r with \xA0 before saving the item to the history file, so if we can do some regex replacing with item
, that last command will not be needed.
from cliphist.
You can send me a pull request if you want my code merged.
@FollieHiyuki , try call-process
api. shell-command
is used when I was still not good at Emacs Lisp.
I don't think you need sed
. Emacs has its own API replace-regexp-in-string
.
from cliphist.
Thanks. I have some more questions:
- How can I regexp-replace the character
\xa0
in Emacs. I'm struggling with it :) - And can you provide some guideline on how to integrate this into
cliphist
, since til now what I have done only touched x clipboard, and haven't done anything with Emacs kill ring at all.
from cliphist.
https://github.com/redguardtoo/cliphist/blob/master/cliphist.el#L131
from cliphist.
Thanks for the info. I will take a look.
This might take a while, since I have to learn lisp along the way as well.
from cliphist.
1ef5045 support greenclip (Chen Bin)
from cliphist.
Thanks for your work, meanwhile I'm still fighting brackets :)
I tried it out and it works.
1 concern though: I tend to not have my clipboard clutter up, so I usually delete the clipboard history once in while. cliphist
currently saves cache when reading items. Adding a variable so that the users can control the caching behavior would be nice.
from cliphist.
cliphist will synchronise cache with clipboard manager if it's not empty. So you don't need worry about clearing cache.
If you really need manually empty cache, eval (setq cliphist-items nil)
.
from cliphist.
That was the last missing piece I needed.
I think you can close the issue.
from cliphist.
Related Issues (17)
- need tweak the height of popup dynamically
- use ivy and js-beautify to compare two items in clipboard
- paste multiple items
- cliphist requires popup even when cliphist-use-ivy is t HOT 2
- Read Flycut message no content HOT 16
- use `completing-read` instead of `ivy-read`, add ci support
- cliphist no longer works after update of 2021-07-31 HOT 4
- cliphist-select-item with error HOT 1
- ability to clear the emacs kill-ring HOT 4
- add screencast
- Use ivy-mode or helm-mode to select the entry? HOT 2
- need html decode when paste from flycut on OSX HOT 1
- cannot use with ivy HOT 13
- Add option to select clipit or parcellite HOT 4
- Error with clipit HOT 4
- Doesn't work with FlyCut v1.8.2 (1.fe5bb21.10.1612 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cliphist.