aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-04-03sam: attempt to make x/y commands more robustMarc André Tanner1-4/+8
These commands can be followed by an address which changes the range to which the sub command applies. The looping construct should then continue at the position of the last change within the original range. A previously problemeatic example: :sam x/^static/ .,+/^\}/ c/replaced
2016-04-03sam: implement > commandMarc André Tanner1-6/+24
2016-04-03sam: implement r (read) command in terms of < catMarc André Tanner1-1/+13
It replaces current range with the file content. However in the common case the range is actually defaults to the whole file which is probably not what is expected.
2016-04-03sam: implement < command in terms of | with an empty rangeMarc André Tanner1-1/+13
2016-04-03sam: implement | (filter) commandMarc André Tanner1-4/+81
2016-04-03sam: implement w (write) commandMarc André Tanner1-4/+47
2016-04-03sam: add infrastructure to support multi letter commandsMarc André Tanner2-48/+53
2016-04-03sam: fix escape handling in regex parsingMarc André Tanner1-0/+4
2016-04-03sam: more flexible parsingMarc André Tanner2-22/+126
Add infrastructure to handle commands which take file names, shell commands or general white space delimited parameters as arguments.
2016-04-03sam: treat single line numbers as motions not rangesMarc André Tanner1-2/+9
That is something like :sam +5 or :sam 10 will move to the start of the selected line instead of selecting the whole line. TODO: due to the current implementation it will also affect :sam x/pattern/-10+10
2016-04-03sam: remove old cursor/selection before executing commandMarc André Tanner1-1/+12
Because duplicated cursors are no longer allowed we have to remove the old cursors before, not after executing the sam command. Otherwise commands like g/foo/ which re-create the same selection fail.
2016-04-03sam: fix default regexp handling i.e. ':sam x'Marc André Tanner1-1/+1
2016-04-03sam: adapt to changes in multiple cursors APIMarc André Tanner1-10/+7
2016-04-03sam: fix negative relative line number placementMarc André Tanner1-7/+11
This should fix -0+,+0-
2016-04-03sam: change print command behavior when given an empty rangeMarc André Tanner1-6/+23
Only create a selection (and switch to visual mode) if at least one print command was given a non-empty range. Also reject invalid ranges. This allows cursor movements with thinks like #10
2016-04-03sam: fix empty regexp matchesMarc André Tanner1-6/+13
This fixes x/^.*$/i/FOO
2016-04-03sam: fix regex parsingMarc André Tanner1-32/+5
This fixes y/\n/i/FOO
2016-04-03sam: fix parsing of , compound addressMarc André Tanner1-5/+2
In a command like ,x/pattern the comma should default to the whole file.
2016-04-03sam: do not segfault when given a NULL pointer to parseMarc André Tanner1-0/+2
2016-04-03sam: fix segfault with multiple regular expressions in same commandMarc André Tanner1-29/+17
2016-04-03Add section about new command language to READMEMarc André Tanner1-8/+94
2016-04-03Support sam's structural regular expression based command languageMarc André Tanner6-1/+836
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-03vis: in visual mode let \ trim selectionsMarc André Tanner3-0/+33
2016-04-03view: make syntax coloring more robustMarc André Tanner1-1/+3
Do not crash if for some reason view->{start,end} have outdated values.
2016-04-03buffer: add buffer_content utility functionMarc André Tanner2-0/+6
2016-04-03buffer: add buffer_length utility functionMarc André Tanner2-0/+6
2016-04-03view: add return value to view_cursors_disposeMarc André Tanner2-8/+9
indicating whether cursor could be removed
2016-04-03text-regex: introduce function to match arbitrary textMarc André Tanner2-0/+5
2016-04-01vis: cleanup vis_pipe APIMarc André Tanner3-8/+17
2016-03-30vis: implement selection rotationMarc André Tanner3-2/+85
In visual mode + and - will rotate the selection count times to the right or left respectively. If there exists a line containing multiple selections then the rotation happens within each line. Otherwise if each line contains at most one selection the rotation is performed among all existing selections.
2016-03-30view: constify functions to manipulate selectionsMarc André Tanner2-4/+4
2016-03-30text-util: constify text_range_* functionsMarc André Tanner2-12/+12
2016-03-30view: change internal representation of selectionsMarc André Tanner1-23/+27
We place the end mark inside the selection as opposted to on the character immediately following it. This is better when selections are touching each other. Previously for two seletions [a][b] the end mark for selection a would be at the same location as the start mark of selection b. Thus when for example the content of selection b is deleted it would also destroy selection a, because the end mark would no longer be valid.
2016-03-30array: allow arbitrarily sized array elementsMarc André Tanner5-16/+81
There exist two typical ways to use an array: 1) to hold pointers to externally allocated memory regions Use array_init(...) for initialization, an element has the size of a pointer. Use the functions suffixed with `_ptr' to manage your pointers. The cleanup function array_release_full must only be used with this type of array. 2) to hold arbitrary sized objects Use array_init_sized(...) to specify the size of a single element. Use the regular (i.e. without the `_ptr' suffix) functions to manage your objects. array_get will return a pointer to the object stored within the array.
2016-03-29ignore README.htmlChristian Hesse1-0/+1
2016-03-29README: add a paragraph about distribution packagesChristian Hesse1-0/+4
We have binary packages for Arch Linux, at least!
2016-03-28Update README section about multiple cursor key bindingsMarc André Tanner1-17/+21
2016-03-28vis: cleanup usage of vis_cursors_countMarc André Tanner3-3/+3
2016-03-28vis: Ctrl-{j,k} do not create duplicate cursors, instead advance primary oneMarc André Tanner1-1/+8
2016-03-28view: prevent creation of duplicated cursorsMarc André Tanner1-2/+8
Fail if there is already a cursor located at the requested position.
2016-03-28vis: support right alignment of selections in visual mode with <S-Tab>Marc André Tanner2-10/+28
2016-03-28vis: support count for {Meta-Ctrl,Ctrl}-{j,k}Marc André Tanner1-23/+26
Create count new cursors on the lines above/below.
2016-03-28vis: fix changing of primary cursor via Ctrl-{u,d}Marc André Tanner1-1/+1
2016-03-28vis: let Meta-Ctrl-{j,k} create new cursorMarc André Tanner2-1/+30
on the line above/below the first/last existing cursor.
2016-03-28vis: align selections with <Tab> in visual modeMarc André Tanner2-2/+6
2016-03-28vis: support column based alignmentMarc André Tanner1-22/+27
That is when multiple cursors are on the same line, the first cursor on every line is aligned, then the second one and so on.
2016-03-28view: add infrastructure to iterate through cursor columnsMarc André Tanner2-0/+61
The number of columns i.e. maximal number of cursors located on the same line can be obtained by view_cursors_column_count. Column addressing is zero based, valid indexes are [0, max-1]. Assuming there is a cursor on every letter: a b c d e f g h i max column would be 3, and the following would iterate over the cursors forming the second column [c, e, h]: for (Cursor *c = view_cursors_column(view, 1); c; c = view_cursors_column_next(c, 1)) ...
2016-03-28view: maintain ordering relation among cursorsMarc André Tanner1-9/+53
This is currently only enforced upon creation i.e. we assume that after creation a cursor can not change its relative ordering with respect to its neighbors. The existing code assumes that when iterating through cursors with: for (Cursor *c = view_cursors(view); c; c = view_cursors_next(c)) ... new cursors created with view_cursors_new do not show up. This assumption is preserved under the following conditions: * it only holds for the most recent view_cursors call As a consequence when doing nested iterations new cursors will be yielded once the inner view_cursors call was performed. * view_cursors_primary_get is not called
2016-03-28view: change cursor creation API to take an initial positionMarc André Tanner4-25/+23
2016-03-26fix linker flagsChristian Hesse1-1/+1
fixes #214