aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-12-15vis: always store registers values NUL terminatedMarc André Tanner1-4/+6
Previously we only made sure that the register content is NUL terminated when reading it out. This made it impossible to distinguish between an empty register and one which stores a single NUL byte. Now the in memory representation of a non-empty register is always NUL terminated. When appending we temporarily remove the trailing NUL byte and restore it later. This should fix put commands of a previously yanked single NUL byte.
2016-12-15vis: respect terminating NUL bytes in the input queueMarc André Tanner1-1/+1
It can happen that the Buffer content used for the input queue becomes <\000> where the NUL byte is intended to terminate the queue, but termkey happily parses it and because it is delimited by < and > on both sides we then interpret it as a key. In input mode this leads to the insertion of a NUL byte which is displayed as ^@. Close #432
2016-12-15vis: more informative error message for :set optionJosh Wainwright1-1/+1
Close #433
2016-12-14lua: make sure we always load a default themeMarc André Tanner2-1/+2
2016-12-14lua: improve error message when failing to load lpeg/lexer moduleMarc André Tanner2-9/+22
Differentiate between the case where the module is not found and the case where an error occured while loading it. This should make it easier to debug cases in which there is a Lua version mismatch between vis and lpeg.
2016-12-14vis: remove useless NULL checkMarc André Tanner1-1/+1
The very first thing we do if that check is false, is return from the function.
2016-12-14build: improve description of --enable-lpeg configure optionMarc André Tanner1-1/+1
It links lpeg statically into the vis binary, meaning it does not need to be dlopen(3)-ed at runtime. While this improves the portability of the resulting vis binary, it is not necessary to enable this option to get syntax highlighting support. Maybe the option should be renamed to avoid further confusion.
2016-12-14lua: avoid errors if no theme is setMarc André Tanner1-7/+7
Close #429
2016-12-14lua: add crontab file type and configure it to save in-placeMarc André Tanner1-0/+4
This should fix isses with `crontab -e` editing.
2016-12-14lua: allow per file type :commands being executedMarc André Tanner1-3/+11
2016-12-14lua: use Lua patterns to match file extensionsMarc André Tanner1-125/+120
2016-12-14vis: add new :set savemethod auto|atomic|inplace optionMarc André Tanner4-2/+38
Specifies how the current file should be saved, `atomic` which uses rename(2) to atomically replace the file, `inplace` which truncates the file and then rewrites it or `auto` which tries the former before falling back to the latter. The rename method fails for symlinks, hardlinks, in case of insufficient directory permissions or when either the file owner, group, POSIX ACL or SELinux labels can not be restored. The option defaults to `auto`.
2016-12-14text: expose text save method to calling codeMarc André Tanner3-11/+13
There are cases where it is useful to specify how the file should be saved.
2016-12-13build: fix Cygwin buildMarc André Tanner1-1/+2
The simple method lpeg uses to create a shared library does not seem to work in Cygwin.
2016-12-13man: avoid standard directives which are undefined for some groff versionsMarc André Tanner1-2/+2
This fixes a warning when displaying the manual page on macOS systems.
2016-12-13build: remove internal configure options from help textMarc André Tanner1-2/+0
These are used by `make standalone` but are not really appropriate for normal usage and just cause confusion as demonstrated by #373.
2016-12-13build: add configure options for built-in lpeg supportMarc André Tanner4-19/+68
2016-12-12Allow building lpeg into visMichael Forney2-0/+11
If lpeg is built statically, this allows for a completely static vis binary that still supports syntax highlighting.
2016-12-09Remove useless variable assignmentMarc André Tanner1-1/+0
Fixes CID 139067.
2016-12-09vis-lua: add generic way to expose C text objects to LuaMarc André Tanner1-1/+41
Expose text_object_word as an example.
2016-12-09man: fix mistakesMarc André Tanner1-6/+13
2016-12-09vis-lua: add comment about possibly outdated Lua API documentationMarc André Tanner2-1/+3
2016-12-09lua: add more mime types for file type detectionMarc André Tanner1-0/+21
2016-12-09vis-lua: expose input key event in insert and replace modesMarc André Tanner6-1/+53
2016-12-08vis: rename some internal C function pointersMarc André Tanner3-14/+12
2016-12-08build: include Lua files in windows zipMarc André Tanner1-1/+1
2016-12-08Update tests to changes in Lua APIMarc André Tanner1-12/+5
2016-12-08vis-lua: only fail file_save_pre event if explicitly returned falseMarc André Tanner1-1/+1
Previously we would also interpret a missing return value `nil` as is the case when no pre save event handler is subscribed as failure.
2016-12-08Move manual pages to man/ subfolderMarc André Tanner5-3/+3
2016-12-08vis-lua: move mode constants from vis.MODE_* to vis.modes.*Marc André Tanner3-44/+44
2016-12-08vis-lua: add optional help parameter to mapping functionsMarc André Tanner3-12/+18
2016-12-08vis-lua: expose init event and use it to set default themeMarc André Tanner4-6/+15
The init event is emitted immediately after `visrc.lua` has been sourced, but before any other events have occured, in particular the command line arguments have not yet been processed. Close #422
2016-12-08lua: add simple event multiplexing mechanismMarc André Tanner6-24/+121
The editor core calls into the functions registered in the `vis.events` table which then multiplex the events to all registered event handlers. The first handler which returns a non `nil` value terminates event propagation.
2016-12-07lua: move non-core code out of vis.luaMarc André Tanner5-591/+585
The following structure is adapted: * visrc.lua entry point for all Lua code * vis.lua only implements the Lua part of the core API * vis-std.lua registers standard event handlers (e.g. syntax highlighting, statusbar handling, theme changes etc). It is sourced from vis.lua. * plugins/* non essential editor functionality, needs to be explicitly enabled by loading it from visrc.lua
2016-12-07Cleanup .gitignore and ignore HTML and CSS filesMarc André Tanner1-8/+9
Close #424
2016-12-07Move all lua related files to lua/ subfolderMarc André Tanner141-32/+46
Also remove the lexers sub directory from the Lua search path. As a result we attempt to open fewer files during startup: $ strace -e open -o log ./vis +q config.h && wc -l log In order to avoid having to modifiy all lexers which `require('lexer')` we instead place a symlink in the top level directory. $ ./configure --disable-lua $ rm -rf lua Should result in a source tree with most lua specifc functionality removed.
2016-12-06Reorganize READMEMarc André Tanner1-599/+30
Reference external manual page and Lua API documentation. This is still work in progress the piece table documentation should probably also be moved somewhere else.
2016-12-06vis-lua: more extensive Lua API documentationMarc André Tanner5-33/+281
2016-12-05vis-lua: add preliminary version of LDoc based Lua API documentationMarc André Tanner2-3/+368
A new Makefile target `luadoc` has been added which generates HTML documentation in the doc subfolder using ldoc(1) from https://stevedonovan.github.io/ldoc/ There are still a few problems to resovle, for example the links (e.g. in parameter lists) to our custom types seem to be broken. At this point only the C part of the Lua API is covered and even that is not yet complete.
2016-12-05view: make cursor placement more robustMarc André Tanner1-0/+5
Reject invalid cursor positions.
2016-12-05man: improve vis manual pageMarc André Tanner1-129/+203
2016-12-03vis: use file(1) for file type detectionMarc André Tanner1-174/+384
File type detection works as follows: 1) strip off suffixes to be ignored and test against a set of known file extensions 2) run `file -bL --mime-type` and check against a set of known mime types 3) read out the first few bytes of the file and pass them to custom Lua file type detection functions For now the configured file extensions are literal strings which are matched against the end of the file name. Maybe we should use Lua patterns instead. We will need to add more mime types to our mapping table. For now only the `bash` file type was associated with the text/x-shellscript mime type.
2016-12-03build: do not define _FORTIFY_SOURCE for debug buildsMarc André Tanner1-1/+1
This avoids warnings like: "_FORTIFY_SOURCE requires compiling with optimization".
2016-12-03vis: improve :set option number parsingMarc André Tanner3-8/+22
Only accept numbers in range [0, INT_MAX]. Reject trailing garbage, where before something like `:set cc 50NaN` worked it will now cause an error. Close #418
2016-12-02build: simplify manual page installationMarc André Tanner1-9/+5
The version substitution does not seem to work with BSD make because ${VERSION} is expanded to an empty string.
2016-12-02build: add new `make man` targetMarc André Tanner1-0/+8
Uses mandoc(1) to generate manual pages in HTML format.
2016-12-02man: improve formatting and fix warningsMarc André Tanner1-112/+105
2016-12-02man: Make vis-{clipboard,menu,open} manpages lint-clean.Tim Allen3-44/+40
They now pass `mandoc -Tlint` (the BSD manpage renderer) and `man --warnings=w` (the GNU one).
2016-12-01man: first steps towards a proper manual pageMarc André Tanner1-480/+808
2016-12-01Merge branch 'master' of https://github.com/josuah/vis into manMarc André Tanner1-39/+857
Conflicts: vis.1