https://github.com/zhuzilin/li
another mini text editor with 500 loc and simple interfaces for short cut.
https://github.com/zhuzilin/li
text-editor
Last synced: about 2 months ago
JSON representation
another mini text editor with 500 loc and simple interfaces for short cut.
- Host: GitHub
- URL: https://github.com/zhuzilin/li
- Owner: zhuzilin
- License: mit
- Created: 2019-08-06T06:56:37.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-08-06T20:52:31.000Z (almost 6 years ago)
- Last Synced: 2025-03-26T03:51:14.492Z (2 months ago)
- Topics: text-editor
- Language: C++
- Size: 103 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# li (里)
li is another mini text editor with 500 loc and simple interfaces for short cut.Inspired by [antirez/kilo](https://github.com/antirez/kilo) and the great tutorial [here](https://viewsourcecode.org/snaptoken/kilo/), li uses C++11 to simplify some pointer manipulation in kilo.
## Usage
To use li, just
```
> make
> li about_li
```

## Add Short Cuts
Also to make li easier to customize, li extracted simple interfaces for short cut. The `find.cpp` is an example.
To add search for Ctrl+F, just claim the function needed in an external file like `find.cpp`:
```c++
// find.cpp
#include "li.h"void editorFindCallback(const std::string& query, int key) {
...
}void editorFind() {
...
}
```
And in `li.h` and `li.cpp`, add:
```c++
// li.h/*** add-ons ***/
void editorFind();// li.cpp
std::unordered_map fns({
{CTRL_KEY('f'), editorFind}
});
```
Last, add `find.cpp` to `Makefile` and make li. Now the search short cut has been added successfully!## Customize Highlight
To customize highlight, please use `default_highlight.cpp` as an example. Don't forget to change the `Makefile`.## TODOs
- [x] add modular highlight.## Acknowledgement
- [antirez/kilo](https://github.com/antirez/kilo): A text editor in less than 1000 LOC with syntax highlight and search.
- [Build Your Own Text Editor](https://viewsourcecode.org/snaptoken/kilo/): an instruction booklet that shows you how to build a text editor in C.