On Friday, May 18, 2012 2:10:05 PM UTC-5, howardb21 wrote: > On May 16, 6:39 pm, "John Beckett" <[email protected]> wrote: > > > I think it would be good to start again with a statement of what problem > > needs to be solved. I'm wondering why 'ihs' appears twice, and what would > > you want the user command to be? > > > > How about a simple example showing what you would like to enter > > and what it should do. > > OK There is a form of the abbreviation command like this: > > ab <expr> string expression > > For this purpose I want to use this function for the expression: > > function! ABB(lhs, rhs) > if getcmdtype() == ':' > return a:lhs > else > return a:rhs > endif > endfunction > > So after I execute the command, > > ab <expr> howard ABB("howard","schwartz") > > each time I type howard it will be replaced by schwartz, except when > I am on the : command line. In that case, howard will not be replaced > by > schwartz. > > I want to write a user defined command that does the same > thing as the above, ab, command. Let's call the user command Ab. Then, > > Ab howard schwartz > > will have the same effect as executing the command, > > ab <expr> howard ABB(howard,schwartz) > > The string, 'howard', must occur twice in the ordinary abbreviation > command > above - once as the initial string, and again as the first argument of > the > function ABB(). > > So I must, extract `howard' from the expressions <args> or <f-args> > that > evaluate to all arguments of a user command. >
Have you tried the command Christian created to do exactly this in your original thread? https://groups.google.com/d/topic/vim_use/46_Na5k0Ku8/discussion Note his solution uses <q-args> and the split() function to get the individual pieces. You could also probably use <f-args> and just use the arguments separately. -- 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
