Re: VIM window restores incorrectly

2006-11-22 Thread Bram Moolenaar

Yegappan Lakshmanan wrote:

 On 11/22/06, Bram Moolenaar [EMAIL PROTECTED] wrote:
 
   
 VIM 7.0, MS-Windows 32 bit GUI version with OLE support
 Included patches: 1-162

 run gvim a.txt;
 maximize the VIM window, then minimize it to task bar;
 run gvim --remote-tab b.txt;
 VIM window is brought to foreground, then double click
 the title bar of VIM window to restore its size, it's
 restored incorrectly with maximum dimension.
   
There appears to be something wrong with the GUI tab pages line.  I only
see the label for the current tab, not the others.  That looks like a
bug.
   
  
   I am not able to reproduce this problem with the tab page line. When the
   GVIM window is restored, the tab page line is properly updated with
   the tab names.
  
   I do see the problem reported by OP with the size of the restored Vim
   window.
 
  It does happen for me:
 
  gvim somefile
  maximize gvim window
  minimize gvim window
  gvim --remote-tab otherfile
 
  Now I only see the tab label for otherfile.  I can click on the gap
  before it to go to somefile, and then only that label is shown.
 
 
 Which version of MS-Windows (Win98/WinME/Win2K/WinXP/Vista)
 are you using? I am not able to reproduce this problem using the
 above steps on WinXP and Win2K.
 
 I am using the following version of Vim:
 
 VIM - Vi IMproved 7.0 (2006 May 7, compiled May  7 2006 16:21:39)
 MS-Windows 32 bit GUI version
 Compiled by [EMAIL PROTECTED]
 Big version with GUI.  Features included (+) or not (-):
 
 Anybody else seeing this problem on MS-Windows?

It apparently only happens when 'encoding' is set to utf-8.  Can you
reproduce it then?

-- 
E  M  A  C  S
s  e  l  o  h
c  t  t  n  i
a  a t  f
pr  t
eo
 l

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


Re: VIM window restores incorrectly

2006-11-22 Thread Bram Moolenaar

Yegappan Lakshmanan wrote:

 On 11/21/06, Bram Moolenaar [EMAIL PROTECTED] wrote:
 
  Liu Yubao wrote:
 
   VIM 7.0, MS-Windows 32 bit GUI version with OLE support
   Included patches: 1-162
  
   run gvim a.txt;
   maximize the VIM window, then minimize it to task bar;
   run gvim --remote-tab b.txt;
   VIM window is brought to foreground, then double click
   the title bar of VIM window to restore its size, it's
   restored incorrectly with maximum dimension.
 
  There appears to be something wrong with the GUI tab pages line.  I only
  see the label for the current tab, not the others.  That looks like a
  bug.
 
 
 I am not able to reproduce this problem with the tab page line. When the
 GVIM window is restored, the tab page line is properly updated with
 the tab names.
 
 I do see the problem reported by OP with the size of the restored Vim
 window.

It does happen for me:

gvim somefile
maximize gvim window
minimize gvim window
gvim --remote-tab otherfile

Now I only see the tab label for otherfile.  I can click on the gap
before it to go to somefile, and then only that label is shown.

-- 
Intelligence has much less practical application than you'd think.
  -- Scott Adams, Dilbert.

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


Re: VIM window restores incorrectly

2006-11-22 Thread Yegappan Lakshmanan

Hi Bram,

On 11/22/06, Bram Moolenaar [EMAIL PROTECTED] wrote:

   
 VIM 7.0, MS-Windows 32 bit GUI version with OLE support
 Included patches: 1-162

 run gvim a.txt;
 maximize the VIM window, then minimize it to task bar;
 run gvim --remote-tab b.txt;
 VIM window is brought to foreground, then double click
 the title bar of VIM window to restore its size, it's
 restored incorrectly with maximum dimension.
   
There appears to be something wrong with the GUI tab pages line.  I only
see the label for the current tab, not the others.  That looks like a
bug.
   
  
   I am not able to reproduce this problem with the tab page line. When the
   GVIM window is restored, the tab page line is properly updated with
   the tab names.
  
   I do see the problem reported by OP with the size of the restored Vim
   window.
 
  It does happen for me:
 
  gvim somefile
  maximize gvim window
  minimize gvim window
  gvim --remote-tab otherfile
 
  Now I only see the tab label for otherfile.  I can click on the gap
  before it to go to somefile, and then only that label is shown.
 

 Which version of MS-Windows (Win98/WinME/Win2K/WinXP/Vista)
 are you using? I am not able to reproduce this problem using the
 above steps on WinXP and Win2K.

 I am using the following version of Vim:

 VIM - Vi IMproved 7.0 (2006 May 7, compiled May  7 2006 16:21:39)
 MS-Windows 32 bit GUI version
 Compiled by [EMAIL PROTECTED]
 Big version with GUI.  Features included (+) or not (-):

 Anybody else seeing this problem on MS-Windows?

