aboutsummaryrefslogtreecommitdiff
path: root/sam.h
AgeCommit message (Collapse)AuthorFilesLines
2025-12-16mark all functions in headers with VIS_EXPORT or VIS_INTERNALRandy Palamar1-3/+3
if vis actually wants to be a library exported symbols may need mark up depending on the platform (eg. __declspec(dllexport)). This needs to be hidden behind a macro because the way you export is not the same on every platform. I did this based on the assumption that vis.h was supposed to be the only interface to the "vis" library. Since nobody actually uses vis as a library I have no idea if this is actually correct. Anyway marking up all prototypes like this allows for one to convert all functions to static if a single translation unit is used by inserting at the start: #define VIS_INTERNAL static #define VIS_EXPORT static
2017-04-12sam: add support for count specifier to `g` and `y` commandsMarc André Tanner1-0/+1
2017-01-26sam: disallow destructive commands in groups and looping constructsMarc André Tanner1-0/+2
This should fix segfaults for commands like `:{ q i/foo/ }` or `:x/pattern/ q` where a command invalidates the current window. The checks are a bit too strict, for example a destructive command at the end of a non-nested group would be fine, but is currently also rejected.
2017-01-12sam: implement parallel grouping behaviorMarc André Tanner1-0/+2
2016-11-28sam: introduce `m as an address refering to mark mMarc André Tanner1-0/+1
2016-11-27sam: stricter command parsingMarc André Tanner1-0/+1
Properly detect unbalanced curly braces and spurious output at the end of a group.
2016-09-29sam: consistent argument handling for :r, :w, :e commandsMarc André Tanner1-1/+0
:e without any argument can be used to reload the file from disk whereas before a "Filename expected" error would be displayed.
2016-04-21vis: do not lazy allocate :-commandsMarc André Tanner1-1/+2
The built in commands should always be available.
2016-04-03sam: more flexible parsingMarc André Tanner1-0/+2
Add infrastructure to handle commands which take file names, shell commands or general white space delimited parameters as arguments.
2016-04-03Support sam's structural regular expression based command languageMarc André Tanner1-0/+21
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.