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

Both AutoPairsBackInsert and AutoPairsDelete on Backspace? #124

Open
Tarmean opened this issue Dec 5, 2015 · 0 comments
Open

Both AutoPairsBackInsert and AutoPairsDelete on Backspace? #124

Tarmean opened this issue Dec 5, 2015 · 0 comments

Comments

@Tarmean
Copy link

Tarmean commented Dec 5, 2015

Hey, just was wondering if there'd be enough interest in this to include it into the real version as an option. It does seem fairly niche but is pretty useful so far.

Basically, if you used auto pairs to jump as the very last thing use back insert when pressing backspace. Otherwise do the normal delete business!

Easiest thing I could come up with was something like this:

let g:AutoPairsFlyActive = 0
function! s:AutoPairsActivateFlyFlag()
    let g:AutoPairsFlyActive = 1
    augroup FlyFlag 
        autocmd InsertCharPre * call s:AutoPairsRemoveFlyFlag()
        autocmd InsertLeave   * call s:AutoPairsRemoveFlyFlag()
    augroup END
endfunction
function! s:AutoPairsRemoveFlyFlag()
    if g:AutoPairsFlyActive
        let g:AutoPairsFlyActive = 0
        augroup FlyFlag
            au!
        augroup END
    endif
endfunction

Plus one line changed in backinsert and delete each.

I could imagine that a lot more people would find some function to map different keys to brackets more useful. I like to have ö, ä, and ü as (, [, and { respectively for instance because these are in the same position as the brackets on the American keyboard. It makes typing many programming languages a lot easier. On the other hand, even a function to toggle that is only ~10 lines so maybe it isn't needed anyway.

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

No branches or pull requests

1 participant