Table of Contents
Lued
lua-based text editor
Description
Lued is an extensible, terminal-based text editor written in C and Lua.
Contact
<[email protected]> Vist jwrr.com for more examples.Basic Operations Work as Expected
- Open a file with 'lued filename.txt and JUST START TYPING...
- Arrow keys, Delete, Backspace, PgUp, PgDnwork as expected.
- Homeand Endgo to the beginning and end of line, respectively.
- Ctrl+ssaves the file.
- Ctrl+aselects all of the text in the file.
- Ctrl+ffinds a string.
- Ctrl+rreplaces a string.
- Ctrl+z/ Ctrl+yundo and redo, repectively, as expected.
- Ctrl+oopens an existing file.
- Ctrl+nopens a new file.
- Ctrl+c, Ctrl+xand Ctrl+vcopy, cut and paste.
- Ctrl+qquits the editor and Ctrl+wcloses the document.
Ctrl, Alt and Esc
- To minimize clashes with the terminal window, Lued uses the Altkey for most of its commands.
- All of the above Ctrlkeystroke commands have an equivalent, similarly named Altcommand.
- Pressing Escand then pressing a key is equivalent to simultaneously pressing Altand the key. Some keystrokes may be more comfortable with Esc, while others may be easier with Alt. Note, this behavior is a feature of the terminal and is not unique to Lued.
Working Multiple Files
- Alt+oopens another file. Each file is contained in a tab.
- Alt+tselects one of the open tabs.
- Alt+ttswitches to the next tab.
- Alt+tytoggles between the last two tabs.
- Alt+oopens an existing file.
- Alt+ncreates a new file.
- Alt+qquits the editor and Alt+wcloses the document.
Moving Around
- The arrow keys move the cursor as expected.
- Alt+hjumps to the end of the line.
Endalso jumps to the end of the line.
- Alt+gjumps to the beginning of the line. When the line is indented the cursor moves to the first non-space of the line. If the cursor is on the first non-space then the cursor moves to the first character of the line.
Homealso jumps to the beginning of the line. - Shift+RightArrow moves a word to the left.
- Shift+RightArrow moves a word to the right.
- Shift+DownArrow moves down a partial page (the partial page size is configurable).
- Shift+UpArrow moves up a partial page.
- Alt+bmoves to the bottom, last line, of the file when the cursor is on the first line. Otherwise, it moves to the first line of the file.
- Alt+umoves the cursor and the line it's on to the upper part of the screen. This is useful when you're at the bottom of the screen and the text you're interested in is hidden on the next page.
- Alt+LLinserts a line above the current line and indents appropriately. This is useful when you want to add a line before the current line.
- Shift+RightArrow+Enter inserts a line after the current line and indents appropriately.
- The Mouse Scroll Wheel quickly moves up and down in steps of five lines (the number of lines is configurable).
- DoubleSpeed moves the cursor faster when using the arrow keys. After two moves in a direction, subsequent moves in that
same direction advance two steps instead of one.
Alt+DSturns on/off the Double-Speed feature.
- MagicMove uses Alt+<and Alt+>to speed up movement on a line by log2. The first step goes half the distance to the end (or beginning) of the line. The second step goes half the distance again. If the cursor goes too far then use the other MagicMove key to go in the other direction.
Select, Copy, Cut, Delete and Paste
- Alt+kselects the current word.
- Alt+ccopies selected text to the paste buffer.
- Alt+xcuts selected text to the paste buffer.
- Alt+vwrites the paste buffer into the text.
- Alt+edeletes to the end of word. If the cursor is over whitespace then it deletes the whitespace up to the start of the next word.
- Alt+dcuts an entire line into the paste buffer. Continue hitting Alt+dadds each deleted line to the paste buffer, so the paste buffer will contain multiple lines. You can then Alt+vto restore the text, move to another location and Alt+vagain, to duplicate the text.
- Alt+.starts selecting text. Move the cursor to the end of the selection and press Alt+cor Alt+xto copy or cut the selection into the paste buffer. If you start typing when a region is selected, the region will be deleted and replaced with the typing. Press Alt+.to abort the selection.
Find and Replace
- Alt+fis the forward find command and presents a dialog to enter a search string. Previous searches can be accessed quickly using the up arrow key.
- Alt+Fis the reverse find command.
- Alt+lis the find next command. If text is selected then the selected text will be searched for.
- Alt+jfinds the previous occurrence of the search string.
- Alt+ris the find and replace command.
- Alt+Sallsearches all tabs.
Comments
- Alt+CCcomments out the line and advances to the next line
- Alt+CSsets the comment to a custom string value.
Remove All Trailing Spaces
- Trailing whitespace is highlighted.
- Alt+Ratsremoves all trailing spaces. Esc+Ratsis equivalent
Mouse
- Try the Scroll Wheel... It should work
- Try Mouse select... It should work too Left Mouse Button to select, Middle Mouse Button to paste at cursor. Or... Left Mouse Button to select, Right Mouse Button to copy/paste to/from system buffer.
Installation
- git clone https://github.com/jwrr/lued.git
- cd lued
- make install make uses wget to download Lua 5.2.4 from https://www.lua.org/ftp make clones the carr repo from https://github.com/jwrr/carr carr provides support for large, dynamic arrays written in the C programming language. make compiles the source code make creates and populates ~/.lued make prompts to add lued to path
- ./lued TreasureIsland.txt ## courtesy of Project Guttenberg
Customize Keyboard Bindings
You can easily modify the keyboard bindings. The Lua file lued_bindings.lua contains the keyboard bindings.Extending Lued
You can write new Lued features and store them in the .lued/plugin directory. Files in this directory are automatically read at startup. lued_lib.lua contains the default Lued commands an provides a reference for new features.Terminal Work-arounds
- Alt+V - Gnome Terminal provides many keyboard shortcuts (https://help.gnome.org/users/gnome-terminal/stable/adv-keyboard-shortcuts.html.en). Sometimes the Gnome bindings conflict with LuEd bindings. For example, Alt+Vopens the Gnome Terminal View Menu. To disable Gnome's Alt+Vbehavior do the following: Edit > Keyboard Shortcuts..., and then unselect "Enable menu access keys". If you want to keep the Gnome behavior, Lued provides an alternative keyboard binding, Ctrl+V' instead of Alt+V.
- Ctrl+S - Terminals usually stop when Ctrl+S (XOFF) is pressed and remain suspended until Ctrl+Q (XON) is presed. This behavior may be confusing and a user may think the application is hung. The KDE Konsole terminal attempts to help by printing a warning message "Output has been suspended by pressing Ctrl+S. Press Ctrl+Q to resume". LuEd, and other text editors, use the stty command to disable the Ctrl+S (XOFF) and Ctrl+Q (XON) behavior. Unfortunately, older versions of Konsole have a bug that incorrectly shows the error message even when Ctrl+S (XOFF) is disabled. * Lued provides an alternative keyboard binding, Alt+s'Enter,to work around this Konsole bug.
TBD
- Indent Selection
- Block Select, Cut, Copy, Move
- Split screen
- Document API for plugins
- Syntax Highlighting