first commit

This commit is contained in:
Arthur Barraux
2025-11-01 13:18:23 +01:00
commit 8540c674ad
2 changed files with 77 additions and 0 deletions
+29
View File
@@ -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.
+48
View File
@@ -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)