diff --git a/README.md b/README.md index e04b0e2..fa21d6e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,49 @@ # doom-parents -A set of mappings for manipulating parentheses and sexps +A set of Doom Emacs mappings for manipulating parentheses and sexps + +## Installation + +```lisp +;; ~/.doom.d/packages.el + +(package! doom-parents + :recipe (:host github :repo "tomekw/doom-parents")) + +;; ~/.doom.d/config.el + +(use-package! doom-parents) +``` + +## Usage + +1. Wrap sexp in round parentheses + + `SPC` - `c` -`p` - `(` + +1. Wrap sexp in square parentheses + + `SPC` - `c` -`p` - `[` + +1. Wrap sexp in curly parentheses + + `SPC` - `c` -`p` - `{` + +1. Raise sexp + + `SPC` - `c` -`p` - `r` + +1. Push parenthesis to the right + + `SPC` - `c` -`p` - `>` - `)` + +1. Push parenthesis to the left + + `SPC` - `c` -`p` - `<` - `(` + +1. Pull parenthesis from the right + + `SPC` - `c` -`p` - `<` - `)` + +1. Pull parenthesis from the left + + `SPC` - `c` -`p` - `>` - `(` diff --git a/doom-parents.el b/doom-parents.el new file mode 100644 index 0000000..c10a14a --- /dev/null +++ b/doom-parents.el @@ -0,0 +1,54 @@ +;;; doom-parents.el --- A set of mappings for manipulating parens and sexps -*- lexical-binding: t; -*- + +;; Copyright (C) 2022 Tomek Wałkuski + +;; Author: Tomek Wałkuski +;; Package-Requires: ((emacs "24.1")) +;; URL: https://github.com/tomekw/doom-parents +;; Version: 0.1.0 + +;; MIT License + +;; Copyright (c) 2022 Tomek Wałkuski + +;; Permission is hereby granted, free of charge, to any person obtaining a copy +;; of this software and associated documentation files (the "Software"), to deal +;; in the Software without restriction, including without limitation the rights +;; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +;; copies of the Software, and to permit persons to whom the Software is +;; furnished to do so, subject to the following conditions: + +;; The above copyright notice and this permission notice shall be included in all +;; copies or substantial portions of the Software. + +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +;; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +;; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. + +;;; Commentary: + +;; A set of Doom Emacs mappings for manipulating parentheses and sexps + +;;; Code: + +(map! + :leader + (:prefix-map ("c" . "code") + (:prefix ("p" . "parentheses") + :desc "wrap round" "(" #'sp-wrap-round + :desc "wrap square" "[" #'sp-wrap-square + :desc "wrap curly" "{" #'sp-wrap-curly + :desc "raise" "r" #'sp-raise-sexp + (:prefix (">" . "right side") + :desc "push" ")" #'sp-forward-slurp-sexp + :desc "pull" "(" #'sp-backward-barf-sexp) + (:prefix ("<" . "left side") + :desc "pull" ")" #'sp-forward-barf-sexp + :desc "push" "(" #'sp-backward-slurp-sexp)))) + +(provide 'doom-parents) +;;; doom-parents.el ends here