Last active
January 27, 2016 06:31
-
-
Save lo48576/abb65f85860d05a8bd9c to your computer and use it in GitHub Desktop.
ignore input for duplicate closing paren/brace/brackets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function! InsDedupParen(closer) | |
| let cur_ch = getline('.')[col('.')-1] | |
| let parenRList = ["}", ")", "]", "\"", "\'"] | |
| let paren_index = index(parenRList, cur_ch) | |
| if paren_index >= 0 && parenRList[paren_index] == a:closer | |
| return "\<C-O>a" | |
| endif | |
| return a:closer | |
| endfunction | |
| inoremap <silent> ) <C-R>=InsDedupParen(')')<CR> | |
| inoremap <silent> ] <C-R>=InsDedupParen(']')<CR> | |
| inoremap <silent> } <C-R>=InsDedupParen('}')<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment