Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. function! s:OpenSpecial(ochar,cchar)
  2. echo "OpenSpecial"
  3. let line = getline('.')
  4. let col = col('.') - 2
  5. if(line[col] != a:ochar)
  6. if(col > 0)
  7. return "\<ESC>a\<CR>"
  8. else
  9. return "\<CR>"
  10. endif
  11. endif
  12. if(line[col+1] != a:cchar)
  13. call setline('.',line[:(col)].a:cchar.line[(col+1):])
  14. else
  15. call setline('.',line[:(col)].line[(col+1):])
  16. endif
  17. return "\<Esc>a\<CR>;\<CR>".a:cchar."\<Esc>\"_xk$\"_xa"
  18. endfunction
  19.  
  20. inoremap <silent> <CR> <C-R>=<SID>OpenSpecial('{','}')<CR>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement