All Projects → adsr → Mle

adsr / Mle

Licence: apache-2.0
Flexible terminal-based text editor (C)

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Mle

Dte
A small, configurable console text editor (moved to https://gitlab.com/craigbarnes/dte)
Stars: ✭ 98 (-74.07%)
Mutual labels:  terminal, console, editor, text-editor
Femto
A toy text editor with no dependencies written in Ruby
Stars: ✭ 34 (-91.01%)
Mutual labels:  editor, text-editor, text
Micro
A modern and intuitive terminal-based text editor
Stars: ✭ 18,526 (+4801.06%)
Mutual labels:  terminal, editor, text-editor
Cloudcmd
✨☁️📁✨ Cloud Commander file manager for the web with console and editor.
Stars: ✭ 1,332 (+252.38%)
Mutual labels:  console, hacktoberfest, editor
Text
📑 Collaborative document editing using Markdown
Stars: ✭ 282 (-25.4%)
Mutual labels:  hacktoberfest, editor, text
Zep
Zep - An embeddable editor, with optional support for using vim keystrokes.
Stars: ✭ 477 (+26.19%)
Mutual labels:  editor, text-editor, text
Csconsoleformat
.NET C# library for advanced formatting of console output [Apache]
Stars: ✭ 296 (-21.69%)
Mutual labels:  terminal, console, text
Zmjimageeditor
ZMJImageEditor is a picture editing component like WeChat. It is powerful and easy to integrate, supporting rendering, text, rotation, tailoring, mapping and other functions. (ZMJImageEditor 是一个和微信一样图片编辑的组件,功能强大,极易集成,支持绘制、文字、旋转、剪裁、贴图等功能)
Stars: ✭ 470 (+24.34%)
Mutual labels:  editor, text-editor, text
Suplemon
🍋 Console (CLI) text editor with multi cursor support. Suplemon replicates Sublime Text like functionality in the terminal. Try it out, give feedback, fork it!
Stars: ✭ 734 (+94.18%)
Mutual labels:  terminal, console, editor
Tldr
📚 Collaborative cheatsheets for console commands
Stars: ✭ 36,408 (+9531.75%)
Mutual labels:  terminal, console, hacktoberfest
Left
Distractionless Writing Tool
Stars: ✭ 1,538 (+306.88%)
Mutual labels:  editor, text-editor, text
Htop
htop - an interactive process viewer
Stars: ✭ 3,076 (+713.76%)
Mutual labels:  terminal, console, hacktoberfest
Ruby jard
Just Another Ruby Debugger. Provide a rich Terminal UI that visualizes everything your need, navigates your program with pleasure, stops at matter places only, reduces manual and mental efforts. You can now focus on real debugging.
Stars: ✭ 669 (+76.98%)
Mutual labels:  terminal, console, hacktoberfest
Word Wrap
Wrap words to a specified length.
Stars: ✭ 107 (-71.69%)
Mutual labels:  terminal, console, text
Finalcut
A text-based widget toolkit
Stars: ✭ 244 (-35.45%)
Mutual labels:  terminal, console, text
Chalk
🖍 Terminal string styling done right
Stars: ✭ 17,566 (+4547.09%)
Mutual labels:  terminal, console
Castero
TUI podcast client for the terminal
Stars: ✭ 375 (-0.79%)
Mutual labels:  terminal, hacktoberfest
A
A graphical text editor
Stars: ✭ 280 (-25.93%)
Mutual labels:  editor, text
Nestjs Console
A nestjs module that provide a cli to your application.
Stars: ✭ 284 (-24.87%)
Mutual labels:  terminal, console
Consola
Elegant Console Logger for Node.js and Browser 🐨
Stars: ✭ 3,461 (+815.61%)
Mutual labels:  terminal, console

mle

mle is a small, flexible, terminal-based text editor written in C.

Runs on Linux, Windows (cygwin or WSL), FreeBSD, and macOS.

Build Status

Packaging status

Demos

asciicast

Aims

  • Keep codebase small and hackable
  • Minimize build-time and run-time dependencies
  • Make extensible and configurable
  • Favor simplicity over portability
  • Use shell commands to enhance functionality (e.g., grep, tree)

Features

  • Small codebase (<10k sloc)
  • Full UTF-8 support
  • Syntax highlighting
  • Stackable key maps (modes)
  • Extensible via Lua
  • Scriptable rc file
  • Key macros
  • Multiple splittable windows
  • Regex search and replace
  • Large file support
  • Incremental search
  • Linear undo and redo
  • Multiple cursors
  • Auto indent
  • Headless mode
  • Navigation via ctags
  • Movement via less
  • Fuzzy file search via fzf
  • File browsing via tree
  • File grep via grep
  • String manip via perl

Building

$ sudo apt install git build-essential libtool automake # or equivalent
$
$ git clone --recursive https://github.com/adsr/mle.git
$ cd mle
$ make mle_vendor=1

To build a completely static binary, try make mle_vendor=1 mle_static=1.

You can also run plain make to link against system libraries instead of vendor/. Note this requires the following packages to be installed:

uthash-dev
liblua5.3-dev
libpcre3-dev
libtermbox-dev

Installing

To install to /usr/local/bin:

$ make install

To install to a custom directory, supply prefix, e.g.:

$ make install prefix=/usr # /usr/bin/mle

Basic usage

$ mle             # Open blank buffer
$ mle one.c       # Edit one.c
$ mle one.c:100   # Edit one.c at line 100
$ mle one.c two.c # Edit one.c and two.c
$ mle -h          # Show command line help

The default key bindings are intuitive. Input text as normal, use directional keys to move around, use Ctrl-S to save, Ctrl-O to open, Ctrl-X to exit.

Press F2 for full help.

Advanced usage: mlerc

mle is customized via command line options. Run mle -h to view all cli options.

To set default options, make an rc file named ~/.mlerc (or /etc/mlerc). The contents of the rc file are any number of cli options separated by newlines. Lines that begin with a semi-colon are interpretted as comments.

If ~/.mlerc is executable, mle executes it and interprets the resulting stdout as described above. For example, consider the following snippet from an executable ~/.mlerc bash(1) script:

# Define 'test' kmap
echo '-Ktest,,1'

# M-q: replace grep with git grep if `.git` exists
if [ -d ".git" ]; then
  echo '-kcmd_grep,M-q,git grep --color=never -P -i -I -n %s 2>/dev/null'
fi

# Set default kmap
echo '-n test'

This overrides the built-in grep command with git grep if .git exists in the current working directory.

Shell command integration

The following programs will enable or enhance certain features of mle if they exist in PATH.

  • bash (tab completion)
  • fzf (fuzzy file search)
  • grep (file grep)
  • less (less integration)
  • perl (perl 1-liners)
  • readtags (ctags integration)
  • tree (file browsing)

Arbitrary shell commands can also be run via cmd_shell (M-e by default). If any text is selected, it is sent to stdin of the command. Any resulting stdout is inserted into the text buffer.

Advanced usage: Headless mode

mle provides support for non-interactive editing which may be useful for using the editor as a regular command line tool. In headless mode, mle reads stdin into a buffer, applies a startup macro if specified, and then writes the buffer contents to stdout. For example:

$ echo -n hello | mle -M 'test C-e space w o r l d enter' -p test
hello world

If stdin is a pipe, mle goes into headless mode automatically. Headless mode can be explicitly enabled or disabled with the -H option.

If stdin is a pipe and headless mode is disabled via -H0, mle reads stdin into a new buffer and then runs as normal in interactive mode.

Advanced usage: Scripting

mle is extensible via the Lua programming language. Scripts are loaded via the -x cli option. Commands registered by scripts can be mapped to keys as normal via -k. See uscript.lua for a simple example.

There is also a wren branch with Wren scripting support. That work is on pause.

Known bugs

  • Multi-line style rules don't work properly when overlapped/staggered.

Forks

  • eon - mouse support and Notepad-like selections
  • turbo-mle - Turbo Vision port

Acknowledgments

mle makes extensive use of the following libraries.

  • uthash for hash maps and linked lists
  • termbox for TUI
  • PCRE for syntax highlighting and search
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].