aboutsummaryrefslogtreecommitdiff
path: root/vis-cmds.c
AgeCommit message (Collapse)AuthorFilesLines
2017-05-06vis: add doxygen commentsMarc André Tanner1-2/+2
Rename some structures, add typedefs for function pointers, remove unused arguments from vis_run.
2017-05-03text: remove count argument from text_{earlier,later}Marc André Tanner1-4/+7
2017-03-21vis: reject invalid option namesMarc André Tanner1-0/+4
This should fix the ressource leak as found by CID 142510.
2017-03-19Move :set horizon option implementaiton to luaMarc André Tanner1-3/+0
2017-03-19Move :set theme option implementation to luaMarc André Tanner1-6/+0
2017-03-19Move :set syntax option implementation to luaMarc André Tanner1-17/+0
It is no longer possible to change the used syntax by assigning to the `win.syntax = name` field, instead the function win:set_syntax(name)` should be called. The distinction between filetype and syntax lexer to use should probably be clarified/cleaned up at some point.
2017-03-19vis: add infrastructure to dynamically add :set optionsMarc André Tanner1-25/+86
2017-03-14Add experimental raw vt100 UI backendMarc André Tanner1-0/+1
The intention of this is not to slowly reimplement curses but to provide a minimal working terminal UI backend which can also be used for debugging, fuzzing and in environments where curses is not available. Currently no attempt is made to optimize terminal output. The amount of flickering will depend on the smartness of your terminal emulator.
2017-03-02vis: remove :bdelete commandMarc André Tanner1-18/+0
It does not really fit into the style of the rest of the command language. Eventually we should be able to express this kind of thing using a looping construct based on the `X` and `Y` commands.
2017-02-27vis: allow useage of file dialog for :read commandMarc André Tanner1-0/+18
Fix #505
2017-02-24vis: make help texts optional to produce a smaller binaryMarc André Tanner1-12/+20
$ ./configure --disable-help shrinks the binary by about 20K on a x86_64 system.
2017-02-23vis: unify error path of command registration functionsMarc André Tanner1-6/+10
2017-02-08vis: fix cursor positioning after :helpMarc André Tanner1-0/+1
2017-02-05vis: add file argument to vis_pipeMarc André Tanner1-1/+2
2017-02-02vis: support rudimentary help search using :help patternMarc André Tanner1-0/+3
The argument needs to be a valid regular expression. It currently clobbers the last used search term and hence allows repeated searches using `n` and `N` respectively.
2017-01-31vis: add workaround for broken color handling in Terminal.appMarc André Tanner1-0/+3
Terminal.app sets $TERM=xterm-256color and ships a corresponding terminfo description advocating that it is capable of color changes to the 256 color palette when in fact it can not. We introduce a new boolean option "change-256colors" which is true by default but can be used to disable color changes. It is automatically set if Terminal.app is detected using $TERM_PROGRAM. This should fix display artifacts as described in #456.
2017-01-19text-regex: add regex backend based on libtreMarc André Tanner1-0/+1
While memory consumption should be improved, backward searches will still be slow, because they are implemented in terms of repeated forward searches. It needs to be investigated whether the underlying automaton can have its transitions reversed and essentially run backwards, as is the case in sam.
2017-01-15vis: show error messages for failed :map/:unmap commandsMarc André Tanner1-7/+19
Close #458
2017-01-10vis: add register description to :help outputMarc André Tanner1-0/+6
2017-01-10vis: add valid marks to :help outputMarc André Tanner1-0/+5
2017-01-10vis: add process id to :help outputMarc André Tanner1-1/+1
2017-01-06vis: simplify mode lookup for :map and :unmapMarc André Tanner1-19/+2
2016-12-31vis: allow user registered :-commands to specify a help textMarc André Tanner1-3/+17
2016-12-31vis: typedef function type not pointer to functionMarc André Tanner1-2/+2
2016-12-28vis: do not free right hand side of mapping twiceMarc André Tanner1-8/+3
Fix #447
2016-12-27vis: properly free dynamic key bindingsMarc André Tanner1-2/+2
The handling of :unmap needs to be revisited at some point.
2016-12-17vis: allow boolean :set options to be toggledMarc André Tanner1-13/+29
Boolean options can be toggled by appending `!` to the option name. Close #435
2016-12-16vis: add section about compile time configuration to :help outputMarc André Tanner1-0/+15
2016-12-15vis: more informative error message for :set optionJosh Wainwright1-1/+1
Close #433
2016-12-14vis: add new :set savemethod auto|atomic|inplace optionMarc André Tanner1-0/+15
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-03vis: improve :set option number parsingMarc André Tanner1-5/+21
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-11-30vis: avoid inconsistent state after file reloading with :eMarc André Tanner1-1/+6
When a file is opened in multiple windows we could end up in an inconsistent state by doing: $ vis some-file :spl :e At this point the two windows were referencing different file objects thus changes in one would not affect the other although they have the same path. Another option would be to reload all windows currently displaying the file being reloaded. We opt for the simpler fix for now.
2016-11-25vis: fix I/O redirection bugs, cleanup vis_pipeMarc André Tanner1-2/+2
The `:!` command did redirect stdout to a pipe which was used by `vis-menu` to return the selected entry. However, this breaks other interactive commands such as `:!/bin/sh` where command output was never displayed. Instead we modified `vis-menu` to re-open /dev/tty for its user interface which makes it work as a regular filter `:|` This patch also obsoletes the interactive flag previously passed to the vis_pipe function. Interactive mode is instead enabled by piping an invalid range.
2016-11-22vis: add `:set escdelay nn` optionMarc André Tanner1-0/+6
Make the delay used to distinguish between an <Escape> key and other terminal escape sequences such as for the Meta key run time configurable. The value is given in miliseconds and defaults to 50ms. Notice that terminal multiplexers like dvtm or tmux might also induce some delay which has to be configured independently.
2016-11-22vis: populate :set option map at startupMarc André Tanner1-11/+0
2016-11-15vis: generalize special stdin handlingMarc André Tanner1-1/+1
In preparation to move argument parsing code out of vis.c.
2016-11-11vis: cleanup `:set option` argument parsing logicMarc André Tanner1-15/+5
No longer accept "no" prefix for boolean options. Reject too many option values (use proper quoting to specify values containing spaces).
2016-11-11vis: add `:set shell` optionMarc André Tanner1-0/+11
2016-11-10vis: split `:set show <option>` into separate optionsMarc André Tanner1-26/+14
It was the only command option which needed `=` to assign a value to. This unifies the argument parsing logic and adds the possibility to specify a per-option help text. You might want to adapt your visrc.lua configuration accordingly.
2016-11-05vis: display Lua package.cpath in :help outputMarc André Tanner1-11/+16
These paths are used to load the Lua LPeg module (lpeg.so) and are thus helpful when diagnosing setup problems in case syntax highlighting does not work.
2016-09-29sam: consistent argument handling for :r, :w, :e commandsMarc André Tanner1-2/+5
:e without any argument can be used to reload the file from disk whereas before a "Filename expected" error would be displayed.
2016-09-19vis: also list :set options in :help outputMarc André Tanner1-47/+15
The help formatting could probably be improved, short single line help texts are still missing. Patches welcome. Close #283
2016-09-19vis: add rudimentary builtin help for :-commandsMarc André Tanner1-1/+12
2016-05-22vis: consider :set horizon setting when syntax highlightingMarc André Tanner1-1/+1
2016-05-22vis: move syntax highlighting to pure Lua codeMarc André Tanner1-3/+3
2016-05-18vis: add #define for VIS_MENUMarc André Tanner1-4/+0
2016-05-18vis: add an interactive mode to vis_pipe{,_collect}(...)Marc André Tanner1-1/+1
Previously the interactive mode was implicitly enabled by passing an invalid range. However for some use cases (e.g. completion) we need to be able to pipe a given text range to an external process without also redirecting stderr (which is used to draw the slmenu interface on top of vis).
2016-05-13vis: clean up key mapping implementationMarc André Tanner1-21/+4
2016-05-10Revert "vis: clean up interaction between vis and ui"Marc André Tanner1-1/+2
This caused issues on OpenBSD where it crashed the terminal. Also on Mac OS X suspend via ^Z (Ctrl-Z) was missing a \r i.e. the shell prompt was not properly redrawn. While in principle user interfaces should not have to depend on libtermkey, in practice this won't be an issue unless we are adding a non-terminal based UI (which won't happen anytime soon). This reverts commit 8f92b98848f9366e78c7aa824615bade83971513. Close #311
2016-05-04vis: clean up interaction between vis and uiMarc André Tanner1-2/+1
A concrete user interface implementation should not have to depend on libtermkey. Therefore the vis core now uses an independent instance to parse keys.