Comments (8)
Opened a question on stack exchange and threw up a bounty.
http://apple.stackexchange.com/questions/115675
from vim-anywhere.
Found some great resources and made general progress.
First of all, the property list that contains this shortcut is pbs
:
$ defaults read pbs
{
NSServicesStatus = {
"(null) - VimAnywhere - runWorkflowAsService" = {
"key_equivalent" = "@^v";
};
"org.vim.MacVim - MacVim/New MacVim Buffer Here - newFileHere" = {
"enabled_context_menu" = 0;
"enabled_services_menu" = 0;
};
};
}
Now, being as this is a nested property list, it isn't really easy to edit it via the command line. Even if you read the entire property as it is now, process it and modify it, writing it back becomes another problem.
Apparently, you can also do this in pure applescript (which terrifies me, but I'm going to give it a shot).
scpt way: https://discussions.apple.com/thread/4709713?tstart=0
from vim-anywhere.
Something like:
set theServiceName to "(null) - Print to PDF - runWorkflowAsService"
set libPrefPath to POSIX path of (path to preferences folder from user domain as text)
set PlistFile to "pbs.plist"
set PlistPath to libPrefPath & PlistFile as text
set mainPropertyItem to "NSServicesStatus"
set theKey to "key_equivalent"
tell application "System Events"
set gp to (get property list item theServiceName of property list item mainPropertyItem of property list file PlistPath)
tell gp
--set value of property list item "enabled_services_menu" to true
--set value of property list item "enabled_context_menu" to true
set value of property list item theKey to "@^h"
end tell
end tell
do shell script " defaults read " & quoted form of PlistPath
though I can't exactly get this to work.
from vim-anywhere.
New question up: http://apple.stackexchange.com/questions/115992/set-service-keyboard-shortcut-and-have-change-take-effect-programtically
from vim-anywhere.
Would be over the moon if anyone could figure this one out. I never could quite get it to work on OSX.
from vim-anywhere.
Enabling the shortcut via System Preferences results in this entry appearing in the Mac OS X user defaults system :
$ defaults read pbs
{
NSServicesStatus = {
"(null) - VimAnywhere - runWorkflowAsService" = {
"key_equivalent" = "@^v";
};
"org.vim.MacVim - MacVim/New MacVim Buffer With Selection - openSelection" = {
"key_equivalent" = "@^v";
};
};
}
You can add this manually by running the following:
$ defaults write pbs NSServicesStatus '{
"(null) - VimAnywhere - runWorkflowAsService" = {
"key_equivalent" = "@^v";
};
"org.vim.MacVim - MacVim/New MacVim Buffer With Selection - openSelection" = {
"key_equivalent" = "@^v";
};
}'
Is this an acceptable solution? I am not entirely familiar with MacOSX so this answer might be incomplete, or incorrect.
from vim-anywhere.
Following up in #74.
from vim-anywhere.
Closed by #74
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.