It apparently only happens when 'encoding' is set to utf-8.  Can you
reproduce it then?



Yes. When 'encoding' is set to 'utf-8', I am able to reproduce the
problem now.

- Yegappan


Re: VIM window restores incorrectly

2006-11-22 Thread Yegappan Lakshmanan

Hi Bram,

On 11/22/06, Bram Moolenaar [EMAIL PROTECTED] wrote:


 
   VIM 7.0, MS-Windows 32 bit GUI version with OLE support
   Included patches: 1-162
  
   run gvim a.txt;
   maximize the VIM window, then minimize it to task bar;
   run gvim --remote-tab b.txt;
   VIM window is brought to foreground, then double click
   the title bar of VIM window to restore its size, it's
   restored incorrectly with maximum dimension.
 
  There appears to be something wrong with the GUI tab pages line.  I only
  see the label for the current tab, not the others.  That looks like a
  bug.
 

 I am not able to reproduce this problem with the tab page line. When the
 GVIM window is restored, the tab page line is properly updated with
 the tab names.

 I do see the problem reported by OP with the size of the restored Vim
 window.

It does happen for me:

gvim somefile
maximize gvim window
minimize gvim window
gvim --remote-tab otherfile

Now I only see the tab label for otherfile.  I can click on the gap
before it to go to somefile, and then only that label is shown.



Which version of MS-Windows (Win98/WinME/Win2K/WinXP/Vista)
are you using? I am not able to reproduce this problem using the
above steps on WinXP and Win2K.

I am using the following version of Vim:

VIM - Vi IMproved 7.0 (2006 May 7, compiled May  7 2006 16:21:39)
MS-Windows 32 bit GUI version
Compiled by [EMAIL PROTECTED]
Big version with GUI.  Features included (+) or not (-):

Anybody else seeing this problem on MS-Windows?

- Yegappan


sorting columns alphabetically

2006-11-22 Thread Vim Visual

Hi,

I have a text file like

Mr Bla Blo
Ms Ble Blu
Dr Bli Blu
etc

and I would like to sort the file alphabetically after the surname
(3rd column). How can I do that? I know how to sort it after the first
one (visual + !sort)

thanks!

Pau


Re: How to override $HOME on Windows NT/XP?

2006-11-22 Thread Wolfgang Schmidt

   Hi,

to me it's no clear what you mean by prevent Vim from going to my Home 
directory. I'm using Vim on windows, too, but he never asked me for a 
HOME directory. Instead, the _vimrc file is kept in $VIMRUNTIME, which 
by default on XP is C:\Programme\Vim\vim70. Therefore, all you have to 
do is to put

your _vimrc there and all should work fine.

Cheers

   Wolfgang


Paul Stone wrote:

I know this is a bizarre request.  I would like to prevent Vim from
going to my Home directory.  The reason is that my IT department has
mapped my home directory to a laggy network drive with a login script.
I can't override the Windows environment variables which set up the
home directory, because the login script overrides my settings.

I can set up the environment in a DOS box, but I like to be able to
invoke Vim by using the edit with vim context menu item.

Any advice on how to workaround this issue?  Vim keeps grinding to a
halt while waiting for a response from the network drive, so I have to
solve this.

If there's no way to workaround it in Vim, then I will contact IT to
see if they can change my login script.

Best Regards,
Paul Stone




Re: sorting columns alphabetically

2006-11-22 Thread Vim Visual

sorry, I got it:

sort -k 3

The problem now are midnames, like


Mr Bla Blo
Ms Ble Blu
Dr Bli T. Blu

but I have deleted them :)

2006/11/22, Vim Visual [EMAIL PROTECTED]:

Hi,

I have a text file like

Mr Bla Blo
Ms Ble Blu
Dr Bli Blu
etc

and I would like to sort the file alphabetically after the surname
(3rd column). How can I do that? I know how to sort it after the first
one (visual + !sort)

thanks!

Pau



Re: sorting columns alphabetically

2006-11-22 Thread Jürgen Krämer

Hi,

Vim Visual wrote:
 
 I have a text file like
 
 Mr Bla Blo
 Ms Ble Blu
 Dr Bli Blu
 etc
 
 and I would like to sort the file alphabetically after the surname
 (3rd column). How can I do that? I know how to sort it after the first
 one (visual + !sort)

