transform word1...wordn to Word1...Wordn

2006-08-25 Thread Richard Emberson


I have a bunch of expressions of the form:

   word1 word2 ... wordn

lower case words with spaces between them enclosed in
angle brackets. (the ... means 0 or more).
I would like a macro (place cursor within s and execute
macro) that converts the
above to:   

   Word1Word2...Wordn

Is the only way to do this to write a function?
Thanks.
RME

--
This email message is for the sole use of the intended recipient(s) and
may contain confidential information.  Any unauthorized review, use,
disclosure or distribution is prohibited.  If you are not the intended
recipient, please contact the sender by reply email and destroy all
copies of the original message.


escaping special characters in visual search

2006-07-14 Thread Richard Emberson


I've got the following visual maps which I use to do
visual base searches:

vmap F y?C-RCR
vmap f y/C-RCR

They work great, select some characters in visual mode and
then enter 'f' (or 'F').
The one caveat is if there are characters that have
special meaning in searched such as the '[' ']' pair
in the visual selection, then the search fails.
Does anyone have a macro that will allow visual selection
based searches that account for such special characters
being in the selection?

Thanks.

RME



--
This email message is for the sole use of the intended recipient(s) and
may contain confidential information.  Any unauthorized review, use,
disclosure or distribution is prohibited.  If you are not the intended
recipient, please contact the sender by reply email and destroy all
copies of the original message.


Re: Bug in chaining dictionary function calls

2006-06-22 Thread Richard Emberson

I reported this as bug number 1492165,
https://sourceforge.net/tracker/?atid=391887group_id=27891func=browse

Hari Krishna Dara wrote:

I found a problem with chaining function calls through the new
dictionary functions. Here is some code demonstrate the problem, if you
execute this code, the last line generates an E488 error, where as the
previous lines combines (they are equivalent) works fine.

let tt = {}
function! tt.TT()
  echomsg 'This is TT'
endfunction

let t = {'tt': tt}
function t.T()
  return self.tt
endfunction

let tmptt = t.T()
call tmptt.TT()
call t.T().TT()




--
This email message is for the sole use of the intended recipient(s) and
may contain confidential information.  Any unauthorized review, use,
disclosure or distribution is prohibited.  If you are not the intended
recipient, please contact the sender by reply email and destroy all
copies of the original message.


Re: Bug in chaining dictionary function calls

2006-06-22 Thread Richard Emberson

Bram Moolenaar wrote:

Hari Krishna Dara wrote:


I found a problem with chaining function calls through the new
dictionary functions. Here is some code demonstrate the problem, if you
execute this code, the last line generates an E488 error, where as the
previous lines combines (they are equivalent) works fine.

let tt = {}
function! tt.TT()
  echomsg 'This is TT'
endfunction

let t = {'tt': tt}
function t.T()
  return self.tt
endfunction

let tmptt = t.T()
call tmptt.TT()
call t.T().TT()


You cannot call a function in the LHS of an assignment.



Forgive me, but which statement is not legal?
Thanks.

Richard

--
This email message is for the sole use of the intended recipient(s) and
may contain confidential information.  Any unauthorized review, use,
disclosure or distribution is prohibited.  If you are not the intended
recipient, please contact the sender by reply email and destroy all
copies of the original message.


Re: vim patch: fixing resetting dictionary function

2006-06-15 Thread Richard Emberson

Attached is a patch file. Is this what you wanted?
Its been almost 20 years since I programmed in 'c'
and the vim 'c' code is rather hard to grok if one
is looking at it for the first time, so I do not
claim that my patch is the best way to do it.

It seems that after the function is defined, it is
then referenced by its number, but the function
definition code expects a function name.

Richard

Bram Moolenaar wrote:

Richard Emberson wrote:


In the following I am creating a dictionary, associating a function
with the dictionary and then reassociating a new function
with the name of the original function.

Try this without the fix and you get:
ADD
n=9
Error detected while processing /home/emberson/vim/foo.vim:
line   14:
E475: Invalid argument: 1
ADD
n=9

Note that 1 is the index of the function in the dictionary.

Try it with the fix you get:
ADD
n=9
MULTIPLY
n=20


This makes sense.  Can you please provide a context diff so that it's
easier to see what you are changing?




--
This email message is for the sole use of the intended recipient(s) and
may contain confidential information.  Any unauthorized review, use,
disclosure or distribution is prohibited.  If you are not the intended
recipient, please contact the sender by reply email and destroy all
copies of the original message.
patch for eval.c:

