emacs-surround is like vim.surround. This plugins provides easily change, delete and insert such surrounding in pairs.
Press C-q "'
"Hello| world!"
Change it to
'Hello world!'
Press C-q i"
or C-q " <return>
Hel|lo
Change it to
"Hello"
Press C-q d"
"He|llo \"world\""
Change it to
Hello \"world\"
Use cask
or el-get
or clone
form https://github.com/ganmacs/emacs-surround.git
And add this script your .init.el
(require 'emacs-surround)
(global-set-key (kbd "C-q") 'emacs-surround)
You can use custimze pair.
For Example Add this line to your .init.el
(add-to-list 'emacs-surround-alist '("}" . ("{ " . " }")))
Now press C-q {}
[1, 2, 3].each {p |1+i}
Change it to
[1, 2, 3].each { p 1+i }