Sunday, July 31, 2011

Re: Detecting Encrypted File

Reply to message «Re: Detecting Encrypted File»,
sent 03:40:27 01 August 2011, Monday
by Ben Schmidt:

> BufReadPost should also work, and won't trigger every time you move the
> cursor into the encrypted file's window/buffer.

@Paul:
> This works when I've already opened the file, but it doesn't work when I
> put it in my .vimrc, even when I try it both ways, like this:
>
> if !empty(&key) | set viminfo= | endif
> au! BufRead * if !empty(&key) | set viminfo= | endif
+ documentation
> BufRead or BufReadPost When ...


Original message:
> On 1/08/11 5:46 AM, Paul wrote:
> > On Sun, Jul 31, 2011 at 09:51:00PM +0400, ZyX wrote:
> >> Try BufWinEnter, BufEnter or such. I don't really know which events are
> >> launched after file is decrypted.
> >
> > Either of those work, thank you.
>
> BufReadPost should also work, and won't trigger every time you move the
> cursor into the encrypted file's window/buffer.
>
> Ben.

Re: Custom Completion Function

I forgot something regarding your need to know the exact choice even if there are ambiguities.

> Hello,
>
>
> "Amit Dev" wrote:
>
> > One thing I'm trying to do is to
> > use the custom completion function (^X^U). [...]
> >
> > Is there a callback or something that can be registered to find out
> > which item user chose?
>
> In mu-template [1], I've proceeded the following (asynchronous) way.
> (I've found no way to proceed synchronously) :
>
> - use feedkey (in s:ChooseTemplateFile(), l.680) to call a function
> that returns nothing, but that calls complete()
>
> - the function called (s:ChooseByComplete(), l.643) prepares the
> dictionary for complete(), registers a hook (to be called at the end
> of the process), and calls complete() -- this is all done through a
> "library" that I wrote for the occasion (lh-vim-lib ->
> autoload/lh/icomplete.vim)
>
> - the hook function (s:FinishCompletion(), l.659) extracts from the
> buffer what has really been inserted, and then do what I wished to
> do (here insert and interpret a template-file)

At this point, the string inserted is by no mean the final string, but something like a temporary identifier that I use to know which was the user's choice.


> The hook itself is triggered when <cr> or <c-y> are pressed. Both key
> are temporarily overriden for this purpose.
> NB: I also register a clear-once-the-temporary-mappings hook on
> InsertLeave, thanks to lh-vim-lib again.
>
>
> HTH,
>
> [1] the source code that'll interest you is here:
> http://code.google.com/p/lh-vim/source/browse/mu-template/trunk/autoload/lh/mut.vim
>
> --
> Luc Hermitte
> http://lh-vim.googlecode.com/
> http://hermitte.free.fr/vim/

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

Re: Custom Completion Function

Hello,


"Amit Dev" wrote:

> One thing I'm trying to do is to
> use the custom completion function (^X^U). [...]
>
> Is there a callback or something that can be registered to find out
> which item user chose?

In mu-template [1], I've proceeded the following (asynchronous) way. (I've found no way to proceed synchronously) :

- use feedkey (in s:ChooseTemplateFile(), l.680) to call a function that returns nothing, but that calls complete()

- the function called (s:ChooseByComplete(), l.643) prepares the dictionary for complete(), registers a hook (to be called at the end of the process), and calls complete() -- this is all done through a "library" that I wrote for the occasion (lh-vim-lib -> autoload/lh/icomplete.vim)

- the hook function (s:FinishCompletion(), l.659) extracts from the buffer what has really been inserted, and then do what I wished to do (here insert and interpret a template-file)
The hook itself is triggered when <cr> or <c-y> are pressed. Both key are temporarily overriden for this purpose.
NB: I also register a clear-once-the-temporary-mappings hook on InsertLeave, thanks to lh-vim-lib again.


HTH,

[1] the source code that'll interest you is here: http://code.google.com/p/lh-vim/source/browse/mu-template/trunk/autoload/lh/mut.vim

--
Luc Hermitte
http://lh-vim.googlecode.com/
http://hermitte.free.fr/vim/

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

Re: Detecting Encrypted File

On 1/08/11 5:46 AM, Paul wrote:
> On Sun, Jul 31, 2011 at 09:51:00PM +0400, ZyX wrote:
>> Try BufWinEnter, BufEnter or such. I don't really know which events are launched
>> after file is decrypted.
>
> Either of those work, thank you.

BufReadPost should also work, and won't trigger every time you move the
cursor into the encrypted file's window/buffer.

Ben.

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

Re: A modern look for gvim (win32)

On 31/07/11 09:30, Tobbe Lundberg wrote:
> On Sunday, July 31, 2011 4:10:22 AM UTC+2, Tony Mechelynck wrote:
[...]
> > :set go-=e stal=2
>
> Nice! I wish I could get a line like that for my open buffers! Much
> better looking (and uses less space) than something like minibufexpl

For buffers in windows of the current tab page, there are of course the
status lines; the non-current windows can be squashed to zero height if
desired, see http://vim.wikia.com/wiki/Window_zooming_convenience and
scroll down to the line starting "Moved from" (without the quotes).

I use a custom 'tabline' which prefixes the filename on each tab by
something like 2:3/7 meaning: "Tab page 2, window 3 of 7". The function
itself is 34 lines long (but written for legibility rather than sparseness).


Best regards,
Tony.
--
"I can remember when a good politician had to be 75 percent ability and
25 percent actor, but I can well see the day when the reverse could be
true."
-- Harry Truman

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

Re: sh vs bash syntax coloring

On 2011-07-31, ranousse wrote:

> By the way I have another question concerning shell and vim.
> I'm using zsh as interactive shell (because of completion possibilities)
> but I prefer bash/sh to write scripts.
>
> So when I type
> :!shell_command
> I would prefer it was seen as bash code by vim
> and when I type
> :sh
> I would prefer vim opens zsh as interactive shell.

I'm not sure I understand the problem. If you write your shell
scripts with

#!/bin/bash

as the first line, they will be executed by bash, regardless of the
shell they were started from.

What behavior do you want from

:!shell_command

that you get from bash that you don't get from zsh?

> I know I can do
> :set sh=bash
> but it changes shell in both case.

You could create a ~/.bashrc that contains just

exec /bin/zsh

and that would start zsh as your interactive shell, but I don't know
whether the behavior would be the same as if you executed ":sh" with
sh=zsh.

Regards,
Gary

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

Re: histwin warning: "DM is already defined"

Hi Paul!

On So, 31 Jul 2011, Paul wrote:

> On Sun, Jul 31, 2011 at 08:09:31PM +0200, Thilo Six wrote:
> >Christian Brabandt wrote the following on 31.07.2011 19:38
> >>No, I meant ID
>
> But it complains about DM, not ID...

That is the error in the plugin.


regards,
Christian

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

Re: Detecting Encrypted File

On Sun, Jul 31, 2011 at 09:51:00PM +0400, ZyX wrote:
>Try BufWinEnter, BufEnter or such. I don't really know which events are launched
>after file is decrypted.

Either of those work, thank you.

--

.

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

Re: histwin warning: "DM is already defined"

On Sun, Jul 31, 2011 at 08:09:31PM +0200, Thilo Six wrote:
>Christian Brabandt wrote the following on 31.07.2011 19:38
>> No, I meant ID

But it complains about DM, not ID...

>It seems there is at least one other plugin with this command:
>
>:verb com ID
> Name Args Range Complete Definition
> ID ? . expression call visincr#VisBlockIncr(s:ID , <f-args>)
> Last set from ~/.vim/bundle/VisualIncrementing/plugin/visincrPlugin.vim

Same here.

--

.

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

Re: histwin warning: "DM is already defined"

Hi Thilo!

On So, 31 Jul 2011, Thilo Six wrote:

> I tend to create my own namespace for such things e.g.
>
> s:ID:HistWinID:
>
> Additionally this has the advantage to visually group the commands
> when using <TAP>.

That is for the user of the plugin not easy to remember and not easy to
use. Maybe :HID would be better.

Currently, I tend to use :IndicateDifferences

regards,
Christian

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

Re: histwin warning: "DM is already defined"

Christian Brabandt wrote the following on 31.07.2011 20:16

Hello Christian

> Hi Thilo!

-- <snip> --

> I see, now I have to think about another name ...
>
> regards,
> Christian

I tend to create my own namespace for such things e.g.

s:ID:HistWinID:

Additionally this has the advantage to visually group the commands when using <TAP>.

Regards,
--
bye Thilo

