Nothing Special   »   [go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use buffer mappings #43

Closed
wants to merge 8 commits into from
Closed

Use buffer mappings #43

wants to merge 8 commits into from

Conversation

mg979
Copy link
Contributor
@mg979 mg979 commented Sep 8, 2019

Prelude

Thank you for helping out DoGe!

By contributing to DoGe you agree to the following statements (Replace [ ] with [x] with those you agree with):

Why this PR?

<Tab> and <S-Tab> are the most obvious mappings, but to dedicate them to
doge (and in all modes) is very demanding. Use buffer mappings instead,
so that they are only active in 'doge-mode', and unmapped when finished.

Deactivation is either automatic (end of placeholders, press outside of
comment area) or manual (main mapping is pressed again).

The first commit didn't give me troubles. The second commit requires some testing (I had a recursion once, then I changed it and it looks ok but some more testing is needed).

@mg979 mg979 changed the title Bufmaps Use buffer mappings Sep 8, 2019
autoload/doge.vim Outdated Show resolved Hide resolved
autoload/doge.vim Outdated Show resolved Hide resolved
autoload/doge.vim Outdated Show resolved Hide resolved
@kkoomen
Copy link
Owner
kkoomen commented Sep 10, 2019

FYI: I will check the tests later this week.

<Tab> and <S-Tab> are the most obvious mappings, but to dedicate them to
doge (and in all modes) is very demanding. Use buffer mappings instead,
so that they are only active in 'doge-mode', and unmapped when finished.

Deactivation is either automatic (end of placeholders, press outside of
comment area) or manual (main mapping is pressed again).
Pressing <Tab> at the last placeholder would enter a tab, even if there
are placeholders left before it, let it cycle back to the first one.
Similarly, if currently at the first placeholder and pressing <S-Tab>,
jump to the last placeholder.
Do not enable buffer mappings if g:doge_comment_interactive is false.
Also use explicit check (v:true).
Pressing the main mapping after activation shouldn't trigger
deactivation.
Default behaviour remains as it was. User must set
g:doge_buffer_mappings to 1 if buffer mappings are preferred.
Add option to documentation.

Also made messages for activation/deactivation disabled by default
(they're still undocumented).
Tests fail if cycling among placeholders is allowed by default, so I'm
restricting this behaviour to the case that buffer mappings have been
activated.
vint was complaining about local scopes and such
@mg979
Copy link
Contributor Author
mg979 commented Sep 10, 2019

I rebased and made tests pass. Tests were probably failing because hitting Tab would cycle among placeholders also with default setup (no buffer mappings). I think it's a desirable behaviour, but tests are not made with it in mind. If you would like to make placeholder-cycling the default, one test should be fixed.

Right now every difference is optional and must be enabled with

let g:doge_buffer_mappings = 1

@mg979
Copy link
Contributor Author
mg979 commented Sep 10, 2019

This PR can be simplified a lot, I'm dumping it and making a new one.

@mg979 mg979 closed this Sep 10, 2019
@mg979 mg979 mentioned this pull request Sep 10, 2019
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants