code_junkie

How to emulate Emacs’ transpose-words in Vim?

Nov 11th, 2011
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. SOME_BOOST_PP_BLACK_MAGIC( (a)(b)(c) )
  2. // with cursor here ^
  3.  
  4. %#
  5.  
  6. " swap two words
  7. :vnoremap <C-X> <Esc>`.``gvP``P
  8. " Swap word with next word
  9. nmap <silent> gw "_yiw:s/(%#w+)(_W+)(w+)/321/<cr><c-o><c-l> *N*
  10.  
  11. dw wP
  12.  
  13. 2dw bhP
  14.  
  15. map L dwwP
  16. map M 2dwbhP
Add Comment
Please, Sign In to add comment