It's a standard practice of mine having to replace whole words with something else, very useful when coding.  I have the following mapping in my vimrc:
nnoremap <Leader>s :%s/\<\(<C-r><C-w>\)\>//g<Left><Left>
which lets me just hit \+s and replace the current word under the cursor.
Now I've found myself needing more and more frequently to insert something in between a word.  For example, say I have the word "getSomething" and I want to replace all occurrences with "getThisSomething", that is insert 'This' in between 'get' and 'Something'.  I know how to do this by a hand-written regex but I wanted to create a mapping like the one above.

I was thinking that I would set the cursor where I need to insert the new word, as in "get#Something" where # represents the cursor and then I'd need to replace it like so:
but I haven't been able to find anything that lets me split the word under the cursor.  It's probably not possible to do with such a simple mapping and I might need a function for it but my knowledge of vim-scripting is next to nothing so I thought you guys could help me figure this out.

Thank you very much!
-- Sycc90

This email has been checked for viruses by AVG.

You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to