From 8540c674adb0164c65b4ade0ccefbd6427101692 Mon Sep 17 00:00:00 2001 From: Arthur Barraux Date: Sat, 1 Nov 2025 13:18:23 +0100 Subject: [PATCH] first commit --- README.md | 29 +++++++++++++++++++++++++++++ init.lisp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 README.md create mode 100644 init.lisp diff --git a/README.md b/README.md new file mode 100644 index 0000000..c36c30e --- /dev/null +++ b/README.md @@ -0,0 +1,29 @@ +# Smart delimiters + +Smart delimiters is a package for beluga editor. The aim of it is to add closure delimiter when opening it. + +## Install +Clone this repo in the packages folder of beluga (`~/.beluga/packages`). +``` bash +git clone https://homelinuxserver.ddns.net/git/arthur/smart_delimiters.git ~/.beluga/packages/smart_delimiters +``` +Then add the following line to your init file. + +``` lisp +(add-package "smart_delimiters") +``` + +## Functions + +| Function | Description | +|:---------|:------------| +| `open-parenthesis` | insert open and close parenthensis then put the cursor in between | +| `open-brackets` | insert open and close brackets then put the cursor in between | +| `open-curly-brackets` | insert open and close curly brackets then put the cursor in between | +| `open-single-quotes` | insert two single quotes then put the cursor in between | +| `open-double-quotes` | insert two double quotes then put the cursor in between | + +## Binding + +All functions are binded to the corresponding key. + diff --git a/init.lisp b/init.lisp new file mode 100644 index 0000000..65253a3 --- /dev/null +++ b/init.lisp @@ -0,0 +1,48 @@ + +(define open-parenthesis (lambda() ( + (editor-insert-char "(") + (editor-insert-char ")") + (move-cursor "left") + ) + ) + ) + +(define open-brackets (lambda() ( + (editor-insert-char "[") + (editor-insert-char "]") + (move-cursor "left") + ) + ) + ) + +(define open-curly-brackets (lambda() ( + (editor-insert-char "{") + (editor-insert-char "}") + (move-cursor "left") + ) + ) + ) + +(define open-single-quotes (lambda() ( + (editor-insert-char "'") + (editor-insert-char "'") + (move-cursor "left") + ) + ) + ) + +(define open-double-quotes (lambda() ( + (editor-insert-char "\"") + (editor-insert-char "\"") + (move-cursor "left") + ) + ) + ) + + + +(map-key "(" open-parenthesis) +(map-key "[" open-brackets) +(map-key "{" open-curly-brackets) +(map-key "'" open-single-quotes) +(map-key "\"" open-double-quotes)