Re: repeating up/down/delete commands

2007-05-20 Thread A.J.Mechelynck

[EMAIL PROTECTED] wrote:

"A.J.Mechelynck" <[EMAIL PROTECTED]> 写于 2007-05-19 15:42:15:

This is true, but rather than an empty vimrc I suggest the following:

runtime vimrc_example.vim
" if and when we want to further customize Vim, we'll add more lines

below

Best regards,
Tony.
--


I always recommend include the contents of vimrc_example.vim instead of
just source the file by :runtime.

By including the contents of vimrc_example.vim we know all it has done and
we can change it anyway. i.e. chang the .vimrc is a good way, changing the
$VIMRUNTIME/vimrc_example.vim is NOT a good pratice. (vimrc_example fits
the need of the author but it definetely do not fit everyone, so I suggest
most users to change it and create their own .vimrc.)

The second reason: vimrc_example.vim comes from the distribution and it may
change, when it change it may silently break our existing scripts or
configurations. include the contents into our .vimrc minimize the
incompatible changes.

So the better practise to create a new .vimrc may be: just copy the
vimrc_example.vim to ~/.vimrc
--
Sincerely, Pan, Shi Zhu. ext: 2606




Changing the vimrc_example.com is not a good practice, but I prefer sourcing 
(contrary to Bram's repeated advice) because that way, if an improvement is 
distributed, I don't remain stuck with the old version. If the vimrc_example 
does something I don't want (and sometimes it does) I reverse it in the part 
of my own vimrc after the sourcing: for instance, to avoid filetype-specific 
indenting:


...
runtime vimrc_example.vim
filetype indent off
...

Likewise for other options. If I want to check what the vimrc_example actually 
does, I can always use ":view $VIMRUNTIME/vimrc_example.vim"; but that script 
is long, complex, and not written by me, enough for me to want it kept apart 
from my own changes -- and in a different file.


I don't remember the vimrc_example introducing changes which broke my own 
scripts, but if it did, ":verbose set optionname" would quickly tell me that 
'optionname' whas set there. YMMV.


Which practice is "better" depends on by which criteria you judge those 
practices. According to my criteria, sourcing the vimrc_example is "better" 
than copying it. Bram doesn't agree with me on that point, and neither do you, 
because you apply different criteria.



Best regards,
Tony.
--
The best book on programming for the layman is "Alice in Wonderland";
but that's because it's the best book on anything for the layman.


Re: C-X C-F completion and paths with spaces

2007-05-20 Thread panshizhu
"Yakov Lerner" <[EMAIL PROTECTED]> 写于 2007-05-21 05:50:03:
> On 5/20/07, Matthew Winn <[EMAIL PROTECTED]> wrote:
> > I can't begin to imagine why Microsoft thought it would be
> > a good idea to put spaces in the names of system directories
>
> I have two theories about this.
> 1) MS lifted the idea from Macintosh
> 2) MS, long humiliated by inferiority complex of the 8+3 FAT16 filenames,
> did it to subvert the idea of unix shell scripting powers. To create,
> that is, the
> files that break unix shell scripts  (remember samba ? ).
>
> Yakov

Interesting, it is said that MS uses '\' in paths (such as c:\foo\bar\)
just to conteract the unix '/'.

However, '\' in paths is very inconvenient in C programming so they use '/'
in Windows internels.

It is very likely that M$ set this just to "baffle" users. So my choice is
just "never use filenames with spaces", Since I never put anything
important into "Document and Settings"


--
Sincerely, Pan, Shi Zhu. ext: 2606

Re: Vim71: undocumented change for netrw plugin.

2007-05-20 Thread panshizhu
Charles E Campbell Jr <[EMAIL PROTECTED]> 写于 2007-05-18 23:23:23:
> That's an awful lot of text just to mention that there's an omission
> from the help!
>
>
> Regards,
> Chip Campbell
>

Sorry I think I'm a bit nervous recently and it often takes several
paragraphs to express my single idea, I'm going to see a doctor about this.
(really, I mean it, it's my problem since ten years before)

;-)

--
Sincerely, Pan, Shi Zhu. ext: 2606

Re: repeating up/down/delete commands

