aboutsummaryrefslogtreecommitdiffstats
path: root/plugin
AgeCommit message (Collapse)Author
2020-09-29plugin/grappele.vim: Add mode to `hasmapto()` callfix-omapTeddy Wing
Since these `<Plug>` mappings are mode-specific, ensure we specify the mode in the `hasmapto()` call.
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-29plugin/grappele.vim: Remove `<Plug>Grappele` mappingTeddy Wing
Since the plugin doesn't use this mapping any more due to the performance delay, let's remove it. Tells people that it shouldn't be 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-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.
2015-09-16plugin/grappele.vim: Silence `G` mappingTeddy Wing
Don't output the mapping result in the command line when using the `G` command. Was handling this prevously with the `<Plug>Grappele` mapping but not with the new one that I added in 07a75d523eadaf1027aa8bf287256602ad05f97f.
2015-09-14plugin/grappele.vim: Fix performance issue with `G`Teddy Wing
Looked into the performance issues I was having with the `G` command. After a little profiling and then messing around with let start = reltime() | <do stuff> | echom reltimestr(reltime(start)) Using the `reltime` method I discovered that `grappele#Grappele()` was running pretty quick (~60 time units). I then ran it around the :<c-u>call grappele#Grappele(v:count)<cr> part of the mapping and found that it took about 130 time units. Then doing nnoremap G :let start = reltime() \| execute 'normal! G' | echom reltimestr(reltime(start)) was pretty quick. With that information, I decided to try a direct mapping bypassing the `<Plug>` mapping just to see what that would do. Turns out the custom `G` command works much faster with this method for some reason. In terms of feel it's as fast as the normal `G` command. Replacing the `<Plug>` mapping with the direct one for speed. Not really sure what the reason for this is but I'm glad the performance is up to snuff and actually usable now. I'm testing this on OS X 10.8.5 with the stock Vim (7.3 (2010 Aug 15, compiled Jun 20 2012 13:16:02)). Also noticed this issue on my Debian server which I just found out uses the same version of Vim (7.3 (2010 Aug 15, compiled May 4 2012 04:25:35)).
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-13plugin/grappele.vim: Silence mappingTeddy Wing
Otherwise the mapped command is printed on the command line which isn't necessary and adds visual noise and distraction.
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-13plugin/grappele.vim: Fix mapping (add missing <cr>)Teddy Wing
2015-09-13plugin/grappele.vim: Fix <Plug> mapping definitionTeddy Wing
Should be mapping `<Plug>Grappele` to the function call. `G` doesn't belong in this map call. That's what the one at the end is for.
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