diff --git a/.gitignore b/.gitignore index afcbc8c..ed9600d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ **/*.o lite -TODO diff --git a/LICENSE b/LICENSE index 39ddd05..ddbb154 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,5 @@ Copyright (c) 2020 rxi +Copyright (c) 2021 Alessandro Mauri Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/TODO b/TODO new file mode 100644 index 0000000..b405164 --- /dev/null +++ b/TODO @@ -0,0 +1,30 @@ +[x] use system lua lib +[ ] make it std=c11 not gnu11 +[ ] make it compile on openbsd +[ ] update license, readme and documentation +[ ] add manpage +[x] add desktop file +[x] makefile: add install and uninstall +[ ] SDL: disable key not recognized messages +[ ] add menu to exec arbitrary command + [ ] that command can be what is selected +[ ] add a cross to close tab +[ ] prevent overscrolling on treeview +[ ] user config file and/or init.lua +[ ] save session and restore on reopening +[ ] some key bindings: + [ ] alt+right == End + [ ] alt+left == Home + [ ] alt+up == PageUp + [ ] alt+down == PageDown + [ ] ctrl+d == duplicate line + [ ] ctrl+x == cut line || selection + [ ] ctrl+c == copy line || selection + [ ] ctrl+shift+o == change & open project folder -> core:open-project-module + [ ] ctrl+q == quit +[x] change alt+ to ctrl+ +[ ] add multi cursor system +[ ] add binding to open up a cheatsheet of keybinding, with a + search feature +[ ] implement visual "ruler" at column 80 +[ ] show hidden files config and binding diff --git a/data/core/keymap.lua b/data/core/keymap.lua index 4d48ed4..a50570f 100644 --- a/data/core/keymap.lua +++ b/data/core/keymap.lua @@ -104,15 +104,15 @@ keymap.add { ["ctrl+shift+tab"] = "root:switch-to-previous-tab", ["ctrl+pageup"] = "root:move-tab-left", ["ctrl+pagedown"] = "root:move-tab-right", - ["alt+1"] = "root:switch-to-tab-1", - ["alt+2"] = "root:switch-to-tab-2", - ["alt+3"] = "root:switch-to-tab-3", - ["alt+4"] = "root:switch-to-tab-4", - ["alt+5"] = "root:switch-to-tab-5", - ["alt+6"] = "root:switch-to-tab-6", - ["alt+7"] = "root:switch-to-tab-7", - ["alt+8"] = "root:switch-to-tab-8", - ["alt+9"] = "root:switch-to-tab-9", + ["ctrl+1"] = "root:switch-to-tab-1", + ["ctrl+2"] = "root:switch-to-tab-2", + ["ctrl+3"] = "root:switch-to-tab-3", + ["ctrl+4"] = "root:switch-to-tab-4", + ["ctrl+5"] = "root:switch-to-tab-5", + ["ctrl+6"] = "root:switch-to-tab-6", + ["ctrl+7"] = "root:switch-to-tab-7", + ["ctrl+8"] = "root:switch-to-tab-8", + ["ctrl+9"] = "root:switch-to-tab-9", ["ctrl+f"] = "find-replace:find", ["ctrl+r"] = "find-replace:replace", diff --git a/lite.desktop b/lite.desktop new file mode 100644 index 0000000..146ec72 --- /dev/null +++ b/lite.desktop @@ -0,0 +1,16 @@ +[Desktop Entry] + +Name=Lite +GenericName=Text Editor +Comment=Lightweight Lua text editor + +Icon=lite +Type=Application +Categories=Utility;TextEditor;Development; +Keywords=text;editor;syntax; + +Exec=lite %F +StartupNotify=false +Terminal=false +MimeType=text/plain;text/x-chdr;text/x-csrc;text/x-c++hdr;text/x-c++src;text/x-java;text/x-dsrc;text/x-pascal;text/x-perl;text/x-python;application/x-php;application/x-httpd-php3;application/x-httpd-php4;application/x-httpd-php5;application/xml;text/html;text/css;text/x-sql;text/x-diff; + diff --git a/makefile b/makefile index da78ca0..6ca7289 100644 --- a/makefile +++ b/makefile @@ -1,9 +1,11 @@ .POSIX: +PREFIX = /usr/local +MANPREFIX = ${PREFIX}/share/man CC ?= gcc SRCDIR = ./src -CFLAGS = -Wall -Werror -pedantic -O3 -std=gnu11 -fno-strict-aliasing -I${SRCDIR}\ - -DLUA_USE_POSIX +CFLAGS = -Wall -Werror -pedantic -O3 -std=gnu11 -fno-strict-aliasing \ + -I${SRCDIR} -DLUA_USE_POSIX # remove this LDFLAGS = -lSDL2 -lm -llua5.2 FILES != find ${SRCDIR} -name '*.c' @@ -12,5 +14,25 @@ OBJS = $(FILES:.c=.o) lite: ${OBJS} ${CC} ${LDFLAGS} $^ -o $@ +install: lite + mkdir -p ${DESTDIR}${PREFIX}/share/lite + cp -f lite ${DESTDIR}${PREFIX}/share/lite/lite + chmod 755 ${DESTDIR}${PREFIX}/share/lite/lite + cp -rf data ${DESTDIR}${PREFIX}/share/lite/data + mkdir -p ${DESTDIR}${PREFIX}/bin + ln -sf ${DESTDIR}${PREFIX}/share/lite/lite ${DESTDIR}${PREFIX}/bin/lite +# mkdir -p ${DESTDIR}${MANPREFIX}/man1 +# cp -f us.1 ${DESTDIR}${MANPREFIX}/man1/us.1 +# chmod 644 ${DESTDIR}${MANPREFIX}/man1/us.1 + cp -f lite.desktop ${DESTDIR}${PREFIX}/share/applications/lite.desktop + cp -f icon.ico ${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/lite.ico + +uninstall: + rm -f ${DESTDIR}${PREFIX}/bin/lite \ + ${DESTDIR}&{PREFIX}/share/applications/lite.desktop \ + ${DESTDIR}${PREFIX}/share/icons/hicolor/scalable/apps/lite.ico +# ${DESTDIR}${MANPREFIX}/man1/us.1 + rm -rf ${DESTDIR}${PREFIX}/share/lite + clean: rm -f lite ${OBJS} diff --git a/src/api/api.c b/src/api/api.c index d273cf2..a31334f 100644 --- a/src/api/api.c +++ b/src/api/api.c @@ -10,7 +10,6 @@ static const luaL_Reg libs[] = { }; void api_load_libs(lua_State *L) { - for (int i = 0; libs[i].name; i++) { + for (int i = 0; libs[i].name; i++) luaL_requiref(L, libs[i].name, libs[i].func, 1); - } } diff --git a/src/main.c b/src/main.c index c5291e8..f47e93b 100644 --- a/src/main.c +++ b/src/main.c @@ -94,7 +94,6 @@ int main(int argc, char **argv) lua_pushstring(L, exename); lua_setglobal(L, "EXEFILE"); - (void) luaL_dostring(L, "local core\n" "xpcall(function()\n"