aboutsummaryrefslogtreecommitdiff
path: root/vis-motions.c
AgeCommit message (Collapse)AuthorFilesLines
2017-12-21vis: improve `cw` behaviorMarc André Tanner1-6/+11
Correctly handle single letter words surrounded by special symbols, e.g. [c]. Fix #643
2017-07-10vis: remove change listMarc André Tanner1-42/+0
This was completely broken since 71eab6d5d72145f17ab3d4c87945ac12176ae8e9 and even before never really worked as one would expect. If anything it should be implemented like the jump list using marks.
2017-07-10vis: implement jump list in terms of marksMarc André Tanner1-32/+0
2017-07-08vis: cleanup marks implementationMarc André Tanner1-31/+0
We now use ' to refer to marks. Mark a is set using 'am and restored using 'aM while this is slightly harder to type than ma and 'a it is consistent with register usage for yank/put and allows a default mark to be used which is handy for quick selection manipulation primitives.
2017-07-07vis: use marks instead of registers to store selectionsMarc André Tanner1-4/+9
The key binding remain the same, but the selections are now stored on a per-buffer basis.
2017-05-06vis: add doxygen commentsMarc André Tanner1-2/+1
Rename some structures, add typedefs for function pointers, remove unused arguments from vis_run.
2017-05-03text: remove text_history_get functionMarc André Tanner1-2/+2
As currently implemented this does not properly integrate with multiple cursor support. The functionality should be provided in a layer higher up. The jumplist and changelist need to be redesigned, for now they are broken.
2017-04-14vis: make certain operations interruptible with <C-c>Marc André Tanner1-0/+2
As currently implemented this will only work for operations which are individually fast, but repeated many times (e.g. `1000000itext<Escape>`).
2017-04-04vis: add motions to move by codepointsMarc André Tanner1-0/+8
Some people might prefer this for <Backspace> behavior. Except for that and debugging purposes using `ga` and `g8` it is not yet that useful.
2017-03-31vis: add non-default actions for vi compatible n/N motionsMarc André Tanner1-2/+21
The following key mappings should result in the vi behavior: :map! normal n <vis-motion-search-repeat> :map! normal N <vis-motion-search-repeat-reverse> The default remains unchanged, that is `n` (`N`) always searches towards the end (start) of the file. Fix #470
2017-03-31vis: rename search related constantsMarc André Tanner1-4/+4
2017-03-21vis: make `cw` and `cW` more vim compatibleMarc André Tanner1-2/+55
If the starting position is: * on a space or tab use the `w` motion * on the last letter of a word use `l` or `e` depending on whether a count was given. This also applies for single letter words. * otherwise use the `e` motion As in vim `cw` and `dw` behave differently, whether that is desirable remains to be seen. Might fix #521
2017-02-25vis: mark 0, ^, g_ and $ as idempotentMarc André Tanner1-1/+4
2017-02-22vis: add exact count motion flagMarc André Tanner1-2/+4
Some motions should fail (i.e. keep the initial position) when the specified count can not be satisfied exactly. Examples include t, f, T, and F. Fix #497
2017-02-15vis: remove motion and text objects related to C functionsMarc André Tanner1-16/+0
These do not really belong into the editor core. If desired they could be implemented in Lua instead.
2017-02-15text-motions: remove unused text_line_lastcharMarc André Tanner1-4/+0
2017-01-16vis: cleanup regex header inclusionMarc André Tanner1-1/+0
2016-12-22text: change datatype of Mark to uintptr_tMarc André Tanner1-2/+2
This should avoid undefined pointer comparisons.
2016-12-21vis: implement `gh` and `gl` to move by relative byte offsetsMarc André Tanner1-0/+20
2016-12-21vis: implement `go` to move to absolute byte positionMarc André Tanner1-0/+10
2016-11-19vis: make gg and G move to first non-blank character of lineMarc André Tanner1-5/+15
2016-11-19vis: reformat motion definition block to avoid overly long linesMarc André Tanner1-67/+239
No functional changes.
2016-09-29vis: fix % for angle bracketsMarc André Tanner1-1/+3
2016-08-24vis: improve dot (repeat) command implmentationMarc André Tanner1-1/+1
Do not override implicit operator macro in command mode. Fix #334
2016-05-04vis: make j and k a linewise inclusive motionMarc André Tanner1-2/+2
They behave like an inclusive motion, but only if they are also linewise (which they are by default). This should make `yjp` and `ykp` yank both the current and the next/previous line when the cursor is at the start of a line. See also 532f52e9e52b98dc5749396f7353295418e0227a and #237
2016-04-12Add "[(" and "])" motions for jumping to a parenthese pair's start/endRob Pilling1-0/+2
2016-04-12Add "[{" and "]}" motions to jump to a block's start/endRob Pilling1-0/+2
2016-04-09vis: make j an inclusive motionMarc André Tanner1-1/+1
Given the following text with no trailing new line at the end of line2, where # denotes the cursor position: #ine1 of text line2 of text the command yjp should produce line1 of text #ine1 of text line2 of text line2 of text where previously it would wrongly result in line1 of text #ine1 of text line2 of text
2016-04-06text-motion: restore old text_{line_,}find_prev behaviorMarc André Tanner1-8/+2
This partially reversts the "Fix to/till movements" commit 0d4093c3371079c5f75055338f0341f684542465 The pos += len hunk was interfering with other code which does not want this behavior. The original issue should be fixed directly within the to/till movements.
2016-03-30array: allow arbitrarily sized array elementsMarc André Tanner1-2/+2
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-12vis: overhaul search related code, support "/ registerMarc André Tanner1-14/+28
2016-03-10vis: let /^pattern match at the start of the lineMarc André Tanner1-1/+1
2016-02-18Add infrastructure to add custom motion functionsMarc André Tanner1-1/+26
A motion function can be registered with vis_motion_register(...) the returned id (if non negative) can then be used as an argument to vis_motion(...)
2016-02-12Mark some tables as constMarc André Tanner1-1/+1
This allows them to be placed into the read only ELF section.
2016-02-11vis: try to make * and # motions work on more systemsMarc André Tanner1-2/+7
The used regular expression \<%s\> where %s refers to the search term/word under cursor is not POSIX compliant but happens to work on both musl and glibc. First try the alternate syntax [[:<:]]%s[[:>:]] which works on Mac OS X. The reason it is done in this order is that musl/glibc will reject it as invalid pattern when compiling while the Mac OS X libc will accept \<%s\> but not match anything. Based on a patch by Erlend Fagerheim.
2016-01-28vis: implement nn%Marc André Tanner1-0/+8
Moves to the given percentage of the file in bytes (not lines). This is useful when dealing with huge files because it is a constant time operation. Performance could still be improved by adapting the display code not to rely on line numbers at all.
2016-01-28vis: clean up count handlingMarc André Tanner1-4/+4
There are cases where zero can also be a legitimate count.
2016-01-27text-motion: change text_bracket_match APIMarc André Tanner1-1/+1
2016-01-27vis: let % move to next special char if not already thereMarc André Tanner1-1/+22
2016-01-20Fix to/till movementsMarkus Teich1-2/+6
Some corner cases allowed to move between lines with the to/till movements. The change in find_prev serves two purposes. When searching for a string which the cursor is already above the match, this match is returned (pos += len). Secondly there was a failure when searching for strings with len == 1 which lead to `matched == 0` which was always true, even if the string was not found, therefore leading to a wrong return value.
2016-01-19vis: fix # and * motions to only match wordsMarc André Tanner1-9/+12
Word matching is currently implemented by using the \< and \> anchors of the regex(3) library part of libc. Another option would have been to use the text_object_word_find_{next,prev} functions from text-objects.c. The used search term is currently not added to the search history. Based on a patch by Markus Teich.
2016-01-18vis: tweak count handling of till motions 't' and 'T'Marc André Tanner1-2/+4
The behaviour when already in front of a match is deliberately different from vim. Based on a patch from Markus Teich.
2016-01-15vis: sentence motions are not linewiseMarc André Tanner1-2/+2
Close #141
2016-01-14vis: s/moves/vis_motions/gMarc André Tanner1-2/+2
2016-01-14vis: s/ops/vis_operators/gMarc André Tanner1-2/+2
2016-01-14vis: move motion releated functions to corresponding fileMarc André Tanner1-0/+91
2016-01-10Simplify code by using text_bytes_alloc0Marc André Tanner1-7/+1
2015-11-08vis: remove regex based syntax highlightingMarc André Tanner1-0/+1
2015-11-08vis: more comments and cleanupsMarc André Tanner1-5/+5
2015-11-07vis: prefix enum VisMotion values with VIS_Marc André Tanner1-100/+61