18410c18410,18420
 while (arg[j] != NUL  (j == 0 ?  eval_isnamec1(arg[j])
---
 /* The name can be an index into a dictionary. */
 /* There maybe a better way, this demonstrates a fix. */
 while (arg[j] != NUL  VIM_ISDIGIT(arg[j]))
 ++j;
 if (arg[j] != NUL)
 {
 if (*arg == K_SPECIAL)
 j = 3;
 else
 j = 0;
 while (arg[j] != NUL  (j == 0 ?  eval_isnamec1(arg[j])
18413,18414c18423,18425
 if (arg[j] != NUL)
 emsg_funcname(_(e_invarg2), arg);
---
 if (arg[j] != NUL)
 emsg_funcname(_(e_invarg2), arg);
 }




vim patch: fixing resetting dictionary function

2006-05-18 Thread Richard Emberson

In the following I am creating a dictionary, associating a function
with the dictionary and then reassociating a new function
with the name of the original function.

Try this without the fix and you get:
ADD
n=9
Error detected while processing /home/emberson/vim/foo.vim:
line   14:
E475: Invalid argument: 1
ADD
n=9

Note that 1 is the index of the function in the dictionary.

Try it with the fix you get:
ADD
n=9
MULTIPLY
n=20

script:

let x = {}

function x.foo(a,b) dict
echo ADD
return a:a + a:b
endfunction

let n = x.foo(4,5)
echo n= . n

function! x.foo(a,b) dict
echo MULTIPLY
return a:a * a:b
endfunction

let n = x.foo(4,5)
echo n= . n


patch for eval.c:

18410c18410,18420
   while (arg[j] != NUL  (j == 0 ? eval_isnamec1(arg[j])
---
 /* The name can be an index into a dictionary. */
 /* There maybe a better way, this demonstrates a fix. */
   while (arg[j] != NUL  VIM_ISDIGIT(arg[j]))
   ++j;
 if (arg[j] != NUL)
 {
   if (*arg == K_SPECIAL)
   j = 3;
   else
   j = 0;
   while (arg[j] != NUL  (j == 0 ? eval_isnamec1(arg[j])
18413,18414c18423,18425
   if (arg[j] != NUL)
   emsg_funcname(_(e_invarg2), arg);
---
   if (arg[j] != NUL)
   emsg_funcname(_(e_invarg2), arg);
 }


--
This email message is for the sole use of the intended recipient(s) and
may contain confidential information.  Any unauthorized review, use,
disclosure or distribution is prohibited.  If you are not the intended
recipient, please contact the sender by reply email and destroy all
copies of the original message.


Set color block of text

2006-05-12 Thread Richard Emberson


Is there a way in a vim script to set the color (fg/bg) to a block
of text? say from line 12 to line 15 and from column 4 to column 9.
The text in this block can be anything, not syntax.

RME

--
This email message is for the sole use of the intended recipient(s) and
may contain confidential information.  Any unauthorized review, use,
disclosure or distribution is prohibited.  If you are not the intended
recipient, please contact the sender by reply email and destroy all
copies of the original message.


Re: fast file opening / find file as you type

2006-05-09 Thread Richard Emberson

Up at the vim site theres a script called javae.vim:
http://www.vim.org/scripts/script.php?script_id=1164
This lets one create a list of directory paths to
Java source code. Then, if one places the cursor
over a class name, you can jump to the associated
source file.
RME


Benjamin Reitzammer wrote:

Hi,
I've searched the archive and asked many search engines for help, but
I still haven't found what I'm looking for (well, I'll stop the
humming, singing instantly ;)

Currently I switch between jEdit and vim on a hourly basis, depending
on the machine I'm working. I really love vim and would like to use it
exclusively, but until now there's one major thing missing for me,
that I couldn't find. Find filenames as you type, and open them
instantly  or explained in more detail ...

In jEdit there's a plugin called Openit
(http://plugins.jedit.org/plugins/?OpenIt) which let's me configure a
number of directories. It then indexes the filenames contained in
these directories. Then it gives me the opportunity to search through
all the indexed filenames very, very quickly, and opening a found
file. Combined with fast typing, knowing the names of your files, and
a shortcut for opening the searching window, this is awesome.
I've uploaded a screenshot to better convey what I mean. It's at
http://nur-eine-i.de/openit_screenshot.png


Now my question:
Is there something similar for vim? Or do you guys have any hacks,
shell scripts for achieving this? Pressing a key combination, typing
in some letters, hitting enter and you opened another file?

This would really make my day (and some more weeks), if there was
anything like that for vim.

Thanks for reading and for your help

Cheers
Benjamin



--
This email message is for the sole use of the intended recipient(s) and
may contain confidential information.  Any unauthorized review, use,
disclosure or distribution is prohibited.  If you are not the intended
recipient, please contact the sender by reply email and destroy all
copies of the original message.


vim7 spell none file

2006-05-08 Thread Richard Emberson


with a file with no extension when leaderss is
executed regardless of whats in the file I get:

Spell check done: 1 possible spell errors in 1 words.

For a *.java file I get spelling errors highlighted
in comments so spell is working - at least for
java comments.

How do I get spell to work on a none file?
A default, out-of-the-box, Vim unix install.
Thanks.
RME

--
This email message is for the sole use of the intended recipient(s) and
may contain confidential information.  Any unauthorized review, use,
disclosure or distribution is prohibited.  If you are not the intended
recipient, please contact the sender by reply email and destroy all
copies of the original message.