4096R/0xC70B1A8F
721B 1BA0 095C 1ABA 3FC6 7C18 89A4 A2A0 C70B 1A8F


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

Re: histwin warning: "DM is already defined"

Hi Thilo!

On So, 31 Jul 2011, Thilo Six wrote:

> Christian Brabandt wrote the following on 31.07.2011 19:38
>
> Hello
>
> -- <snip> --
>
> > No, I meant ID
> >
> > regards,
> > Christian
>
> It seems there is at least one other plugin with this command:
>
> :verb com ID
> Name Args Range Complete Definition
> ID ? . expression call visincr#VisBlockIncr(s:ID , <f-args>)
> Last set from ~/.vim/bundle/VisualIncrementing/plugin/visincrPlugin.vim
>
> http://www.vim.org/scripts/script.php?script_id=670

I see, now I have to think about another name ...

regards,
Christian
--
Wer Phrasen drischt, wird Phrasen ernten.
-- Ernst R. Hauschka

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

Re: histwin warning: "DM is already defined"

Christian Brabandt wrote the following on 31.07.2011 19:38

Hello

-- <snip> --

> No, I meant ID
>
> regards,
> Christian

It seems there is at least one other plugin with this command:

:verb com ID
Name Args Range Complete Definition
ID ? . expression call visincr#VisBlockIncr(s:ID , <f-args>)
Last set from ~/.vim/bundle/VisualIncrementing/plugin/visincrPlugin.vim

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

--
bye Thilo

4096R/0xC70B1A8F
721B 1BA0 095C 1ABA 3FC6 7C18 89A4 A2A0 C70B 1A8F


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

Re: Detecting Encrypted File

Reply to message «Re: Detecting Encrypted File»,
sent 21:35:41 31 July 2011, Sunday
by Paul:

Try BufWinEnter, BufEnter or such. I don't really know which events are launched
after file is decrypted.

Original message:
> On Sun, Jul 31, 2011 at 07:52:36PM +0400, ZyX wrote:
> > if !empty(&key) | set viminfo= | endif
>
> This works when I've already opened the file, but it doesn't work when I
> put it in my .vimrc, even when I try it both ways, like this:
>
> if !empty(&key) | set viminfo= | endif
> au! BufRead * if !empty(&key) | set viminfo= | endif
>
> viminfo still has things in it after the file is loaded.
>
> >Do not use :setlocal here: viminfo is global option and using :setlocal
> >will only confuse you as in this case it is not different to :set or
> >:setglobal.
>
> OK, thanks.

Re: histwin warning: "DM is already defined"

Hi Paul!

On So, 31 Jul 2011, Paul wrote:

> On Sun, Jul 31, 2011 at 06:42:14PM +0200, Christian Brabandt wrote:
> >That error message is confusing. It should mean :ID is already defined.
> >This means, that apparently some other plugin defined the :ID command
> >and so the histwin command does not define it. You can check with
> >:verb com ID
>
> Aha, thanks. Apparently Align's cecutil.vim already uses DM:
>
> :verb com DM
> Name Args Range Complete Definition
> DM 1 call DestroyMark(<q-args>)
> Last set from ~/.vim/bundle/Align/plugin/cecutil.vim
>
> I suppose this is a conflict that the authors of these plugins ought to resolve...

No, I meant ID

regards,
Christian

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

Re: Detecting Encrypted File

On Sun, Jul 31, 2011 at 07:52:36PM +0400, ZyX wrote:
> if !empty(&key) | set viminfo= | endif

This works when I've already opened the file, but it doesn't work when I put it in my .vimrc, even when I try it both ways, like this:

if !empty(&key) | set viminfo= | endif
au! BufRead * if !empty(&key) | set viminfo= | endif

viminfo still has things in it after the file is loaded.

>Do not use :setlocal here: viminfo is global option and using :setlocal will
>only confuse you as in this case it is not different to :set or :setglobal.

OK, thanks.

--

.

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

Re: histwin warning: "DM is already defined"

On Sun, Jul 31, 2011 at 06:42:14PM +0200, Christian Brabandt wrote:
>That error message is confusing. It should mean :ID is already defined.
>This means, that apparently some other plugin defined the :ID command
>and so the histwin command does not define it. You can check with
>:verb com ID

Aha, thanks. Apparently Align's cecutil.vim already uses DM:

:verb com DM
Name Args Range Complete Definition
DM 1 call DestroyMark(<q-args>)
Last set from ~/.vim/bundle/Align/plugin/cecutil.vim

I suppose this is a conflict that the authors of these plugins ought to resolve...

--

.

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

Re: Manu missing: Ubuntu 11.04

Sorry: it was obviously MENU missing. I am typing with the unsolicited
cooperation of one of my cats...

