transform "" to "Word1...Wordn"

2006-08-25 Thread Richard Emberson


I have a bunch of expressions of the form:

   ""

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?"
vmap f y/"

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

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: Bug in chaining dictionary function calls

2006-06-22 Thread Richard Emberson

I reported this as bug number 1492165,
https://sourceforge.net/tracker/?atid=391887&group_id=27891&func=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.


Bug 1492165 - Dictionary function chaining

2006-05-20 Thread Richard Emberson

Just an FYI, I've just submitted a demonstration patch
that allows one to do dictionary function chaining.
Some of you might be interested in extending the
patch to include value access via applying a key
to the results of a function (if the function returns
a dictionary).
RME

Text to bug report:

This concerns functions and dictionaries
While bug: 1491613 is a true error in the existing
code, this bug is more of an enhancement.
Currently if a function returns a dictionary, one
can not call a function on that returned dictionary
(or access a value via a key) inline:

let v = dict1.getDict2().getValue()

(
Note: the include patch does not address the following:
let v = dict1.getDict2().somekey
let v = dict1.getDict2()[somekey]
)

With this patch the following code:

XXX
"
" example of function chaining
"
let gt6 = {'cylinder': 6, 'manufacture': "Triumph" }
let twodoor = {'sunbeam': "sunbeam", 'gt6': gt6 }
function twodoor.getGt6() dict
   return self.gt6
endfunction
let fourdoor = {'stationwagon': "stationwagon", 'sedan': "sedan" }
let cars = {'twodoor': twodoor, 'fourdoor': fourdoor }
function cars.getTwodoor() dict
   return self.twodoor
endfunction
function cars.getFourdoor() dict
   return self.fourdoor
endfunction

let pickup = {'ford': "Ford", "toyota": "Toyota" }
let van = {'ford': "Ford", "gm": "GM" }
let trucks = {'pickup': pickup, "van": van }
function trucks.getPickup() dict
   return self.pickup
endfunction
function trucks.getVan() dict
   return self.van
endfunction

let vehicles = {'cars': cars, "trucks": trucks }
function vehicles.getCars() dict
   return self.cars
endfunction
function vehicles.getTrucks() dict
   return self.trucks
endfunction

echo "gt6 = " . string(vehicles.getCars().getTwodoor().getGt6())
XXX
produces the the following:

gt6 = {'cylinder': 6, 'manufacture': 'Triumph'}

The included patch is more of a demonstration of what
can be done (it also includes the patch associated with
bug 1491613). It only allows for mult-level function
chaining.  In addition, I am certain that its not the
correct way to implement this feature.

--
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 ss 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.