2007-05-20 Thread panshizhu
"A.J.Mechelynck" <[EMAIL PROTECTED]> 写于 2007-05-19 15:42:15:
> This is true, but rather than an empty vimrc I suggest the following:
>
> runtime vimrc_example.vim
> " if and when we want to further customize Vim, we'll add more lines
below
> Best regards,
> Tony.
> --

I always recommend include the contents of vimrc_example.vim instead of
just source the file by :runtime.

By including the contents of vimrc_example.vim we know all it has done and
we can change it anyway. i.e. chang the .vimrc is a good way, changing the
$VIMRUNTIME/vimrc_example.vim is NOT a good pratice. (vimrc_example fits
the need of the author but it definetely do not fit everyone, so I suggest
most users to change it and create their own .vimrc.)

The second reason: vimrc_example.vim comes from the distribution and it may
change, when it change it may silently break our existing scripts or
configurations. include the contents into our .vimrc minimize the
incompatible changes.

So the better practise to create a new .vimrc may be: just copy the
vimrc_example.vim to ~/.vimrc
--
Sincerely, Pan, Shi Zhu. ext: 2606

Re: How to get value of ~ (last used replace-to string) in script

2007-05-20 Thread Antony Scriven

On 5/20/07, Yakov Lerner <[EMAIL PROTECTED]> wrote:

> In a script, how do I get the value of ~ -- the last used
> replace-to string, as used in s//~/ ?
>
> Yakov
>

Quick hack. --Antony

fun! EchoTilde()
  $ put=''
  s/^/~/
  let tilde = getline('.')
  d
  echo tilde
endfun


Re: How to compile graphical Vim on Mandriva 2007?

2007-05-20 Thread A.J.Mechelynck

Steve Litt wrote:

On Sunday 20 May 2007 15:51, you wrote:

On 5/20/07, Steve Litt <[EMAIL PROTECTED]> wrote:

Hi all,

I tried to compile graphical Vim 7.1 on Mandriva 2007. I downloaded
vim-7.1.tar.bz2, untarred it, and did the following from the top level
directory created (vim71):

./configure --enable-gui
make
src/vim -g

The following error message appeared:

E25: GUI cannot be used: Not enabled at compile time


I retried, after make distclean, with the following configure options:

enable-gui=gtk
enable-gui=gtk2
enable-gui=auto

All produced the same error:

E25: GUI cannot be used: Not enabled at compile time

I chose not to perform make install in order to preserve the integrity of
my existing Vim 7.0 that came with Mandriva 2007.

Anyone know how to compile graphical Vim on Mandriva 2007, or at least
some diagnostic tests I can use to narrow down the problem?

You need to install gtk2-devel package. Also, the x11-devel package if
it's not installed.
The exact names of packages may vary between distributions. But the
idea is, you are
missing development packages (*-devel or *-dev) needed to compile GUI
functionality of vim.


Thanks Yakov,

I can't find them anywhere in the distribution packages. Funny thing is, Gnome 
works, and Mandriva managed to get a working 7.0 version of gvim installed on 
the machine as a package. Is there any way I can look at the error message 
and find out exactly what filename it's looking for? Perhaps it's just a 
missing symlink.


Thanks

SteveT

Steve Litt
Author: Universal Troubleshooting Process books and courseware
http://www.troubleshooters.com/



If you redirected your configure output (saving it as a logfile on disk) you 
can look into tyhat logfile, searching for anything unexpected.


Then, regardless of whether you logged configure output, there's the file 
src/auto/config.log, which traces in much more detail what happened during 
configure.


Note that for Vim, you don't need to run configure as a separate step: "make" 
(if there is no config cache), "make config" or "make reconfig" will invoke 
it; see my HowTo sheet http://users.skynet.be/antoine.mechelynck/compunix.htm 
for details.


I agree with Yakov that you probably lack the "development" packages required 
to compile Vim (they are not needed to run a precompiled Vim binary). Search 
your installation source (CD-ROM, online repository, whatever) for packages 
with names similar (but not necessary identical) to


ncurses-devel
gtk2-devel
xorg-x11-devel

and maybe more, depending on which features you want to include. If you can 
search package names, try to see all packages including "devel" (or maybe 
"-dev") in them, include any of them that you may need, and when in doubt 
about some package, include it. Then if you installed from a CD (which will 
always be slightly out-of-date even on the day you buy it), do an "online 
update" of your whole system (or whatever Mandriva calls it), and after that, 
set your environment options (as shown in my above-mentioned HowTo page), cd 
to the vim71/src directory (for building: there is no src/ subfolder in 
$VIMRUNTIME) and run


