On Fri, Oct 26, 2012 at 2:41 PM, Bee <forth@calcentral.com> wrote:
>
>
> On Oct 26, 11:31 am, Ben Fritz <fritzophre...@gmail.com> wrote:
>> On Friday, October 26, 2012 1:15:34 PM UTC-5, Bee wrote:
>> > is it possible to make a 'substitute' where the 'pattern' is taken from a file?
>>
>> Not unless you write a script to read the file and use :execute to build a substitute command. What are you trying to accomplish?
>>
>> Note it's pretty easy to yank text from a buffer or copy it external to Vim and paste it into a command-line. See :help c_CTRL-R.
>
> I thought of creating wordlists in files for, such as, changing case
> of application specific keywords.
>
> The lists are not all that long, so embedding them in a :s in .vimrc
> would work.
You can use the readfile() function, which returns a List of lines in the file.
From there it is very easy to iterate using a for statement and build
the substitute command using exec as Ben stated.
So, this is quite easy and could be done in around 20 lines of vimL.
Dave
--
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
No comments:
Post a Comment