rxi / lite Goto Github PK
View Code? Open in Web Editor NEWA lightweight text editor written in Lua
License: MIT License
A lightweight text editor written in Lua
License: MIT License
Hello,
it'd be nice if it were possible to toggle plugins on/off during runtime instead of lite loading and enabling all available plugins
Hi
I am really enjoying exploring Lite (Windows 10 - on a small screen laptop). The speed and beauty are very attractive, but there are a few minor points that detract from my pleasure.
I respect the decision against proper word wrapping, but the current situation is not "nice". As I type near the right window margin the whole screen scrolls, with no horizontal scroll bar - this is very disorientating.
When the screen is in this scrolled state I cannot accurately select a position with the mouse - the text jumps left/right - a single click selects several characters.
On first opening there is a very clean window. After each use of command entry / find / eval / exec - I can see pixels on the last row of the screen - matching those from the top row of the single line command window which has been closed (?off by one). These stray pixels are unaffected by window scrolling or resizing.
If I mess up and Lua issues a long error message I can't see the text beyond the right screen edge. The End and Right keys don't function, and there is no horizontal scroll bar.
I would be really nice to have Lua syntax highlighting when typing in the eval plugin.
When using the eval plugin (windows 10) any print statements produce no output. The return value inserts as expected. Is there any way to capture stdout and append to a buffer? I would prefer a solution with output in a fully editable buffer - not a limited buffer like "Log".
I note that package.cpath is set (e.g. P:\MyPrograms\EDITORS\LiteMOD?.dll;P:\MyPrograms\EDITORS\LiteMOD\loadall.dll;.?.dll) but I can't get any of my Lua52 binary libraries to load. I understand some may be dependent upon lua52.dll but I can't get anything to load. (Any examples that work would be interesting - so I can see what was used to compile them)
Many thanks for the latest release, especially for eval which allows me to prod and poke.
Kind Regards Gavin Holt
I am using the latest release, and the _SCALE variable in my init.lua to make things bigger.
Just as title says. I mean the toolbar at the top of window like usually.
see language_6502.lua I'd like to allow upper and lowercase keywords for this.
Hey @rxi,
I hope you are doing great.
This is an outstanding project, super light, super fast; kudos! π₯
I have just downloaded the code, compiled it on my GNU / Debian testing 64-bit system, and my so far experience is the following:
Ctrl+Shift+P
lets me choose the command to close it; that's also an option.Ctrl+UpArrow/DownArrow
do not work../lite &
πCtrl+Shift+P
; not very convenient but it's better than nothing!data/plugins/
for plugins and data/user/colors/
for theme, respectively? π€·That's it for now; I will continue with experimentation.
When this editor becomes stable enough, for sure I will switch to it for good; it's exactly what I was looking for!
Keep up the good work mate.
Cheers π
Hello,
right now lite assumes that the lite binary will be right next to the data directory - but that might not hold true in practice. E.g. linux distros would generally prefer having lite in /usr/bin
while having the data in /usr/share/lite
. It'd be nice if lite had a toggle to set that during build time - that could go hand-in-hand with #48 , e.g. by adding a "@datadir@" directive that's then replaced during compiletime instead of using the EXEDIR. I currently just patch around this for Alpine Linux.
Steps to reproduce:
Hi, Cool project. I built it but I can't figure out how to open a folder. Ctrl-O only allows you to open files. What else should I try?
P.S. Where can I look to help me through these sorts of questions?
Here is my output from running the build command. As somebody not familiar with Linux or C it appears I am missing a dependency named SDL2, but I don't know what that is. I attempted to run: sudo apt-get install SDL2
but the package does not exist.
austin@austin-VirtualBox1:~/lite$ ./build.sh
compiling (unix)...
In file included from src/renderer.c:5:
src/renderer.h:4:10: fatal error: SDL2/SDL.h: No such file or directory
4 | #include <SDL2/SDL.h>
| ^~~~~~~~~~~~
compilation terminated.
In file included from src/rencache.h:5,
from src/rencache.c:2:
src/renderer.h:4:10: fatal error: SDL2/SDL.h: No such file or directory
4 | #include <SDL2/SDL.h>
| ^~~~~~~~~~~~
compilation terminated.
src/main.c:2:10: fatal error: SDL2/SDL.h: No such file or directory
2 | #include <SDL2/SDL.h>
| ^~~~~~~~~~~~
compilation terminated.
In file included from src/api/renderer.c:2:
src/renderer.h:4:10: fatal error: SDL2/SDL.h: No such file or directory
4 | #include <SDL2/SDL.h>
| ^~~~~~~~~~~~
compilation terminated.
src/api/system.c:1:10: fatal error: SDL2/SDL.h: No such file or directory
1 | #include <SDL2/SDL.h>
| ^~~~~~~~~~~~
compilation terminated.
In file included from src/api/renderer_font.c:2:
src/renderer.h:4:10: fatal error: SDL2/SDL.h: No such file or directory
4 | #include <SDL2/SDL.h>
| ^~~~~~~~~~~~
compilation terminated.
cleaning up...
done
I downloaded the lite.zip
from the releases page, unzipped it into a .lite
directory into my user folder and ran the executable from this folder just to check out if it opened without crashing or something.
Then, I decided to add this folder to my PATH, it runs but instantly crashes with the message: attempt to concatenate global '_EXEDIR' (a nil value)
:
Would be nice to be able to have word wrapping.
While coding usually I don't make lines that long, but when writing text for articles and other things in html or markdown it's common to have longer lines. And in markdown an enter will have meaning.
Compilation was easy enough for me too.
When launching from terminal everything works.
If I just launch through finder I'm getting a crash after 2 secs:
gianmichelemariani$ /Users/gianmichelemariani/Projects/lite/lite ; exit;
Error: /Users/gianmichelemariani/Projects/lite/data/core/init.lua:397: /Users/gianmichelemariani/Projects/lite/data/core/init.lua:369: /Users/gianmichelemariani/Projects/lite/data/core/init.lua:30: could not open directory: ./Library/Application Support/CallHistoryDB
stack traceback:
[C]: in function 'run_threads'
/Users/gianmichelemariani/Projects/lite/data/core/init.lua:397: in function 'run'
[string "local core..."]:10: in function <[string "local core..."]:2>
[C]: in function 'xpcall'
[string "local core..."]:2: in main chunk
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
Deleting expired sessions...none found.
For some reason I remember it asking for contacts access at some point.
OSX 10.14.6 Macbook pro 13"
Happy New Year :D
First off: this is AMAZING! Thank you so much for creating lite, it feels just like home coming from Atom :)
When I open lite passing a path as first argument i.e. lite ~/projects/
it works just fine. However opening lite without a path crashes on my system due to lite scanning my whole $HOME and stumbling upon some Proton file.
~> lite
Error: /home/mirodin/bin/liteeditor/data/core/init.lua:397: /home/mirodin/bin/liteeditor/data/core/init.lua:369: /home/mirodin/bin/liteeditor/data/core/init.lua:30: could not open directory: ./games/SteamLibrary/steamapps/common/Proton 3.16 Beta/dist/share/default_pfx/dosdevices/z:/etc/cups/ssl
stack traceback:
[C]: in function 'run_threads'
/home/mirodin/bin/liteeditor/data/core/init.lua:397: in function 'run'
[string "local core..."]:9: in function <[string "local core..."]:2>
[C]: in function 'xpcall'
[string "local core..."]:2: in main chunk
I fixed it by making a change in docview.lua:
-- scroll to make caret visible and reset blink timer if it moved
local line, col = self.doc:get_selection()
if (line ~= self.last_line or col ~= self.last_col) and self.size.x > 0 then
if core.active_view == self and self.mouse_selecting == false then
self:scroll_to_make_visible(line, col)
My change was adding and self.mouse_selecting == false
Home, End, PgUp, PgDn, etc. and their combinations with mod keys dosn't works for me.
I added core.log_quiet("Key pressed %s", k)
to keymap.on_key_pressed
function and got results:
Home -> keypad 7
End -> keypad 1
PgUp -> keypad 9
PgDn -> keypad 3
and similar results for arrows.
Are there users with the same problems?
When num lock is off, alternate functions do not work (direction keys, end, home, pgup, pgdown).
Also: really nice editor! Blazingly fast!
Hi there - awesome project!
On macOS, the command key is generally the default modifier instead of control. I'd be happy to work on this with a little guidance as I'm not too familiar with Lua. I'm not sure if there's a way to detect if we're on mac at compile time or if runtime checks will be necessary.
Whenever I open Lite from run command on my XFCE4 system, it opens and immediately starts file loading procedure which makes no sense to me.
Hi,
Would you consider implementing a Toggle Statusview command?
I'm working from home on a small laptop with old eyes, using the fantastic full screen mode I get 26 and one half lines, that means the status bar is taking about 4% of the available screen.
Also I would commend the aesthetics of full screen without status bar - it feels very pure :)
Kind Regards Gavin Holt
The scrollbar is too narrow. It requires too much precision when trying to scroll a split because the cursor sometimes becomes the adjustment pointer.
Example: in a left-right window split. Trying to scroll in the left window.
Sent from my HUAWEI GR5 2017 using FastHub
first impression was good so I spent some time testing lite 1.03 on win10/hidpi
rendering: is OK, but does not use sub pixels
editing: tab size is 2, cannot find out how to change
find: find previous next (F3, shift-F3) does not work for me, missing: highlight all, show total number of matches
file format: opening non utf-8 file shows no error (added this to #27)
long lines: no line wrap function, no horizontal scroll bar
vertial scolling: when scrolling up (with cursor up) top line is incomplete shows only a few pixels. cannot disable soft scrolling.
sidebar: cannot resize (but cursor shows <->), cannot disable
tabs: cannot arrange tabs (e.g. drag and drop), cannot find full path name (e.g. have two "init.lua", who is who?)
large files: opening file with 1.2 mio lines and 40MB: eats cpu and memory, 2GB after scolling to bottom and waiting. (compare with notepad3: opens faster, scrolls faster, consumes 80MB)
Maybe it could be better to use SDL_ttf. I know that it doesn't change anything totally, but it could make code more consistent and better for packaging i guess.
It would be great if plugins could underline certain bits of code with a reason that's showed when the user hovers over them. This way we could implement syntax and code-style checks.
Hello,
I found this quite curious - no shortcuts (eg C-f) were working until I tried the real Control key and suddenly the editor made sense ;)
There are no other GUI applications where this happens. Any tips on how to fix it?
After 20 years its really hard to not use Caps-As-Control...
Looks like some SDL thing. If you click twice in 2 different locations in quick succession, it selects a word. If you do it three times it selects the line. The click count should reset when clicking somewhere else in a different location.
Additionally, it looks like SDL's clicks goes beyond 3, which means that if you click more than 3 times, nothing happens, which is inconsistent with the rest of the system.
This is on Linux.
Not sure it this is wanted behaviour, but scrolling upward (with the mouse wheel) when at the first line, produces infinite empty lines.
I'm on OSX 10.14.6
The attached file hangs the editor for ~1 second on open.
If you rename the file to test.lua or test.js it crashes the editor instantly on open.
Seems like lite currently supports only UTF-8 encoded files, files encoded in another codepages not displayed correctly and their editing is impossible.
Steps to reproduce that problem:
I am trying to build this on ubuntu:latest
.
Running ./build_release.sh
file form the terminal produces a zip file that doesn't include the lite
executable binary!!
Seen on Windows on version 1.03
When dragging the window so that it snaps between being maximised and smaller, the screen will sometimes not redraw when the window becomes maximised again.
Repro steps:
This only works if the mouse button is held down throughout. If you release it when the window is smaller, everything works just fine. Let me know if you need any more info :) I'm loving the editor so far btw!
Linters, gitstatus etc. are very annoying on Windows, because every time there is io.popen invoked, it creates visible cmd.exe window.
Lite crashes with the wayland SDL driver when the window is closed (while it works fine with SDL_VIDEODRIVER=x11).
A gdb backtrace leads to malloc_consolidate:
0 0x00007ffff7b880ac in malloc_consolidate () from /usr/lib/libc.so.6
1 0x00007ffff7b89600 in _int_free () from /usr/lib/libc.so.6
2 0x00007ffff7e7bd6f in ?? () from /usr/lib/libSDL2-2.0.so.0
3 0x00007ffff7e5885a in ?? () from /usr/lib/libSDL2-2.0.so.0
4 0x00007ffff7e54a66 in ?? () from /usr/lib/libSDL2-2.0.so.0
5 0x00007ffff7eb8999 in ?? () from /usr/lib/libSDL2-2.0.so.0
6 0x00007ffff7ebcbbb in ?? () from /usr/lib/libSDL2-2.0.so.0
7 0x00007ffff7ebcf45 in ?? () from /usr/lib/libSDL2-2.0.so.0
8 0x00007ffff7e2a5cb in ?? () from /usr/lib/libSDL2-2.0.so.0
9 0x00007ffff7e2a6b8 in ?? () from /usr/lib/libSDL2-2.0.so.0
10 0x00007ffff7b3f537 in __run_exit_handlers () from /usr/lib/libc.so.6
11 0x00007ffff7b3f6ee in exit () from /usr/lib/libc.so.6
12 0x00005555555742f1 in os_exit (L=0x5555558382f0) at src/lib/lua52/loslib.c:295
13 0x000055555556a176 in luaD_precall (L=L@entry=0x5555558382f0, func=, func@entry=0x55555609c800, nresults=nresults@entry=0) at src/lib/lua52/ldo.c:319
14 0x0000555555580a77 in luaV_execute (L=L@entry=0x5555558382f0) at src/lib/lua52/lvm.c:709
... (abbreviated lua stack)
This is with Intel graphics on Manjaro.
99% of the time I would like the program to start up with the window maximized. Yes, I can use operating system shortcuts to maximize it, but that's one extra thing I have to do every single time.
Fullscreen is nice (and it's easy to call in your user\init so it starts with it), but for everyday use I like to see my taskbar, so maximizing is better.
Hello,
this has already been mentioned in #45 (comment), but I think a non-custom build system like meson would greatly benefit lite, making it easier to build on more platforms. I could look into doing that while I package it for Alpine Linux.
OS Win 10 64bit
put lite in c:\lite and open c:\project dir from lite
I use Ubuntu 19.10, Linux 5.3.0-24-generic
After cloning and building Lite without any problem, I moved its directory to my /opt/
. I created a symlink to the binary in my /usr/sbin/
to use Lite globally. But once launched in any directory that is not its own (in my case /opt/lite/
), it prints out this error and exits:
Error: [string "local core..."]:7: attempt to concatenate global '_EXEDIR' (a nil value)
stack traceback:
[string "local core..."]:7: in function <[string "local core..."]:2>
[C]: in function 'xpcall'
[string "local core..."]:2: in main chunk
I fixed it by adding my own path to the Lua string in src/main.c
, line 66, as follows:
_EXEDIR = _ARGS[1]:match('(.*)[/\\\\].*$') or '/opt/lite'
After recompiling, it launched perfectly fine.
But of course this edit only works for me.
As I understand it, you need to access the data/
directory where the Lua scripts are located. Why not have an installation script that saves into a user config file where the sources are?
Also, I guess I need to write in data/user/init.lua
if I want to customize Lite's behavior, but what about having a .literc
file or .lite
directory in the user's home?
Thank you for your time and work on this project :)
It'd be dope if you could select text from where the cursor is up to the where you click next by holding the shift key.
results should be more than one screen
The mouse cursor changes when you hover over the edge of the Tree-view area, but nothing happens when you drag it. Dragging to resize split editor panels works just fine.
When you invoke it from terminal like: lite new_file.txt
it should create new document and upon saving create new file with the specified name. Currently it just opens 'empty' window.
Hi
I really like the Lite editor - really quick and really clean. Reminds me of TextAdept - an example of convergent evolution?
Should you choose to add functionality I think Textadept may offer a map to follow. The keyboard driven extension TextRedux is also worth a look.
I have been trying to mold the two together to produce a curses WIN32 editor looking much like Lite.
Some questions about the current version:
Q1. Is there a way to list all the available commands?
Q2. Can key bindings be associated with a specific mode?
I like ESC to core:quit - will this mess up the autocomplete script?
Q3. Is there a way to execute arbitrary Lua code - see my post on command line editing (sorry about the lack of CRLF in the post - still not sure how to set up gmail for this mailing list)
Q4. Documentation??
Kind Regards Gavin Holt
OS Windows 10 64 bit
lite crash on start from a directory called non-latin characters
put lite exe to
c:\ΠΡΠΎΠ±Π°
ant start lite
The following information might be the product of multiple plugins used from https://github.com/rxi/lite-plugins.
The test took place under an ANSI C demo code.
So far I have detected the following hotkeys, in case you are interested:
Ctrl+L
highlights the whole lineCtrl+\
hides the sidebarCtrl+D
highlights the word under cursor and shows with highlighted border around multiple findings of that wordCtrl+P
it opens a file from a projectCtrl+Shift+P
runs a commandCtrl+Shift-D
duplicates a lineCtrl+Shift+K
deletes line under cursorShift+RightArrow
highlights character by character and behaves much like Ctrl-D
Ctrl+O
Opens a fileCtrl+F
Find Text (in current opened file)Ctrl+Shift+F
Find text in entire ProjectCtrl+R
Finds something and replaces itCtrl+J
This is a very interesting command: it deletes the newline from the end of a line; in other words, you have 3 lines, you place your cursor anywhere in your first line and press the hotkey twice. Now you have a single line.Ctrl+G
Go to lineCtrl+S
Save fileCtrl+Shift+S
Save asCtrl+A
Select all textCtrl+[
and Ctrl+]
jumps from code block to code block? π€·Ctrl+Shift+[
and Ctrl+Shift+]
highlights 3-ish lines forward and backward, respectivelyCtrl+'
Converts all your text to a single, minified line with escaped characters and newlinesCtrl+/
comments the current line; to select multiple lines, press Ctrl+Shift
and your arrows to select the lines you want, then the aforementioned command.Ctrl+Arrows
Moves the line up or downCtrl+Shift+Q
it adds a number sign, a hashtag, a pound sign..?, name it however you like, and makes a code block as a single line; weird behaviorAlt+Shift+L
clones the current screen on your right, vertically while maintaining curret's position on the cloned file; press Ctrl+W
to close itAlt+Shift+K
clones the current screen on the bottom, horizontally while maintaining curret's position on the cloned file; press Ctrl+W
to close itAlt+Shift+J
clones the current screen on your right, vertically while maintaining curret's position on the opened file; press Ctrl+W
to close itSee https://wiki.libsdl.org/Tutorials/TextInput
Chinese and Japanese users (mostly) use IMEs (input method editors) to input characters, and these require some help from the applications to work properly. Thankfully, SDL exposes functionality to do this.
I have implemented some basic support for it here, the patch is not large (about 40 lines total).
Here's a demonstration of me inputting some text in Japanese without this patch (you can't see the characters as I type them and the candidate box shows up in the top left corner of the window):
and with the patch:
I changed the code font in those demos since the default one does not have glyphs for CJK characters.
The reason I'm making an issue for this is because it's requires adding stuff to the core (albeit it's not a lot) and it can technically be considered new functionality. It does not affect users who don't use an IME in any way. I haven't tested it on windows since I don't have a windows computer but I assume it would work since the SDL APIs that the patch uses are supposed to work there too.
I will also add that this is not an ideal implementation, as the compositing text shows up in a box hovering in front of the rest of the text (similar to an over the spot implementation), however in my opinion it's better to have at least some basic support than none at all.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.