Compare commits
5 Commits
v2.0
..
7eaf6913cb
| Author | SHA1 | Date | |
|---|---|---|---|
| 7eaf6913cb | |||
| 8f7dcf3534 | |||
| d8c6b9ace3 | |||
| d0173d7308 | |||
| 40fc234eeb |
@@ -6,7 +6,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: home-1
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
|
|||||||
@@ -1,26 +1,29 @@
|
|||||||
# Beluga
|
# Beluga
|
||||||
|
|
||||||
Beluga is a project of CLI text editor that will fit perfectly with your azerty keyboard.
|
Beluga is a project of CLI text editor that uses lisp as configuration language.
|
||||||
|
It's abviously only working for **Linux**.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
You will only need **cmake** and **clang** to compile the editor.
|
You will only need **meson** and a **C compiler** to compile the editor.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Here is the installation line for development version:
|
Here is the installation line for development version:
|
||||||
|
|
||||||
```git clone --recurse-submodules https://github.com/le-cocotier/beluga.git ~/.beluga && cd ~/.beluga && mkdir build && cd build && cmake ../ && make beluga```
|
```git clone https://homelinuxserver.ddns.net/git/arthur/beluga.git ~/.beluga && cd ~/.beluga && meson setup --reconfigure build && meson compile -C build```
|
||||||
|
|
||||||
The executable file will be in `bin/beluga`. Feel free to add it to your path.
|
The executable file will be `build/beluga`. Feel free to add it to your path.
|
||||||
|
|
||||||
You can either run `make all` or `make doc_doxygen` if you're interested by the doxygen documentation.
|
|
||||||
|
|
||||||
## Getting start
|
## Getting start
|
||||||
|
|
||||||
To open an existing file just type :
|
To open an existing file just type :
|
||||||
```beluga path_to_my_file```
|
```./build/beluga path_to_my_file```
|
||||||
|
|
||||||
The only keybinds that you will need will be :
|
Here is some few command that you will need :
|
||||||
- Ctrl-Q : leave the editor
|
|
||||||
- Ctrl-S : Save a file
|
| keybind| command |
|
||||||
|
|--------|------------------|
|
||||||
|
| Ctrl-Q | leave the editor |
|
||||||
|
| Ctrl-S | Save a file |
|
||||||
|
| Ctrl-O | open file |
|
||||||
|
|||||||
Executable
+34
@@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
echo "--- Welcome to Beluga installer ---"
|
||||||
|
read -p "Do you want to start the installation ? (Y/n)" confirm && [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]] || exit 1
|
||||||
|
|
||||||
|
# Check dependencies
|
||||||
|
|
||||||
|
if ! command -v "meson" &>/dev/null; then
|
||||||
|
echo "❌ Error: meson not found. Please install it first."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Create config files
|
||||||
|
|
||||||
|
echo "Create config files ..."
|
||||||
|
mkdir -pv ~/.beluga/
|
||||||
|
cp -rv ./assets/ ~/.beluga/
|
||||||
|
cp -rv ./config/ ~/.beluga/
|
||||||
|
|
||||||
|
# Compile the project
|
||||||
|
|
||||||
|
|
||||||
|
echo "Start compilation ..."
|
||||||
|
meson setup --reconfigure build/
|
||||||
|
meson compile -C build/
|
||||||
|
|
||||||
|
# Add to path
|
||||||
|
echo "Adding beluga to the path"
|
||||||
|
sudo cp -f ./build/beluga /usr/local/bin/
|
||||||
|
|
||||||
|
echo "Installation finish"
|
||||||
|
echo "Check ~/.beluga/config/init.lisp for customization"
|
||||||
@@ -5,6 +5,9 @@
|
|||||||
* interactions. \version 0.1 \date 21 septembre 2024
|
* interactions. \version 0.1 \date 21 septembre 2024
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define _DEFAULT_SOURCE
|
#define _DEFAULT_SOURCE
|
||||||
@@ -22,14 +25,20 @@ struct editorConfig E;
|
|||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
|
char * splash_screen = (char *) calloc(256, sizeof(char));
|
||||||
|
|
||||||
enableRawMode();
|
enableRawMode();
|
||||||
initEditor();
|
initEditor();
|
||||||
if (argc >= 2) {
|
if (argc >= 2) {
|
||||||
E.state = READ_AND_WRITE;
|
E.state = READ_AND_WRITE;
|
||||||
editorOpen(argv[1]);
|
editorOpen(argv[1]);
|
||||||
} else {
|
} else {
|
||||||
editorOpen("assets/beluga.txt");
|
strcat(splash_screen, getenv("HOME"));
|
||||||
|
strcat(splash_screen, "/.beluga/assets/beluga.txt");
|
||||||
|
fprintf(stderr, "%s\n", splash_screen);
|
||||||
|
editorOpen(splash_screen);
|
||||||
}
|
}
|
||||||
|
free(splash_screen);
|
||||||
|
|
||||||
editorSetStatusMessage("HELP: Ctrl-S = save | Ctrl-Q = quit");
|
editorSetStatusMessage("HELP: Ctrl-S = save | Ctrl-Q = quit");
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -34,6 +34,7 @@ void initBuiltins() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initEditor() {
|
void initEditor() {
|
||||||
|
char init_file_path[256];
|
||||||
E.cursor_x = 0;
|
E.cursor_x = 0;
|
||||||
E.cursor_y = 0;
|
E.cursor_y = 0;
|
||||||
E.rx = 0;
|
E.rx = 0;
|
||||||
@@ -53,8 +54,10 @@ void initEditor() {
|
|||||||
|
|
||||||
E.number_of_keybinds = 0;
|
E.number_of_keybinds = 0;
|
||||||
|
|
||||||
|
strcat(init_file_path, getenv("HOME"));
|
||||||
E.fd_init_file = fopen("config/init.lisp", "r");
|
strcat(init_file_path, "/.beluga/config/init.lisp");
|
||||||
|
printf("%s\n", init_file_path);
|
||||||
|
E.fd_init_file = fopen(init_file_path, "r");
|
||||||
E.ctx = lisp_init();
|
E.ctx = lisp_init();
|
||||||
E.env = lisp_env(E.ctx);
|
E.env = lisp_env(E.ctx);
|
||||||
lisp_lib_load(E.ctx);
|
lisp_lib_load(E.ctx);
|
||||||
|
|||||||
Reference in New Issue
Block a user