2011/7/31 Guido Milanese <guido.milanese@gmail.com>:
> I am sorry to ask again the same question after some years, but the
> answer I received does not work now. To my excuse, I may say that I
> probably helped someone else posting the answer I had received (see
> http://tech.groups.yahoo.com/group/vim/message/79922).
>
> After installing afresh Ubuntu (version 11.04) gvim displays menus
> only if I run it as root (superuser). If I run it as normal user I
> find no way of displaying menus. The command "verbose set guioptions?"
> displays "aegimrLtT". I tried to play with the settings of
> ~/gnome2/Vim, or even to delete this file, as I did 4 years ago, but
> nothing changes. It must be either a PATH problem or a problem of
> symlinks, I suspect.
>
>     ls -l `which gvim` gives
> lrwxrwxrwx 1 root root 22 2011-07-31 14:08 /usr/bin/gvim ->
> /etc/alternatives/gvim
>     which on its turn points to /usr/bin/vim.gnome
>
> I googled on the topic but did not find a solution -- better: some
> solutions that did not work for me.
>
> Many thanks for your kind help.
> guido (Italy)
>
>
> --
> Guido Milanese - Professor of Latin
> The Catholic University, Milano, Italy
> http://docenti.unicatt.it/ita/guido_fabrizio_milanese
> http://www.arsantiqua.org
>

--
Guido Milanese - Professor of Latin
The Catholic University, Milano, Italy
http://docenti.unicatt.it/ita/guido_fabrizio_milanese
http://www.arsantiqua.org

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

Manu missing: Ubuntu 11.04

I am sorry to ask again the same question after some years, but the
answer I received does not work now. To my excuse, I may say that I
probably helped someone else posting the answer I had received (see
http://tech.groups.yahoo.com/group/vim/message/79922).

After installing afresh Ubuntu (version 11.04) gvim displays menus
only if I run it as root (superuser). If I run it as normal user I
find no way of displaying menus. The command "verbose set guioptions?"
displays "aegimrLtT". I tried to play with the settings of
~/gnome2/Vim, or even to delete this file, as I did 4 years ago, but
nothing changes. It must be either a PATH problem or a problem of
symlinks, I suspect.

ls -l `which gvim` gives
lrwxrwxrwx 1 root root 22 2011-07-31 14:08 /usr/bin/gvim ->
/etc/alternatives/gvim
which on its turn points to /usr/bin/vim.gnome

I googled on the topic but did not find a solution -- better: some
solutions that did not work for me.

Many thanks for your kind help.
guido (Italy)


--
Guido Milanese - Professor of Latin
The Catholic University, Milano, Italy
http://docenti.unicatt.it/ita/guido_fabrizio_milanese
http://www.arsantiqua.org

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

Re: histwin warning: "DM is already defined"

Hi Paul!

On So, 31 Jul 2011, Paul wrote:

> I just installed histwin for the first time to try it out. When I
> start vim, it immediately gives a warning: "histwin: DM is already
> defined. May be by another Plugin?". It doesn't seem to affect
> anything that histwin does, although I've not gone through and tried
> every other function of every other plugin I have, so I don't know if
> anything else is affected. How can I debug or resolve this?

That error message is confusing. It should mean :ID is already defined.
This means, that apparently some other plugin defined the :ID command
and so the histwin command does not define it. You can check with
:verb com ID

That should give you an idea, what interferes with the plugin.

regards,
Christian

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

Re: Detecting Encrypted File

Reply to message «Detecting Encrypted File»,
sent 19:40:50 31 July 2011, Sunday
by Paul:

if !empty(&key) | set viminfo= | endif
Do not use :setlocal here: viminfo is global option and using :setlocal will
only confuse you as in this case it is not different to :set or :setglobal.

Original message:
> Whenever I read an encrypted file, I want to 'setlocal viminfo='. If I
> always know the name of the file, I can put something like this in .vimrc:
>
> au! BufRead thefile setlocal viminfo=
>
> What if I don't always know the name of the file? Is there some 'if'
> operand that I can use, maybe like this?:
>
> au! BufRead * if &encrypted | setlocal viminfo= | endif
>
> (I'm not sure that syntax is even correct.)

Detecting Encrypted File

Whenever I read an encrypted file, I want to 'setlocal viminfo='. If I always know the name of the file, I can put something like this in .vimrc:

au! BufRead thefile setlocal viminfo=

What if I don't always know the name of the file? Is there some 'if' operand that I can use, maybe like this?:

au! BufRead * if &encrypted | setlocal viminfo= | endif

(I'm not sure that syntax is even correct.)

--

.

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

Re: JS edition of VIM

Reply to message «JS edition of VIM»,
sent 07:31:54 31 July 2011, Sunday
by Kai Zhang:

There is no JS edition, but if you want to write one try out emscripten LLVM
backend which can translate any languages supported by LLVM (including C which
is vim written in) to javascript. Mozilla developers once successfully compiled
Doom using it.

Original message:
> Hello, everyone! I am wondering if there is a javascript edition of vim. I
> have found JSVIM, but it is too simple. Since web application is more and
> more popular, I think we need a online edition of VIM, which may let more
> people know this powerful editor!

histwin warning: "DM is already defined"

I just installed histwin for the first time to try it out. When I start vim, it immediately gives a warning: "histwin: DM is already defined. May be by another Plugin?". It doesn't seem to affect anything that histwin does, although I've not gone through and tried every other function of every other plugin I have, so I don't know if anything else is affected. How can I debug or resolve this?

--

.

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

Re: sh vs bash syntax coloring

> > By the way I have another question concerning shell and vim.
> > I'm using zsh as interactive shell (because of completion possibilities)
> > but I prefer bash/sh to write scripts.
> >
> > So when I type
> >
> > :!shell_command
> >
> > I would prefer it was seen as bash code by vim
> > and when I type
> >
> > :sh
> >
> > I would prefer vim opens zsh as interactive shell.
> >
> > I know I can do
> >
> > :set sh=bash
> >
> > but it changes shell in both case.

On 31/07 18:25, ZyX wrote:

> Use <C-z> in normal mode instead. It won't launch anything, it will instead
> suspend vim so that you will see shell you opened vim from. Obviously,
> set shell=bash
> won't have any affect on shell that is already launched.

Yes indeed it's a solution. With also one drawback :-( :
I often launch vim, with xterm -e vim, and in this case I cannot use
<c-z>.

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

Re: JS edition of VIM

Excerpts from Kai Zhang's message of Sat Jul 30 05:31:54 +0200 2011:
> Hello, everyone! I am wondering if there is a javascript edition of vim. I
> have found JSVIM, but it is too simple. Since web application is more and
> more popular, I think we need a online edition of VIM, which may let more
> people know this powerful editor!
We all feel the same. Looks like nobody has time to rewrite Vim.
I'd like to draw your attention to HaXe, because that can also be
compiled to C. Thus you would have native versions on Android etc
easily.

If you start working on this ping back - we can then add notes to the
homepage to draw peoples attention to this (new) project.

Marc Weber

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

Re: sh vs bash syntax coloring

Reply to message «Re: sh vs bash syntax coloring»,
sent 18:07:46 31 July 2011, Sunday
by ranousse@gmx.com:

> I would prefer it was seen as bash code by vim
> and when I type
>
> :sh
>
> I would prefer vim opens zsh as interactive shell.
Use <C-z> in normal mode instead. It won't launch anything, it will instead
suspend vim so that you will see shell you opened vim from. Obviously,
set shell=bash
won't have any affect on shell that is already launched.

Original message:
> On 31/07 13:49, Thilo Six wrote:
> > ,----[ :h ft-sh-syntax ]----------------------
> >
> > < bash: >
> >
> > let g:is_bash = 1
> >
> > `---------------------------------------------
>
> So there is no trick at all, I only have to choose the right option.
> Thank you very much.
>
> By the way I have another question concerning shell and vim.
> I'm using zsh as interactive shell (because of completion possibilities)
> but I prefer bash/sh to write scripts.
>
> So when I type
>
> :!shell_command
>
> I would prefer it was seen as bash code by vim
> and when I type
>
> :sh
>
> I would prefer vim opens zsh as interactive shell.
>
> I know I can do
>
> :set sh=bash
>
> but it changes shell in both case.

Re: sh vs bash syntax coloring

On 31/07 13:49, Thilo Six wrote:
> ,----[ :h ft-sh-syntax ]----------------------
>
> < bash: >
> let g:is_bash = 1
> `---------------------------------------------

So there is no trick at all, I only have to choose the right option.
Thank you very much.

By the way I have another question concerning shell and vim.
I'm using zsh as interactive shell (because of completion possibilities)
but I prefer bash/sh to write scripts.

So when I type
:!shell_command
I would prefer it was seen as bash code by vim
and when I type
:sh
I would prefer vim opens zsh as interactive shell.

I know I can do
:set sh=bash
but it changes shell in both case.

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

Re: netrw dir listing position

Charles E Campbell Jr wrote:
> >> Hi,
> >>
> >> Is there a way to make the netrw dir listing maintain
> >> the cursor position?
> >>
> >> For example if I do a dir listing on a big dir, scroll down, and
> >> press enter to edit a file, when I go back to the dir listing the
> >> cursor is no longer at the file where I left it. The cursor
> >> starts over at the top of the dir listing.
> >>
> >> This is a pain if I want to edit a handful of files chosen from
> >> the netrw listing.
> >>
> >> Is there a way to maintain the cursor position in the dir listing?
> >>
> >>
> > I'm afraid that I don't see this behavior using v143d of netrw. Please
> > try upgrading netrw and see if you still have this problem.
> >
> > You may get v143d from:
> > http://mysite.verizon.net/astronaut/vim/index.html#NETRW
> >
> I should mention that I tried both the wide listing and the default thin
> listing when attempting to elicit this behavior. If the behavior
> persists, please let me know what netrw settings you may have and any
> more details that may be helpful.

I have the same problem, never took time to figure out how to fix it.

Start Vim with: vim -u NORC -N

Edit a directory with lots of files, move to halfway the list.
Press Enter, then :e #.
I end up at the top of the listing.
If after Enter I use CTRL-O I end up at the bottom of the listing.

In both cases using '" takes me to where I wanted to be. Does netrw
jump to the '" mark when opening a directory?

--
Windows
M!uqoms

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

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

Re: JS edition of VIM

Maybe you should look to extend Cloud9

On Sat, Jul 30, 2011 at 5:31 AM, Kai Zhang <zk65900931@gmail.com> wrote:
> Hello, everyone! I am wondering if there is a javascript edition of vim. I
> have found JSVIM, but it is too simple. Since web application is more and
> more popular, I think we need a online edition of VIM, which may let more
> people know this powerful editor!
>
> --
> 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
>

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

Conceal & folding lines

When using the conceal levels, is it possible to automatically fold
(ie. hide) lines that contain nothing except concealed text?

Best wishes,

Nicholas

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

Re: sh vs bash syntax coloring

ranousse@gmx.com wrote the following on 31.07.2011 12:42

Hello

> I'm not very happy with syntax coloring of sh scripts (starting with
> #!/bin/sh). For example, things like
> $(command), $((n+1)) or ${var%.txt} are very badly displayed.
> However they are part of POSIX sh I think.
>
> Do you know a simple hack to correct this. Something that could interest
> me would be always using bash syntax coloring even with
> #!/bin/sh
> at the beginning.
>
> I thought of modelines but vim seems to use the same syntax file for sh
> and bash and thus I cannot use something like
> # vi: syntax=bash
> or
> # vi: ft=bash
>


,----[ :h ft-sh-syntax ]----------------------

< bash: >
let g:is_bash = 1
`---------------------------------------------


--
bye Thilo

4096R/0xC70B1A8F
721B 1BA0 095C 1ABA 3FC6 7C18 89A4 A2A0 C70B 1A8F


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

Re: Vim: Warning: Output is not to a terminal

Kote Dekuur wrote:

> Have anyone seen this error before?
>
> Vim: Warning: Output is not to a terminal
>
> I'm writing a bash script to do merges in Mercurial and using vimdiff as
> the merge tool.   When there are merge conflicts that requires manual
> interactions it will open up vimdiff of the two files, but it seems to
> hang on
>
> Vim: Warning: Output is not to a terminal   and the terminal is stuck.
>
> I have no problems executing vimdiff <file1> <file2>
> manually.  This only happens when running it through a bash script.  I'm
> not sure if I'm missing an environment setting somewhere.

If you redirect Vim input it will read commands from there. If the
stdin actually contains text use the "-" argument, e.g.:

ls . | vim -

If you redirect Vim output you get the message you mentioned. You then
can't see what you are doing, but you can still edit.

Try typing ":qa!". If only output was redirected it should get you out
of the stuck situation.

If both input and output are redirected, you are really stuck.

--
I'm sure that I asked CBuilder to do a "full" install. Looks like I got
a "fool" install, instead. Charles E Campbell, Jr, PhD


/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

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

Custom Completion Function

Hi,

I'm learning to write a vim plugin. One thing I'm trying to do is to use the custom completion function (^X^U). The problem is I need a list of completion items and a short description. So I tried to use each item as a dict ('word' : <word> and 'menu' : <description>). This works fine, except that I need to find out what was the completion chosen by user. How to find that? There are duplicates in the completion items and only way to find correct entry is by knowing description as well. Eg:

abcd <a@c.com>
dup   <d1@c.com>
dup   <d2@c.com>
xyz   <x@y.com

Is there a callback or something that can be registered to find out which item user chose?

Another minor thing is doing ^X^U will complete to the first item. Is there a way not to do that? I want something like completion on browsers. While user types it should show the options. Currently I have to do ^X^U then backspace till beginning and start typing.

Thanks,
Amit

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

sh vs bash syntax coloring

I'm not very happy with syntax coloring of sh scripts (starting with
#!/bin/sh). For example, things like
$(command), $((n+1)) or ${var%.txt} are very badly displayed.
However they are part of POSIX sh I think.

Do you know a simple hack to correct this. Something that could interest
me would be always using bash syntax coloring even with
#!/bin/sh
at the beginning.

I thought of modelines but vim seems to use the same syntax file for sh
and bash and thus I cannot use something like
# vi: syntax=bash
or
# vi: ft=bash

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

Re: A modern look for gvim (win32)

On Sunday, July 31, 2011 4:10:22 AM UTC+2, Tony Mechelynck wrote:
> > 2. Create a GUI statusbar, but make it just an empty field and write
> > whatever the user has set as "statusline" in it. Will probably
> > have to use a smaller/different font than guifont to make
> > everything fit.

> IMHO this could still be 100% compatible. I think the font would not
> necessarily have to be smaller (after all, the current 'statusline'
> option uses the same 'guifont' as the rest of the window, with added
> empty space or filename truncation to make everything fit.

For me, "100% compatible" means that it uses the same font and that
everything is placed at the exact same location. Using a GUI status
bar I think the border of the bar would take up too many pixels to
use the same size font as gvim does now. And because of the left
side border everything (left-aligned) would be pushed a few pixels
to the right.


> but is it possible to use both font= and gui= guibg= guifg=
> guisp= in a single :hi command?

Don't know....

> > 3. Create a GUI statusbar with support for dividing it up in
> > different fields. It would use a special syntax for configuring
> > it, for example using the pipe character (|) to specify a new
> > field.

> Why reinvent the wheel? Option 2 above seems perfectly viable to me, if
> it can be implemented.

Because every other editor on Windows uses different fields for the
information in the status bar. One field for cursor location, one for
file encoding, one for file size etc...

> > What do you mean by "text-style tabs"?

> The kind of tabs you get above the Vim screen contents, in console mode,
> or in GUI mode with the e flag excluded from 'guioptions'. It is
> customizable with the 'tabline' option. When empty (default), Vim uses
> "a default tab pages line". To see what it looks like in gvim, use

> :set go-=e stal=2

Nice! I wish I could get a line like that for my open buffers! Much
better looking (and uses less space) than something like minibufexpl

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

Saturday, July 30, 2011

Re: How to make cursor not always at the last line

On 30/07/11 07:26, Rice wrote:
> Hi, I am writing code and reading source code with vim. When I am
> reading the source code, the cursor always stays at the last line.
> What I want is to make the cursor always stays at the middle of the
> screen when I am pressing "j", so that I can have a larger view of the
> code that below the cursor. It seems that I achieve it by posting the
> following line in the .vimrc
> set so=8
> which means that the cursor always keep the distance of 8 lines from
> the bottom.
>
> However, when I am do some coding, it does not wok. I found that I am
> always at the last line to do my coding, which makes me feel annoyed.
> Of course, I can press "zz" to push the current editing line at the
> middle of the screen. But, it is just a boring work when i go to the
> last line and press "zz" again and again.
>
> So is there any ways not to keep the cursor at the last line when I am
> coding, just like after pressing "zz" or something similar.
>

Well, if you are in a file with lots of lines both above and below the
cursor, then ":set so=999" (or some other big value) should keep the
cursor near the middle of the window. However:

* It is not possible to make the first line in the file start lower than
the top of the window.

* When 'wrap' is on, the top of the window will always be at the start
of a line (which may occupy several lines on the screen), except perhaps
if the current line is bigger than the whole window (in which case
either or both of the start and end of the current line may overflow the
boundaries of the current window).

* When near the bottom of the file, Vim will let the cursor go down once
the last line in the file is fully inside the window (i.e., 'scrolloff'
doesn't count anything after the last existing line in the file).


Best regards,
Tony.
--
People need good lies. There are too many bad ones.
-- Bokonon, "Cat's Cradle" by Kurt Vonnegut, Jr.

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

Re: Function/variable containing the number of current buffers

On 29/07/11 12:35, Axel Bender wrote:
> Is there any function/variable returning the number of open (non-hidden)
> buffers in GVim?

Not out of the box, I think, but you could certainly build one by means
of two nested while loops, with the help of the following functions (q.v.):

winnr()
tabpagenr()
tabpagewinnr()
winbufnr()

Adding tabpagewinnr(t, '$') for all t such that 1 <= t <= tabpagenr('$')
could give too high a value, because a single buffer may be displayed in
more than one window of one or more tabpages.


Best regards,
Tony.
--
Just remember: when you go to court, you are trusting your fate to
twelve people that weren't smart enough to get out of jury duty!

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

Re: Using gvim and Visual Studio side by side

On 28/07/11 06:16, Väinö Leppänen wrote:
[...]
> Väinö (yes, that's a name)

Hm... let me guess... would that by any chance be a diminutive of
Väinämöinen?


Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
145. You e-mail your boss, informing him you'll be late.

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

Re: A modern look for gvim (win32)

On 28/07/11 09:58, Tobbe Lundberg wrote:
[...]
> I see a few possible solutions.
> 1. Keep the status bar exactly as it is. I think this is the only way
> to be 100% backwards compatible.
> 2. Create a GUI statusbar, but make it just an empty field and write
> whatever the user has set as "statusline" in it. Will probably
> have to use a smaller/different font than guifont to make
> everything fit.

IMHO this could still be 100% compatible. I think the font would not
necessarily have to be smaller (after all, the current 'statusline'
option uses the same 'guifont' as the rest of the window, with added
empty space or filename truncation to make everything fit. I suppose
that in this case it would be permissible to use a different font on the
status line (as in the tooltip balloons and the menus, for Athena and
Motif), but is it possible to use both font= and gui= guibg= guifg=
guisp= in a single :hi command? Or else, a new option, defaulting to
'guifont' if empty.

> 3. Create a GUI statusbar with support for dividing it up in
> different fields. It would use a special syntax for configuring
> it, for example using the pipe character (|) to specify a new
> field.

Why reinvent the wheel? Option 2 above seems perfectly viable to me, if
it can be implemented.

>
> (The gui status bar is raised by default, a field is a sunken part of
> the status bar, giving it borders all around.)
>
> Option 2 and 3 can probably be combined.
>
> So the best option is probably to implement both 1 and 2/3, and then
> let the user choose which one he/she prefers.
>
> > You mean I could not use gvim anymore the way I like it, with custom
> > statusline and text-style tabs, but also any installed monospace
> > font I damn well please? That's certainly a no-no. Any controversial
> > change should be optional.
>
> No, that is not what I mean. But you are not the only one who
> understood it that way, so I must have expressed myself poorly.
>
> What I meant was that you could still use vim on ancient machines
> with "no other keyboard than a plain typewriter keyboard, and no
> mouse" or machines with only a terminal. I.e. you can still use
> vim where vim has always been the only option. Gvim will still
> be usable in any setting it has previously been usable.
>
> See above for my proposal for the status line. Of course you will
> be able to pick any monospaced font you want for the editor.
> What do you mean by "text-style tabs"?

The kind of tabs you get above the Vim screen contents, in console mode,
or in GUI mode with the e flag excluded from 'guioptions'. It is
customizable with the 'tabline' option. When empty (default), Vim uses
"a default tab pages line". To see what it looks like in gvim, use

:set go-=e stal=2

(where 'stal' or 'showtabline' has possible values 0=never, 1=only if at
least 2 tabs present, 2=always).

Historically, the text-style tabline appeared a few snapshots earlier
than the GUI-style tabline (with go+=e and 'guitablabel') during Vim 7.0
alpha development and I adopted it immediately. I still use it because
it gives me a more uniform look & feel between vim and gvim.


Best regards,
Tony.
--
The law will never make men free; it is men who have got to make the
law free.
-- Henry David Thoreau

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

%f in errorformats on network file systems

Hello Group!

my grepformat is:
gfm=%f:%l:%c:%m,%f:%l%m,%f\ \ %l%m

but because I am on NFS mounted drive. %f is expanded to sth like

/.automount/wl1dfs3/root/vol/vol1/users/jgreen/src/src.cpp

it should be
/home/jgreen/src/src.cpp

it is really annoying to look at the quick fix window full of this
lengthy automount path.

Could anyone help?

Thanks!
Jim.

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

Re: substitute on odd lines only

On Jul 30, 7:06 am, ranou...@gmx.com wrote:
> It works fine.
> I never thought of using | after :g/pattern/
> Thank you.
>

Actually, you're using the | after the "if". :g is one of the commands
that treats | as part of its argument.

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

Re: netrw dir listing position

Charles E Campbell Jr wrote:
> Sigma wrote:
>
>> Hi,
>>
>> Is there a way to make the netrw dir listing maintain
>> the cursor position?
>>
>> For example if I do a dir listing on a big dir, scroll down, and
>> press enter to edit a file, when I go back to the dir listing the
>> cursor is no longer at the file where I left it. The cursor
>> starts over at the top of the dir listing.
>>
>> This is a pain if I want to edit a handful of files chosen from
>> the netrw listing.
>>
>> Is there a way to maintain the cursor position in the dir listing?
>>
>>
> I'm afraid that I don't see this behavior using v143d of netrw. Please
> try upgrading netrw and see if you still have this problem.
>
> You may get v143d from:
> http://mysite.verizon.net/astronaut/vim/index.html#NETRW
>
I should mention that I tried both the wide listing and the default thin
listing when attempting to elicit this behavior. If the behavior
persists, please let me know what netrw settings you may have and any
more details that may be helpful.

Regards,
Charles Campbell

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

Re: netrw dir listing position

Sigma wrote:
> Hi,
>
> Is there a way to make the netrw dir listing maintain
> the cursor position?
>
> For example if I do a dir listing on a big dir, scroll down, and
> press enter to edit a file, when I go back to the dir listing the
> cursor is no longer at the file where I left it. The cursor
> starts over at the top of the dir listing.
>
> This is a pain if I want to edit a handful of files chosen from
> the netrw listing.
>
> Is there a way to maintain the cursor position in the dir listing?
>
I'm afraid that I don't see this behavior using v143d of netrw. Please
try upgrading netrw and see if you still have this problem.

You may get v143d from:
http://mysite.verizon.net/astronaut/vim/index.html#NETRW

Regards,
Charles Campbell

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

Re: E684 error when changing buffers

Hi Grahame!

On Sa, 30 Jul 2011, Grahame Blackwood wrote:

> Hi
>
> Whenever I change buffers, or open a new one I get an error message as
> follows:
>
> Error detected while processing function <SNR>16_ActivateBuffer:
> line 6:
> E684: list index out of range: 1
>
> Is anyone else experiencing this and is there a remedy?
>
> I am using PCLinuxOS and Vim 7.3.230 and the issue has only arisen since
> PCLinuxOS upgraded from Vim 7.3 to 7.3.230

This is caused by a plugin. Look for item 16 in the output of
:scriptnames

regards,
Christian
--

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

E684 error when changing buffers

Hi

Whenever I change buffers, or open a new one I get an error message as
follows:

Error detected while processing function <SNR>16_ActivateBuffer:
line 6:
E684: list index out of range: 1

Is anyone else experiencing this and is there a remedy?

I am using PCLinuxOS and Vim 7.3.230 and the issue has only arisen since
PCLinuxOS upgraded from Vim 7.3 to 7.3.230

Best regards

G


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

Re: Assign the result of a COMMAND to a variable

Hi Axel!

On Fr, 29 Jul 2011, Axel Bender wrote:

> I wonder if it is possible to assign the result of a command to a variable
> like so (not working):
>
> let [var] = [command]
>
> (where [command] stands for an arbitrary command producing output, like e.g.
> ls].

System command or Vim command (Unfortunately, ls could be both)? For the
latter, ZyX has already answered, for the first, you can use the
system() function.

regards,
Christian

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

Re: A modern look for gvim (win32)

Hi Ben!

On Fr, 29 Jul 2011, Ben Fritz wrote:

> > s = 'hello'
> > s[2]   # l
> > s[-2:] # lo
> > s[1:2] # el

> Agree, these would be nice to have. There's strpart() but it can be
> awkward to use.

That works in Vim as well:
:h expr8

Agreed, indexing on bytes has its own disadvantages, so I usually don't
use it...


regards,
Christian
--
Ich bin der Wahrheit verpflichtet, wie ich sie jeden Tag erkenne, und
nicht der Beständigkeit.
-- Mahatma Gandhi

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

Re: Vim buffer memory leak?

On 07/30/2011 02:42 AM, Liunx wrote:
> problem when i try to load large files, then when i unload
> these files with ":bd" or ":bunload", my vim never release the
> relative memory, i wondering why?

:bd and :bunload don't free all resources associated with the
file. You might try :bwipe instead to see if that helps.

-tim

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

Re: key mappings work in gvim but not in vim?

Hi Yuliang!

On Fr, 29 Jul 2011, Yuliang Wang wrote:

> I have the following key mapping in .vimrc
>
> imap <C-CR> <Esc>o
> nmap <C-CR> o<Esc>
>
> They work in gvim, but not in vim. I'm sure it's not due to the terminal.
> Because I tried gnome-terminal, xterm, urxvt and the console (Ctrl+Alt+F1).

http://vimhelp.appspot.com/vim_faq.txt.html#faq-20.5

regards,
Christian
--
Die Diktatur duldet Reden. Aber keine Widerreden.
-- Werner Mitsch

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

Re: substitute on odd lines only

It works fine.
I never thought of using | after :g/pattern/
Thank you.

Le 30/07 - 06:29, Tim Chase wrote :
> On 07/30/2011 05:22 AM, ranousse@gmx.com wrote:
> >I want to perform a substitute command on odd lines only.
> >Is there some some "range" for this like sed 1~2 in vim?
> >Else do you know a better solution than
> >:%!sed '1~2s/pattern/replace/'
>
> Not natively, but it's easy to do something of the sort:
>
> :g/^/if line('.')%2|s/foo/bar/g|endif
>
> You can tweak the test for even lines:
>
> :g/^/if !(line('.')%2)|s/foo/bar/g|endif
>
> or for every 3rd line (or Nth):
>
> :g/^/if !(line('.')%3)|s/foo/bar/g|endif
>
> -tim
>
>
>

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

Re: substitute on odd lines only

On 07/30/2011 05:22 AM, ranousse@gmx.com wrote:
> I want to perform a substitute command on odd lines only.
> Is there some some "range" for this like sed 1~2 in vim?
> Else do you know a better solution than
> :%!sed '1~2s/pattern/replace/'

Not natively, but it's easy to do something of the sort:

:g/^/if line('.')%2|s/foo/bar/g|endif

You can tweak the test for even lines:

:g/^/if !(line('.')%2)|s/foo/bar/g|endif

or for every 3rd line (or Nth):

:g/^/if !(line('.')%3)|s/foo/bar/g|endif

-tim

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

substitute on odd lines only

I want to perform a substitute command on odd lines only.
Is there some some "range" for this like sed 1~2 in vim?
Else do you know a better solution than
:%!sed '1~2s/pattern/replace/'
?
(not so complicated after all)

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

Re: netrw dir listing position

On Saturday, July 30, 2011 01:38:45 Gary Johnson wrote:

> On 2011-07-29, Sigma wrote:
> > On Jul 29, 7:10 pm, sc wrote:
> > > On Friday, July 29, 2011 11:19:34 Steve Sullivan wrote:
> > > (i've since stopped using netrw, but the
> > >
> > > principle applies)
> >
> > There's a replacement for netrw? Great!What? How?
> > When I build vim 7.3 from source, netrw is built in.
> > It's not even an option. When I type :e .
> > up comes netrw. I'd be glad for a better replacement!

> NERD_tree

> http://vim.sourceforge.net/scripts/script.php?script_id=1658

> A lot of people seem to think it's a lot better than netrw. I
> tried it for a while but personally didn't like it as well as
> netrw, so I went back to using netrw. For me, netrw "just
> works" without having to think about it. YMMV.

for me simpler is better -- plugins like netrw try to do too
much, are far too complicated and carry baggage i don't want
or need

you can prevent its loading with

let g:loaded_netrw = 1

in your .vimrc

as i said, my browsing key du jour is shift-F11 i define as

nmap <silent> <S-F11> :call MyExplore('')<CR>
function! MyExplore(s)
if a:s == "t"
call MyExploreT()
return
endif
call CdCurBuf()
let wh = ' ' . escape(expand("%:t"), '.\') . '$'
call Maikallfiles()
call search(wh)
normal zz
endfunction

and

function! Maikallfiles()
let l:tst_name = expand("%")
if l:tst_name != ".allfiles"
call EditTry(".allfiles")
endif
call Hideme()
silent %d
0r!pwd
normal o
silent r!ls -algG --group-directories-first
silent g/^total/d
normal gg
endfunction

" make allfiles, sorted on time
function! MaikallfilesT()
let l:tst_name = expand("%")
if l:tst_name != ".allfiles"
if &modified
split .allfiles
else
edit .allfiles
endif
endif
call Hideme()
silent %d
0r!pwd
normal o
silent execute 'r!ls -algGt'
silent g/^total/d
normal gg
endfunction

with

function! EditTry(what)
if &modified
execute "split " a:what
else
execute "edit " a:what
endif
endfunction

and

function! Hideme()
setlocal noswapfile
setlocal buftype=nofile
setlocal bufhidden=hide
endfunction

then when i see a module i want to edit i navigate to it and
use F4:

map <F4> :call OpenWhat()<CR>
function! OpenWhat()
let testme = expand("<cfile>")
if isdirectory(testme)
call CdMaik()
else
execute 'e ' . testme
endif
endfunction

YMMV -- for me this is the best combination of "just works"
and light baggage -- i don't need to edit files over ftp or
any of the other fancy things netrw does, and i've seen netrw
do things like change formatoptions in other buffers (now
fixed) that frankly scared me

i used to have a web site where i posted my whole .vimrc, but
several months after at&t decided to stop supporting usenet
they then decided to stop providing web hosting

i guess i'm lucky they still support email

sc

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

Re: Vim buffer memory leak?

于 2011年07月30日 15:05, Dominique Pellé 写道:
> Liunx<liunx1987@gmail.com> wrote:
>
>> hello,
>> i am using vim7.3.266, i encounter some problem, that when i type ":w"
>> per time,
>> the memory usage of vim go up, then never go down, so with time go by,
>> the memory
>> the vim used go up, but the speed go down, do you get this trouble, too?
>> help, please!
>> regards.
> Hi
>
> I don't see this problem. I'm using vim-7.3.266 (linux x86).
>
> Can you check whether it also happens even you start
> vim with:
>
> $ vim -u NONE -U NONE --noplugin
>
> If it does not happen, then you can try to narrow it
> down adding back your plugins one by one and
> try commenting out things in .vimrc until you find
> what's triggering it.
>
> Which OS are you using? Your nickname suggests
> that you're using Linux. If so, you may be able to find
> memory leaks with valgrind. See:
> http://dominique.pelle.free.fr/valgrind.txt.html
>
> Regards
> -- Dominique
>
Thanks very much, i am using ubuntu11.04-x86_64, i will try it, and i
also get some
problem when i try to load large files, then when i unload these files
with ":bd" or ":bunload",
my vim never release the relative memory, i wondering why?
regards.

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

Re: question about 'isfname'

Reply to message «Re: question about 'isfname'»,
sent 06:36:28 30 July 2011, Saturday
by Gary Johnson:

> Either way works--I just prefer the former.
It is strange because first variant works better. Correct variant using :execute
is
execute 'edit' fnameescape(testme)

Original message:
> On 2011-07-29, sc wrote:
> > On Friday, July 29, 2011 16:55:17 Gary Johnson wrote:
> > > (which I'm surprised even works) to
> > >
> > > exe 'e' testme
> >
> > well -- i was surprised THAT works and changed it to
> >
> > execute 'e ' . testme
>
> From ":help :exe":
> :exe[cute] {expr1} .. Executes the string that results from
>
> the evaluation of {expr1} as an Ex
> command. Multiple arguments are
> concatenated, with a space in between.
>
> Either way works--I just prefer the former.
>
> Regards,
> Gary

Re: Assign the result of a COMMAND to a variable

Reply to message «Assign the result of a COMMAND to a variable»,
sent 14:34:06 30 July 2011, Saturday
by Axel Bender:

Use :redir, but if you can avoid it, do avoid. It has some problems due to the
fact that redirections do not nest.

Original message:
> I wonder if it is possible to assign the result of a command to a variable
> like so (not working):
>
> let [var] = [command]
>
> (where [command] stands for an arbitrary command producing output, like
> e.g. ls].

Re: Vim buffer memory leak?

Liunx <liunx1987@gmail.com> wrote:

> hello,
> i am using vim7.3.266, i encounter some problem, that when i type ":w"
> per time,
> the memory usage of vim go up, then never go down, so with time go by,
> the memory
> the vim used go up, but the speed go down, do you get this trouble, too?
> help, please!
> regards.

Hi

I don't see this problem. I'm using vim-7.3.266 (linux x86).

Can you check whether it also happens even you start
vim with:

$ vim -u NONE -U NONE --noplugin

If it does not happen, then you can try to narrow it
down adding back your plugins one by one and
try commenting out things in .vimrc until you find
what's triggering it.

Which OS are you using? Your nickname suggests
that you're using Linux. If so, you may be able to find
memory leaks with valgrind. See:
http://dominique.pelle.free.fr/valgrind.txt.html

Regards
-- Dominique

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

Friday, July 29, 2011

Vim buffer memory leak?

hello,
i am using vim7.3.266, i encounter some problem, that when i type ":w"
per time,
the memory usage of vim go up, then never go down, so with time go by,
the memory
the vim used go up, but the speed go down, do you get this trouble, too?
help, please!
regards.

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

Re: netrw dir listing position

On 2011-07-29, Sigma wrote:

> On Jul 29, 7:10 pm, sc wrote:
> > On Friday, July 29, 2011 11:19:34 Steve Sullivan wrote:
>
> > (i've since stopped using netrw, but the
> > principle applies)

> There's a replacement for netrw? Great!What? How?
> When I build vim 7.3 from source, netrw is built in.
> It's not even an option. When I type :e .
> up comes netrw. I'd be glad for a better replacement!

NERD_tree

http://vim.sourceforge.net/scripts/script.php?script_id=1658

A lot of people seem to think it's a lot better than netrw. I tried
it for a while but personally didn't like it as well as netrw, so I
went back to using netrw. For me, netrw "just works" without having
to think about it. YMMV.

Regards,
Gary

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

How to make cursor not always at the last line

Hi, I am writing code and reading source code with vim. When I am
reading the source code, the cursor always stays at the last line.
What I want is to make the cursor always stays at the middle of the
screen when I am pressing "j", so that I can have a larger view of the
code that below the cursor. It seems that I achieve it by posting the
following line in the .vimrc
set so=8
which means that the cursor always keep the distance of 8 lines from
the bottom.

However, when I am do some coding, it does not wok. I found that I am
always at the last line to do my coding, which makes me feel annoyed.
Of course, I can press "zz" to push the current editing line at the
middle of the screen. But, it is just a boring work when i go to the
last line and press "zz" again and again.

So is there any ways not to keep the cursor at the last line when I am
coding, just like after pressing "zz" or something similar.

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

Re: netrw dir listing position

There's a replacement for netrw? Great!What? How?
When I build vim 7.3 from source, netrw is built in.
It's not even an option. When I type :e .
up comes netrw. I'd be glad for a better replacement!

Thanks,

Sigma

On Jul 29, 7:10 pm, sc <tooth...@swbell.net> wrote:
> On Friday, July 29, 2011 11:19:34 Steve Sullivan wrote:

> (i've since stopped using netrw, but the
> principle applies)
>

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

Re: A modern look for gvim (win32)

On Jul 29, 7:23 pm, AK <andrei....@gmail.com> wrote:
> On 07/29/2011 02:51 PM, Ben Fritz wrote:
>
>
> > One of the biggest strengths of VimL, and probably the main reason for
> > its continued existence, is that most of the language is made up
> > of :ex commands which you can/do use in your normal interactions with
> > the editor. Learning VimL is mostly equivalent to learning to use Vim
> > itself.
>
> Well, in python interface you can do something like:
>
> from vim import command as c
> def normal(cmd):
>      c("normal "+cmd)
>
> so commands can be run as
>
> c('bnext')
> normal('3jyy')
>
> etc.
>
> I think that's about as easy as using vimL.
>

Ok, so now you need to learn two languages, one which looks just like
VimL but apparently won't be usable in scripts, and python. Why not
just use VimL? My point that learning how to use Vim automatically
teaches you basic Vim scripting stands regardless of whether you can
use VimL commands in python or not.

> But in many ways languages like python and ruby are cleaner and
> nicer than vimL.. for example, in python all functions, vars and
> classes are in module's namespace, not global, so if you need
> to use it you can do
>
> import mymodule
> mymodule.myfunc()
>
> and not worry about name clashes.
>

I could see this getting annoying, but in practice I haven't had a
problem. Most authors prefix with the plugin name any variables,
functions, and the like which are part of an external API, or they use
<Plug>. Internal variables and functions mostly use s: to make them
private to the script.

Yes, it's a neat feature missing from vimscript, but it's hardly
crippling. People have been coding in C for decades without using
namespaces.

> putting vars into strings is much cleaner:
>
> exec 'let ' . a:var . ' = ' . "'" . a:value . "'"
>
> cmd = "let %s = '%s'" % (var, value)
>
> What's easier to read? And that's just 2 vars..
>

how about:

let {a:var} = {a:value}

:help curly-braces-names for details.

Again, this is completely missing from many languages in common use.
And actually for this purpose, i find Vim easier to read.

> Function args are very powerful and easy to use:
>
> def myfunc(x, y, z=0): ..
>
> myfunc(1, 2)
>
> or:
>
> args = [1,2]
> kwargs = {z:3}
> myfunc(*args, **kwargs)
>

Sorry, I don't know python, so I'm not sure what this does. It looks
like you're demonstrating 2 things:

1. In Python, you can define functions in a way that you do not need
to call them with all the arguments defined. Vim can also do this.
Admittedly, Vim does not provide a built-in way to provide defaults
for those arguments, but it is not hard to check for their absence and
default some internal variable to some value.

2. I'm really fuzzy on this one (the syntax is very cryptic IMO, and I
don't know python at all), but in python, perhaps you can pass in
arguments as part of a list instead of passing them in as defined in
the function prototype. While an interesting feature, I fail to see
the utility. It looks like a good way to obfuscate code to me.

> String indexes, slices and methods are great to have:
>
> s = 'hello'
> s[2]   # l
> s[-2:] # lo
> s[1:2] # el

Agree, these would be nice to have. There's strpart() but it can be
awkward to use.

> s.capitalize().rstrip('o')      # Hell
>

I don't see very many advantages of having methods as part of strings,
over having functions which act on strings.

> Triple quotes are much easier, IMHO, than vimL's varying handling of quotes:
>
> """Can use 'single', "double" quotes to heart's content."""
>

That looks like a neat feature. It certainly is nicer than the
escaping mechanisms required by almost every other language, including
VimL.


>
> It would be good if they were better integrated, I'm not sure how
> it works internally but I think an interpreter is started every time,
> for example, when you use a mapping that uses one of those languages.
> I tried writing a folding function once and it was too slow compared
> to vimL version. It would be great if a script could be running
> alongside vim, monitor contents of current line and step in when it
> matches some criteria. It would be great if a script could run in
> a thread and communicate back to vim.
>
>

I thought it could...am I wrong? I have a vague idea this is how some
of the "background command" and interactive shell plugins work, but
maybe I'm mistaken. I haven't looked into any of these. Like I said,
though, better integration with the interpreters would probably be a
plus.

I'm surprised to hear you found python slower than Vim for something.
One of the big reasons given for writing in a different scripting
language is speed improvements. Maybe there's just a big tradeoff if
you call the interpreter for small tasks many times instead of one big
task a few times.

>
> >> maybe there was a split into
> >> separate terminal and gui versions that would share some libraries.
>
> > What would be the point of this? I disagree with making changes for
> > the sake of making changes.
>
> I could be wrong but I think a lot of things are not done for Gvim
> because they have to work in console version, too. For example a lot
> of shortcuts are not possible in Gvim like ctrl-;, ctrl-", I think
> because keypress processing code is shared between console and gui
> Vim?
>

Keypress processing code is shared to some extent, but that's not why
gvim cannot process codes. A lot of it has to do with the internal
encoding of those keycodes, if I understand correctly (it all sounds
very complicated to me). There have been multiple proposals (some very
recently) for updating Vim so that both console AND gvim can use most
key combinations in mappings. But, nobody has stepped up and written a
patch. So far, it's been a request only.

> I wonder if most Vim users fall into 2 categories: those who use
> gvim 95% of time and those who use console version 95% of time. If
> that was the case, having less compatibility between the two
> would not be a problem.
>

That may be the case, but a big plus of Vim is that it acts (almost)
the same no matter where you run it. Putting that in jeopardy by
splitting it into two separate apps seems silly at best. People can
and do build a Vim without GUI enabled if it really matters to them,
so I don't think you'd buy much except for new places to introduce
differences in behavior between console and gvim.

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

JS edition of VIM

Hello, everyone! I am wondering if there is a javascript edition of vim. I have found JSVIM, but it is too simple. Since web application is more and more popular, I think we need a online edition of VIM, which may let more people know this powerful editor!

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

Re: question about 'isfname'

On 2011-07-29, sc wrote:
> On Friday, July 29, 2011 16:55:17 Gary Johnson wrote:
>
> > (which I'm surprised even works) to
>
> > exe 'e' testme
>
> well -- i was surprised THAT works and changed it to
>
> execute 'e ' . testme

From ":help :exe":

:exe[cute] {expr1} .. Executes the string that results from
the evaluation of {expr1} as an Ex
command. Multiple arguments are
concatenated, with a space in between.

Either way works--I just prefer the former.

Regards,
Gary

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

Re: question about 'isfname'

On Friday, July 29, 2011 16:55:17 Gary Johnson wrote:

> (which I'm surprised even works) to

> exe 'e' testme

well -- i was surprised THAT works and changed it to

execute 'e ' . testme

sc

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

Re: netrw dir listing position

On Friday, July 29, 2011 11:19:34 Steve Sullivan wrote:

> Hi,

> Is there a way to make the netrw dir listing maintain
> the cursor position?

> For example if I do a dir listing on a big dir, scroll down,
> and press enter to edit a file, when I go back to the dir
> listing the cursor is no longer at the file where I left it.
> The cursor starts over at the top of the dir listing.

> This is a pain if I want to edit a handful of files chosen
> from the netrw listing.

> Is there a way to maintain the cursor position in the dir
> listing?

charles may know a better way, but indirectly, here's how i
used to do it (i've since stopped using netrw, but the
principle applies)

i've defined shift-F11 as my browser key with

nmap <silent> <S-F11> :call MyExplore('')<CR>
function! MyExplore(s)
if a:s == "t"
call MyExploreT()
return
endif
call CdCurBuf()
let wh = ' ' . escape(expand("%:t"), '.\') . '$'
call Maikallfiles()
call search(wh)
normal zz
endfunction

you could use the same logic replacing 'call Maikallfiles()'
with 'call Explore()' or your netrw invocation of choice --
'e .' is many ppl's favorite

the call to CdCurBuf simply changes current directory to the
directory of the current file -- i finally weaned myself from
setting 'autochdir' -- in this case you won't find the current
file unless the directory is current to it

for completeness here it is:

function! CdCurBuf()
let cwd = getcwd()
let cth = expand("%:p:h")
if cwd ==# cth
echo 'cwd already ' cth
else
execute 'cd '.cth
echo 'cwd changed to ' cth
endif
endfunction

sc

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

Re: A modern look for gvim (win32)

On 07/29/2011 02:51 PM, Ben Fritz wrote:
>
>
> On Jul 28, 4:23 pm, AK<andrei....@gmail.com> wrote:
>> Since we're talking about this, I have a somewhat related question..
>>
>> If backwards compatibility was not an issue at all, what would be
>> changed in vim?
>
> But, backwards compalitibility will always be an issue. One of the
> strengths of Vim is the plethora of ready-made plugin solutions to a
> wide variety of problems.

I understand, but I thought it's an interesting question to explore
anyway.

>
>> How many people would prefer it if at some point
>> there was a significant break from current codebase and vimL would
>> be changed to something similar to ruby or python, even if that
>> broke ALL currently available scripts,
>
> One of the biggest strengths of VimL, and probably the main reason for
> its continued existence, is that most of the language is made up
> of :ex commands which you can/do use in your normal interactions with
> the editor. Learning VimL is mostly equivalent to learning to use Vim
> itself.


Well, in python interface you can do something like:

from vim import command as c
def normal(cmd):
c("normal "+cmd)

so commands can be run as

c('bnext')
normal('3jyy')

etc.

I think that's about as easy as using vimL.

But in many ways languages like python and ruby are cleaner and
nicer than vimL.. for example, in python all functions, vars and
classes are in module's namespace, not global, so if you need
to use it you can do

import mymodule
mymodule.myfunc()

and not worry about name clashes.

putting vars into strings is much cleaner:

exec 'let ' . a:var . ' = ' . "'" . a:value . "'"

cmd = "let %s = '%s'" % (var, value)

What's easier to read? And that's just 2 vars..


Function args are very powerful and easy to use:

def myfunc(x, y, z=0): ..

myfunc(1, 2)

or:

args = [1,2]
kwargs = {z:3}
myfunc(*args, **kwargs)


String indexes, slices and methods are great to have:

s = 'hello'
s[2] # l
s[-2:] # lo
s[1:2] # el
s.capitalize().rstrip('o') # Hell


Triple quotes are much easier, IMHO, than vimL's varying handling of quotes:

"""Can use 'single', "double" quotes to heart's content."""


I have to run but I'm sure I could come up with a lot more...


>
> For this reason, I think it would be a really bad idea to make
> significant changes to VimL for the sake of making it look more like
> another language.
>
> I would certainly not be opposed to making changes to the Perl,
> python, Ruby, etc. interfaces where they are lacking, for example it
> would be nice to be able to pass complex variables back and forth
> between Vim and the scripting language being used.

It would be good if they were better integrated, I'm not sure how
it works internally but I think an interpreter is started every time,
for example, when you use a mapping that uses one of those languages.
I tried writing a folding function once and it was too slow compared
to vimL version. It would be great if a script could be running
alongside vim, monitor contents of current line and step in when it
matches some criteria. It would be great if a script could run in
a thread and communicate back to vim.

>
>> maybe there was a split into
>> separate terminal and gui versions that would share some libraries.
>
> What would be the point of this? I disagree with making changes for
> the sake of making changes.

I could be wrong but I think a lot of things are not done for Gvim
because they have to work in console version, too. For example a lot
of shortcuts are not possible in Gvim like ctrl-;, ctrl-", I think
because keypress processing code is shared between console and gui
Vim?

I wonder if most Vim users fall into 2 categories: those who use
gvim 95% of time and those who use console version 95% of time. If
that was the case, having less compatibility between the two
would not be a problem.

-ak

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

Re: key mappings work in gvim but not in vim?

On 11-07-29 07:37 PM, Taylor Hedberg wrote:
> Vim receives characters from the terminal, rather than actual key presses like the GUI version does. And I don't believe that<C-CR> is actually a valid character. So that would probably explain why it works in GVim but not in any terminal.
>

Sometimes virtual terminals (aka xterm) intercept key presses for
special processing. On mine, Ctrl+Shift+PgUp will scroll the terminal
one page up. Also, your desktop manager might do the same. Check the
documentation on them for special key presses.


--
Just my 0.00000002 million dollars worth,
Shawn

Confusion is the first step of understanding.

Programming is as much about organization and communication
as it is about coding.

The secret to great software: Fail early & often.

Eliminate software piracy: use only FLOSS.

"Make something worthwhile." -- The Dear Hunter

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

Re: key mappings work in gvim but not in vim?

Vim receives characters from the terminal, rather than actual key presses like the GUI version does. And I don't believe that <C-CR> is actually a valid character. So that would probably explain why it works in GVim but not in any terminal.

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

key mappings work in gvim but not in vim?

I have the following key mapping in .vimrc

imap <C-CR> <Esc>o
nmap <C-CR> o<Esc>

They work in gvim, but not in vim. I'm sure it's not due to the terminal. Because I tried gnome-terminal, xterm, urxvt and the console (Ctrl+Alt+F1).

--
Yuliang

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

Vim: Warning: Output is not to a terminal

Hi,

Happy Friday everyone!

Have anyone seen this error before?

Vim: Warning: Output is not to a terminal

I'm writing a bash script to do merges in Mercurial and using vimdiff as the merge tool.   When there are merge conflicts that requires manual interactions it will open up vimdiff of the two files, but it seems to hang on

Vim: Warning: Output is not to a terminal   and the terminal is stuck.

I have no problems executing vimdiff <file1> <file2> manually.  This only happens when running it through a bash script.  I'm not sure if I'm missing an environment setting somewhere.

Thanks,

KD

Re: question about 'isfname'

On 2011-07-29, Gary Johnson wrote:
> On 2011-07-29, sc wrote:
> > list--
> >
> > i like to grep and pipe the results into an unnamed hidden vim
> > buffer so when i see a module i want to edit i can hit F4 on
> > it
> >
> > i have F4 defined as
> >
> > map <F4> :call OpenWhat()<CR>
> > function! OpenWhat()
> > let testme = expand("<cfile>")
> > if isdirectory(testme)
> > call CdMaik()
> > else
> > e <cfile>
> > endif
> > endfunction
> >
> > the relevant portion being the edit of <cfile>
> >
> > a typical chunk of grep output might look like the following:
> >
> > hl:open(PRS, ".prime_run_start");
> > hl2:open(PRS, ".prime_run_start");
> > inst:echo "restoreprs restores .prime_run_start from save_prs"
> > inst:echo "saveprs saves .prime_run_start to save_prs"
> > nmt:open(PRS, ".prime_run_start");
> >
> > when it first comes up, F4 performs fine and i am able to edit
> > for example 'hl' because the default value for 'isfname' does
> > not include ':'
> >
> > however, when 'hl' is a perl module, 'isfname' gets redefined
> > by $RUNTIME/ftplugin/perl.vim so when i quit or bp back to the
> > unnamed buffer with the grep output my F4 no longer works --
> > perl.vim adds ':' to 'isfname' and now it would try to open
> > 'hl:open', creating a new file by that name
> >
> > according to the help isfname is a global option so forcing
> > perl.vim to perform a setlocal would have no effect
> >
> > has anyone else run into this and if so, how did you deal with
> > it?
>
> If the file name is always to the left of the ':', you could change
>
> let testme = expand("<cfile>")
>
> to
>
> let testme = substitute(expand("<cfile>"), ':.*', '', '')

Here's a better way that grabs the file name under the cursor
instead of assuming that the file name is to the left of the ':'.
It saves the value of 'isfname', removes the ':' before accessing
<cword>, then restores the original value.

function! OpenWhat()
let l:isf = &isf
set isf-=:

let testme = expand("<cfile>")
if isdirectory(testme)
call CdMaik()
else
e <cfile>
endif

let &isf = l:isf
endfunction

I also forgot part of my first solution. You would also have to
change

e <cfile>

(which I'm surprised even works) to

exe 'e' testme

Regards,
Gary

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

Re: Uploading a new version of a script to the Vim website

El 28/07/11 12:35, Ben Fritz escribió:
>
> On Jul 27, 1:50 pm, Gerardo Marset<gammer1...@gmail.com> wrote:
>> Some time ago, I uploaded a script to the Vim website. Later I realized
>> I had made a little mistake in the description, so I went to "edit
>> details" to fix it. The link took me to a login page. I was logged in
>> already, and my username showed up at the top of the menu at the left,
>> along with a link to log out. "Some security measurement, maybe", I
>> thought, and typed my e-mail and my password again. But when I pressed
>> the "login" button, I was taken back to the login page again, with no
>> errors (or warnings :P). After trying around a bit unsuccesfully, I gave
>> up. Later, I tried to upload a new version of the script, and I could do
>> it with no problems.
>>
>> Now the story repeats, only the other way around. I was able to change
>> the description, but I can't upload a new version. The issue is the
>> same: upon clicking the "login" button, I'm asked to login again.
>> I have cookies enabled, and I'm certain I'm writing my password right
>> (an error shows up when I write it wrong).
>>
>> Maybe I'm just unlucky, but so far, the Vim website login system is the
>> most bogous I've ever seen.
>>
>> Has this happened before to someone? Am I doing something wrong? :/
> I've never seen this before, but I haven't tried changing the one or
> two scripts I have on vim.org in a few months at least.
>
Hmm :/. It's so weird. Anyway, thanks for the answer.

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