osx: add osx-dictionary and make it default for OS X

This commit is contained in:
Muneeb Shaikh 2016-08-27 20:58:27 +05:30
parent 781532d4d2
commit 8e1d449754
4 changed files with 30 additions and 1 deletions

View File

@ -8,6 +8,7 @@
- [[#install][Install]]
- [[#layer][Layer]]
- [[#use-with-non-us-keyboard-layouts][Use with non-US keyboard layouts]]
- [[#define-words-using-os-x-dictionary][Define words using OS X Dictionary]]
- [[#coreutils][Coreutils]]
- [[#key-bindings][Key Bindings]]
- [[#future-work][Future Work]]
@ -50,6 +51,16 @@ key.
(setq-default mac-right-option-modifier nil)
#+END_SRC
*** Define words using OS X Dictionary
This layer by default enables defining words under point ~SPC x w d~ using OS X Dictionary.
You can disable it by setting =osx-use-dictionary-app= variable to =nil=:
#+BEGIN_SRC emacs-lisp
(setq-default dotspacemacs-configuration-layers '(
(osx :variables osx-use-dictionary-app nil)))
#+END_SRC
** Coreutils
To get =gls= install coreutils homebrew:

View File

@ -2,6 +2,9 @@
"If non nil the option key is mapped to meta. Set to `nil` if you need the
option key to type common characters.")
(defvar osx-use-dictionary-app t
"If non nil use osx dictionary app instead of wordnet")
;; Use the OS X Emoji font for Emoticons
(when (fboundp 'set-fontset-font)
(set-fontset-font "fontset-default"

View File

@ -3,6 +3,7 @@
exec-path-from-shell
helm
launchctl
(osx-dictionary :toggle osx-use-dictionary-app)
osx-trash
pbcopy
reveal-in-osx-finder
@ -68,6 +69,20 @@
(kbd "#") 'launchctl-unsetenv
(kbd "h") 'launchctl-help))))
(defun osx/init-osx-dictionary ()
(use-package osx-dictionary
:if osx-use-dictionary-app
:init (spacemacs/set-leader-keys "xwd" 'osx-dictionary-search-pointer)
:config
(progn
(evilified-state-evilify-map osx-dictionary-mode-map
:mode osx-dictionary-mode
:bindings
"q" 'osx-dictionary-quit
"r" 'osx-dictionary-read-word
"s" 'osx-dictionary-search-input
"o" 'osx-dictionary-open-dictionary.app))))
(defun osx/init-osx-trash ()
(use-package osx-trash
:if (and (spacemacs/system-is-mac)

View File

@ -10,7 +10,7 @@
;;; License: GPLv3
(setq spacemacs-language-packages
'(define-word
'(define-word :toggle (not osx-use-dictionary-app)
google-translate))
(defun spacemacs-language/init-define-word ()