update readme
This commit is contained in:
parent
36b32c5a23
commit
8233c722b8
76
README.md
76
README.md
|
@ -9,21 +9,37 @@ line editors such as linenoise (see rdstdin in the nim
|
||||||
standard library) or nimline (https://github.com/h3rald/nimline). Currently you probably want to use either of
|
standard library) or nimline (https://github.com/h3rald/nimline). Currently you probably want to use either of
|
||||||
those because this is a wip.
|
those because this is a wip.
|
||||||
|
|
||||||
# Building
|
# Installation
|
||||||
|
|
||||||
Have nim (tested on 1.4.2, x86_64 gnu/linux) installed.
|
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://github.com/japl-lang/jale
|
git clone https://github.com/japl-lang/jale
|
||||||
cd jale
|
cd jale
|
||||||
nim c main
|
nimble install
|
||||||
./main
|
|
||||||
```
|
```
|
||||||
|
|
||||||
You should enter a temporary testing prompt, which you
|
# Checking the examples out
|
||||||
can quit with ctrl+c.
|
|
||||||
Pressing enter when the last line is empty submits
|
Building the examples
|
||||||
the output.
|
|
||||||
|
```
|
||||||
|
nimble examples
|
||||||
|
```
|
||||||
|
|
||||||
|
Checking the sample editor out. Quit with ctrl+c, save with ctrl+s.
|
||||||
|
|
||||||
|
```
|
||||||
|
examples/editor <filename>
|
||||||
|
# or windows:
|
||||||
|
.\examples\editor.exe <filename>
|
||||||
|
```
|
||||||
|
|
||||||
|
Checking the interactive prompt out. Move between lines using ctrl+up/down. Create new lines with ctrl+down on the last line. ctrl+page up/down also works.
|
||||||
|
|
||||||
|
```
|
||||||
|
examples/interactive_history
|
||||||
|
# or windows:
|
||||||
|
.\examples\interactive_history.exe
|
||||||
|
```
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
|
|
||||||
|
@ -32,45 +48,7 @@ the output.
|
||||||
- very customizable (even inserting characters is a keybinding that's optional)
|
- very customizable (even inserting characters is a keybinding that's optional)
|
||||||
- plugin system based
|
- plugin system based
|
||||||
- history
|
- history
|
||||||
|
- horizontal scrolling
|
||||||
# Example usage
|
|
||||||
|
|
||||||
```nim
|
|
||||||
# for now, from the same directory where it's cloned
|
|
||||||
# import the line editor
|
|
||||||
import editor
|
|
||||||
# import the default keybindings for basic stuff
|
|
||||||
# like arrow key movement or inserting characters
|
|
||||||
import plugin/defaults
|
|
||||||
# import helper templates for adding custom key or
|
|
||||||
# event bindings
|
|
||||||
import templates
|
|
||||||
|
|
||||||
# create the line editor
|
|
||||||
let e = newLineEditor()
|
|
||||||
# set its prompt to something
|
|
||||||
e.prompt = "> "
|
|
||||||
# add the default keybindings
|
|
||||||
e.populateDefaults()
|
|
||||||
|
|
||||||
var printOutput = true
|
|
||||||
|
|
||||||
# very weird use case, but if ctrl+b is pressed during reading, don't
|
|
||||||
# print the output
|
|
||||||
e.bindKey("ctrl+b"):
|
|
||||||
printOutput = false
|
|
||||||
|
|
||||||
let input = e.read()
|
|
||||||
if printOutput:
|
|
||||||
echo "output:"
|
|
||||||
echo input
|
|
||||||
```
|
|
||||||
|
|
||||||
Also see examples folder if the above example does not suffice,
|
|
||||||
and look at defaults.nim for many binding examples.
|
|
||||||
Look at multiline.nim's procs and editor.nim's
|
|
||||||
LineEditor type for an "API". It's wip, docs will
|
|
||||||
improve if it ever gets more stable.
|
|
||||||
|
|
||||||
# Missing features
|
# Missing features
|
||||||
|
|
||||||
|
@ -79,5 +57,5 @@ Note: they won't be missing forever hopefully.
|
||||||
- No utf-8
|
- No utf-8
|
||||||
- No tab autocompletion support
|
- No tab autocompletion support
|
||||||
- No syntax highlighting support
|
- No syntax highlighting support
|
||||||
- Windows keybindings not finished, windows was not tested yet
|
- Windows output still really unstable/untested in depth
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue