Re: Vim and Unicode supplementary chars

2007-01-05 Thread LandSurveyor
Your secret to success is 'digraphs'.  Vim provides its' own method of 
displaying many special characters.
While in vim, type ":help digraphs"-and enjoy!

-Original Message-
>From: Kenneth Reid Beesley <[EMAIL PROTECTED]>
>Sent: Jan 6, 2007 12:30 AM
>To: vim@vim.org
>Subject: Vim and Unicode supplementary chars
>
>I've started looking at vim again, and as far as I can see, it
>"handles" Unicode supplementary chars internally, but still
>doesn't render them properly.
>
>E.g. if you enter CTRL-V U00010400 the character is in the
>buffer, and can be written to file, but all you see on the screen
>is a question mark.
>
>Is that still the status? or is there a way to enter supplementary
>chars in vim and see the glyphs?
>
>Thanks,
>
>Ken



Vim and Unicode supplementary chars

2007-01-05 Thread Kenneth Reid Beesley

I've started looking at vim again, and as far as I can see, it
"handles" Unicode supplementary chars internally, but still
doesn't render them properly.

E.g. if you enter CTRL-V U00010400 the character is in the
buffer, and can be written to file, but all you see on the screen
is a question mark.

Is that still the status? or is there a way to enter supplementary
chars in vim and see the glyphs?

Thanks,

Ken


Re: Vim Scripting - passing parameters to/from Perl code using Perl interface

2007-01-05 Thread Suresh Govindachar

   Marcin Komorowski asked a long time ago around Thursday,
   September 22, 2005 6:24 PM
  
  > Vim provides a very nice way of executing Perl code right within
  > Vim scripts, but I have been trying to find a way to pass
  > parameters to this code, and return parameters from it.  I have
  > been unable to find a way so far.  Does anyone know a solution?
  
  See the "Additional Notes" section dated October 29, 2001 23:02
  for a tip by Benoit Cerrin:
   http://www.vim.org/tips/tip.php?tip_id=140 
  I had to re-read the tip several times before I figured out what
  it was all about -- but once I understood, it became very easy to
  use perl within vim.

  --Suresh



RE: Perl plugin example

2007-01-05 Thread Suresh Govindachar

   David Fishburn indicated that:

  > [has written many plugins in VimL; wants to write on in perl;
  > looking for perl/vim plugin examples]

  The best tip for getting started with perl/vim is in the
  "Additional Notes" section dated October 29, 2001 23:02 for a 
  tip by Benoit Cerrin: http://www.vim.org/tips/tip.php?tip_id=140 

  For more complex examples of using perl within vim, see:

  http://www.vim.org/scripts/script.php?script_id=1082
  http://www.vim.org/scripts/script.php?script_id=1052
  http://www.vim.org/scripts/script.php?script_id=906

  Another thing that might help:  
  
 1) Put the following toward the top of you perl file 
BEGIN {(*STDERR = *STDOUT) || die;}
 2) End the perl file with the line
__END__
 3) In $vim/ftplugin/perl.vim, use a mapping such as:

nmap:wmwG:r!perl %:p`.
 
 The just hit  and you will see the results of the perl
 processing.  You can go back to where you were using `w.
  
  --Suresh



Re: help with multi environment vim on xp

2007-01-05 Thread Marc Weber
On Fri, Jan 05, 2007 at 12:35:57PM -0800, Marc Bernstein wrote:
> I have cygwin and xp needs for editing files on xp. In addition most
> of the scripts I edit are destined for use on unix and possibly
> windows as well (Perl).After extensive search I am still
> looking for a cogent explanation about how best to setup the xp
> environment for seamless use of gvim, either opened from explorer or
> cygwin command line.
> 
> I presume this has to do with common use of vimfiles and coordinated
> use of environment variables  but am confused  
> 

> [...] because I
> cant seem to get the thing to work as expected.<
It does help much if you tell us in which way your expectation differs
from the real world.

First of all you have to know that much vim behaviour is contcrolled by
scrpts. If you know which scripts are lodaded you get a better idea
whats going on. cywin has set the $HOME environment variable. Thus
if you start a windows vim 
from windows
it will source 
C:\Dokumente und Einstellungen\\_vimfiles
(sorry don't know the english named path)
from cygwin
it will source
//home/_vimfiles (try echo $HOME to get the
path)
also it will source by default another script mapping C-v C-x ..
if you start vim compiled with cygwin it will (never used this version
on windows) to read scripts from $HOME/.vim ...

seee :h 'clipboard (unnamed to automatically copy selection)

Consider using a tool like virtalwin to manage many windows and map the
sceens to Win-1 Win-2 .. Win-9 ;) (thats my style of working *lol*)

How to seamlessly use vim integrated in windows?

Open files - :
Files are opned in windows in general by 
starting the application
a) File -> lead/open menu
b) drop the file using drag & drop (see :h drag to know how to
split or change current directory this way )
c) using file associations 
* double click / right click on the file and choose open
* open with
If you need a description how to change these settings
give me a reply

This might be an option, too:
using a icon to drop a file on that (eg create a link to vim on your
desktop, press Win-d (minimize all windows) and move the file on the
icon, then this file will be appended to the gvim arguments thus be
opened.
Press Win-r enter gvim (I assume gvim.exe is in $PATH) and move files
onto the entry.. This is much faster then clicking throug the start
menu..

and ... don't use explorer but total-commander .. you need some time
to learn shortcuts but its much nicer to work with..

Open files from within vim: There exist many possibilities which has
already been discussed yet. You should be able to find them by searching
the mailinglist archive.
in short
 Use :e **/* to expand path automatically matching a filename
 (I've cmapped **/* ;)
 Use :Explore ? ( perhaps netrw script which seems to be better ?)
 Most important: To get the last opened file simply press C-o twice (use
 mru script (most recent files) and / search to opene files you konw you
 were editing some time ago.. and map :MRU to a combination such as
 noremap  :MRU/http://mawercer.de/marcweber/vim/vimlib/installers/vimlib_gfhandler_installer_sourceme.vim,
short description :
http://mawercer.de/marcweber/vim/vimlib/docs/vl_ui_navigation_gfHandler_vim.html
 )

HTH
Marc


Re: .vimrc from URL

2007-01-05 Thread Maurí­cio

>> I change my .vimrc very often, and I use vim in
>> many computers. The result is that my changes
>> are not always updated to all computers.  Is it
>> possible to ask vim to update its .vimrc from
>> an URL, like an FTP address?

>
> The vimrc is sourced before the global plugins,
> in particular before the netrw plugin. So I
> think the short answer is no. What you could do
> (maybe) is setup a shell script (aka "Batch
> file" on Dos/Windows) to synchronize your vimrc
> from the master online version just before
> starting Vim. (...)

I don't need vim to read .vimrc from URL at
startup. I can just map a key, like F12, to try to
download that file and update the one at my home
dir. Then I can just press F12 and restart vim
when I want a configuration update.

However, writing an external script to do that for
me can be easier, since I know nothing about vim
scripting...

  Thanks,
  Maurício



Re: .vimrc from URL

2007-01-05 Thread Maurí­cio

> > I change my .vimrc very often, and I use vim
> > in many computers. (...)

> Mauricio, Maybe you should consider having your
> .vimrc (and other vim configuration files, like
> plugins etc) under source control? I have all my
> personal vimfiles directory + .vimrc under
> subversion, and it works very well. I don't
> synchronize these daily with the repository,
> unless there are some major changes, but now and
> then (weekly?).  (...)

I like the idea. Today, I use Google Docs to save
my files. However, I know of no free subversion
(or other system) sites where I could store my
files. Do you?

  Maurício



Re: help with multi environment vim on xp

2007-01-05 Thread A.J.Mechelynck

Marc Bernstein wrote:

Thanks so much! I have a few specific startup env questions.

If I am going to use the gvim that comes with cygwin for cygwin
command prompt, I presume all I need to do is put .vim and the
antecedent files in my home directory.
To keep things simple, I would of course set the path etc in .bashrc
and copy the vimfiles from wherever I may have vimfile versions that
correspond to the cygwin version of gvim.

Similarly to have a similar look and feel for vim70 for windows, I
suppose I have to have vimrc look the same in both envs and reference
the same colors and syntax. Could you point me to some good syntax.vim
working examples?

Thanks,

Marc


If they are not the same version, each one can use its own runtimes, e.g. 
"C:\Program Files\Vim\vim70" for native-Windows and /usr/share/vim/vim64/ for 
Cygwin. Default look and feel is similar, including coloring; except that a 
console version (typical for Cygwin) normally uses the terminal font with 
light foreground text and a dark (usually black) background, while gvim 
(typical for Windows) uses whatever font you set, with dark foreground on a 
white background. It is possible, however, to use Console Vim in a Dos Box, 
unless you need GUI features such as a Unicode font.


You can write a single vimrc, for instance _vimrc in your Windows home 
directory (but with ":setlocal ff=unix" for compatibility) and either set the 
Cygwin $HOME to that directory, or use a soft link (Cygwin knows about soft 
links even if Windows doesn't). Note that as long as there is only one vimrc 
in your home directory, its name can start with either a period or an 
underscore: Vim for Windows will look for .vimrc if it doesn't find _vimrc, 
and vice-versa for the Unix version.


The font-selection part of your vimrc (which IMHO is the most complex 
platform-dependent part) will for instance look similar to this:


if has("gui_running")" 'guifont' only has meaning in gvim
if has("gui_gtk2")  " GTK2 only, not GTK1
set guifont=LucidaTypewriter\ 12
elseif has("gui_kde")   " the obsolete kvim, but there are still
" some versions of it here and there
set guifont=LucidaTypewriter/12/-1/5/50/0/0/0/1/0
elseif has("x11")   " all other X11 versions, including GTK1
let &guifont = "*-lucidatypewriter-medium-r-normal"
\ . "-*-*-120-*-*-m-*-*"
else" all others, including Windows
set guifont=Lucida_Console:h12
endif
endif

For other compatibility issues, see
:help has()
:help exists()

For user-written runtime files, IMHO the simplest is to create 
/usr/share/vim/vimfiles as a softlink to its Windows counterpart, using (in 
bash) the following commands:


cd /usr/share/vim
ln -sv `cygpath -u C:\PROGRA~1\Vim\vimfiles`

(Note the use of the "cygpath" program, a very useful little utility which can 
convert paths to and from Unix format, Windows LFN format and Dos 8.3 format.) 
This way you can maintain (with 'fileformat' set to "unix" -- important!) 
single copies of your user-written colorschemes, keymaps, etc., store them in 
$VIM/vimfiles (and its subdirectories) and use them in both.



Best regards,
Tony.


Re: help with multi environment vim on xp

2007-01-05 Thread Marc Bernstein

Thanks so much! I have a few specific startup env questions.

If I am going to use the gvim that comes with cygwin for cygwin
command prompt, I presume all I need to do is put .vim and the
antecedent files in my home directory.
To keep things simple, I would of course set the path etc in .bashrc
and copy the vimfiles from wherever I may have vimfile versions that
correspond to the cygwin version of gvim.

Similarly to have a similar look and feel for vim70 for windows, I
suppose I have to have vimrc look the same in both envs and reference
the same colors and syntax. Could you point me to some good syntax.vim
working examples?

Thanks,

Marc

On 1/5/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:

Marc Bernstein wrote:
> I have cygwin and xp needs for editing files on xp. In addition most
> of the scripts I edit are destined for use on unix and possibly
> windows as well (Perl).After extensive search I am still
> looking for a cogent explanation about how best to setup the xp
> environment for seamless use of gvim, either opened from explorer or
> cygwin command line.
>
> I presume this has to do with common use of vimfiles and coordinated
> use of environment variables  but am confused  because I
> cant seem to get the thing to work as expected.<
>
> I intend to eventually use colors , syntax highlighting, script plugin
> (Perl), source code control?
>
> Thanks,
>
> Marc

Cygwin and Windows have different conventions for e.g. path. Running
Vim-for-cygwin from the Windows "Execute" menu or the cmd.exe command prompt,
or Vim-for-Windows from Cygwin bash, will IMHO never be "seamless". It may be
possible, but precautions (such as wrapping file names into a call to cygpath)
need to be taken wherever path names are used, such as for files on the
command-line or for the Vim commands which invoke an external command.

It may be easiest to have two versions of Vim on your system: "C:\Program
Files\Vim\vim70\gvim.exe" (and possibly vim.exe), compiled for native-Windows
though the compilation can be done under Cygwin; and a "unix-like" version
/usr/bin/vim (and possibly gvim), compiled for Cygwin using the top-level
Makefile, not the Make_cyg.mak. The latter could be the Vim version available
on the Cygwin site, but I don't know how up-to-date it is. The former can be
downloaded from Steve Hall's page
https://sourceforge.net/project/showfiles.php?group_id=43866&package_id=39721
-- that one is currently at the latest patchlevel.

You can use a common vimrc (with LF-only ends-of-lines, see below) if anything
which differs is wrapped in statements such as :if has("unix") etc. For
instance the 'guifont' for Cygwin-X11 will be different from that for
native-Windows because they use mutually incompatible formats.

You can use a common set of runtime files provided that they have "Unix-like"
ends-of-lines (LF only, no CR) and that 'fileformats' includes "unix" (which
is the default).

See also (if you want to compile it yourself):
http://users.skynet.be/antoine.mechelynck/vim/compile.htm (native-W32)
http://users.skynet.be/antoine.mechelynck/vim/compunix.htm (Unix-like)


Best regards,
Tony.



Re: map the arrow keys

2007-01-05 Thread A.J.Mechelynck

Rui Gonçalves wrote:

Ah. This means (apparently) that Vim doesn't properly recognise your
Shift-Left key combo. This could mean either that the keys are not 
passed to
it, or that the termcap/terminfo entry is bad. Are you using gvim 
(with its
graphical display) or Console Vim (within the Terminal app)? Does the 
mapping

work if you use the other?


i use Console Vim, in GVim the  and  do that (go to the
begin or to end of line).
but in terminal is different, the behavior is go to the begin or end
of windows. so i try use the combination S-Left (and S-Right).

Anyway, ":map!  " also doesn't work in GVim...



Top or bottom of the file can be Ctrl-Home/Ctrl-End but normally Home and End 
should go to the start and end of the line; so there's definitely something 
fishy with your keyboard interface.


In Terminal Vim, in a [no Name] buffer in Insert mode, you could try hitting 
Ctrl-V (or whatever does duty for it on a Mac: Cmd-V maybe?) followed by 
Shift-Left, or Ctrl-V followed by Home, and compare what (if anything) it 
writes into your buffer with the values displayed in answer to the ":set 
termcap" command. (The latter is not useful in gvim.)


(If, with your vimrc, Vim uses Ctrl-V to paste, then use Ctrl-Q instead.)


Best regards,
Tony.


Re: map the arrow keys

2007-01-05 Thread Rui Gonçalves

Ah. This means (apparently) that Vim doesn't properly recognise your
Shift-Left key combo. This could mean either that the keys are not passed to
it, or that the termcap/terminfo entry is bad. Are you using gvim (with its
graphical display) or Console Vim (within the Terminal app)? Does the mapping
work if you use the other?


i use Console Vim, in GVim the  and  do that (go to the
begin or to end of line).
but in terminal is different, the behavior is go to the begin or end
of windows. so i try use the combination S-Left (and S-Right).

Anyway, ":map!  " also doesn't work in GVim...


Re: map the arrow keys

2007-01-05 Thread A.J.Mechelynck

Rui Gonçalves wrote:
>> > is possible change the meaning of key combination 


>> > to "go to begin of line" in insert mode?



>> :map!



> I forgot... i use MacOSX.
> in MacOSX the   key doesn' t work that way.



In Vim the Home key works that key. Maybe not the MacOsX Home key if Vim
doesn't recognise it, but the conceptual "Vim" Home-key (which is 
actually the

{rhs} of that mapping) works that way.

Have you tried the above mapping? If it doesn't work, try

:map!  

and see if hitting the Shift-Left key (in Insert mode) inserts a 
less-than
sign. If it doesn't, then there is something wrong with the detection 
of your

Shift-Left key combo.


:map!  

this also doesn't work...
but thanks for all!

Ah. This means (apparently) that Vim doesn't properly recognise your 
Shift-Left key combo. This could mean either that the keys are not passed to 
it, or that the termcap/terminfo entry is bad. Are you using gvim (with its 
graphical display) or Console Vim (within the Terminal app)? Does the mapping 
work if you use the other?


Best regards,
Tony.

P.S. Please use "Reply to List" if your mailer has it, or otherwise "Reply to 
All", so everyone on the list can see what you write.


Perl plugin example

2007-01-05 Thread David Fishburn

I just searched through the help and didn't find anything to get me started.

I have written many Vim plugins using VimL, but in this case I need to write
one using Perl.

I also want to use Perl's DBI interface.  Does anyone have a perl/vim plugin
that I can use as a template to get me started?

TIA,
Dave



Re: help with multi environment vim on xp

2007-01-05 Thread Gary Johnson
On 2007-01-05, Marc Bernstein <[EMAIL PROTECTED]> wrote:
> I have cygwin and xp needs for editing files on xp. In addition most
> of the scripts I edit are destined for use on unix and possibly
> windows as well (Perl).
>
> After extensive search I am still
> looking for a cogent explanation about how best to setup the xp
> environment for seamless use of gvim, either opened from explorer or
> cygwin command line.
> 
> I presume this has to do with common use of vimfiles and coordinated
> use of environment variables but am confused because I
> cant seem to get the thing to work as expected.
> 
> I intend to eventually use colors , syntax highlighting, script plugin
> (Perl), source code control?

I tried to configure my Windows gvim to know whether it was invoked 
from the explorer or the Cygwin shell and to handle file names, 
etc., according to either Windows or Cygwin rules.  I finally 
decided that, if possible at all, it was more trouble than it was 
worth.

For example, using Windows gvim, if you put the cursor over the file 
name "/usr/share/man" and type "gf", Vim will complain that it can't 
find the file because neither Vim nor Windows knows how to find /usr 
(C:\cygwin\usr).

So I decided to install the Cygwin version of vim (not gvim) as well 
as the Windows versions of gvim and vim.  When I open Vim from 
explorer, I get Windows gvim; when I run gvim or vim from the 
Windows Command Prompt, I get Windows gvim or Windows vim; when I 
run gvim or vim from the Cygwin bash prompt, I get Windows gvim or 
Cygwin vim.  This lets me use Vim sanely in a Cygwin environment or 
in a Windows environment and has worked very well.

One of the tricky parts was getting the Cygwin vim to use my Windows 
_vimrc and vimfiles, so I didn't have to maintain two equivalent 
sets.  Since Cygwin vim wanted to find .vimrc in 
/cygdrive/c/Documents and Settings/garyjohn and vimfiles in 
/usr/share/vim/vimfiles, I created a .vimrc file containing this:


if has("win32unix")
" Running Cygwin version.
let &rtp = substitute(&rtp, '/usr/share/vim/vimfiles',
\   '/cygdrive/c/Program Files/Vim/vimfiles', 
'g')
source /cygdrive/c/Program\ Files/Vim/_vimrc
else
" Running native Windows version.
source $VIM/_vimrc
endif


Cygwin Vim expects all its configuration files to have LF line 
endings, not CRLF, so I had to run Cygwin's d2u on a number of files 
under C:\Program Files\Vim\vimfiles.

Luc Hermitte has a very useful script for invoking Windows
applications from Cygwin here,

http://hermitte.free.fr/cygwin/

and a page on using Vim in a Cygwin environment here:

http://hermitte.free.fr/vim/

HTH,
Gary

-- 
Gary Johnson | Agilent Technologies
[EMAIL PROTECTED] | Wireless Division
 | Spokane, Washington, USA


Re: map the arrow keys

2007-01-05 Thread A.J.Mechelynck

Rui Gonçalves wrote:

On 1/5/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:

Rui Gonçalves wrote:
> is possible change the meaning of key combination 
> to "go to begin of line" in insert mode?
>
> thanks
>

:map!


Best regards,
Tony.


I forgot... i use MacOSX.
in MacOSX the   key doesn' t work that way.

In Vim the Home key works that key. Maybe not the MacOsX Home key if Vim 
doesn't recognise it, but the conceptual "Vim" Home-key (which is actually the 
{rhs} of that mapping) works that way.


Have you tried the above mapping? If it doesn't work, try

:map!  

and see if hitting the Shift-Left key (in Insert mode) inserts a less-than 
sign. If it doesn't, then there is something wrong with the detection of your 
Shift-Left key combo.



Best regards,
Tony.


Re: help with multi environment vim on xp

2007-01-05 Thread A.J.Mechelynck

Marc Bernstein wrote:

I have cygwin and xp needs for editing files on xp. In addition most
of the scripts I edit are destined for use on unix and possibly
windows as well (Perl).After extensive search I am still
looking for a cogent explanation about how best to setup the xp
environment for seamless use of gvim, either opened from explorer or
cygwin command line.

I presume this has to do with common use of vimfiles and coordinated
use of environment variables  but am confused  because I
cant seem to get the thing to work as expected.<

I intend to eventually use colors , syntax highlighting, script plugin
(Perl), source code control?

Thanks,

Marc


Cygwin and Windows have different conventions for e.g. path. Running 
Vim-for-cygwin from the Windows "Execute" menu or the cmd.exe command prompt, 
or Vim-for-Windows from Cygwin bash, will IMHO never be "seamless". It may be 
possible, but precautions (such as wrapping file names into a call to cygpath) 
need to be taken wherever path names are used, such as for files on the 
command-line or for the Vim commands which invoke an external command.


It may be easiest to have two versions of Vim on your system: "C:\Program 
Files\Vim\vim70\gvim.exe" (and possibly vim.exe), compiled for native-Windows 
though the compilation can be done under Cygwin; and a "unix-like" version 
/usr/bin/vim (and possibly gvim), compiled for Cygwin using the top-level 
Makefile, not the Make_cyg.mak. The latter could be the Vim version available 
on the Cygwin site, but I don't know how up-to-date it is. The former can be 
downloaded from Steve Hall's page 
https://sourceforge.net/project/showfiles.php?group_id=43866&package_id=39721 
-- that one is currently at the latest patchlevel.


You can use a common vimrc (with LF-only ends-of-lines, see below) if anything 
which differs is wrapped in statements such as :if has("unix") etc. For 
instance the 'guifont' for Cygwin-X11 will be different from that for 
native-Windows because they use mutually incompatible formats.


You can use a common set of runtime files provided that they have "Unix-like" 
ends-of-lines (LF only, no CR) and that 'fileformats' includes "unix" (which 
is the default).


See also (if you want to compile it yourself):
http://users.skynet.be/antoine.mechelynck/vim/compile.htm (native-W32)
http://users.skynet.be/antoine.mechelynck/vim/compunix.htm (Unix-like)


Best regards,
Tony.


Re: map the arrow keys

2007-01-05 Thread A.J.Mechelynck

Rui Gonçalves wrote:

is possible change the meaning of key combination 
to "go to begin of line" in insert mode?

thanks



:map!


Best regards,
Tony.


help with multi environment vim on xp

2007-01-05 Thread Marc Bernstein

I have cygwin and xp needs for editing files on xp. In addition most
of the scripts I edit are destined for use on unix and possibly
windows as well (Perl).After extensive search I am still
looking for a cogent explanation about how best to setup the xp
environment for seamless use of gvim, either opened from explorer or
cygwin command line.

I presume this has to do with common use of vimfiles and coordinated
use of environment variables  but am confused  because I
cant seem to get the thing to work as expected.<

I intend to eventually use colors , syntax highlighting, script plugin
(Perl), source code control?

Thanks,

Marc

--=_Part_17607_26368855.1168029085738
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

I have cygwin and xp needs for editing files on xp. In addition
mostof the scripts I edit are destined for use on unix and
possiblywindows as well (Perl).

After extensive search I am still looking for a cogent explanation about how best to setup the xpenvironment for seamless use of gvim, either opened from explorer orcygwin command line.I presume this has to do with common use of vimfiles and coordinated use of environment variables  but am confused  because Icant seem to get the thing to work as expected.

map the arrow keys


is possible change the meaning of key combination 
to "go to begin of line" in insert mode?

thanks


Re: :sort by date

On 2007-01-05, Bill McCarthy <[EMAIL PROTECTED]> wrote:
> On Fri 5-Jan-07 1:04pm -0600, Gary Johnson wrote:
> 
> > On 2007-01-05, Erlend Hamberg <[EMAIL PROTECTED]> wrote:
> >> On Friday 05 January 2007 15:47, striker wrote:
> >> > I have a text file in the format:
> >> > 01/04/2007,field1,field2,field3
> >> > 01/03/2007,field1,field2,field3
> >> > 12/30/2006,field1,field2,field3
> >> > etc...
> >> >
> >> > I need to sort by date, but the new dates in 2007 are placed first in
> >> > the sort algorithm.  How can I sort by the entire date in the format
> >> > above?
> >> 
> >> :%sort n /\d\+\/\d\+/
> 
> > To sort by the entire date, this needs to be a two-stage process.
> > First do an ordinary (not numeric) sort on the whole line:
> >
> > :%sort
> >
> > Then do a sort (numeric or ordinary) ignoring the month and day
> > fields, as Erlend suggested:
> >
> > :%sort n /\d\+\/\d\+/
> 
> That would work if the sort were stable.  It isn't in native
> Windows.  The following will fail to sort with earliest date
> last:
> 
> :%sort!
> :%sort! n /\d\+\/\d\+/

Bummer.  I thought it was stable--it appeared to be whenever I used 
it on a Unix system--and that the algorithm was completely internal 
to vim.  Having now actually read ":help sort", I see that you're 
right.  Thanks for pointing that out.

Regards,
Gary

-- 
Gary Johnson | Agilent Technologies
[EMAIL PROTECTED] | Wireless Division
 | Spokane, Washington, USA


Re: :sort by date


Gary Johnson wrote:

On 2007-01-05, Erlend Hamberg <[EMAIL PROTECTED]> wrote:

On Friday 05 January 2007 15:47, striker wrote:

I have a text file in the format:
01/04/2007,field1,field2,field3
01/03/2007,field1,field2,field3
12/30/2006,field1,field2,field3
etc...

I need to sort by date, but the new dates in 2007 are placed first in
the sort algorithm.  How can I sort by the entire date in the format
above?

:%sort n /\d\+\/\d\+/


To sort by the entire date, this needs to be a two-stage process.  
First do an ordinary (not numeric) sort on the whole line:


:%sort

Then do a sort (numeric or ordinary) ignoring the month and day 
fields, as Erlend suggested:


:%sort n /\d\+\/\d\+/

HTH,
Gary