make reconfig 2>&1 |tee ../reconfig.log

This normally runs configure and proceeds to compile and link. If it produces 
a Vim executable (in the current src/ folder), run


./vim --version |more

and, if it looks OK,

cd ..
make install 2>&1 |tee install.log

If, instead, it produces no executable, or if you don't get the features you 
wanted, check the logs, and try to find some more packages you might lack.



Best regards,
Tony.
--
He thought he saw an albatross
That fluttered 'round the lamp.
He looked again and saw it was
A penny postage stamp.
"You'd best be getting home," he said,
"The nights are rather damp."


Re: How to get value of ~ (last used replace-to string) in script

2007-05-20 Thread A.J.Mechelynck

Tim Chase wrote:

In a script, how do I get the value of ~ -- the last used
replace-to string, as used in s//~/ ?


While I've wondered this in the past, and don't have an answer at
the moment, I found a small bug in the help text (or in the :help
command) while hunting.

In Vim7, if I type

:help ~

and hit control+D to expand the available help items, one of them is

s/\~

However, if I type

:help s/\~

and hit , Vim returns

 E33: No previous substitute regular expression
 E149: Sorry, no help for s/\~

According to a helpgrep (which had to be entered as

:helpgrep s/\\\~

), there's only one location in the help where this matches,
right next to

:help s~

I suspect it's a bug for control+D expansion to return something
that, if chosen as the help tag, refuses to jump there.

-tim






I don't get an error but I get a wrong matching anyway. Here, ":help s/\~" 
goes to the helptag for s/\& (s/\~ is 12 lines further down).


To find the tag for s/\~ I have to enter ":help s/\\~". ":help s/\\\~" jumps 
to s/\\



Best regards,
Tony.
--
Most people wouldn't know music if it came up and bit them on the ass.
-- Frank Zappa


Re: How to compile graphical Vim on Mandriva 2007?

2007-05-20 Thread Steve Litt
On Sunday 20 May 2007 15:51, you wrote:
> On 5/20/07, Steve Litt <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> > I tried to compile graphical Vim 7.1 on Mandriva 2007. I downloaded
> > vim-7.1.tar.bz2, untarred it, and did the following from the top level
> > directory created (vim71):
> >
> > ./configure --enable-gui
> > make
> > src/vim -g
> >
> > The following error message appeared:
> >
> > E25: GUI cannot be used: Not enabled at compile time
> >
> >
> > I retried, after make distclean, with the following configure options:
> >
> > enable-gui=gtk
> > enable-gui=gtk2
> > enable-gui=auto
> >
> > All produced the same error:
> >
> > E25: GUI cannot be used: Not enabled at compile time
> >
> > I chose not to perform make install in order to preserve the integrity of
> > my existing Vim 7.0 that came with Mandriva 2007.
> >
> > Anyone know how to compile graphical Vim on Mandriva 2007, or at least
> > some diagnostic tests I can use to narrow down the problem?
>
> You need to install gtk2-devel package. Also, the x11-devel package if
> it's not installed.
> The exact names of packages may vary between distributions. But the
> idea is, you are
> missing development packages (*-devel or *-dev) needed to compile GUI
> functionality of vim.

Thanks Yakov,

I can't find them anywhere in the distribution packages. Funny thing is, Gnome 
works, and Mandriva managed to get a working 7.0 version of gvim installed on 
the machine as a package. Is there any way I can look at the error message 
and find out exactly what filename it's looking for? Perhaps it's just a 
missing symlink.

Thanks

SteveT

Steve Litt
Author: Universal Troubleshooting Process books and courseware
http://www.troubleshooters.com/


Re: How to get value of ~ (last used replace-to string) in script

2007-05-20 Thread Yakov Lerner

On 5/21/07, Tim Chase <[EMAIL PROTECTED]> wrote:

> In a script, how do I get the value of ~ -- the last used
> replace-to string, as used in s//~/ ?

While I've wondered this in the past, and don't have an answer at
the moment,


It seems natural to patch expand() function to return this.
The question which argument to use. expand('~') ?
This is home directory. expand('s~') maybe ?

Yakov


Re: remote editing and spell list sync

2007-05-20 Thread fREW

