Re: Hiding lines

2006-09-19 Thread Christian MICHON

Interesting discussion.

Wouldn't it be easier to:
1st: fold the lines you do not want to see
2nd: conceal all folded lines (using conceal patch)

I know how to do the 1st point, how can I go around the 2nd,
knowing conceal is mostly a syntax add-on ?

Keep vimming!
Christian


Re: cursor movement

2006-09-19 Thread J.Hofmann
 -Ursprüngliche Nachricht-
 Von: Yakov Lerner [mailto:[EMAIL PROTECTED]
 On 9/18/06, Yakov Lerner [EMAIL PROTECTED] wrote:
 Does this do what you wanted:
 --- remap w and b to make them line-locked 

Yes, it works, thank you.

By the way, I supposed this behavior could be achieved by  setting a hidden
compatible-option or something like this.


Joachim
###

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.f-secure.com/



Re: Auto-indent Comments

2006-09-19 Thread Vigil
For at least filetypes html, sh, and perl, whenever I start a line with '#', 
it moves it to the very beginning of the line, ignoring any indent. It 
doesn't do this with filetype=c.


Maybe the 'indentexpr' does it for those filetypes.

Try :filetype indent off in your vimrc.


indentexpr isn't set, and filetype indent off didn't make a difference.

--

.


Re: Auto-indent Comments

2006-09-19 Thread Vigil
For at least filetypes html, sh, and perl, whenever I start a line with '#', 
it moves it to the very beginning of the line, ignoring any indent. It 
doesn't do this with filetype=c.


Try to unset 'smartindent'. At least I had to do this for Lisp indenting :)


Unsetting smartindent didn't affect it.

--

.


Re: Auto-indent Comments

2006-09-19 Thread Yakov Lerner

On 9/19/06, Vigil [EMAIL PROTECTED] wrote:

 For at least filetypes html, sh, and perl, whenever I start a line with '#',
 it moves it to the very beginning of the line, ignoring any indent. It
 doesn't do this with filetype=c.

 Try to unset 'smartindent'. At least I had to do this for Lisp indenting :)

Unsetting smartindent didn't affect it.


It's time to get full inventory of all your indenting-related options.
Please report output of this:

:set autoindent? cindent? smartindent? indentexpr? indentkeys?
comments? filetype?

7 above, I know they affect indenting. But in case theere are
some more indenting-related options not mentioned above,
report them too...

Yakov


Re: How pair g /g

2006-09-19 Thread Benji Fisher
On Mon, Sep 18, 2006 at 10:23:27PM +0200, Thomas Holder wrote:
 Yakov Lerner wrote:
  On 9/18/06, Thomas Holder [EMAIL PROTECTED] wrote:
  Peng Yu wrote:
   I'm writing some xml code in vim. In xml, there are some pair like
   g /g. Would you please let me know how to pair them as { and
   } such that I can us % to visit them?
 
  source $VIMRUNTIME/macros/matchit.vim
  let b:match_words = 'g:/g'
  
  Hmm, the set of xml tags that I have is large and
  basically open-ended. Do you mean, there is no method
  to let plugin handle *any* ... tag, automatically ?
  Isn't it unproductive to add manually each and every tag
  to b:match_words ?
 
 Try this:
 
 let b:match_words = '\(\w\+\)\(\s[^]*\)\?:/\1'
 
 This pattern also allows attributes inside the opening tag after some
 space (but not newline). You could figure this out yourself if you would
 read the help file for this macro.
 
 Regards,
   Thomas

 Do not reinvent the wheel!  Assuming that you have filetype support
enabled, i.e., something like

:filetype plugin on

in your vimrc file, $VIMRUNTIME/ftplugin/xml.vim will be :source'd
automatically whenever you edit an xml file.  It already sets
b:match_words to something reasonable.  To test, try

:e foo.xml
:echo b:match_words

 If you want to use matchit rather than default % pairing all the
time, add something like

source $VIMRUNTIME/macros/matchit.vim

or

runtime macros/matchit.vim

to your vimrc file.

 Historical note:  Johannes Zellner suggested adding support for
variable matching pairs (such as matching anything with /anything in
*ML) shortly after I started maintaining the script.  Implementing that
suggestion was complicated enough that I started to think of it as my
script, rather than just something I had tinkered with.

HTH --Benji Fisher


Re: accents and tex

