Comments (12)
@99arobe yeah, that will work! that's a better idea actually
from vim-anywhere.
I'd love this too.
from vim-anywhere.
I did something on my branch, not sure if it will worth it to bring it here, as it'll affect the clipboard contents. (you'll lose your current clipboard content). I haven't found an easy way to do this (I could temporarily copy the current clipboard content to a file and restore it at the end.... <- I might try this idea later)
anyways, this is what I did:
you could see it in action on the demo gif here: https://github.com/d1egoaz/vim-anywhere/
osascript -e 'tell application "System Events" to set the clipboard to ""'
osascript -e 'tell application "System Events" to keystroke "c" using command down'
pbpaste >> $TMPFILE
from vim-anywhere.
I'm interested in Linux version of this.
from vim-anywhere.
@d1egoaz Thanks for this!
You mention that you thought about saving the clipboard contents to a file temporarily. Would it also be feasible in AppleScript to just store them in a variable and then copy them back to the clipboard once the selected contents have been pasted?
from vim-anywhere.
@balta2ar I was too, but realized that with all the different manners of interaction with text selections and different window managers, etc that stepping it back to just using clipboard contents was the more reasonable solution not only for Linux but across platforms
I submitted a pull request to do this:
#99
from vim-anywhere.
I did something on my branch, not sure if it will worth it to bring it here, as it'll affect the clipboard contents. (you'll lose your current clipboard content). I haven't found an easy way to do this (I could temporarily copy the current clipboard content to a file and restore it at the end.... <- I might try this idea later)
anyways, this is what I did:d1egoaz/vim-anywhere:bin/run@
634c9d5
#L90-L92you could see it in action on the demo gif here: d1egoaz/vim-anywhere
osascript -e 'tell application "System Events" to set the clipboard to ""' osascript -e 'tell application "System Events" to keystroke "c" using command down' pbpaste >> $TMPFILE
That did the trick for me.
😨 you, you used emacs in your link 😜
from vim-anywhere.
😨 you, you used emacs in your link 😜
lol 😈
from vim-anywhere.
I had used Vim-Anywhere some time ago and then kinda forgot about it. When trying it again now, was disappointed vim was opening with an empty buffer (OS X). I made a simple change to bin/run and now get the current clipboard:
` *** bin/run.1586528512 2020-04-10 10:21:52.000000000 -0400
--- bin/run 2020-06-18 10:54:18.000000000 -0400
*************** elif [[ $OSTYPE == "arwin" ]]; then
*** 72,77 ****
--- 72,79 ----
"mvim must have been moved or uninstalled.\nPlease make sure it is"
"available in your path and then reinstall vim-anywhere."
- pbpaste >> $TMPFILE
- $mvim_path $VIM_OPTS $TMPFILE`
Is there a better/more clever way to do this?
[ my pasted code is getting munged, I only inserted the pbpaste line just before invoking mvim]
from vim-anywhere.
that's v close to what I did in PR #99 🙂
been a minute though, and still no movement 😞
from vim-anywhere.
To be clear, with my one line change, prior to using:
v to invoke vim-anywhere,
I first use c to copy the highlighted text into the paste buffer.
Every place I use this, I initially get a pop-up window asking if
I want to allow this. Sometimes 2. Safari, then iTerm2.
The other fix I saw for this required using newer/different version of
emacsclient than is found in /usr/bin
Ideally it would be great to not need to manually copy the highlighted
text into the paste buffer. Certainly there is a way to combine two
keyboard shortcuts?
from vim-anywhere.
I have no familiarity with MacOS, so I have no idea what one might do about clipboard permissions or what any of that really even means.
But if I understand you correctly at the end there, you're wondering how to automagically pull a GUI text selection?
I think that would likely be beyond the scope of vim-anywhere and I expect would not even be practically possible to do well across all the supported operating systems.
The ugly duct tape way that comes to mind though on Linux would be to wrap vim-anywhere to use xdotool or equivalent to send ctrl+c (or whatever combo will copy things) as key events before launching vim-anywhere with clipboard reading functionality. Maybe there is an xdotool-equivalentish utility on Mac?
It's an inelegant and fragile solution, and I wouldn't bother with it, but if you're really hurting for that behavior you might give something like it a go.
from vim-anywhere.
Related Issues (20)
- macOS - No hotkey in Services HOT 3
- feature proposition: Automatic pasting HOT 5
- Can't auto refocus the previous editer after quit vim in Ubuntu18.04 HOT 2
- How to open a new buffer in current MacVim window? HOT 1
- Doesnt work on only i3wm? Really needs gnome? HOT 1
- Can't lock the PC, the lock file doesn't exist HOT 1
- Keybind Not Working in Chrome HOT 1
- Workflow starts, but nothing else happens HOT 1
- change key board shortcut on ubuntu HOT 1
- Switch to soft wrap on launch?
- Use without temp files on mac [suggestion]
- Plugin not working HOT 2
- Vim takes a long time to start after being invoked.
- Open Vim with selected text
- On Linux Mint Cinnamon: use `cinnamon-settings` or `dconf`
- Support without gvim. HOT 9
- Changing xclip to xsel for Linux HOT 2
- not working? (with screencast) HOT 2
- Windows version HOT 3
- put vim in insert mode automatically 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 vim-anywhere.