I am tidying up my vimrc.
Mission:
- Copy content inside single-quotes (and preferably after the slash)
- Paste them below line 1
1: Name:
2:
3: Bundle 'tpope/vim-rails'
4: Bundle 'tpope/vim-endwise'
5: Bundle 'mileszs/ack.vim'
6: Bundle 'scrooloose/nerdcommenter'
7: Bundle 'kana/vim-textobj-entire'
8: Bundle 'kana/vim-textobj-user'
I know about the
:{source_address}t{target_address}
Ex command, and I know it accepts patterns. However, I am still not able to get it just right. I am also fairly new to regexes so bear with me. I tried something along the lines of (on a visual selection
:'<,'>/\/.*\'t1
Where I attempt to match a pattern that:
- Starts with a /
- May contain stuff in the middle .*
- Ends with a '
Obviously I am off by some degree. Any ideas?
:tcopy the whole line, not thematchstrto achieve what you want, you need
matchstr()function.this line will do the similar thing, but in reverse order. Hope it is ok for you:
for example, if I just select the first two "Bundle" lines, and execute the cmd, I get:
you see that the order was in reverse.
To keep the order you have options :
'<,'>g/.*/m12put! x