Expose git root to meta
Document default macros
meta.helpers.call should capture stderr
A fully-featured macro system for the nano editor, powered by Luajit.
nano -s ./nam YOURFILE
Supply the location of nam
to the -s
flag, and open your file/s like normal. (Or an empty buffer.)
Then, write the macro call you want directly into the buffer, on it's own line:
!:spell
And then call the spellchecker with ^T
or whatever non-default binding you've added.
The macro system can only effect the open buffer, it can't modify nano's default behaviours. It cannot move the active cursor.
This turns it into a text-manipulation system, rather than a self-modifying system like you might find in vim and emacs.
It is still reasonably powerful.
See the issue tracker.
You don't need a user to post.
Metadata can be utilied by macros.
It can be set by placing a file called .namrc
in the Current Working Directory, git repository root, and ~/.namrc
.
This file represents the contents of a Lua key-value table.
e.g.
wat = "Hello?",
is equivalent to:
return {wat = "Hello?",}
Place a file named .nam
in the Current Working Directory or root of a git repository (for just this project), or at ~/.nam/.nam
(to apply everywhere).
This file is expected to:
Return a table that contains two further tables:
A table called 'file' for file-scoped macros
A table called 'inline' for line-scoped macros
The spell macro, calls a file with either 'aspell -c' or a string set in .namrc to the key 'spellcheck'.
The build macro looks for the meta key 'build'. It calls it with any supplied arguments, and captures the output.
Upon completion, the output is opened in a new nano instance, which can be closed to resume processing.
The lint macro looks for the meta key 'lint'. It calls it with any supplied arguments, and captures the output.
Upon completion, the output is opened in a new nano instance, which can be closed to resume processing.
The replace macro takes two arguments: The first is a pattern to supply to Luajit's gsub, and the second is the replacement.
Copyright 2019 James Milne
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.