Micro: added initial support

This commit is contained in:
2026-04-22 18:37:31 +02:00
parent 847f0dae5d
commit cb6ac9bce6
+26 -2
View File
@@ -1,8 +1,8 @@
#include "utils.h" #include "utils.h"
#include "string.h" #include "string.h"
const char *supportedEditor[] = {"helix", "kakoune", "nano", "neovim", "vim"}; const char *supportedEditor[] = {"helix", "kakoune", "micro", "nano", "neovim", "vim"};
const int numEditors = 5; const int numEditors = 6;
int compareString(const void *a, const void *b) { int compareString(const void *a, const void *b) {
const char *str1 = *(const char **)a; const char *str1 = *(const char **)a;
@@ -376,6 +376,30 @@ if (editor_pid == 0) {
} }
} }
error(1, "program", "execlp() failed.");
// ---- MICRO ----
} else if (strcmp(editor, "micro") == 0) {
if (render) {
if (shouldJumpToEndOfFile) {
debug("Running MICRO_VIVIFY=1 micro %s +99999", path);
setenv("MICRO_VIVIFY", "1", 1);
execlp("micro", "micro", path, "+999999", NULL);
} else {
debug("Running MICRO_VIVIFY=1 micro %s", path);
setenv("MICRO_VIVIFY", "1", 1);
execlp("micro", "micro", path, NULL);
}
} else {
if (shouldJumpToEndOfFile) {
debug("Running micro %s +999999", path);
execlp("micro", "micro", path, "+999999", NULL);
} else {
debug("Running micro %s", path);
execlp("micro", "micro", path, NULL);
}
}
error(1, "program", "execlp() failed."); error(1, "program", "execlp() failed.");
} }