with VIM 7 you can sort inside VIM:

  :%sort /^\S\+\s\+\S\+\s\+/

tells VIM to skip the first two words in every line and to sort on
whatever follows.

If the third column is always the last column another way would be to

  :%sort /\\S\+\$/ r

The r flag tells VIM to sort based on the matched text, which is the
last word in this case. This would also work around your problem with
initials you mentioned in your second mail.

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)


Re: How to override $HOME on Windows NT/XP?

2006-11-22 Thread A.J.Mechelynck

Wolfgang Schmidt wrote:

   Hi,

to me it's no clear what you mean by prevent Vim from going to my Home 
directory. I'm using Vim on windows, too, but he never asked me for a 
HOME directory. Instead, the _vimrc file is kept in $VIMRUNTIME, which 
by default on XP is C:\Programme\Vim\vim70. Therefore, all you have to 
do is to put

your _vimrc there and all should work fine.

Cheers

   Wolfgang


No it won't.

1. If $HOME exists, Vim will look first for $HOME/_vimrc and $HOME/.vimrc ; 
and if neither is found, it will look for $VIM/_vimrc and $VIM/.vimrc . $VIM 
is normally set (on Windows) to C:\Program Files\Vim so if you put your _vimrc 
in $VIMRUNTIME (aka $VIM/vim70), not only it won't be found, but the $HOME 
directory (which, on the OP's system, is on a slow remote disk) will be 
accessed twice. It is these accesses to the remote disk that the OP wants to 
avoid -- one way to do that is to set $HOME to something on C:\ -- for 
instance $USERPROFILE which is a user-private directory -- _before_ the user 
vimrc is looked for, i.e., either by means of a -cmd argument on the 
command-line, or by a command in a system vimrc named $VIM/vimrc (with no 
dot or underscore).


2. On a multiuser system like the OP's seems to be, $VIM and $VIMRUNTIME are 
common to all users, so putting the _vimrc there will force all users to use 
the same vimrc, something usually not desired.


3. Anything in $VIMRUNTIME or under it can be silently replaced by any 
upgrade; and the whole tree will be rebuilt under a different name by a 
version upgrade (e.g. $VIM/vim71 for Vim 7.1). For that reason, users should 
avoid placing anything there, other than files distributed together with Vim.



Best regards,
Tony.


tar all files in buffer preserving path

2006-11-22 Thread Eric Smith

I want to make a tar file that includes the full pathname.
When I go
:bufdo ! tar -vrf archive_with_full_path.tar %

The `%' does not expand the full path so I do not get the path
information into the tar file.

How could I best achieve what I want?

--
Eric Smith


Re: Dangerous keybindings

2006-11-22 Thread A.J.Mechelynck

DervishD wrote:

Hi all :))

I'm not exactly new to this list, I was subscribed back in 2002,
when I tried to migrate from Joe to Vim. I finally didn't do it for
some reasons, and I finally forgot about it.

The fact is that I've decided to go Vim once and for all, because
Joe is giving me some problems in its latest versions. I've already
made a vimrc file (only set commands by now), and now the turn is
for keybindings ;)

My main problem is that *my* keybindings for joe are deep in my
muscle memory (so to say) and I keep hitting them for things like
saving, going to the next open file, etc. This is not a big deal,
because I can remap those key combos, or learn the new ones. The
problem is that I'm pretty sure that sooner or later I'm going to hit
a vim key combination that will wreak havoc.

I simply don't want to go through the hundred keys in vim just to
avoid hitting them accidentally, so I have a question: is there any
equivalent to :mapclear for builtin keys? I suppose not, because in
vim that builtin keys are really the editing commands :( So, is there
a way of disabling all default keys and use only those keys specified
using map?

I want to do something like that in my vimrc.

delete_all_keys if at all possible
map i i yes, I want to go to insert mode
...
...
map C-kx wWeird, but just an example

So, if I don't have map'ed C-w+ and I hit it, the window size
won't change, but I still will be able to do this:

map C-+ C-w+

Sorry if I haven't made it clear O: and thanks in advance.

Raúl Núñez de Arenas Coronado



- There is no simple command to unbind all keys. You can have one particular 
key have no effect by mapping it to Nop -- but beware of the risk of 
breaking the :normal command in scripts.


- You may want to use :noremap rather than :map. See :help map.txt for 
details.


- BUT, I don't think you can map Ctrl-K. It is used for digraphs (see :help 
digraphs) and (IIUC) cannot be mapped to anything else. As for Ctrl-+, that's 
not a standard control-key: I don't think Vim (which uses cooked keyboard 
input) would be able to recognise it reliably.


I recommend that you learn the vim key bindings. (Until you learn them, you 
can use arrow keys, which are presumably portable; menus; and ex-commands.)



Best regards,
Tony.


Re: g/pat/s/pat.*/to/ vs :%s/pat.*/to/

2006-11-22 Thread Tim Chase

In vim docs, there is example like this:
   g/pat/s/pat.*/to/
As far as I know, it is also possible to do it without g:
   %s/pat.*/to/
Is there a difference, a reason to prefer the
first form, the longer for with 'g' ?



I don't think in the example you gave, that there's a significant 
difference, if any.


However, where the pattern (so to speak) is useful, is where you 
want something like


:g/pat1/s/pat2/replacement

where rather than using the same pattern, you have two different 
patterns.  I use this frequently to do things like


:g/echo/s/^/#

to comment out any lines in a script that use the echo command. 
 Yes, this could be rewritten as


:%s/.*echo/#

but the former makes clearer sense in my head.

It's particularly useful if you have pieces that you're searching 
for that overlap:


text:   aaabbbcccddd
g/b.*d/s/a.*c/XXX

where the pattern matches one fragment, and the s// matches an 
overlapping, but not-quite-the-same-end-points fragment of the line.


-tim





Re: Can't change search background color

2006-11-22 Thread Benji Fisher
On Tue, Nov 21, 2006 at 03:25:13AM -0600, Larry Alkoff wrote:
 I'm using Vim64 in Kubuntu and cannot change the color background when 
 doing a search.  The background color is a kind of darkish orange - I 
 _think_ it's numbe 3.  I'd like to have LightYellow but nothing I have 
 done so far changes it.
 
 From my ~/.vimrc:
 
 
 set hlsearch
 
  toggle hlsearch in normal mode:
 map F1 :set hlsearch!CR
  or insert mode with imap:
 imap F1 ESC:set hlsearch!CRa
 
  result of :hi search is
  xxx term=reverse ctermbg=3 (orangy)  14 is ltyellow
 
  None of the below worked
  
  hi search guibg=LightBlue
  hi Search   guifg=#ec guibg=#c4a000
  hi Search guibg=14
 
 
 Any ideas how to change the background?
 
 Larry

 It helps to be clear about what you have typed and what vim
responds, as in

:hi search
Search xxx term=reverse ctermfg=0 ctermbg=14 guibg=Yellow

instead of mixing your comments (such as results of ... is and
(orangy)  14 is ltyellow.  I suggest using :redir and the :Echo
command from foo.vim, my file of example vim functions:
http://www.vim.org/script.php?script_id=72

 I am guessing that you are using vim, not gvim.  If I ma right,
then chaining guibg is not going to help.  Try

:hi Search ctermbg=14

instead.

:help :hi

in general and

:help highlight-args

in particular.

HTH --Benji Fisher


Re: Dangerous keybindings

2006-11-22 Thread DervishD
Hi Benji :)

 * Benji Fisher [EMAIL PROTECTED] dixit:
 On Wed, Nov 22, 2006 at 02:04:29PM +0100, A.J.Mechelynck wrote:
  DervishD wrote:
 [snip]
  I want to do something like that in my vimrc.
  
  delete_all_keys if at all possible
  map i i yes, I want to go to insert mode
  ...
  ...
  map C-kx wWeird, but just an example
  
  So, if I don't have map'ed C-w+ and I hit it, the window size
  won't change, but I still will be able to do this:
  
  map C-+ C-w+
  
  - There is no simple command to unbind all keys. You can have one 
  particular key have no effect by mapping it to Nop -- but beware of the 
  risk of breaking the :normal command in scripts.
 
  I agree that this is not necessarily a good idea, but there
 are a few ways to map keys to Nop in bulk.
 
 let letter = a
   while letter = z
   execute map letter Nop
   let letter = nr2char(char2nr(letter) + 1)
 endwhile
 
  Vim 7.0 only
 for char in split(@!#$%, '.\zs')
   execute map char Nop
 endfor
 
  Vim 7.0 only
 for word in ['C-W', 'C-X', 'C-A']
   execute map word Nop
 endfor

Thanks a lot :) This is what we was looking for, except, as you
say, this is not a good idea unless I don't use any script (or
plugin, etc.) which uses :normal :(
 
  A better solution might be to stay out of Normal mode.
 
 :set insertmode
 :help 'insertmode'
 :help evim-keys

That's another idea I had: set permanent Insert mode and bind the
keys I'm used to type, together with a couple of keybindings for
setting noinsertmode if I need to.

The naked truth is that I should learn the vim keybindings, but
it is going to be pretty hard...

Thanks a lot for your answer, you've been very helpful :))

Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736 | http://www.dervishd.net
It's my PC and I'll cry if I want to... RAmen!


Re: tar all files in buffer preserving path

2006-11-22 Thread Tom Purl
This seems like a pretty sweet tip.  It would be much appreciated if you
could post a fleshed-out version of this tip, along with some possible
use cases on the vim.org tips page.

Thanks!

Tom Purl

 Yeah, thanks it works like this too:
 bufdo !tar -vrf /path/to/archive.tar  %:p

 How do I avoid the
 Press ENTER or type command to continue
 prompt after each file is processed?

 On 22/11/06, A.J.Mechelynck [EMAIL PROTECTED] wrote:
 Eric Smith wrote:
  I want to make a tar file that includes the full pathname.
  When I go
  :bufdo ! tar -vrf archive_with_full_path.tar %
 
  The `%' does not expand the full path so I do not get the path
  information into the tar file.
 
  How could I best achieve what I want?
 

 Try (untested)

 bufdo exe '!tar -vrf /path/to/archive.tar' expand('%:p')

 see :help expand()


 Best regards,
 Tony.



 --
 Eric Smith




Execute command for current block of code

2006-11-22 Thread Kevin Old

Hello everyone,

I have been thinking about implementing this little feature to help
clean up my code.  Here's the scoop.  I'm a Perl programmer and I use
a templating module called HTML::Mason which allows perl code within
certain tags.  Here's an example of the code:

% $tmpl-template_top()  %

% $m-call_next();

% $tmpl-template_bottom  %


%init
use Myapp::HTML;
use Myapp:Config qw(IMG_BASE_URL);

my $tmpl = Myapp::HTML-new({
   title = 'Something',
   js = ['jquery.js'] },
   );
/%init

%flags
inherit = undef
/%flags


Between the %init tags is just straight Perl code.  I have two maps
I've setup in vim that will run the contents of a file through an
external program (perltidy) and clean up my code.  They are:

map ti :%!perltidy  clean entire file
map mt :.!perltidy  clean current line

Just wondering if there'd be a way that I could write a map that would
work for a current block of code.  Maybe autodetect what block I'm
in?  In this case whatever block I'm in (init).  If I couldn't
autodetect the block I'm in, that'd be ok cause I could just map the
few types of blocks into separate map commands.

Should I go about this with a regex and then pass that line range to
the external command?

Any help is greatly appreciated!

Kevin
--
Kevin Old
[EMAIL PROTECTED]


Re: Execute command for current block of code

2006-11-22 Thread A.J.Mechelynck

Kevin Old wrote:

Hello everyone,

I have been thinking about implementing this little feature to help
clean up my code.  Here's the scoop.  I'm a Perl programmer and I use
a templating module called HTML::Mason which allows perl code within
certain tags.  Here's an example of the code:

% $tmpl-template_top()  %

% $m-call_next();

% $tmpl-template_bottom  %


%init
use Myapp::HTML;
use Myapp:Config qw(IMG_BASE_URL);

my $tmpl = Myapp::HTML-new({
   title = 'Something',
   js = ['jquery.js'] },
   );
/%init

%flags
inherit = undef
/%flags


Between the %init tags is just straight Perl code.  I have two maps
I've setup in vim that will run the contents of a file through an
external program (perltidy) and clean up my code.  They are:

map ti :%!perltidy  clean entire file
map mt :.!perltidy  clean current line

Just wondering if there'd be a way that I could write a map that would
work for a current block of code.  Maybe autodetect what block I'm
in?  In this case whatever block I'm in (init).  If I couldn't
autodetect the block I'm in, that'd be ok cause I could just map the
few types of blocks into separate map commands.

Should I go about this with a regex and then pass that line range to
the external command?

Any help is greatly appreciated!

Kevin


If you type : on a highlighted Visual area, you'll get :',' as the range 
(where ' means the first line of the Visual area and ' means the last 
line of the Visual area). If you use that on an ex-command which accepts a 
range (defined with the -range modifier) the range will be passed to the 
command; otherwise it will be executed once for every line in the range.


vobject where object is a Normal-mode object, will highlight the 
concerned object. Example: vip for the inner paragraph.



Best regards,
Tony.


RE: How to override $HOME on Windows NT/XP?

2006-11-22 Thread Gene Kwiecinski
I know this is a bizarre request.  I would like to prevent Vim from
going to my Home directory.  The reason is that my IT department has
mapped my home directory to a laggy network drive with a login script.

I can't override the Windows environment variables which set up the
home directory, because the login script overrides my settings.

I can set up the environment in a DOS box, but I like to be able to
invoke Vim by using the edit with vim context menu item.

I got the same damned thing here at work, where everything's locked up
tight and I can't touch it.  Policy, and all that...  :P

My own workaround for 'vim' and other critters is to just grab the usual
desktop shortcuts, set the properties to what I prefer, and dump 'em
into the Send to directory.  Will be one level down from the Edit
with Vim thingy, but at least it's a workaround.

Same thing for using Firefox 1.5/2.0, Opera, Netscape 4.8, 6.x, and up,
etc., instead of Exploder, so that I can pick which version for testing
webpages in different browsers, and so on.  If you can't override the
defaults, dump 'em there and edit the prefs to your heart's content.


Calendar ?

2006-11-22 Thread Meino Christian Cramer
Hi,

 where can I find instructions on how to use Calendar.vim and its
 keybindings ? I visited vim.org's script pages about Calendar.vim but
 didn't found, what I was searching for. Google also gave me
 nothing...

 But may be all this is my fault ?!

 Regards,
 mcc



Re: Execute command for current block of code

2006-11-22 Thread Kevin Old

Hi Tony,

Actually, I didn't know that highlighting visually and hitting the :
will give me the range.  That's half the battle for me on this.

I've tried putting that into a mapping like this:

map vti :',' !perltidy

but when I visually select a chunk of code then type vti I get and
error saying:
E492: Not an editor command ',' !perltidy

Now my question is, how do I program a mapping so that I don't have to
type the !perltidy after I highlight the lines of code I need cleaned
up.

Thanks,
Kevin

On 11/22/06, A.J.Mechelynck [EMAIL PROTECTED] wrote:

Kevin Old wrote:
 Hello everyone,

 I have been thinking about implementing this little feature to help
 clean up my code.  Here's the scoop.  I'm a Perl programmer and I use
 a templating module called HTML::Mason which allows perl code within
 certain tags.  Here's an example of the code:

 % $tmpl-template_top()  %

 % $m-call_next();

 % $tmpl-template_bottom  %


 %init
 use Myapp::HTML;
 use Myapp:Config qw(IMG_BASE_URL);

 my $tmpl = Myapp::HTML-new({
title = 'Something',
js = ['jquery.js'] },
);
 /%init

 %flags
 inherit = undef
 /%flags


 Between the %init tags is just straight Perl code.  I have two maps
 I've setup in vim that will run the contents of a file through an
 external program (perltidy) and clean up my code.  They are:

 map ti :%!perltidy  clean entire file
 map mt :.!perltidy  clean current line

 Just wondering if there'd be a way that I could write a map that would
 work for a current block of code.  Maybe autodetect what block I'm
 in?  In this case whatever block I'm in (init).  If I couldn't
 autodetect the block I'm in, that'd be ok cause I could just map the
 few types of blocks into separate map commands.

 Should I go about this with a regex and then pass that line range to
 the external command?

 Any help is greatly appreciated!

 Kevin

If you type : on a highlighted Visual area, you'll get :',' as the range
(where ' means the first line of the Visual area and ' means the last
line of the Visual area). If you use that on an ex-command which accepts a
range (defined with the -range modifier) the range will be passed to the
command; otherwise it will be executed once for every line in the range.

vobject where object is a Normal-mode object, will highlight the
concerned object. Example: vip for the inner paragraph.


Best regards,
Tony.




--
Kevin Old
[EMAIL PROTECTED]


Re: Calendar ?

2006-11-22 Thread Tom Purl
Check out the source, which should be in one of your plugin directories.  For
me, it's in $HOME/vimfiles/plugin/calendar.vim on my Win XP computer. The
header of the file has a ton of commments, including usage statements nad
Additional notes.

HTH!

Tom Purl

 Hi,

  where can I find instructions on how to use Calendar.vim and its
  keybindings ? I visited vim.org's script pages about Calendar.vim but
  didn't found, what I was searching for. Google also gave me
  nothing...

  But may be all this is my fault ?!

  Regards,
  mcc





Re: Execute command for current block of code

2006-11-22 Thread Christian Ebert
* Kevin Old on Wednesday, November 22, 2006 at 12:57:27 -0500:
 Actually, I didn't know that highlighting visually and hitting the :
 will give me the range.  That's half the battle for me on this.
 
 I've tried putting that into a mapping like this:
 
 map vti :',' !perltidy

vmap vti :!perltidyCR

c
-- 
_B A U S T E L L E N_ lesen! --- http://www.blacktrash.org/baustellen.html


Re: vim encryption

2006-11-22 Thread panshizhu
Noah Spurrier [EMAIL PROTECTED] 写于 2006-11-22 04:14:52:
 I am not so concerned with strong encryption
 (although, I'd be sad if the encryption turned out to be trivial).
 At the moment my main goal is to be able to write
 VIM compatible encrypted files from a PHP or Python script.


Just :h :X and looked down for one or two pages you will found the text,
and I guess that's what you're looking for .

editing.txt line 1379:
- Pkzip uses the same encryption, and US Govt has no objection to its
export.
  Pkzip's public file APPNOTE.TXT describes this algorithm in detail.

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

Re: Can't change search background color

2006-11-22 Thread panshizhu
Larry Alkoff [EMAIL PROTECTED] 写于 2006-11-21 17:25:13:
 I'm using Vim64 in Kubuntu and cannot change the color background when
 doing a search.  The background color is a kind of darkish orange - I
 _think_ it's numbe 3.  I'd like to have LightYellow but nothing I have
 done so far changes it.
  result of :hi search is
  xxx term=reverse ctermbg=3 (orangy)  14 is ltyellow

Usually, it is impossible to set a ctermbg to 8 or above for terminals,
especially when you have t_Co=8, i.e. your terminal is 8-color terminal.

Sometimes, manually :set t_Co=16 does the trick, if that works for you,
then just do it.

But it may not work. If you still want a light background, there're several
solutions:

1. Get a terminal emulator with fully 16-color support, or even 256-color
terminal emulator which has support for ctermbg = 8. --- this works for
yourself.

2. Do not use ctermbg = 8 when designing color schemes. Note this is
important if you want your color scheme portable, because many terminal
emulators cannot have light background. --- this works for everyone.

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

Re: Execute command for current block of code

2006-11-22 Thread A.J.Mechelynck

Christian Ebert wrote:

* Kevin Old on Wednesday, November 22, 2006 at 12:57:27 -0500:

Actually, I didn't know that highlighting visually and hitting the :
will give me the range.  That's half the battle for me on this.

I've tried putting that into a mapping like this:

map vti :',' !perltidy


vmap vti :!perltidyCR

c


See also :help filter


Best regards,
Tony.


Re: Calendar ?

2006-11-22 Thread Meino Christian Cramer
From: Tom Purl [EMAIL PROTECTED]
Subject: Re: Calendar ?
Date: Wed, 22 Nov 2006 12:15:04 -0600 (CST)

I found the plugin in $HOME/.vim/plugin/.

What version do you use? The header of my calendar.vim consists mainly
of a long history, instructions on how to set some calendar specific
variables in .vimrc and some other stuff for .vimrc.

no usage instructions, no keybindings.

Mine is the version of the 17.Jan 2006 and is named 1.4.

mcc



 Check out the source, which should be in one of your plugin directories.  For
 me, it's in $HOME/vimfiles/plugin/calendar.vim on my Win XP computer. The
 header of the file has a ton of commments, including usage statements nad
 Additional notes.
 
 HTH!
 
 Tom Purl
 
  Hi,
 
   where can I find instructions on how to use Calendar.vim and its
   keybindings ? I visited vim.org's script pages about Calendar.vim but
   didn't found, what I was searching for. Google also gave me
   nothing...
 
   But may be all this is my fault ?!
 
   Regards,
   mcc
 
 


Searching/replacing literally

2006-11-22 Thread Meino Christian Cramer
Hi,

 I want to search a longer string totally literally...regexp totally
 switched of, no exceptions. Or in other words: I want to search like
 sttcmp() of glibc would do.

 Is this possible with vim?
 (ok, this is a more rethorical question...everything is possible with
 vim. The question is more like: How and how complicate is is? ;O)

 Keep hacking!
 mcc


Re: error reading from stdin, vim 7.0.164

2006-11-22 Thread Gregory Margo
On Tue, Nov 21, 2006 at 09:34:45AM -0500, Adam Mercer wrote:
 On 21/11/06, Yakov Lerner [EMAIL PROTECTED] wrote:
 In the latest vim (7.0.164), I am getting error reading
 from stdin:
 ls | vim -u NONE -
 press any key
 Vim: Reading from stdin...
 Vim: Error reading input, exiting...
 
 Works fine for me on Mac OS X, as in is opens a vim session with the
 listing of the current directory in the current buffer.
 

Also works fine for me on Debian Stable i386.
I tried 7.0.164 and 7.0.168.

-- 
+
Gregory H. Margo


Re: sorting columns alphabetically

2006-11-22 Thread drchip
Quoting Vim Visual [EMAIL PROTECTED]:

 I have a text file like

 Mr Bla Blo
 Ms Ble Blu
 Dr Bli Blu
 etc

 and I would like to sort the file alphabetically after the surname
 (3rd column). How can I do that? I know how to sort it after the first
 one (visual + !sort)

May I suggest looking at How to sort using visual blocks at:

http://vim.sourceforge.net/tips/tip.php?tip_id=588

Regards,
Chip Campbell



why CTRL-W = don't work after :cope command ?

2006-11-22 Thread KLEIN Stéphane

Hello,

why CTRL-W = don't work after :cope command ?

Thanks for your help,
Stephane


Re: Execute command for current block of code

2006-11-22 Thread Gary Johnson
On 2006-11-22, A.J.Mechelynck [EMAIL PROTECTED] wrote:

 vobject where object is a Normal-mode object, will highlight the 
 concerned object. Example: vip for the inner paragraph.

And if you're using the matchit.vim plugin with your tags specified 
in b:match_words, then

a%

will highlight the current block as defined by your tags.

:help v_a%

HTH,
Gary

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


Re: Help - install problem can not run gvim (E233)

2006-11-22 Thread Bob Hoekstra
Tony Young wrote:
 Hello
 
 I am trying to see if I can get vim/gvim to work with our work Sun box.
 
 
 I Installed and used instructions from
 
   http://www.vim.org/
   http://www.vim.org/download.php#unix
 
 Downloaded the runtime and source files together: vim-##.tar.bz2
 
 i.e. I used: [ 6575205 Nov 22 17:46 vim-7.0.tar.bz2 ]
 
 for install help, I used
   http://vimdoc.sourceforge.net/vimfaq.html
   SECTION 35 - BUILDING VIM FROM SOURCE
 
 And typed commands (as root):
 
   Make
   Make install
 
   To install using defaults.
 
 When  I use 
 
   Gvim
 
 I get the following error
 
 $ gvim
 E233: cannot open display
 Press ENTER or type command to continue
 
 I am running on a
 
 Sun Microsystems Inc.   SunOS 5.8   Generic Patch   October 2001
 
 The result of the :version within gvim is
 
 +folding -footer +fork() -gettext -hangul_input -iconv +insert_expand 
 +jumplist
  -keymap -langmap +libcall +linebreak +lispindent +listcmds +localmap +menu
 +mksession +modify_fname +mouse +mouseshape -mouse_dec -mouse_gpm
 -mouse_jsbterm -mouse_netterm +mouse_xterm -multi_byte +multi_lang -mzscheme
 +netbeans_intg -osfiletype +path_extra -perl +postscript +printer -profile
 -python +quickfix +reltime -rightleft -ruby +scrollbind +signs +smartindent
 -sniff +statusline -sun_workshop +syntax +tag_binary +tag_old_static
 -tag_any_white -tcl +terminfo +termresponse +textobjects +title +toolbar
 +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace
 +wildignore +wildmenu +windows +writebackup +X11 +xfontset +xim +xsmp_interact
 +xterm_clipboard -xterm_save
system vimrc file: $VIM/vimrc
  user vimrc file: $HOME/.vimrc
   user exrc file: $HOME/.exrc
   system gvimrc file: $VIM/gvimrc
 user gvimrc file: $HOME/.gvimrc
 system menu file: $VIMRUNTIME/menu.vim
   fall-back for $VIM: /usr/local/share/vim
 Compilation: cc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MOTIF  
 -I/usr/dt/inclu
 de -I/usr/local/include  -O  -I/usr/openwin/include
 Linking: cc -L/usr/dt/lib -R /usr/dt/lib -L/usr/openwin/lib 
 -R/usr/openwin/lib -
 L/usr/local/lib -o vim  -lXmu -lXext -lXm -lXt -lX11 -lSM -lICE -ltermlib 
 -lnsl
 -lsocket  -ldl
 
 
 According to the website:
 
 http://www.vim.org/htmldoc/gui.html
 
 for the error E233, it says that 
 
 First you must make sure you actually have a version of Vim with the GUI code
 included.  You can check this with the :version command, it should include
 +GUI_Athena, +GUI_BeOS, +GUI_GTK, +GUI_Motif or MS-Windows ... bit
 GUI version.
 
 I would guess that I need a suitable graphical interface for the Sun box I am 
 using?
 
 Your help/advice is very much appreciated.
 
 Kindest regards
 Tony

Tony

Firstly, the simplest way to get vim onto the box is to download a
package from sunfreeware (http://www.sunfreeware.com/).

If you want to build it yourself, make sure you have the right libraries
installed. I seem to remember using gtk.

However, the can't open display sounds like you have not set  export
the DISPLAY environment variable. Do you have a graphics terminal
connected directly to the Sun? Or are you using another machine with an
X server to display on? Can you get other apps to run (what happens when
you type xterm)?

HTH

Bob