On 5/20/07, Yakov Lerner <[EMAIL PROTECTED]> wrote:

On 5/19/07, Eric Smith <[EMAIL PROTECTED]> wrote:
> I use remote editing a lot (rsync protocol) and want to keep the spelling 
lists
> on both machines always synchromised.
>
> Is the best way with unison(1) or suchlike or is there a better way?

I tried unison, but then I found that personal svn/hg/git/cvs is much better.
For many years, I have been using personal svn. Then I switched to git.
It's matter of taste which VCS to use. But it beats unison, to my opinion.
One "problem" of VCS is that there are many any choices.
hg and svn are both good choices.

Yakov




I agree with Yakov.  I have my dotfiles for zsh and vim and a number
of other programs in an svk and I can do svk push and it will commit
it to an svn server on another computer.  That is nice because I can
have "backups" but also don't NEED internet access to commit.

-fREW


Re: How to get value of ~ (last used replace-to string) in script

2007-05-20 Thread Tim Chase
> In a script, how do I get the value of ~ -- the last used
> replace-to string, as used in s//~/ ?

While I've wondered this in the past, and don't have an answer at
the moment, I found a small bug in the help text (or in the :help
command) while hunting.

In Vim7, if I type

:help ~

and hit control+D to expand the available help items, one of them is

s/\~

However, if I type

:help s/\~

and hit , Vim returns

 E33: No previous substitute regular expression
 E149: Sorry, no help for s/\~

According to a helpgrep (which had to be entered as

:helpgrep s/\\\~

), there's only one location in the help where this matches,
right next to

:help s~

I suspect it's a bug for control+D expansion to return something
that, if chosen as the help tag, refuses to jump there.

-tim






Re: C-X C-F completion and paths with spaces

2007-05-20 Thread Yakov Lerner

On 5/20/07, Matthew Winn <[EMAIL PROTECTED]> wrote:

I can't begin to imagine why Microsoft thought it would be
a good idea to put spaces in the names of system directories


I have two theories about this.
1) MS lifted the idea from Macintosh
2) MS, long humiliated by inferiority complex of the 8+3 FAT16 filenames,
did it to subvert the idea of unix shell scripting powers. To create,
that is, the
files that break unix shell scripts  (remember samba ? ).

Yakov


Re: launching vim from eclipse

2007-05-20 Thread fREW

On 5/18/07, y m <[EMAIL PROTECTED]> wrote:

Thanks for your reply. I guess I should have been more specific. Yes I
tried doing that but I would like 2 additional functionalities which
the Visvim ole interface to MS Visual Studio does: 1. I want to be
able to open vim with the currently displayed file instead of having
to navigate to it through the left hand package view. 2. After opening
the file, I want vim to jump to the line currently displayed in the
eclipse editor. I suppose I will have to write my own ole plugin to do
this, but I was hoping something like this already existed so I
wouldn't have to reinvent the wheel.



I don't know of anything that works that way, but it should be that
hard.  Eclipse is good about things like that.  Just make a hotkey or
something that will run gvim -c : or something like that.
Eclipse often makes such variables for things like that.  I don't
know off hand though.

-fREW


Re: C-X C-F completion and paths with spaces

2007-05-20 Thread A.J.Mechelynck

Matthew Winn wrote:

On Sat, 19 May 2007 19:43:46 +0200, "A.J.Mechelynck"
<[EMAIL PROTECTED]> wrote:

It seems that the 'isfname' option doesn't include a space by default. But is 
that right? On both Windows and Unix, a filename may include spaces (though 
special steps must be taken to include such names in a command-line).


Having a space in isfname by default would cause problems when trying
to use gf. Vim would try to treat both the intended filename and all
the surrounding spaces and words as part of the name.

On Unix a filename may contain any character apart from slash or null,
but the potential for problems is avoided by an informal policy of
never creating names containing characters that are regularly used as
delimiters. I can't begin to imagine why Microsoft thought it would be
a good idea to put spaces in the names of system directories, but I
guess the environment was probably something like the final panel of
.



Or else, the decision was made by some suit with the same mentality as "a 
flight admiral who never flew anything other than a desk".



Best regards,
Tony.
--
The years of peak mental activity are undoubtedly between the ages of
four and eighteen.  At four we know all the questions, at eighteen all
the answers.


Re: How to compile graphical Vim on Mandriva 2007?

