a cursorless text editor
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
Makefile
README
bang.c
bang.h
buffer.c
buffer.h
config.mk
draw.c
draw.h
err.c
err.h
insert.c
insert.h
lwe.1
lwe.c
undo.c
undo.h
yank.c
yank.h

README

 _           
| |_ _ _ ___ 
| | | | | -_|
|_|_____|___|
             
a cursorless text editor


lwe is a text editor in the terminal.  lwe is for you if you like your
editor to start up quickly, don't care for frills and extensions, and
want to try a very different method for controlling your text editor.
If you dig the extensibility of emacs or have more than 10 lines in
your .vimrc then you may enjoy trying out lwe but probably won't find
it useful for day to day use.

Learning lwe shouldn't be too difficult if you're coming from vim,
since you'll already be familiar with modal editing.  No matter what
editor you currently use, simplicity is an important goal of lwe so
there should be relatively few commands to learn.  The reward for your
efforts is an editor that encourages flow by allowing you to quickly
change anything you can see.  See below for details on how this works.
Or compile the code and get editing!

Github: https://github.com/thetomster/lwe
Issues: https://github.com/thetomster/lwe/issues


Quick command reference:
	j, C-d, down, pgdn	scroll down
	k, C-u, up, pgup	scroll up
	g			goto line

	q			quit

	w			write file

	i (I)			insert (line)
	a (A)			append (line)

	d (D)			delete (lines)
	c (C)			change (lines)

	y (Y)			yank (lines) copies text
	o (O)			paste before (line)
	p (P)			paste after (line)

	u			undo
	r			redo

	1 (!)			pipe text through shell command (lines)

	n			display line numbers
	s			show whitespace

	/			search forward
	?			search backward


Compiling / Installing

I use lwe on Linux and on Windows via Cygwin.  In these environments,
you should be able to simply clone the git repository and run make.
If that gives you errors about missing curses headers, you may need to
install libncurses-dev (or the equivalent for your system).  OS X should
be able to compile and run lwe as well, but I don't test it regularly so
it's less guaranteed.  The code should be fairly portable but it isn't
a priority so your mileage may vary.

To install you can copy the lwe executable to a location in your $PATH.
I usually have ~/bin in my path so I copy it to ~/bin/lwe.

	$ git clone https://github.com/TheTomster/lwe
	$ cd lwe
	$ make
	$ cp ./lwe ~/bin/lwe


First steps

	$ lwe foo

This command will open lwe editing file foo.  If foo doesn't exist,
an empty buffer will be opened, and the first time you write it will
create foo.

To start writing in an empty file, press `i` and start typing.  You should
see your text appear.  When it starts up, lwe is in COMMAND mode.
In this default mode it interprets your keypresses as commands to run.
Pressing lowercase i while in COMMAND mode will switch to INSERT mode.
In INSERT mode, your keypresses will insert text into the buffer, just
like notepad or nano.

Press escape or control-d to exit INSERT mode.  The last line of the
screen displays some status information, including what mode you're in.
It also tells the name of the file you are currently editing, as well
as what line you are scrolled to.

	[F: filename    ][M: mode    ][L: scroll pos]

If you've been following along, the status line should show that you're
in COMMAND mode.  Now you can press w (lowercase) to save the file.
There's no indication of a successful write, only an error on failure :-).
Finally, you can press q to quit.

Let's reopen the file to make sure that lwe is working, and to try out
this "cursorless editing" thing.  If there's already text in the buffer,
you'll notice that pressing i doesn't take you straight to INSERT mode.
Instead you get something called TARGET mode.  Since there's no cursor,
specifying where to act on the text is a separate step.  Inserts and
appends add text before or after the target you select.  Once you've
selected a location, lwe switches to INSERT mode.  The change and
delete commands do targeting twice, to pick a start and end point.
Everything between the points will be removed, and you'll be put into
INSERT or COMMAND mode depending on whether you did a change or delete.

Lowercase commands tend to operate on single letters. Uppercase commands
tend to operate on lines.  Experiment with i, I, d, and D to get an idea
of how the targeting works.

Refer to the quick command list above to get an idea of what other
commands are available to you.


Cursorless editing

In a typical screen-oriented text editor, a cursor is used to indicate
where editing operations will happen.  In lwe, there is no cursor.
Instead, each operation waits for a target.  For example, to insert text
you would type 'i' for insert, and then specify a location to insert
the text.  Typing a letter that appears on screen will start inserting
text at that letter.  Frequently there is more than one matching letter
on screen.  lwe will highlight all of the matches and label them a-z,
to allow you to choose which one you intended.  If there are a lot of
matches, it might take more than one layer of relabeling to specify the
correct one.  More than 2 layers is relatively rare, since you would
need more than 600 of the same letter on your screen to require a third
layer of disambiguation.

This is difficult to explain in words, but I think it's intuitive after
a little experimentation.  Instead of navigating the cursor around
constantly, you can locate where you wish to edit with your eyes.
Then simply press the letter you're interested in, and keep pressing
the letters that pop up until the targeting is done.