From 89137bb482169210873cb93713ae7d0770e04d0d Mon Sep 17 00:00:00 2001 From: d12frosted Date: Sun, 28 Aug 2016 13:38:34 +0300 Subject: [PATCH] add notes about setting up osx dictionary Also fill paragraphs in osx layer readme file. --- layers/+os/osx/README.org | 60 ++++++++++++++++++++++---------------- layers/+os/osx/funcs.el | 18 ++++++++++++ layers/+os/osx/packages.el | 3 ++ 3 files changed, 56 insertions(+), 25 deletions(-) create mode 100644 layers/+os/osx/funcs.el diff --git a/layers/+os/osx/README.org b/layers/+os/osx/README.org index 1fb6eff5b..e3ffc56d4 100644 --- a/layers/+os/osx/README.org +++ b/layers/+os/osx/README.org @@ -14,23 +14,21 @@ - [[#future-work][Future Work]] * Description -Spacemacs is not just emacs+vim. It can have OSX keybindings too! -This layer globally defines common OSX keybindings. ~⌘~ is set to -~super~ and ~⌥~ is set to ~meta~. Aside from that, there's nothing -much, really. +Spacemacs is not just emacs+vim. It can have OSX keybindings too! This layer +globally defines common OSX keybindings. ~⌘~ is set to ~super~ and ~⌥~ is set to +~meta~. Aside from that, there's nothing much, really. While in =dired= this layer will try to use =gls= instead of =ls=. * Philosophy -While this layer enables common OSX bindings, it does not implement -OSX navigation keybindings. Spacemacs is meant to be used with evil, -and we encourage you to do so :) +While this layer enables common OSX bindings, it does not implement OSX +navigation keybindings. Spacemacs is meant to be used with evil, and we +encourage you to do so :) * Install ** Layer To use this configuration layer, add it to your =~/.spacemacs=. You will need to -add =osx= to the existing =dotspacemacs-configuration-layers= list in this -file. +add =osx= to the existing =dotspacemacs-configuration-layers= list in this file. *** Use with non-US keyboard layouts If you need the ~⌥~ key to type common characters such as ={[]}~= which is usual @@ -53,7 +51,18 @@ key. *** Define words using OS X Dictionary -This layer by default enables defining words under point ~SPC x w d~ using OS X Dictionary. +This layer by default enables defining words under point ~SPC x w d~ using OS X +Dictionary. In some cases you might want to manually setup dictionary to use. +For example, + +#+BEGIN_SRC emacs-lisp + (setq-default dotspacemacs-configuration-layers '( + (osx :variables osx-dictionary-dictionary-choice "English"))) +#+END_SRC + +To get the list of available dictionaries call =osx/list-available-dictionaries= +function. + You can disable it by setting =osx-use-dictionary-app= variable to =nil=: #+BEGIN_SRC emacs-lisp @@ -70,21 +79,22 @@ To get =gls= install coreutils homebrew: * Key Bindings -| Key Binding | Description | -|-------------+-------------------| -| ~⌘ =~ | Scale up text | -| ~⌘ -~ | Scale down text | -| ~⌘ q~ | Quit | -| ~⌘ v~ | Paste | -| ~⌘ c~ | Copy | -| ~⌘ x~ | Cut | -| ~⌘ a~ | Select all | -| ~⌘ w~ | Close window | -| ~⌘ W~ | Close frame | -| ~⌘ n~ | New frame | -| ~⌘ z~ | Undo | -| ~⌘ Z~ | Redo | -| ~⌃ ⌘ f~ | Toggle fullscreen | +| Key Binding | Description | +|-------------+-----------------------------| +| ~⌘ =~ | Scale up text | +| ~⌘ -~ | Scale down text | +| ~⌘ q~ | Quit | +| ~⌘ v~ | Paste | +| ~⌘ c~ | Copy | +| ~⌘ x~ | Cut | +| ~⌘ a~ | Select all | +| ~⌘ w~ | Close window | +| ~⌘ W~ | Close frame | +| ~⌘ n~ | New frame | +| ~⌘ z~ | Undo | +| ~⌘ Z~ | Redo | +| ~⌃ ⌘ f~ | Toggle fullscreen | +| ~SPC x w d~ | Define word under the point | * Future Work - Allow user to choose from either ~hyper~ or ~super~ as ~⌘~. This is an option diff --git a/layers/+os/osx/funcs.el b/layers/+os/osx/funcs.el new file mode 100644 index 000000000..305e4a28c --- /dev/null +++ b/layers/+os/osx/funcs.el @@ -0,0 +1,18 @@ +;;; config.el --- OSX Layer packages File for Spacemacs +;; +;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; +;; Author: Boris Buliga +;; URL: https://github.com/syl20bnr/spacemacs +;; +;; This file is not part of GNU Emacs. +;; +;;; License: GPLv3 + +(defun osx/list-available-dictionaries () + "Get list of available dictionaries. + +Useful when setting `osx-dictionary-dictionary-choice'." + (interactive) + (message (shell-command-to-string + (format "%s -l" (osx-dictionary-cli-find-or-recompile))))) diff --git a/layers/+os/osx/packages.el b/layers/+os/osx/packages.el index 5967581dd..318ea592b 100644 --- a/layers/+os/osx/packages.el +++ b/layers/+os/osx/packages.el @@ -84,6 +84,9 @@ (use-package osx-dictionary :if osx-use-dictionary-app :init (spacemacs/set-leader-keys "xwd" 'osx-dictionary-search-pointer) + :commands (osx-dictionary-search-pointer + osx-dictionary-search-input + osx-dictionary-cli-find-or-recompile) :config (progn (evilified-state-evilify-map osx-dictionary-mode-map