Skip to content

Commit

Permalink
re-vendor auto-pairs.kak
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed Oct 14, 2021
1 parent dbd8f08 commit 19476c1
Show file tree
Hide file tree
Showing 7 changed files with 473 additions and 24 deletions.
4 changes: 3 additions & 1 deletion dotfiles/kakoune/default.nix
Expand Up @@ -26,6 +26,7 @@ in {
kakoune-find
kakoune-idris
kakoune-surround
prelude-kak
shellcheck-kak
smarttab-kak
tug
Expand Down Expand Up @@ -85,7 +86,8 @@ in {
map global window <a-s> ': tmux-terminal-vertical sh -c %{ kak -c $1 $2 } -- %val{session} %val{bufname} <ret>' -docstring "horizontal split"
# automatically match opening/closing pairs like () and []
enable-auto-pairs
require-module auto-pairs
auto-pairs-enable
# Git status
hook global WinSetOption filetype=.+ %{ git show-diff }
Expand Down
34 changes: 17 additions & 17 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions flake.nix
Expand Up @@ -47,10 +47,6 @@
};

# kakoune plugins
auto-pairs = {
url = "github:alexherbo2/auto-pairs.kak";
flake = false;
};
active-window = {
url = "github:greenfork/active-window.kak";
flake = false;
Expand All @@ -75,6 +71,10 @@
url = "github:h-youhei/kakoune-surround";
flake = false;
};
prelude-kak = {
url = "github:kakounedotcom/prelude.kak";
flake = false;
};
shellcheck-kak = {
url = "github:whereswaldon/shellcheck.kak";
flake = false;
Expand Down Expand Up @@ -134,8 +134,11 @@
active-window =
buildKakounePlugin "active-window" inputs.active-window;

auto-pairs =
buildKakounePlugin "auto-pairs.kak" inputs.auto-pairs;
auto-pairs = final.kakouneUtils.buildKakounePlugin {
pname = "auto-pairs";
version = "vendored";
src = ./vendor/auto-pairs.kak;
};

kak-ayu = final.callPackage ./pkgs/kak-ayu { };

Expand Down Expand Up @@ -164,6 +167,8 @@
kakoune-surround =
buildKakounePlugin "kakoune-surround" inputs.kakoune-surround;

prelude-kak = buildKakounePlugin "prelude.kak" inputs.prelude-kak;

shellcheck-kak =
buildKakounePlugin "shellcheck.kak" inputs.shellcheck-kak;

Expand Down
18 changes: 18 additions & 0 deletions vendor/auto-pairs.kak/CONTRIBUTING
@@ -0,0 +1,18 @@
The preferred way to contribute would be through GitHub pull requests,
as an alternative patches can be discussed on the IRC channel.

When contributing your first changes, please include an empty commit for
copyright waiver using the following message (replace 'John Doe' with
your name or nickname):

John Doe Copyright Waiver

I dedicate any and all copyright interest in this software to the
public domain. I make this dedication for the benefit of the public at
large and to the detriment of my heirs and successors. I intend this
dedication to be an overt act of relinquishment in perpetuity of all
present and future rights to this software under copyright law.

The command to create an empty commit from the command-line is:

git commit --allow-empty
71 changes: 71 additions & 0 deletions vendor/auto-pairs.kak/README.md
@@ -0,0 +1,71 @@
# auto-pairs.kak

Auto-paired characters for [Kakoune].

When inserting an opening pair, auto-pairs always inserts the closing pair,
unless when under a word character or preceded by a **backslash**, and for non
nestable characters (such as **apostrophes**), when preceded by word characters.

Auto-pairing is also about pair navigation and editing (deleting existing pairs
and formatting in pair). It can move in pair `(▌)`, delete in pair `(▌)` and
post pair `()▌`, and pad in pair horizontally `(␣▌␣)` and vertically:
```
foobar {
}
```
.

When inserting an auto-paired character, if the opening and closing characters
are the same (such as double quote strings), auto-pairs will move right in pair
`"▌"` and skip additional pairing post pair `"▌`.

## Features

- Auto-pairing
- Vertical and horizontal padding
- No `sh` call when typing

## Dependencies

- [prelude.kak]

[prelude.kak]: https://github.com/alexherbo2/prelude.kak

## Installation

Add [`auto-pairs.kak`](rc/auto-pairs.kak) to your autoload or source it manually.

``` kak
require-module auto-pairs
```

## Usage

Enable auto-pairs with `auto-pairs-enable`.
Auto-paired characters can be changed via the `auto_pairs` option.

## Surrounding pairs

By default, `auto_pairs` includes the following surrounding pairs:

```
Parenthesis block: ( )
Braces block: { }
Brackets block: [ ]
Double quote string: " "
Single quote string: ' '
Grave quote string: ` `
Double quotation mark: “ ”
Single quotation mark: ‘ ’
Double angle quotation mark: « »
Single angle quotation mark: ‹ ›
```

See also [surround.kak] and [manual-indent.kak].

[Kakoune]: https://kakoune.org
[surround.kak]: https://github.com/alexherbo2/surround.kak
[manual-indent.kak]: https://github.com/alexherbo2/manual-indent.kak
24 changes: 24 additions & 0 deletions vendor/auto-pairs.kak/UNLICENSE
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

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 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.

For more information, please refer to <https://unlicense.org/>

0 comments on commit 19476c1

Please sign in to comment.