There is no guarantee that lines with the same year would remain in the same 
order (see the first non-indented paragraph under ":help :sort". They might 
keep their previous sort sequence in a version of Vim compiled with one 
compiler and run with one library, and not in a version at the same 
patchlevel, but compiled with another cmpiler and run with another library.


IMO the only "safe" method consists in doing a single sort operation, possibly 
with pre- and post- processing of sort keys. See my answer (and that of Tim 
Chase) to the OP.



Best regards,
Tony.


Re: :sort by date

On Fri 5-Jan-07 1:04pm -0600, Gary Johnson wrote:

> On 2007-01-05, Erlend Hamberg <[EMAIL PROTECTED]> wrote:
>> On Friday 05 January 2007 15:47, striker wrote:
>> > I have a text file in the format:
>> > 01/04/2007,field1,field2,field3
>> > 01/03/2007,field1,field2,field3
>> > 12/30/2006,field1,field2,field3
>> > etc...
>> >
>> > I need to sort by date, but the new dates in 2007 are placed first in
>> > the sort algorithm.  How can I sort by the entire date in the format
>> > above?
>> 
>> :%sort n /\d\+\/\d\+/

> To sort by the entire date, this needs to be a two-stage process.
> First do an ordinary (not numeric) sort on the whole line:
>
> :%sort
>
> Then do a sort (numeric or ordinary) ignoring the month and day
> fields, as Erlend suggested:
>
> :%sort n /\d\+\/\d\+/

That would work if the sort were stable.  It isn't in native
Windows.  The following will fail to sort with earliest date
last:

:%sort!
:%sort! n /\d\+\/\d\+/

-- 
Best regards,
Bill



Re: :sort by date

On 2007-01-05, Erlend Hamberg <[EMAIL PROTECTED]> wrote:
> On Friday 05 January 2007 15:47, striker wrote:
> > I have a text file in the format:
> > 01/04/2007,field1,field2,field3
> > 01/03/2007,field1,field2,field3
> > 12/30/2006,field1,field2,field3
> > etc...
> >
> > I need to sort by date, but the new dates in 2007 are placed first in
> > the sort algorithm.  How can I sort by the entire date in the format
> > above?
> 
> :%sort n /\d\+\/\d\+/

To sort by the entire date, this needs to be a two-stage process.  
First do an ordinary (not numeric) sort on the whole line:

:%sort

Then do a sort (numeric or ordinary) ignoring the month and day 
fields, as Erlend suggested:

:%sort n /\d\+\/\d\+/

HTH,
Gary

-- 
Gary Johnson | Agilent Technologies
[EMAIL PROTECTED] | Wireless Division
 | Spokane, Washington, USA


Re: .vimrc from URL


Hi DrChip

I have updated netrw.

I then "checked out" a  page from my ftp server using


Nread ftp://morph.t.../_vimrc


Then, to save it back, I used:


Nwrite ftp://mo.../_vimrc


Now I get a new, much improved error message:


"NetrwMessage" --No lines in buffer--
Error detected whole processing function netrw#NetRestorePosn:
line19:
E121: Undefined variable: w:netrw_hline
E15: Invalid expression: "norm! ".w:netrw_hline."G0z\"
line23:
E121: Undefined variable: w:netrw_line
E15: Invalid expression: "norm! ".w:netrw_line."G0".w:netrw_col."\"
Press ENTER or type command to continue


after which a new buffer window is opened (unsaved), containing:


VIF1DF.tmp: File not found



Charles E Campbell Jr wrote:
Albie: have you updated your netrw to 107?  To get up-to-date versions 
of vimball and netrw:


  vimball:
http://vim.sourceforge.net/scripts/script.php?script_id=1502
 -or-   http://mysite.verizon.net/astronaut/vim/index.html#VimBall
 (the mysite.verizon.net one will be the more recent version)

  netrw:
http://vim.sourceforge.net/scripts/script.php?script_id=1075
 -or-   http://mysite.verizon.net/astronaut/vim/index.html#NETRW

(you'll need an up-to-date vimball to extract netrw).

Regards,
Chip Campbell






--
Albie Janse van Rensburg (neonpill)

Registered Linux User 438873 | 


Re: How to open multiple files in split windows?


Peng Yu wrote:


gvim a b

The above command will open a and b. But only one file will be show at
one time. How to show them in to split windows?


Tim already showed how to open the two files in split windows by 
modifying the command above.


However, if one has already typed  "gvim a b" and then wants them all in 
separate split windows:


 :sba

will do the trick.  This produces horizontally split windows.  If you 
want vertically split ones:


 :vert sba

is what you want.

Regards,
Chip Campbell



Re: :sort by date


striker wrote:

I have a text file in the format:
01/04/2007,field1,field2,field3
01/03/2007,field1,field2,field3
12/30/2006,field1,field2,field3
etc...

I need to sort by date, but the new dates in 2007 are placed first in 
the sort algorithm.  How can I sort by the entire date in the format above?


TIA,
Kevin



IIUC, this calls for a "decorate - operate - undecorate" process:

1,$s/^\d\d\/\d\d/\(\d\d\d\d\).*$/\1:\0/
1,$sort
1,$s/^\d*://

The first line adds the year in front, so that the lines appear as

:mm/dd/,etc.

The second line sorts the lines. Since :mm/dd are now in front, they will 
be sorted by date.


The third line removes what the first line had added.


Best regards,
Tony.


Re: :sort by date

On Friday 05 January 2007 15:47, striker wrote:
> I have a text file in the format:
> 01/04/2007,field1,field2,field3
> 01/03/2007,field1,field2,field3
> 12/30/2006,field1,field2,field3
> etc...
>
> I need to sort by date, but the new dates in 2007 are placed first in
> the sort algorithm.  How can I sort by the entire date in the format
> above?

:%sort n /\d\+\/\d\+/

-- 
Erlend Hamberg
[EMAIL PROTECTED]


Re: :sort by date


I have a text file in the format:
01/04/2007,field1,field2,field3
01/03/2007,field1,field2,field3
12/30/2006,field1,field2,field3
etc...

I need to sort by date, but the new dates in 2007 are placed first in  
the sort algorithm.  How can I sort by the entire date in the format  
above?


You can use the common "decorate, sort, undecorate" pattern:

:%s!^\(\d\d\)/\(\d\d\)/\(\d\d\d\d\)!\3\2\1&
:%sort
:%s/^

This makes the data look like

2007040101/04/2007, field...

putting it in MMDD format, and then sorts it, before removing 
those lines.  If not all your lines match that pattern 
("MM/DD/"), you may have to to a small bit more work to 
identify the lines you want to manipulate.


-tim






:sort by date


I have a text file in the format:
01/04/2007,field1,field2,field3
01/03/2007,field1,field2,field3
12/30/2006,field1,field2,field3
etc...

I need to sort by date, but the new dates in 2007 are placed first in  
the sort algorithm.  How can I sort by the entire date in the format  
above?


TIA,
Kevin


Re: alphabetical order of a long bibl file


gosh, I was wrong!

you don't even need vim7 for that...

just visual, !sort -k 2 and that's it

the problem is that after that the block are no longer
separated by whitespaces and a BIG blank screen is showed but the
rerefences are ahead, in the bottom of the file... That's why I
thought vim was removing everything... 


Glad either works for you.  If "sort -k" skips what you need, 
then it's a nice solution that doesn't require vim7 in the event 
you are stuck with an older version on a *nix box.  The vim7 
internal sort has the nice feature that you can find the 
sort-index by regexp, so if you have to skip over something "-k" 
doesn't treat kindly, vim7's internal sort may give you a hand. 
Additionally, since DOS sort doesn't have anything so smart as 
"-k", vim7's sort can save the day on a win32 box.


-tim





Re: .vimrc from URL

Albie: have you updated your netrw to 107?  To get up-to-date versions 
of vimball and netrw:


  vimball:
http://vim.sourceforge.net/scripts/script.php?script_id=1502
 -or-   http://mysite.verizon.net/astronaut/vim/index.html#VimBall
 (the mysite.verizon.net one will be the more recent version)

  netrw:
http://vim.sourceforge.net/scripts/script.php?script_id=1075
 -or-   http://mysite.verizon.net/astronaut/vim/index.html#NETRW

(you'll need an up-to-date vimball to extract netrw).

Regards,
Chip Campbell



Re: alphabetical order of a long bibl file


gosh, I was wrong!

you don't even need vim7 for that...

just visual, !sort -k 2 and that's it

the problem is that after that the block are no longer
separated by whitespaces and a BIG blank screen is showed but the
rerefences are ahead, in the bottom of the file... That's why I
thought vim was removing everything... it wasn't, it was just working
properly... you delete spaces and they are kept, as blank lines... the
size of the file is the same but you just have to look in the bottom!

A mere :%s/$/\r suffices then, as Tim said

vim is just great!

Pau

2007/1/5, Vim Visual <[EMAIL PROTECTED]>:

HI,

thanks for the answer.

If I try that the whole reference blocks are deleted... If I do it
after having selected them on visual mode, I get "Not an editor
command"

If you want to try yourself, the whole file is here

http://www.aei.mpg.de/~pau/biblio_TOT.bbl

vim version 7.0.42 here ...

??

Thanks

Pau

2007/1/4, Tim Chase <[EMAIL PROTECTED]>:
> > I have a long bibliography file for a latex document and I must put
> > the references in order. Unfortunately the different authors have used
> > different styles, so that I have two blocks.
> > In the first block all references look like
> >
> > 
> > \bibitem[ {Aarseth}, 1999]{Aarseth99}{Aarseth}, S.~J. (1999).\newblock
> > {From NBODY1 to NBODY6: The Growth of an Industry}.\newblock {\em
> > PASP}, 111:1333--1346.
> > --
> >
> > (note that each entry is a single row)
> >
> > And in the second block I have
> >
> > --
> > \bibitem{stroeer06emri} Stroeer A, Gair J R and Vecchio A, 2006,
> > Proceedings of 6th LISA Symposium submitted, preprint gr-qc/0605227
> > --
> >
> > (idem, single rows)
>
> Well, if a few liberties can be taken, Vim7's sorting
> functionality offers a killer solution to this problem:
>
> :%sort /\\bibitem[^{]*{\zs/
>
> Since each bib item is on its own line (and not overflowing to
> multiple lines), a simple sort at the "right" offset (as kindly
> found by the regexp) will do the trick.  In this case, the
> pattern is "start ("\zs") the sorting comparison after '\bibitem
> up through the first open-curly-bracket' ("\\bibitem[^{]*{")"
>
> (okay, now /that/ had some odd quoting and parenthesizing in it...)
>
> It does have the side effect that the block are no longer
> separated by whitespace, but this can then be rectified with
>
> :%s/$/\r
>
> which will doublespace them again.
>
> Adjust the "%" for to be your desired range.
>
> > I have more than 200 references and I don't feel like doing this per hand!
>
>
> Hopefully this does the trick for you.  If not, drop a line to
> the list with the details of went gonzo (likely some precondition
> I'm missing).
>
> -tim
>
>
>



[Fwd: Re: .vimrc from URL]


Forwarding to list.

 Original Message 
Subject: Re: .vimrc from URL
Date: Fri, 5 Jan 2007 13:12:41 +0200
From: Albie Janse van Rensburg <[EMAIL PROTECTED]>
To: A.J.Mechelynck <[EMAIL PROTECTED]>
References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>	 
<[EMAIL PROTECTED]> <[EMAIL PROTECTED]>	 
<[EMAIL PROTECTED]>


Hi all

I find this idea of a net-vimrc very interesting, so I have made a
simple .vimrc that the OP can use:

===
so $VIMRUNTIME/plugin/netrwPlugin.vim
Nread "{website}_vimrc.http"
sav! ~/__vimrc
so ~/__vimrc
silent !rm ~/__vimrc
enew
===

(For some reason, the netrw plugin is named "netrwPlugin.vim" on my
version of vim.  Modify as is needed.)

Of course, this must be loaded in each vimrc on the network, and you
will need a web server to host the master vimrc.

I have also hacked about a bit, and now I also have some functions for
sourcing a file over a network, which I am attaching in
"remotexecute.vim". If someone could look it over it would be
appreciated.  It only handles reading over FTP and HTML at the moment.

I then went ahead and added the following to the tail of my vimrc:

===

" netrw source the remote exec functions file - ugly!
new
Nread "http://morph.telspace.co.za/remotexecute.vim";
let s:tempfilename = tempname()
execute("sav! " . s:tempfilename)
execute("so " . s:tempfilename)
execute("silent !rm " . s:tempfilename)
quit!

" Now that we have the functions for sourcing files over a net connection, we
" can map keys to edit our vimrc over the net, and associated functions.

" Read the _vimrc into a new buffer
nmap   :new:execute ReadNetFileFTP("", "_vimrc",
"")
" Write the current buffer to the onlince _vimrc
nmap   :execute WriteNetFileFTP("", "_vimrc", "")

===

Unfortunately, there seems to be something wrong with the write (Nwrite)
action, whenever I try to write a file back to the server, I get the error:

===
(netrw) Processing your write request
***netrw*** VIR14E.tmp: File not found
Press  to continue
===

or (with g:netrw_ftp = 1):

===
(netrw) Processing your write request
***netrw*** Invalid command.
Press  to continue
===

How can I use netrw to write a file over ftp?  I have tried various
different methods to do this, but none seem to work.  Does anyone else
have the same problem?

--
Albie Janse van Rensburg (neonpill)

Registered Linux User 438873 | 

On 1/5/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:

Mikolaj Machowski wrote:
> On pią sty 5 2007, Mikolaj Machowski wrote:
>> Mikolaj Machowski wrote:
>>> On pią sty 5 2007, Maurí­cio wrote:
 Or else, have the following at the top of the vimrc:

let g:vimrcdate =   "4 Jan 2007 22:49 UTC"
echo This vimrc was last changed on" g:vimrcdate
if input("Do you want to continue? ") !~? "y"
qall!
endif
>>> Since this requires specific .vimrc OP can explicitly source netrw
>^^^
>>> at the beginning of .vimrc; open net address; write it to temporary
>>> file; source that file; remove temporary file.
>>>
>>> m.
>> I repeat: when the vimrc is sourced, the plugins (such as netrw) are NOT
>> YET sourced. So if the vimrc tries to issue
>
> That is why I wrote "explicitly source netrw".
>
> m.
>
>

Oops, I read too fast. Looks like a kludge to me but I guess it would work.


Best regards,
Tony.



remotexecute.vim
Description: Binary data


Re: .vimrc from URL


Hi all (Hugo, sorry about the double-post - I replied *wrong*)

I find this idea of a net-vimrc very interesting, so I have made a
simple .vimrc that the OP can use:

===
so $VIMRUNTIME/plugin/netrwPlugin.vim
Nread "{website}_vimrc.http"
sav! ~/__vimrc
so ~/__vimrc
silent !rm ~/__vimrc
enew
===

(For some reason, the netrw plugin is named "netrwPlugin.vim" on my
version of vim.  Modify as is needed.)

Of course, this must be loaded in each vimrc on the network, and you
will need a web server to host the master vimrc.

I have also hacked about a bit, and now I also have some functions for
sourcing a file over a network, which I am attaching in
"remotexecute.vim". If someone could look it over it would be
appreciated.  It only handles reading over FTP and HTML at the moment.

I then went ahead and added the following to the tail of my vimrc:

===

" netrw source the remote exec functions file - ugly!
  new
  Nread "http://morph.telspace.co.za/remotexecute.vim";
  let s:tempfilename = tempname()
  execute("sav! " . s:tempfilename)
  execute("so " . s:tempfilename)
  execute("silent !rm " . s:tempfilename)
  quit!

" Now that we have the functions for sourcing files over a net connection, we
" can map keys to edit our vimrc over the net, and associated functions.

" Read the _vimrc into a new buffer
nmap   :new:execute ReadNetFileFTP("", "_vimrc",
"")
" Write the current buffer to the onlince _vimrc
nmap   :execute WriteNetFileFTP("", "_vimrc", "")

===

Unfortunately, there seems to be something wrong with the write (Nwrite)
action, whenever I try to write a file back to the server, I get the error:

===
(netrw) Processing your write request
***netrw*** VIR14E.tmp: File not found
Press  to continue
===

or (with g:netrw_ftp = 1):

===
(netrw) Processing your write request
***netrw*** Invalid command.
Press  to continue
===

How can I use netrw to write a file over ftp?  I have tried various
different methods to do this, but none seem to work.  Does anyone else
have the same problem?

--
Albie Janse van Rensburg (neonpill)

Registered Linux User 438873 | 

On 1/5/07, Hugo Ahlenius <[EMAIL PROTECTED]> wrote:

| I change my .vimrc very often, and I use vim
| in many computers. The result is that my changes
| are not always updated to all computers.

Mauricio,
Maybe you should consider having your .vimrc (and other vim configuration
files, like plugins etc) under source control? I have all my personal
vimfiles directory + .vimrc under subversion, and it works very well. I
don't synchronize these daily with the repository, unless there are some
major changes, but now and then (weekly?).

Cheers,
Hugo


--
Hugo Ahlenius
fraxinus (at) oxel.net
http://www.oxel.net





remotexecute.vim
Description: Binary data


RE: .vimrc from URL

| I change my .vimrc very often, and I use vim
| in many computers. The result is that my changes
| are not always updated to all computers.

Mauricio,
Maybe you should consider having your .vimrc (and other vim configuration
files, like plugins etc) under source control? I have all my personal
vimfiles directory + .vimrc under subversion, and it works very well. I
don't synchronize these daily with the repository, unless there are some
major changes, but now and then (weekly?).

Cheers,
Hugo


--
Hugo Ahlenius
fraxinus (at) oxel.net
http://www.oxel.net




Re: alphabetical order of a long bibl file


HI,

thanks for the answer.

If I try that the whole reference blocks are deleted... If I do it
after having selected them on visual mode, I get "Not an editor
command"

If you want to try yourself, the whole file is here

http://www.aei.mpg.de/~pau/biblio_TOT.bbl

vim version 7.0.42 here ...

??

Thanks

Pau

2007/1/4, Tim Chase <[EMAIL PROTECTED]>:

> I have a long bibliography file for a latex document and I must put
> the references in order. Unfortunately the different authors have used
> different styles, so that I have two blocks.
> In the first block all references look like
>
> 
> \bibitem[ {Aarseth}, 1999]{Aarseth99}{Aarseth}, S.~J. (1999).\newblock
> {From NBODY1 to NBODY6: The Growth of an Industry}.\newblock {\em
> PASP}, 111:1333--1346.
> --
>
> (note that each entry is a single row)
>
> And in the second block I have
>
> --
> \bibitem{stroeer06emri} Stroeer A, Gair J R and Vecchio A, 2006,
> Proceedings of 6th LISA Symposium submitted, preprint gr-qc/0605227
> --
>
> (idem, single rows)

Well, if a few liberties can be taken, Vim7's sorting
functionality offers a killer solution to this problem:

:%sort /\\bibitem[^{]*{\zs/

Since each bib item is on its own line (and not overflowing to
multiple lines), a simple sort at the "right" offset (as kindly
found by the regexp) will do the trick.  In this case, the
pattern is "start ("\zs") the sorting comparison after '\bibitem
up through the first open-curly-bracket' ("\\bibitem[^{]*{")"

(okay, now /that/ had some odd quoting and parenthesizing in it...)

It does have the side effect that the block are no longer
separated by whitespace, but this can then be rectified with

:%s/$/\r

which will doublespace them again.

Adjust the "%" for to be your desired range.

> I have more than 200 references and I don't feel like doing this per hand!


Hopefully this does the trick for you.  If not, drop a line to
the list with the details of went gonzo (likely some precondition
I'm missing).

-tim