https://github.com/adsr/mle Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code + Explore + All features + Documentation + GitHub Skills + Blog * Solutions + By Plan + Enterprise + Teams + Compare all + By Solution + CI/CD & Automation + DevOps + DevSecOps + Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles + Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} adsr / mle Public * Notifications * Fork 39 * Star 584 Flexible terminal-based text editor (C) License Apache-2.0 license 584 stars 39 forks Star Notifications * Code * Issues 4 * Pull requests 3 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights adsr/mle This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 5 branches 8 tags Code * Clone HTTPS GitHub CLI [https://github.com/a] Use Git or checkout with SVN using the web URL. [gh repo clone adsr/m] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @adsr adsr add basic mouse support ... 37919fe Sep 27, 2022 add basic mouse support 37919fe Git stats * 519 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github/workflows tests vendor .gitignore .gitmodules LICENSE Makefile README.md buffer.c bview.c cmd.c cursor.c editor.c keys.h main.c mark.c mlbuf.h mle.1 mle.h snapcraft.yaml termbox2.h uscript.c uscript.inc uscript.inc.php uscript.lua utf8.c util.c View code [ ] mle Demos Aims Features Building Installing from a repo Basic usage Advanced usage: mlerc Shell command integration Advanced usage: Headless mode Advanced usage: Scripting Known bugs Forks Acknowledgments README.md mle mle is a small, flexible, terminal-based text editor written in C. Runs on Linux, Windows (Cygwin or WSL), FreeBSD, macOS, and more. Build Status Packaging status Demos asciicast * Emacs-style jump * Large file benchmark * Older demos 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.4-dev libpcre2-dev 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 Installing from a repo mle may be available to install via your system's package manager. # apt install mle # Ubuntu and Debian-based distros # dnf install mle # CentOS, RHEL, Fedora-based distros # pkg install mle # FreeBSD # yay -S mle # Arch (via AUR) # snap install mle # all major Linux distros # nix-env -i mle # NixOS (via nixpkgs) # apk add mle # Alpine # xbps-install mle # Void # brew install mle # macOS (Homebrew) # port install mle # macOS (MacPorts) # setup-x86.exe -q -P mle # Cygwin 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 * termbox2 for TUI * PCRE2 for syntax highlighting and search About Flexible terminal-based text editor (C) Topics c editor console terminal text text-editor hacktoberfest Resources Readme License Apache-2.0 license Stars 584 stars Watchers 19 watching Forks 39 forks Releases 8 v1.5.0 Latest May 28, 2022 + 7 releases Packages 0 No packages published Contributors 6 * * * * * * Languages * C 81.4% * NASL 12.5% * Shell 3.2% * PHP 1.4% * Roff 1.0% * Makefile 0.4% * Lua 0.1% Footer (c) 2022 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.