| Age | Commit message (Collapse) | Author | Files | Lines |
|
The first point of this commit is to allow all options to be read from
lua. This has a number of uses for plugin writers. They are grouped into
a couple of tables depending on what they control:
`vis.options`: table with global configuration
`win.options`: table with window specific configuration
The second point is to allow you to set all these options as if they
were simply lua variables. Technically this is already possible by
using `vis:command("set ...")` but personally I think this interface
is cleaner. Note that this already possible for some things like the
current mode (eg. vis.mode = vis.modes.VISUAL). Examples:
`vis.options.ai = true`
`win.options.brk = " !?."`
`win.options = { showeof = true, showtabs = true }
There are a number of related issues and pull requests:
closes #803: Lua API: let plugins read the values of options
closes #812: Window layout property
supersedes/closes #717: Add ability to access tabwidth from Lua
supersedes/closes #1066: expose UI layout and allow it to be set from lua API
|
|
The only place where this behaviour was encountered was in
file_lines_iterator() and it was just being worked around.
|
|
When `file` was made optional the variable was changed to be initialized
by `vis->win->file` instead of a known safe file pointer. If `vis:pipe()`
is called based on the event `FILE_OPEN` the `file` parameter can be
valid even when `vis->win` is not yet present. Assuming `file` was
provided this would be handled later on if vis didn't segfault. By
initializing to NULL when `vis->win` isn't present `file` is given
a chance be handled later. In the case where `file` wasn't given and
`vis->win` is missing an error is thrown and `vis:pipe()` exits.
fixes #1107 - Lua API: vis:pipe() causes a segfault when called before
a window is open
|
|
This enables restoring the terminal from a fullscreen command like
curses based program. Use cases are e.g. a file picker based on some
external program like nnn (https://github.com/jarun/nnn).
|
|
|
|
|
|
|
|
This reverts commit 22d4709e8a30c8feb9b4da7d78e0ea6a57af83e8.
erf mentioned[0] that this change broke a plugin. Revert for now
until have time to implement it without that bug.
[0] https://github.com/martanne/vis/issues/1034
|
|
The commit that added vis:message[0] used the existing vis_message_show
function which is used internaly to display lua stack traces. That
function uses the internal error_file. vis_event_emit does not trigger
events for internal files in order to avoid extra lua errors when already
printing a lua stack trace[1]. Due to this setup any usage of vis:message
showed the text in a window with default theme/syntax/status bar colors.
Instead of using the internal vis_message_show function, create a new
window and file that are not marked internal in the same manner as
cmd_help so themes are applied.
[0]: d815268 (vis-lua: implement vis:message(msg))
[1]: d555c90 (vis: properly redraw status bar of windows displaying internal files)
|
|
These are the permission bits of struct stat's st_mode field at the
time of the most recent load/save.
Close #861
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
We fake a modification by doing an insertion followed by a deletion
which does not actually change the buffer content.
Close #855
|
|
|
|
|
|
The function lua_pushstring can throw an error, meaning it
will setjmp(3) out thereby leaking the allocated memory.
By using lua_newuserdata we let Lua free the memory during
a GC run.
|
|
|
|
The core vis code was originally written under the assumption that there
always exists at least one window. However, when being called from the
Lua configuration file during start up this is not yet the case.
In general, Lua code should always be placed within appropriate event
handlers e.g. vis.events.INIT for global configuration. Invoking API
functions depending on an active window from top level statements is
not supported. Where before the editor simply crashed, these changes
turn such code sections into NOPs.
Fix #561
|
|
|
|
Fix #695
|
|
|
|
|
|
When the shell cannot find any matching files, the glob is not expanded,
and vis-open will return the absolute path of the current working
directory (because dirname outputs '.'), followed by the filename,
followed by a literal '*'. This commit checks that the final path
actually exists, and if not, exits with status 1.
It also uses text_object_longword for the range to match, so that
absolute paths are accepted, and replaced properly (else it only works
back to the first '/').
|
|
|
|
This for example skips the command prompt window.
|
|
Some marks (only '^ right now) are window specific while others
have file file scope. This distinction is currently hidden in
the API. Before this commit file.marks[...] would always operate
on the currently active window.
|
|
This should also fix coverity issue 157024.
|
|
|
|
Also expose all register slots through the Lua API.
|
|
|
|
We now use ' to refer to marks. Mark a is set using 'am and restored
using 'aM while this is slightly harder to type than ma and 'a it is
consistent with register usage for yank/put and allows a default
mark to be used which is handy for quick selection manipulation
primitives.
|
|
The key binding remain the same, but the selections are now stored on
a per-buffer basis.
|
|
Conflicts:
view.c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|