aboutsummaryrefslogtreecommitdiff
path: root/vis-cmds.c
AgeCommit message (Collapse)AuthorFilesLines
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.
2016-04-29vis: do not crash when processing :-commands and no window is activeMarc André Tanner1-19/+40
This is needed to make the vis.event.start Lua callback useful, setting global options should be possible even if no windows exist yet. The :set command options should probably be cleaned up further, some of them apply only to the currently active window while others have a global effect.
2016-04-28vis: unmap all mapped prefixes if a new mapping is forcedMarc André Tanner1-36/+27
Close #271
2016-04-23vis: display lua search paths in :help outputMarc André Tanner1-0/+15
2016-04-21vis: also show user registered :-commands in :help outputMarc André Tanner1-4/+6
2016-04-21vis: list usable symbolic keys in :help outputMarc André Tanner1-1/+76
2016-04-21vis: add infrastructure to register custom :-commandsMarc André Tanner1-0/+44
2016-04-19vis: add :set horizon optionDavid B. Lamkins1-0/+5
Can be used to specify the number of bytes before the visible area to consider for syntax highlighting. Defaults to 32K for now, whereas before it was 16K.
2016-04-19vis: add an unsigned option type for :set commandMarc André Tanner1-1/+3
2016-04-15vis: fix wrong usage message for :unmap commandMarc André Tanner1-1/+1
2016-04-15vis: improve handling of ~ and environment variables when opening filesMarc André Tanner1-1/+5
2016-04-14vis: allow mapping of <Space>Marc André Tanner1-4/+3
One should generally use <Space> in mappings: :map! normal <Space> h except for insert/replace mode where a literal space has to be used: :map! insert " " foo
2016-04-14vis: add #defines to ease overriding of utility namesMarc André Tanner1-1/+5
This should ease packaging for systems with an existing vis(1) binary.
2016-04-08vis: let :e recreate a window at the same location as the old oneMarc André Tanner1-1/+5
Close #224
2016-04-08vis: make ZZ work for unnamed but unmodified bufferMarc André Tanner1-1/+3
Close #236
2016-04-07Make explicit the space keybinding on help.Joshua Haase1-1/+1
2016-04-03vis: reimplement file open dialogMarc André Tanner1-38/+29
2016-04-03sam: unify vi(m) and sam command lineMarc André Tanner1-761/+59
The following vi commands have been dropped: - saveas - xit - ! The following commands are only recognized in their short form: - e (edit) - q (quit) - s (substitute) - w (write) - r (read)
2016-04-03Support sam's structural regular expression based command languageMarc André Tanner1-0/+10
For those not familiar with sam(1) more information can be found at http://sam.cat-v.org/ For now sam commands can be entered from the vis prompt via :sam <cmd> A command behaves differently depending on the mode in which it is issued: - in visual mode it behaves as if an implicit extract x command matching the current selection(s) would be preceding it. That is the command is executed once for each selection. - in normal mode: * if an address for the command was provided it is evaluated starting from the current cursor position(s) i.e. dot is set to the current cursor position. * if no address was supplied to the command then: + if multiple cursors exist, the command is executed once for every cursor with dot set to the current line of the cursor + otherwise if there is only 1 cursor then the command is executed with dot set to the whole file The command syntax was slightly tweaked to accpet more terse commands. - When specifiying text or regular expressions the trailing delimiter can be elided if the meaning is unambigious. - If only an address is provided the print command will be executed. - The print command creates a selection matching its range. - In text entry \t inserts a literal tab character (sam only recognizes \n). Hence the sam command ,x/pattern/ can be abbreviated to x/pattern If a command is successful vis switches to normal mode (and hence removes any selections), otherwise the editor is kept in visual mode. The print command "fails" by definition.
2016-04-01vis: cleanup vis_pipe APIMarc André Tanner1-5/+5
2016-03-25vis: remove __DATE__ and __TIME__ references to aid with reproducible buildsMarc André Tanner1-1/+1
2016-03-25vis: do not crash when using vis:command without active windowMarc André Tanner1-1/+8
2016-03-15vis: do not segfault when given a NULL command to processMarc André Tanner1-0/+2
2016-03-12vis: overhaul search related code, support "/ registerMarc André Tanner1-5/+2
2016-02-20vis: list layout specifc key mappings in <F1> help outputMarc André Tanner1-0/+10
2016-02-20vis: implement :langmap command to set keyboard mappingsMarc André Tanner1-0/+34
The mappings affect all non-input (i.e. insert/replace) modes. They are useful for non-latin keyboard layouts, example usage: :langmap ролд hjkl Based on a patch by Dmitriy. Close #161
2016-02-12Mark some tables as constMarc André Tanner1-8/+8
This allows them to be placed into the read only ELF section.