2007-05-20 Thread Yakov Lerner

On 5/20/07, Steve Litt <[EMAIL PROTECTED]> wrote:

Hi all,

I tried to compile graphical Vim 7.1 on Mandriva 2007. I downloaded
vim-7.1.tar.bz2, untarred it, and did the following from the top level
directory created (vim71):

./configure --enable-gui
make
src/vim -g

The following error message appeared:

E25: GUI cannot be used: Not enabled at compile time


I retried, after make distclean, with the following configure options:

enable-gui=gtk
enable-gui=gtk2
enable-gui=auto

All produced the same error:

E25: GUI cannot be used: Not enabled at compile time

I chose not to perform make install in order to preserve the integrity of my
existing Vim 7.0 that came with Mandriva 2007.

Anyone know how to compile graphical Vim on Mandriva 2007, or at least some
diagnostic tests I can use to narrow down the problem?


You need to install gtk2-devel package. Also, the x11-devel package if
it's not installed.
The exact names of packages may vary between distributions. But the
idea is, you are
missing development packages (*-devel or *-dev) needed to compile GUI
functionality of vim.

Yakov


How to compile graphical Vim on Mandriva 2007?

2007-05-20 Thread Steve Litt
Hi all,

I tried to compile graphical Vim 7.1 on Mandriva 2007. I downloaded 
vim-7.1.tar.bz2, untarred it, and did the following from the top level 
directory created (vim71):

./configure --enable-gui
make
src/vim -g

The following error message appeared:

E25: GUI cannot be used: Not enabled at compile time


I retried, after make distclean, with the following configure options:

enable-gui=gtk
enable-gui=gtk2
enable-gui=auto

All produced the same error:

E25: GUI cannot be used: Not enabled at compile time

I chose not to perform make install in order to preserve the integrity of my 
existing Vim 7.0 that came with Mandriva 2007.

Anyone know how to compile graphical Vim on Mandriva 2007, or at least some 
diagnostic tests I can use to narrow down the problem?

Thanks

SteveT

Steve Litt
Author: Universal Troubleshooting Process books and courseware
http://www.troubleshooters.com/


How to get value of ~ (last used replace-to string) in script

2007-05-20 Thread Yakov Lerner

In a script, how do I get the value of ~ -- the last used
replace-to string, as used in s//~/ ?

Yakov


Javascript syntax folding

2007-05-20 Thread Tobia
How can I enable syntax folding in Javascript files?

The syntax file seems to support it, controlled by a variable named
javaScript_fold, but setting it in my vimrc or on the command line
doesn't seem to do anything:

let javaScript_fold=1

vim -u /dev/null +"let javaScript_fold=1" file.js

What am I doing wrong?


Tobia

-- 
«A one-time pad isn't a cryptosystem: it's a state of mind.»
—Marcus Ranum


Re: remote editing and spell list sync

2007-05-20 Thread Yakov Lerner

On 5/19/07, Eric Smith <[EMAIL PROTECTED]> wrote:

I use remote editing a lot (rsync protocol) and want to keep the spelling lists
on both machines always synchromised.

Is the best way with unison(1) or suchlike or is there a better way?


I tried unison, but then I found that personal svn/hg/git/cvs is much better.
For many years, I have been using personal svn. Then I switched to git.
It's matter of taste which VCS to use. But it beats unison, to my opinion.
One "problem" of VCS is that there are many any choices.
hg and svn are both good choices.

Yakov


Re: C-X C-F completion and paths with spaces

2007-05-20 Thread Matthew Winn
On Sat, 19 May 2007 19:43:46 +0200, "A.J.Mechelynck"
<[EMAIL PROTECTED]> wrote:

> It seems that the 'isfname' option doesn't include a space by default. But is 
> that right? On both Windows and Unix, a filename may include spaces (though 
> special steps must be taken to include such names in a command-line).

Having a space in isfname by default would cause problems when trying
to use gf. Vim would try to treat both the intended filename and all
the surrounding spaces and words as part of the name.

On Unix a filename may contain any character apart from slash or null,
but the potential for problems is avoided by an informal policy of
never creating names containing characters that are regularly used as
delimiters. I can't begin to imagine why Microsoft thought it would be
a good idea to put spaces in the names of system directories, but I
guess the environment was probably something like the final panel of
.

-- 
Matthew Winn