2006-09-19 Thread Benji Fisher
On Mon, Sep 18, 2006 at 04:47:14PM -0300, Matias Grana wrote:
[snip]
 
  excerpt of .vimrc -
 augroup acentos
   autocmd!
   autocmd BufReadPost *.tex call Acentua()
   autocmd BufWritePre *.tex exe normal mm | call Desacentua()
   autocmd BufWritePost *.tex call Acentua() | exe normal `m
 augroup END
[snip]
  end of excerpt 
 
[snip]
 So far, so good. Now I have two problems:
 
 1) the substitutions in the functions Acentua and Desacentua are saved
 as changings. So undo commands mess with them. I'd like those changings
 not to be seen by undo/redo commands. Is it possible?

 I have not tried using this new vim-7 feature, but you might try
experimenting with :undojoin .

:help :undojoin

 2) Although I put a mark on the line I am at, and then go back to it in
 BufWritePost, sometimes the window scrolls a few lines, which is not
 very nice. Is it possible to save the first line appearing in the
 window, and, at the end of the saving process, end up seeing exactly the
 same lines I was seeing before?

:help winsaveview()

(This is also a new feature in vim 7.)  For something that works with
older versions of vim, you can see how this is done in the Mark()
function defined in foo.vim, my file of example vim functions:

http://www.vim.org/script.php?script_id=72

HTH --Benji Fisher


arbirary regex separator for search ?

2006-09-19 Thread Yakov Lerner

:s/// allows any separator instead of '/' (like s@@@).

(Non-/ separator is convenient when regex or replacement
contains many '/', ... then you can avoid backslasing '/' in the
regex or in replacement.) So far, so good.

My question is, is there variant of :/ that allows non-'/' separator char ?
(It's possible if there's some command name before '/', like in perl,
where m// is synonymous to //).

Yakov


Re: arbirary regex separator for search ?

2006-09-19 Thread Tim Chase

:s/// allows any separator instead of '/' (like s@@@).

(Non-/ separator is convenient when regex or replacement 
contains many '/', ... then you can avoid backslasing '/' in

the regex or in replacement.) So far, so good.

My question is, is there variant of :/ that allows non-'/'
separator char ? (It's possible if there's some command name
before '/', like in perl, where m// is synonymous to //).



Not that I know of, but one might be able to hack it with
something like

:let @/='/path/to/file/with/slashes'
:/

which seems to do the trick for me...

-tim






Re: arbirary regex separator for search ?

2006-09-19 Thread A.J.Mechelynck

Yakov Lerner wrote:

:s/// allows any separator instead of '/' (like s@@@).

(Non-/ separator is convenient when regex or replacement
contains many '/', ... then you can avoid backslasing '/' in the
regex or in replacement.) So far, so good.

My question is, is there variant of :/ that allows non-'/' separator char ?
(It's possible if there's some command name before '/', like in perl,
where m// is synonymous to //).

Yakov



For normal-mode searching, / or ? is both the command and the separator.

In ranges, / or ? similarly define (a) that a search is to take place, 
(b) the direction of the search, and (c) they are repeated as separator 
after the pattern.


The difference with the :s :g and :v commands is that these already 
imply that a forward search is to take place within the command's range.


If you want to do a search without using / or ? you may set the pattern 
first


:let @/ = 'pattern'

and then search for the next occurrence (using n or N ) in the same 
direction as the latest search. In a range you would use \/ or \? to 
reuse the current contents of @/


e.g.
:let @/ = 'pattern1'
:.,\/s+pattern2+text+g

see
:help quote/
:help @/
:help :range


Best regards,
Tony.


Re: ole in eclipse

2006-09-19 Thread Mark Palmer

Followed all those steps, It seems that eclipse does not recognise vim
as an ole component, It can recognise ie and word, so theoretically it
can be done.

What I did do get better integration with eclipse is to write a one line .bat

like so...

gvim.exe --remote-silent %1

And associated the non java files to the bat file, that way it opens
non-java files in the same instance of vim, and with the tab plugin I
get close to what I wanted.

Still if any one knows how to get vim to work as an ole component in
eclipse that would be nice.

Thanks for all the help

-Mark


On 9/19/06, A.J.Mechelynck [EMAIL PROTECTED] wrote:

[ text blocks reordered to reflect chronology ]
Mark Palmer wrote:
 On 9/18/06, Manu Anand [EMAIL PROTECTED] wrote:
 On 9/18/06, Mark Palmer [EMAIL PROTECTED] wrote:
  On 9/9/06, A.J.Mechelynck [EMAIL PROTECTED] wrote:
   Mark Palmer wrote:
Does any one know how to open vim (any version) from eclipse as
 a ole
component, or bonobo?
   
-mark
   
  
   Hmmm... Does it answer your question if I say that the OLE
 interface can
   only be included in native-Windows versions of gvim ?
  
   If it doesn't, see :help if_ole.txt and/or wait for an answer from
   someone more competent than I am.
  
  
   Best regards,
   Tony.
  
 
  I am mainly interested in getting eclipse to work with OLE, as I am
  required to use Windows
  at work.
 
  Was just interested in bonobo out of interest. :-)
 
  Does anyone know how to get vim to work as ole component in eclipse?
 
  -Mark
 

 Hi Mark:

 You may like to try following steps

 1. Go to GeneralEditorsFile Association menu
 2. Click on Add and add the extension of file you want VIM to open.
 For ex  *.java
 3. Select VIM by selecting External Programs and browsing to VIM
 installation.

 Alternatively if that extension is already present, select the same
 and add VIM from the Add button in the bottom column.

 HTH
 Manu





  I gave that a whirl (again) but that simply opens vim as an external
  editor rather than as an ole component. The Eclipse manual suggests
  that 'if the application is properly registered as an ole application
  it should be available in the list of external applications when you
  select external editors' so either the vim ole does meet all the
  requirement of a what eclipse deems proper 'ole component' or I doing
  something wrong.
 
  -Mark
 

1. You should use gvim.exe, not vim.exe

2. Your gvim version should have OLE support compiled-in (e.g., with
OLE support should appear on one of the first five lines in the output
of the :version command).

3. Your gvim program should be registered with Windows as an OLE server.
It normally does that (with a yes/no prompt) the first time it is run;
or you can run gvim -register to make sure that it does register
itself. You may need to log in to Windows on an administrator account to
do that.

See
:help -register
:help -unregister

4. I don't know Eclipse. You may have to tell it that gvim is available
as an OLE server.

5. Please read :help if_ole.txt (the whole help file) attentively. If
you have Visual Basic, Python, or Perl, you may try the examples given
there to see how the result resembles, or differs from, what you see
under Eclipse.


Best regards,
Tony.



Building Vim 7 with Python

2006-09-19 Thread Nick Deubert

Hey Everyone,
I am on a system where I don't want to affect the installed packages
so first I successfully built and installed python 2.5 in a directory
owned by me and kept the build directory around as well. Next I put
the python bin install directory on my PATH so that it would find it
use the one I just built instead of the old one on the system. Then I
configured vim 7.0 with:
--enable-python-interp --with-python-config-dir=python build
directory and it configured fine:
checking for python... /home/TOOLS/python-2.5/bin/python
checking Python version... 2.5
checking Python is 1.4 or better... yep
checking Python's install prefix... /home/TOOLS/python-2.5
checking Python's execution prefix... /home/TOOLS/python-2.5
checking Python's configuration directory... (cached)
/home/TOOLS/vim_src/Python-2.5
checking if -pthread should be used... yes
checking if compile and link flags for Python are sane... yes

Then when I make vim it gets a good amount compiled before getting:
gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_ATHENA -DFUNCPROTO=15
-DNARROWPROTO-g -O2  -I/usr/X11R6/include
-I/home/TOOLS/python-2.5/include/python2.5 -pthread-o
objects/if_python.o if_python.c
make[1]: *** No rule to make target
`/home/TOOLS/vim_src/Python-2.5/config.c', needed by
`objects/py_config.o'.  Stop.

So I took at look at the Makefile in the Python build directory and
sure enough there is no rule for config.c but there is:
Makefile Modules/config.c: Makefile.pre \
...

so I tried adding a rule right above it like so:
config.c: Makefile Modules/config.c

Then did a make distclean in vim and tried to do a build again but
just got the same error.
Anyone have any idea how to resolve this? Run into this before? I
would really like to use some of the plugins that take advantage of
python.
Thanks,
Nick


Re: ole in eclipse

2006-09-19 Thread Jack Donohue
What I did do get better integration with eclipse is to write a one line 
.bat


like so...

gvim.exe --remote-silent %1

And associated the non java files to the bat file, that way it opens
non-java files in the same instance of vim, and with the tab plugin I
get close to what I wanted.


If you just want to open files in Eclipse in vim, you can just drag and drop 
the filename from the package explorer onto an open vim window.  If I have a 
java file open in the editor and I have to type more than a dozen 
characters, I right click an choose the locate in file explorer option, then 
drag and drop that onto vim.  The other thing you can do it select open with 
system editor, which I've managed to set to vim.  Only problem with this is 
that it will become the default, so you'll have to reset it if you want to 
use the Eclipse editor (which doesn have features vim doesn't).



Jack 



Re: Building Vim 7 with Python

2006-09-19 Thread A.J.Mechelynck

Nick Deubert wrote:

Hey Everyone,
I am on a system where I don't want to affect the installed packages
so first I successfully built and installed python 2.5 in a directory
owned by me and kept the build directory around as well. Next I put
the python bin install directory on my PATH so that it would find it
use the one I just built instead of the old one on the system. Then I
configured vim 7.0 with:
--enable-python-interp --with-python-config-dir=python build
directory and it configured fine:
checking for python... /home/TOOLS/python-2.5/bin/python
checking Python version... 2.5
checking Python is 1.4 or better... yep
checking Python's install prefix... /home/TOOLS/python-2.5
checking Python's execution prefix... /home/TOOLS/python-2.5
checking Python's configuration directory... (cached)
/home/TOOLS/vim_src/Python-2.5
checking if -pthread should be used... yes
checking if compile and link flags for Python are sane... yes

Then when I make vim it gets a good amount compiled before getting:
gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_ATHENA -DFUNCPROTO=15
-DNARROWPROTO-g -O2  -I/usr/X11R6/include
-I/home/TOOLS/python-2.5/include/python2.5 -pthread-o
objects/if_python.o if_python.c
make[1]: *** No rule to make target
`/home/TOOLS/vim_src/Python-2.5/config.c', needed by
`objects/py_config.o'.  Stop.

So I took at look at the Makefile in the Python build directory and
sure enough there is no rule for config.c but there is:
Makefile Modules/config.c: Makefile.pre \
...

so I tried adding a rule right above it like so:
config.c: Makefile Modules/config.c

Then did a make distclean in vim and tried to do a build again but
just got the same error.
Anyone have any idea how to resolve this? Run into this before? I
would really like to use some of the plugins that take advantage of
python.
Thanks,
Nick



1. You should install not only the files required to run Python programs 
(usually a package named python or something like that) but also the 
files necessary to compile C interfaces to Python (usually a package 
named python-devel or something like that). The config.c source 
should be included with that Python development package. In fact, you 
shouls install development versions of _any_ packages you want to 
compile into Vim.


2. The current version of the Vim source is meant for Python 2.4; it 
won't work unchanged with Python 2.5. See the thread Python 2.5 
support about 6 or 7 hours ago, for an unofficial patch.



Best regards,
Tony.


glued Cursor trick anyone ?

2006-09-19 Thread Meino Christian Cramer
Hi,

 I would like to accomplish three tricks:

 1.) Suppose you have a source code and have started an new search
   task recently. With n you are jumping from match to
   match. Sometimes the next match is right on the last line
   currently visible. Pressing n let the cursor jump there. The
   screen is not scrolled, cause the target is still on the screen --
   but the context is not.

   Is it possible to always scroll the screen that way, that pressing
   n wll always take you to the middle of the screen (or in other
   words: The cursor is glued to the middle of the screen and the text
   jumps under the cursor)?

 2.) This is similiar: I want to scroll through text and keep the
   cursor glued to a certain position on the screen.

 3.) Last glued cursor thingy: I want to glue the cursor on the text
   and using up and down will not move the cursor on the text but
   the text on the screen.

 
 I am sure these are little steps for a vim guru to accomplish but
 would be big steps for me. :)

 Thank you very much for any hint and/or help in advance !

 Keep hacking!
 mcc 

 


Re: glued Cursor trick anyone ?

2006-09-19 Thread Peter Hodge

--- Meino Christian Cramer [EMAIL PROTECTED] wrote:

 Hi,
 
  I would like to accomplish three tricks:
 
  1.) Suppose you have a source code and have started an new search
task recently. With n you are jumping from match to
match. Sometimes the next match is right on the last line
currently visible. Pressing n let the cursor jump there. The
screen is not scrolled, cause the target is still on the screen --
but the context is not.
 
Is it possible to always scroll the screen that way, that pressing
n wll always take you to the middle of the screen (or in other
words: The cursor is glued to the middle of the screen and the text
jumps under the cursor)?
 
  2.) This is similiar: I want to scroll through text and keep the
cursor glued to a certain position on the screen.
 
  3.) Last glued cursor thingy: I want to glue the cursor on the text
and using up and down will not move the cursor on the text but
the text on the screen.
 

Sounds like you want to use the 'scrolloff' option.  Try ':help scrolloff',
it's pretty straightforward.  Personally I find 'set scrolloff=4' makes
everything much easier to read.

cheers,
Peter



 
On Yahoo!7 
Check out the new Great Outdoors site with video highlights and more 
http://au.travel.yahoo.com/great-outdoors/index.html