Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function! s:OpenSpecial(ochar,cchar)
- echo "OpenSpecial"
- let line = getline('.')
- let col = col('.') - 2
- if(line[col] != a:ochar)
- if(col > 0)
- return "\<ESC>a\<CR>"
- else
- return "\<CR>"
- endif
- endif
- if(line[col+1] != a:cchar)
- call setline('.',line[:(col)].a:cchar.line[(col+1):])
- else
- call setline('.',line[:(col)].line[(col+1):])
- endif
- return "\<Esc>a\<CR>;\<CR>".a:cchar."\<Esc>\"_xk$\"_xa"
- endfunction
- inoremap <silent> <CR> <C-R>=<SID>OpenSpecial('{','}')<CR>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement