Refactor and add the TypeAt command #24
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The refactors were:
s:IdrisCommand(removes a lot of code duplication)IWrite(this guarantees that the window always returns to it's previous position. The reload command used to save just the cursor position, not the whole window view, and that caused annoyances)A change made that isn't really a refactor is that now undo still works after issuing a command that updates the
idris-responsebuffer. Previously, the process of writing to it made the buffer with the current file be temporarily abandoned, causing the undo history to be lost. The fix is implemented by temporarily overwriting thehiddenoption, making it become a hidden buffer, rather than abandoned. There might be a more straightforward way of implementing this though, suggestions are welcomed.The implementation of TypeAt is rather simple. I'm not sure about which key would be the best for it though. My initial idea was
<LocalLeader>ta,TypeAt's initials, but that would make Vim wait for a second keypress before issuing a regular<LocalLeader>t, which is rather inconvenient. I settled on<LocalLeader>yfor lack of anything better.I'm sorry if I ended up coupling too many unrelated changes into this pull request, i'm kind of still learning how to help with open source. If any changes are necessary just let me know and I'll do my best.