Mapping issue

2009-10-14 Thread Efraim Yawitz
Hi,

This is not exactly a bug report, but rather a report of what I find to be a
counterintuitive but evidently planned feature.

If I make a mapping containing a search command (/, #, n, N) and then
execute the mapping and the search ends inside a fold, the fold does not
open as it does when doing the search 'manually'.

Here is the code in normal_search (normal.c) in the Vim source which
produces this behavior:

#ifdef FEAT_FOLDING
if (cap->oap->op_type == OP_NOP && (fdo_flags & FDO_SEARCH) && KeyTyped)
foldOpenCursor();
#endif

My question is why is this check for KeyTyped desirable?  Why shouldn't I
want the fold to open when executing in a mapping?

Thanks,

Ephraim

--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Mapping issue

2009-10-14 Thread Andy Wokula

Efraim Yawitz schrieb:
> Hi,
> 
> This is not exactly a bug report, but rather a report of what I find to be a
> counterintuitive but evidently planned feature.
> 
> If I make a mapping containing a search command (/, #, n, N) and then
> execute the mapping and the search ends inside a fold, the fold does not
> open as it does when doing the search 'manually'.
> 
> Here is the code in normal_search (normal.c) in the Vim source which
> produces this behavior:
> 
> #ifdef FEAT_FOLDING
> if (cap->oap->op_type == OP_NOP && (fdo_flags & FDO_SEARCH) && KeyTyped)
> foldOpenCursor();
> #endif
> 
> My question is why is this check for KeyTyped desirable?  Why shouldn't I
> want the fold to open when executing in a mapping?

It is documented:
:h 'foldopen

When the command is part of a mapping this option is not used.  Add
the |zv| command to the mapping to get the same effect.

-- 
Andy

--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Blinking highlight like cursor

2009-10-14 Thread anna klein
On Wed, Oct 14, 2009 at 2:32 PM, John Beckett wrote:

>
> anna wrote:
> > I want to have a blinking highlight similar like cursor.
>
> Eeek. Please specify the exact system (Vim, terminal/gvim,
> operating system), then someone may have some info.
>
>
I'm sorry for not being specific. I am using gvim in Windows. I want to
highlight a certain pattern. But I want the highlight blinking (like a
cursor). For instance, the highlight in on word 'here', then the word 'here'
is highlighted and it is blinking.
Can anybody help me? :)


> > Is it also possible to highlight different patterns with
> > different color at the same time?
>
> I use a good tip for that:
> http://vim.wikia.com/wiki/Highlight_multiple_words
>
>
Yes. Thank you very much. I found the tip, too. That's exactly what I want.
Just a reminder for those who want to use that tip. You need to have vim7.2
due to matchadd() function.


> John
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Deprecating the use of vmap

2009-10-14 Thread Michael Henry

On 12/10/09 23:11, Bram Moolenaar wrote:
>
> Michael Henry wrote:
>> I'm proposing that the documentation make a strong statement
>> deprecating the use of :vmap for printable characters (and only
>> printable characters).  The statement would need to carefully
>> explain the negative effects of :vmap with printable characters,
>> and contrast this with appropriate use cases for :vmap.
>
> Let's add a note:
>
> *mapmode-x* *mapmode-s*
> Some commands work both in Visual and Select mode, some in only one.  Note
> that quite often "Visual" is mentioned where both Visual and Select mode
> apply. |Select-mode-mapping|
> NOTE: Mapping a printable character in Select mode may
> confuse the user.  It's better to explicitly use :xmap and
> :smap for printable characters.

This note would help, but I'd like to add more substantial
comments to the help to make it clear what's wrong with using
:vmap, showing an example of the negative effects, and show
the recommended way a plugin author should handle the problem.
I'd like to volunteer to come up with some verbiage and see what
you think of it.

Tony pointed out something I'd not considered:

On 10/12/2009 07:48 PM, Tony Mechelynck wrote:
> I shall add (to Bram's remark above) that the :xmap and :smap commands
> (and also ::xmenu and :smenu) are relatively recent (previously there
> were only :vmap and :vmenu) so it is possible that plugins which existed
> prior to their introduction have not yet been updated.
>
> Where plugins, especially ones not part of the Vim distribution, still
> use :vmap or :vmenu, it would probably be better to wrap any change in
> "if exists(':xmap') == 2" or in "if exists(':xmenu') == 2" to avoid
> unexpected errors in older versions of Vim.

I took up Vim in earnest at Vim 7.  Checking :help version7.txt,
I discovered that :xmap and :smap are new with Vim 7.

So I'd make sure the new documentation mentioned the
compatibility issues.  What would the recommended method for
retaining pre-Vim 7 compatibility?  One idea would be to suggest
the plugin author define his own Xmap something like this:

if exists(':xmap') == 2
command -bang -nargs=* Xmap xmap 
else
command -bang -nargs=* Xmap vmap 
endif

Or, if there's a different recommendation for plugin authors,
I'd be happy to include it in map.txt.  For example, it might
not be good to define a global :command like this, but without
it I'm not sure how to avoid having the plugin author duplicate
each of his mappings.

Looking through the map.txt help file again, I can see where the
pre-Vim 7 flavor is still there.  As part of the proposed new
help text, I'd suggest the following:

- Restructure section 1.3 MAPPING AND MODES to treat Visual and
  Select modes separately.

- Update this comment:

  Note that quite often "Visual" is mentioned where both Visual
  and Select mode apply. |Select-mode-mapping|

  I presume this comment is just an acknowledgment that map.txt
  hasn't been updated to use the term "Visual" more precisely
  now that :xmap and :smap treat Visual and Select modes
  differently.  I'd ensure that throughout map.txt, Visual is
  used exclusively to mean Visual mode, and where comments would
  apply to both Visual and Select modes, I'd mention that
  explicitly.

- Add a suggestion to define :Xmap for plugin authors, or
  whatever other compatibility work-around is considered to be
  best practice.

There would probably be other cleanup related to this change, if
there is interest in having me take a crack at a re-write.
Also, how would I best provide new verbiage?  Should I post to
the list and attach the new map.txt file, with or without a diff
between the old and new files?  Should I start a new Wiki page
with the suggested verbiage (and if so, where)?  Guidance on the
method would be appreciated.

Bram continued:
> Perhaps you can go over all existing plugins that use :vmap and ask them
> to change to :xmap where needed.

I'd been planning to email the authors of plugins which I use,
once there is agreement on the pre-Vim 7 compatibility question
and we have something that plugin authors can read to understand
the issue.  I'm not sure how to tackle the other nearly three
thousand plugins :-)  Perhaps if we had a Wiki page explaining
the issue and sent a general call via the mailing list, the
active plugin developers would take care of their plugins, and
users would know enough about the issue to request fixes for the
other plugins.

Thanks,
Michael Henry


--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Deprecating the use of vmap

2009-10-14 Thread Andy Wokula

Michael Henry schrieb:
> All,
> 
> I'd like to advocate the deprecation of the use of :vmap command
> in most places it is currently being used, for the following reasons.
> 
> Lately I've been running into problems caused by the use of
> :vmap in plugins.  Despite the 'v' in the name, :vmap is not
> just for Visual-mode mapping; instead, it creates a mapping for
> both Visual and Select modes.  This leads to unintended
> interference with Select mode's defined behavior, which is
> especially noticeable with "snippets" plugins (such as
> UltiSnips) that use select mode extensively.

The same applies for the :map command which also covers
Select mode.

Mappings in question should be followed by the :sunmap command:
:map {lhs} {rhs}
:sunmap {lhs}

-- 
Andy

--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: ftp.vim.org ???

2009-10-14 Thread Christian Ebert

* meino.cra...@gmx.de on Wednesday, October 14, 2009:
> where is ftp.vim.org gone?
> The server still exists...but the contents seems to be gone with the
> wind?

Temporary? I just checked ftp.vim.org/pub/vim/ and it is quite
populated. You could also try ftp.nluug.nl/pub/vim/.

c
-- 
\black\trash movie_C O W B O Y_  _C A N O E_  _C O M A_
 Ein deutscher Western/A German Western
Next show: 1 November 2009  _R O T E_  _F L O R A_  Hamburg
 --->> http://www.blacktrash.org/underdogma/ccc.php


--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: ftp.vim.org ???

2009-10-14 Thread Bram Moolenaar


Meino Cramer wrote:

>  where is ftp.vim.org gone?
>  The server still exists...but the contents seems to be gone with the
>  wind?
>  Hopefully not...

Looks like the server is broken...
You can use a mirror: http://www.vim.org/mirrors.php

-- 
CUSTOMER: You're not fooling anyone y'know.  Look, isn't there something
  you can do?
DEAD PERSON:  I feel happy... I feel happy.
[whop]
CUSTOMER: Ah, thanks very much.
MORTICIAN:Not at all.  See you on Thursday.
CUSTOMER: Right.
  The Quest for the Holy Grail (Monty Python)

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: inset of line numbers

2009-10-14 Thread MK

On 10/13/2009 03:10:48 PM, Christian Brabandt wrote:

> the vi default is 8 spaces. In vim you can tweak the value using the 
> numberwidth option (which is only available since vim 7, I believe).

ARRRGHHH!  It is 6.3.  Looks like I have to ask if I can upgrade it.

Thanks!  MK



--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Blinking highlight like cursor

2009-10-14 Thread Ben Fritz



On Oct 14, 3:29 am, anna klein  wrote:
>
> Yes. Thank you very much. I found the tip, too. That's exactly what I want.
> Just a reminder for those who want to use that tip. You need to have vim7.2
> due to matchadd() function.
>

matchadd() was added in 7.1.040, actually (and fixed in 7.1.042).
--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Deprecating the use of vmap

2009-10-14 Thread Tony Mechelynck

On 14/10/09 10:54, Michael Henry wrote:
[...]
> - Update this comment:
>
>Note that quite often "Visual" is mentioned where both Visual
>and Select mode apply. |Select-mode-mapping|
>
>I presume this comment is just an acknowledgment that map.txt
>hasn't been updated to use the term "Visual" more precisely
>now that :xmap and :smap treat Visual and Select modes
>differently.  I'd ensure that throughout map.txt, Visual is
>used exclusively to mean Visual mode, and where comments would
>apply to both Visual and Select modes, I'd mention that
>explicitly.
[...]

I think that this comment is more general: there are a lot of places in 
the help at large (not only in map.txt) where "Visual" mode is 
mentioned, and in any of those places it may mean either 
Visual-or-Select or Visual-but-not-Select depending on a context which 
may or may not be obvious from that part of the help taken alone.


Best regards,
Tony.
-- 
hundred-and-one symptoms of being an internet addict:
159. You get excited whenever discussing your hard drive.

--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Syntax-highlighting through putty doesn't work

2009-10-14 Thread pansz

Alexander Kutka 写道:
> set runtimepath=/usr/share/vim/vim72
> 
> if &term =~ "xterm-color"
>if has("terminfo")
>  set t_Co=8
>  set t_Sf=
>  et t_Sb=
> else
>  set t_Co=8
>  set t_Sf=
>  et t_Sb=
> endif
> endif
> 
> set number
> set title
> set background=dark
> syntax on
> syntax enable
> ---

There should be an :set nocompatible on the first line of your .vimrc, 
is it there?

AFAIK putty supports xterm with 256 colors, I don't know if t_Co=8 works 
for putty but t_Co=256 works for me.



--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Is there a vim function to check if a function is allready defined?

2009-10-14 Thread winterTTr

Hi ,

I have known about the exists() , and it used to check if a variable is defined.
So , is there a vim function to check if a function is defined as
exists() do to the variable ?

--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Is there a vim function to check if a function is allready defined?

2009-10-14 Thread Christian Brabandt

On Thu, October 15, 2009 7:44 am, winterTTr wrote:
> So , is there a vim function to check if a function is defined as
> exists() do to the variable ?

Yes. It is called exists() ;)

Read :h exists() carefully and you find:

,
|   *funcname   built-in function (see |functions|)
|   or user defined function (see
|   |user-functions|).
`

regards,
Christian
-- 
:wq


--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Is there a vim function to check if a function is allready defined?

2009-10-14 Thread winterTTr

> Yes. It is called exists() ;)

a spelling mistake ,  o_O||

>
> Read :h exists() carefully and you find:
>
> ,
> |       *funcname       built-in function (see |functions|)
> |                       or user defined function (see
> |                       |user-functions|).
> `
Thanks for your answer.
I think i should read the doc more seriously : - )

>
> regards,
> Christian
> --
> :wq
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



RE: Count and write the number of occurences

2009-10-14 Thread John Beckett

Christian Brabandt wrote:
> I would change the function like this, which should be more
> clear ...

Thanks again. I have now updated the tip with a tweaked version:
http://vim.wikia.com/wiki/Word_frequency_statistics_for_a_file

If anyone notices a problem, please fix it or report here.

John


--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---