aboutsummaryrefslogtreecommitdiffstats
path: root/autoload/grappele.vim
AgeCommit message (Collapse)Author
2020-09-29autoload/grappele.vim: If no line is stored, make `gG` a no-opTeddy Wing
Previously, if you typed, for example: dgGk this would perform `dk`, deleting the current line and the one above it. That doesn't really make any sense. Instead, the `gG` should cancel the operator. Do this by mapping to `<C-c>`. In normal and visual modes, `gG` would move the cursor to the 0th column. Returning an empty {rhs} causes the cursor to stay in the same position it was in before pressing `gG`.
2020-09-29grappele#Recall(): Remove special handling for visual modeTeddy Wing
Now that this is an `<expr>` mapping, we don't need any special handling for visual mode as this will be taken care of automatically. Remove the `mode` argument as it's no longer used.
2020-09-29grappele#Grappele(): Remove varargsTeddy Wing
This function no longer needs any extra arguments.
2020-09-29Change v_gG and o_gG to <expr> mappingsTeddy Wing
Fix visual mode bug where when the cursor is at the top of a visual selection, pressing `gG` changes the bottom of the visual selection instead of the top.
2020-09-29grappele#Grappele(): Remove unnecessary `l:line` variableTeddy Wing
Holdover from old code.
2020-09-29autoload/grappele.vim: Remove old commented codeTeddy Wing
Clean up the file by removing old code that's no longer necessary.
2020-09-29Fix `gG` omap by removing countTeddy Wing
Previously, if we stored a number in `s:line`, for example with `17G`, then `>gG` would cause lines .,17 to be indented 17 times due to the use of `V`. When I removed `V` from the omap, any commands using `gG` operated characterwise, when they should operate linewise. Found this answer from Liu Sha (https://stackoverflow.com/users/7026980/liu-sha) https://stackoverflow.com/questions/4261177/discarding-count-in-expr-mappings/53182922#53182922 that shows how to discard the count for different types of mappings: > nnoremap <expr> s "@_" . ToNthSpace() > vnoremap <expr> s "@_" . ToNthSpace() > onoremap <expr> s printf(":normal %s\<cr>", ToNthSpace()) The `:normal!` looks like it discards the count, so this gives us what we want. Adapted the suggestion into a new `<expr>` omap that indents only once for e.g. .,17.
2020-09-29Trying to fix omap (WIP)Teddy Wing
gG omap works characterwise but should work linewise. Adding V to the gG omap causes >17G to indent 17 times instead of once. Try changing `G` to an `<expr>` mapping to simplify the code, allowing it to work more exactly like the normal `G`. This resulted in moving the logic to `grappele#Recall()`, causing problems for `gG`.
2020-09-20Add operator pending and visual mode `G` mappingsTeddy Wing
I previously added o- and v-maps for the `gG` mapping, but hadn't done so for `G`. This change allows us to reuse lines given to `G` from other modes. For example: 173>>..ygG Didn't use `<Plug>` mappings here because after testing them, there was a noticeable delay. Found 07a75d523eadaf1027aa8bf287256602ad05f97f, which describes a performance penalty, so used direct mappings instead. Kept the `<Plug>Grappele` mapping for a measure of backward compatibility.
2018-12-13Add operator-pending and visual mode mappingsTeddy Wing
New mappings that allow the stored `G` position to be used in both visual mode and operator-pending mode for greater flexibility.
2017-12-20autoload/grappele.vim: Only try to recall if a location was savedTeddy Wing
Previously, if `gG` (the recall mapping) was pressed before previously having pressed a `G` command, the following error would appear: Error detected while processing function grappele#Recall: line 1: E121: Undefined variable: s:line E116: Invalid arguments for function grappele#Grappele This happened because no previous `G` location had been saved. Displaying an error here makes for a bad user experience. Instead if this happens, we should just do nothing. To prevent the error, check for the existence of the `s:line` variable before trying to use it.
2017-07-09autoload/grappele.vim: Don't save location when using `G` directlyTeddy Wing
Previously, we would save the location of the `G` command regardless of whether it was used with a count or not. Thus, `34G` and `G` would both save locations. Saving the location of `G` isn't really useful, but it's easily accessed. Instead, only save location when using a count with `G`. This allows the Grappele command to be useful even after having pressed `G`.
2016-06-17autoload/grappele.vim: Push to jumplistTeddy Wing
Turns out that invoking `G` wouldn't push your movement to the jumplist (unlike Vim's real `G`). This was not only confusing, it was also wrong. Just an oversight on my part that I didn't notice until now.
2015-09-13Create G recall commandTeddy Wing
* Add mapping for the recall command. Using `gG` because it's quick, easy to remember, and doesn't appear to be used for anything. * Create `grappele#Recall()` function that goes to the last `G` count * Store the most recent count passed into `G` Using the recall command, you can `G` to the same count that you previously used no matter what buffer you're now in. TODO: The `G` command appears to be running slowly now for whatever reason. Investigate what's going on.
2015-09-13Replicate n_G functionalityTeddy Wing
Go to the end of the buffer when typed with no count, otherwise go to the line specified by `v:count`.
2015-09-13Initial commit. Project setup.Teddy Wing
* Basic setup for the plugin: * `loaded` global * Create mapping definition based on style from tpope and System Copy * Create dummy function in autoload