ftplugin mail.vim Leader

2006-08-01 Thread J.Hofmann
Hello,

I don't understand the meaning of <(Local)Leader>.

When I set filetype to "mail" (ftplugin mail.vim), how can I execute
the mapping to "Quote text by inserting "> " ?

Thank You

Joachim
###

This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.f-secure.com/


Re: Help with unwanted shell character expansion

2006-08-01 Thread Yakov Lerner

On 7/31/06, Bob Hiestand <[EMAIL PROTECTED]> wrote:

Question one:

Is there a way to achieve execution of system commands without using
the shell?


Yes, via libcall() ( :help libcall()). You can write your own function in
a shared lib that will do fork()+exec() without intermediate /bin/sh.

However, quoting using single-quotes is much easier
method of avoiding expansion of special shell chars. For example:

 :let result = system("cmd '[EMAIL PROTECTED]' '[EMAIL PROTECTED]' ")

All these characters in this examples are passed unexpanded
to the command cmd because of single quotes.

Yakov


Re: Help with unwanted shell character expansion

2006-08-01 Thread Yakov Lerner

On 7/31/06, Bob Hiestand <[EMAIL PROTECTED]> wrote:

Question two:

Is there a way to set the buffer name without the name being subject
to shell metacharacter expansion?


Easy. Here's the function that sets buffername without escaping.

function! LiteralSetBufferName(name)
   " we need to escape following chars: $ ` ~ \ % # * ?
   let escaped = substitute(a:name, '[$`~%#*?\\]', '\\&', 'g')
   exe "file ".escaped
endfun
:command! -nargs=1 FILE :call LiteralSetBufferName()

And here's remapping of :file command to this function/command:

cabbrev f =(getcmdtype()==':' && getcmdpos()==1 ? 'F' : 'f')
cabbrev fi =(getcmdtype()==':' && getcmdpos()==1 ? 'FI' : 'fi')
cabbrev fil =(getcmdtype()==':' && getcmdpos()==1 ? 'FIL' : 'fil')
cabbrev file =(getcmdtype()==':' && getcmdpos()==1 ? 'FILE' : 'file')

Yakov


Re: Help with unwanted shell character expansion

2006-08-01 Thread Yakov Lerner

On 8/1/06, Yakov Lerner <[EMAIL PROTECTED]> wrote:

Here's the function that sets buffername without escaping.


Correction. I wanted to write:

Here's the function that sets buffername without any metacharacter expansion.


Re: Differences with vim 7

2006-08-01 Thread Robert Cussons

Yakov Lerner wrote:

On 7/31/06, Robert Cussons <[EMAIL PROTECTED]> wrote:



>
>
> Are those two vims built with same GUI libraries ?  I suspect
> that they are build with different GUIs.
> Can you send first 4 lines out :version output from each of two vims  ?
>
> Yakov
>
> P.S. I remember that I had similar issue between one Qt-based
> program and similar Xt-based program. I set same font for them two,
> but they showed it rather differently. Maybe you'll want to rebuild
> vim7 to use same GUI as your vim6.3. If you send first 4 lines from
> both vims :version, we'll know which GUI they are both built with.
>

VIM - Vi IMproved 7.0 (2006 May 7, compiled Jul 31 2006 08:50:59)
Included patches: 1-42
Compiled by ...
Huge version with X11-Motif GUI.  Features included (+) or not (-):

VIM - Vi IMproved 6.3 (2004 June 7, compiled Jul 30 2005 12:36:01)
Included patches: 1-71, 81-82
Compiled by ...
Big version with GTK2 GUI.  Features included (+) or not (-):


Seems you have hit the nail on the head Yakov, how would I rebuild Vim7
using your script but changing the GUI is it using the --configure 
options?



a) install package 'openmotif-devel' or (motif-dev or what's called)
b) ./vim7-install.sh enable-gui=motif

Caution: you must make sure motif-dev is instaleld, first.

Yakov



Thanks very much to everyone who helped with this, I'm afraid I 
chickened out in the end and asked the network administrator, he 
backported a vim 7 compiled with GTK2 GUI onto my machine, which has 
solved the problem.


Many thanks again for all the help,
Rob.


Re: Ctl key mapping problems

2006-08-01 Thread Vigil

I'm trying to remap some keys from my vimrc file but am having problems.
What I want to do is the following: have vim print the character '\'
when I press 'Ctl-e'.


imap  \
nmap  \
cmap  \

These all work for me.

--

.


Re: [SPAM?]Re: gvimdiff and gvim 7 in windows

2006-08-01 Thread Robert Cussons

[EMAIL PROTECTED] wrote:

Robert Cussons <[EMAIL PROTECTED]> wrote on 2006.07.21 19:19:56:


because this is the size I want my gvim window to be when it opens,
however as gvimdiff opens at least two buffers I would like it to open
full screen, is there a way of getting this to happen?

gvim 7 in windows part:

I also use gvim at home, but there I use gvim 7 on windows instead of
gvim 6.3 on debian. So I have a few questions:

How do I use gvimdiff in windows?

If I already have a gvim window open how do I launch a new separate
instance of gvim from inside the first window (without having to go to
the desktop and click the icon!)

Sorry this is more of a windows question than gvim: On my linux machine
running KDE I have Ctrl-Shift-G set up to launch gvim, is there a way to
set a keyboard shortcut in Windows XP to do the same?

Many thanks for any help,
Rob.



If you want to maximize the window in Windows, here is the way:

if has("gui_win32")   " NT Windows
autocmd GUIEnter * :simalt ~x
endif

Note that it should be wrapped inside an autocmd group, if you don't have
any autocmd inside your .vimrc, here is the way:
augroup vimrcEx
autocmd!
" put your autocmd here.
augroup END

About diff mode: I use the following to test for diff mode, but I forget
why it works.
let in_diff_mode = 0
windo let in_diff_mode = in_diff_mode + &l:diff
if in_diff_mode == 1
" do something
else
" do something else
endif

About short-cut key for launch gvim? just create a shortcut on desktop or
start menu, then right click to change the properties, the short cut key
could be set there.

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





A very late reply to this, thanks for the diff mode tip that works great 
on Linux, I will try it on windows later.


The short-cut key works, I had already tried it, but I was trying to 
type in the box rather than press the keys themselves, DOH! The only 
problem is that if you already have a gvim session running all the 
shortcut key does is maximize it, but nevermind, in that case I will 
just use what Tony suggested: !gvim


Thanks,
Rob.


Re: netrw v103b

2006-08-01 Thread Bill McCarthy
On Tue 1-Aug-06 1:52am -0600, Hugo Ahlenius wrote:

> I just upgraded netrw to netrw 103b from Charles Campbell's web-site. Now it
> seems like opening a directory by just trying to edit it doesn't work, like
> it used to:
> :e c:\
>
> Could there be an autocommand that is missing? The only message I get is
> "Illegal file name". Browsing directories works through the "Explore"
> command though.
>
> (I am on gvim 7.0 on WinXP, non-cygwin)

I have the same setup and had a similar problem after
installing the new releases to $vim\vimfiles or ~\vimfiles.

Do you still have the distribution copy of netrw v98
installed to $vimruntime?

If so, either remove it (all 6 files) or make the following
change to $vim\plugin\netrwPlugin.vim:

Replace (right after the "Load Once" line):

if exists("g:loaded_netrw")
 finish
endif

with:

if exists("g:loaded_netrwPlugin")
 finish
endif
let g:loaded_netrwPlugin = 1

-- 
Best regards,
Bill



Re: ftplugin mail.vim Leader

2006-08-01 Thread A.J.Mechelynck

[EMAIL PROTECTED] wrote:

Hello,

I don't understand the meaning of <(Local)Leader>.

When I set filetype to "mail" (ftplugin mail.vim), how can I execute
the mapping to "Quote text by inserting "> " ?

Thank You

Joachim

[advertisement snipped]


see
:help 
:help 

HTH,
Tony.


RE: netrw v103b

2006-08-01 Thread Hugo Ahlenius
| Do you still have the distribution copy of netrw v98 installed to 
| $vimruntime?

Yes I had -- your change did it!

Thanks,
Hugo




Re: [SPAM?]Re: gvimdiff and gvim 7 in windows

2006-08-01 Thread A.J.Mechelynck

Robert Cussons wrote:

[EMAIL PROTECTED] wrote:

Robert Cussons <[EMAIL PROTECTED]> wrote on 2006.07.21 19:19:56:


because this is the size I want my gvim window to be when it opens,
however as gvimdiff opens at least two buffers I would like it to open
full screen, is there a way of getting this to happen?

gvim 7 in windows part:

I also use gvim at home, but there I use gvim 7 on windows instead of
gvim 6.3 on debian. So I have a few questions:

How do I use gvimdiff in windows?

If I already have a gvim window open how do I launch a new separate
instance of gvim from inside the first window (without having to go to
the desktop and click the icon!)

Sorry this is more of a windows question than gvim: On my linux machine
running KDE I have Ctrl-Shift-G set up to launch gvim, is there a way to
set a keyboard shortcut in Windows XP to do the same?

Many thanks for any help,
Rob.



If you want to maximize the window in Windows, here is the way:

if has("gui_win32")   " NT Windows
autocmd GUIEnter * :simalt ~x
endif

Note that it should be wrapped inside an autocmd group, if you don't have
any autocmd inside your .vimrc, here is the way:
augroup vimrcEx
autocmd!
" put your autocmd here.
augroup END

About diff mode: I use the following to test for diff mode, but I forget
why it works.
let in_diff_mode = 0
windo let in_diff_mode = in_diff_mode + &l:diff
if in_diff_mode == 1
" do something
else
" do something else
endif

About short-cut key for launch gvim? just create a shortcut on desktop or
start menu, then right click to change the properties, the short cut key
could be set there.

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





A very late reply to this, thanks for the diff mode tip that works great 
on Linux, I will try it on windows later.


The short-cut key works, I had already tried it, but I was trying to 
type in the box rather than press the keys themselves, DOH! The only 
problem is that if you already have a gvim session running all the 
shortcut key does is maximize it, but nevermind, in that case I will 
just use what Tony suggested: !gvim


Thanks,
Rob.




don't forget the initial colon

:!gvim

Best regards,
Tony.


Re: netrw v103b

2006-08-01 Thread Charles E Campbell Jr

Hugo Ahlenius wrote:


Hi,

I just upgraded netrw to netrw 103b from Charles Campbell's web-site. Now it
seems like opening a directory by just trying to edit it doesn't work, like
it used to:
:e c:\

Could there be an autocommand that is missing? The only message I get is
"Illegal file name". Browsing directories works through the "Explore"
command though.
 



Be sure to remove all previous installations of netrw.  The current 
version (v103c as of last night)
and subsequent vim distributions should no longer have this problem.  
After removal of all previous
installations of netrw, in particular the netrw that is made available 
from the standard vim distribution,

then do a netrw install.

Also: there's been a small change in vimballs; you'll need the latest 
vimball plugin to handle it properly.
The vimball v18a is backwards compatible -- ie. it can read older 
vimballs, but v17 and earlier vimball

will have trouble with the newer vimballs.


Charles -- if you read this, here are some things that are still outstanding
-- do you have any plans to fix these?

* URLs with question marks in them, like
http://www.grida.no/products.cfm?pageID=13
 



I just tried it; this appears to work (under linux).  Is there still a 
problem with windows/cygwin?



* FTP listings from a windows ftp server
 


I think the current version addresses this.


* a http url with a trailing slash starts an ftp session, like
http://maps.grida.no/arctic/
 



The trailing slash indicates to netrw that its supposed to be handling a 
directory.  Netrw only supports
two methods for browsing directories: ftp and ssh. If the file transfer 
protocol is either http or ftp,
then ftp is used (for browsing).  If the file transfer protocol is 
anything else, then ssh is used.  Attempts
to use wget or curl (two of the programs used to handle http://... ) 
doesn't yield a listing.  Perhaps you

want netrw to attach an "index.html" automatically?

Regards,
Chip Campbell



RE: netrw v103b - No longer can browse directories

2006-08-01 Thread David Fishburn
> On Tue 1-Aug-06 1:52am -0600, Hugo Ahlenius wrote:
> 
> > I just upgraded netrw to netrw 103b from Charles Campbell's 
> web-site. 
> > Now it seems like opening a directory by just trying to edit it 
> > doesn't work, like it used to:
> > :e c:\

I am having a similar issue, but I am using 102 from the main Vim website:
http://www.vim.org/scripts/script.php?script_id=1075


...
> If so, either remove it (all 6 files) or make the following 
> change to $vim\plugin\netrwPlugin.vim:
> 
> Replace (right after the "Load Once" line):
> 
> if exists("g:loaded_netrw")
>  finish
> endif
> 
> with:
> 
> if exists("g:loaded_netrwPlugin")
>  finish
> endif
> let g:loaded_netrwPlugin = 1


I don't like modifying files in the $VIM directory.

I tried this and it still did not fix the problem on my machine (I still
cannot browse the files in my directory).

I also get this:
:pwd
C:\

:e .
"C:\" Illegal file name


Dave



Re: Help with unwanted shell character expansion

2006-08-01 Thread Bob Hiestand

On 7/31/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:

Bob Hiestand wrote:
> Question one:
>
> Is there a way to achieve execution of system commands without using
> the shell?  Here I'm thinking (for example) of, in perl,  the
> difference between using a single argument to exec() and using
> multiple arguments.  In the first version, shell characters are
> expanded, in the second, they are not.
>
> If there is no such functionality currently, is this a planned
> feature?  I believe that such a feature would make writing portable
> plugins easier.

AFAIK, the only way to execute an external program from Vim with no
shell wrapping is to set the 'shell' option itself to the program name.
There may be drawbacks and pitfalls to that approach, though.

>
> Question two:
>
> Is there a way to set the buffer name without the name being subject
> to shell metacharacter expansion?   As far as I know, only :edit,
> :split, :new, :write, and :file allow setting the buffer name, and
> those all apply shell expansion.  I know that characters can be
> escaped, but that involved knowledge of which characters are
> significant on each platform and again leads to unportable code (or
> highly complex code that attempts to be portable by taking each system
> into account).  I would like a function to set the buffer name
> (potentially for a buffer specified by number) or for the '%' register
> to be writable.
>
> Thank you,
>
> bob
>
>

A buffer name is usually a (potential) file name. Which characters are
allowed in a filename is system-dependent. On Dos and on 16-bit Windows,
only 8+3 names are allowed (with no embedded spaces). On Unix, case is
usually significant while on Windows it usually isn't. And so on.

Also, Windows versions of Vim expand wildcards, while Unix versions
leave the expansion (except for ** which is a Vim-specific extension) to
the shell.

The buffer name can also be set by ":saveas", ":view", ":sview"... I'm
not sure I got them all. I expect all of these to also expand, for
instance, environment variables. ":saveas" is (IIUC) equivalent to
altering the current buffer's name then writing it under the new name.
If the new name already exists, ":saveas filename" will fail but
":saveas! filename" will succeed (unless of course there is a further
write-error, such as a "disk full" condition).

IIUC, all Vim's internal file-related commands accept a "unix-like"
filename syntax, and Vim translates it if necessary to the OS's syntax:
e.g., when Vim for Windows receives the command ":view
$VIMRUNTIME/vimrc_example.vim" (with an environment variable and using a
forward slash as separator) the string it passes to the Windows "file
open" function will be something like "C:\Program
Files\vim\vim70\vimrc_example.vim" (without the quotes and with a
terminating null byte IIUC, but also with the environment variable
resolved and, most important, with backslashes as separators).
Similarly, in Vim for Windows embedded spaces are backslash-escaped (as
in Unix), even though the Windows syntax is not to use any embedded
escaping but to wrap the whole name in double quotes.

If you want to build "portable" names for newly-created files, then

(assuming you can disregard pre-Win32 Dos-like systems) I suggest
limiting yourself to lowercase letters, digits, underscore and period.
Some systems allow more than that (and some OS versions accept Unicode
non-ASCII characters in filenames) but I believe that with [0-9a-z_.]
you can be fairly certain that your filename will be legal "almost
everywhere", and that different names will refer to different files.


Best regards,
Tony.



Thanks, Tony.  I should provide context for my request.  For my
cvscommand plugin, which opens new buffers containing the results of
CVS operations performed on the file associated with the current
buffer, I need to be able to name the resulting scratch buffers.
These buffers will be explicitly not associated with files.

I used to have these as nameless files, and used the statusline to
pull up custom variables set by the plugin to create a suitable
display name (something like "[CVS log originalFileName]").  The
problem with this solution is that the buffer list commands just show
the nameless scratch buffers, of course, making navigation difficult.

As an alternative, in the new version of the plugin, I explicitly name
the buffers.  However, that means that the original file name appears
in the buffer name, and is subject to shell expansion.

While it is indeed possible to do as Yakov suggests and try to escape
the shell meta-characters, I've experienced some difficulty in making
that work across multiple platforms consistently (primarily Linux,
Windows (various flavors), Windows + cygwin (my personal terror)).  I
actually already use the escape command, and ran into issues when
Windows interpreted the resulting escaped character as a backslash +
original character.  While the help mentions a work-around for this in
the case of the '[' character, I 

Re: netrw v103b - No longer can browse directories

2006-08-01 Thread Charles E Campbell Jr

David Fishburn wrote:


I don't like modifying files in the $VIM directory.

I tried this and it still did not fix the problem on my machine (I still
cannot browse the files in my directory).

I also get this:
:pwd
C:\

:e .
"C:\" Illegal file name
 

Please remove all the older versions of netrw prior to installing the 
latest versions of netrw.


The "Illegal file name" message comes up before netrw has anything to do 
with handling it.
However, I see that there's an unwanted "Press ENTER..." prompt.  I want 
to get rid of that;

if there's some ideas on this, please let me know.

Regards,
Chip Campbell



Re: Ctl key mapping problems

2006-08-01 Thread Benji Fisher
On Sun, Jul 30, 2006 at 06:49:26PM -0400, Siegmuund Siegmuundsson wrote:
> Hello all.
> 
> I'm trying to remap some keys from my vimrc file but am having problems.
> What I want to do is the following: have vim print the character '\'
> when I press 'Ctl-e'.
> In my vimrc file I inserted:
> 
> imap  92
> cmap  92
> nmap  92
> 
> However, nothing happens. I also tried to remap 'Esc' to 'Ctl-p', by writing
> imap  
> cmap  
> nmap  
> 
> with no better luck.
> However, I did successfully remap it to TAB with
> 
> imap  
> cmap  
> nmap  
> 
> Any thoughts on what might be going wrong with the Ctl-key mappings?
> Best,
> S.

:imap  092

seems to work.

:help i_CTRL-V_digit

HTH --Benji Fisher


Put the cursor in the middle of screen when replacing

2006-08-01 Thread Carlos Liu

Hi,

How to put cursor in the middle of screen when replacing words? I have
to see the next few lines to know replace or not, but the word always
sit in the bottom of the screen.

Thanks.

--
Best Regards
Carlos


Status line in gvim obscured when maximised

2006-08-01 Thread James Hales

Hi,

When I maximize Gvim in Gnome, the status line is partially hidden by
the gnome panel, which is really annoying. This is because of how Vim
resizes itself, i.e. it is constrained to being resized one character
size at a time. When Gvim is maximized, it is half a character too
high, so that extra half character, half of the status line, is hidden
beneath the gnome panel.

Is there any way to alleviate this problem?

Thanks very much,
James Hales


Automatic updating file content

2006-08-01 Thread Tien Pham

Hi all

Is there any key stroke to update content of a currently open file when its 
content has been changed?


Reason for this is that I want to look at my log file from a simulation, as 
I run simulation so frequently, it is so tedious to click "open" and 
"select" the same file name to see the changes that a new simulation is 
recorded in the log file. I would appreciate very much if someone teach me 
a quick way to update content of the file I have opened, of course the same 
file name.


Your help is greatly appreciated.
Kind regards
tien



Re: Put the cursor in the middle of screen when replacing

2006-08-01 Thread Tim Chase

How to put cursor in the middle of screen when replacing words? I have
to see the next few lines to know replace or not, but the word always
sit in the bottom of the screen.


Sounds like you're looking for the 'scrolloff' setting.

:help 'scrolloff'

will provide details on this.  It allows you to keep a certain 
number of lines on the screen at the same time.  If you set it to 
an outrageously high value, it will keep the cursor centered 
vertically on the screen.


-tkc





Re: latex syntax highlighting problems

2006-08-01 Thread Benji Fisher
On Mon, Jul 31, 2006 at 11:47:33AM +1000, Brett Calcott wrote:
> Hi,
> 
> I want to add some extra syntax highlighting to my latex documents. I
> am writing a thesis, so I have separate files for each chapter.
> 
> For example, I add this in ~/vimfiles/extra/syntax/tex.vim
> 
> syn region texFootnotematchgroup=texStatement start="\\footnote{"   
> end="}"
> hi link texFootnote Special
> 
> Now in my latex file let's say I have this:
> 
> \chapter{Introduction}
> bla bla bla \footnote{see here for more bla}
> 
> The highlighting does not work. But if I comment out the \chapter
> command then it does. So the syntax highlighting of \chapter is
> affecting whether or not my additional syntax works.
> 
> I am sure there is something simple that I need to do to make this
> work, but the intricacies of the syntax highlighting system elude me.
> Can anyone tell me what the right move is here?

 I think the simple answer (untested) is to add "containedin=ALL" to
your syntax definition.

:help syn-containedin

Another way to do it is to search for '\chapter' in the default suntax
file:

:e $VIMRUNTIME/syntax/tex.vim
/\\chapter

I think the \begin{chapter} declaration starts a texChapterZone, so
maybe you could use "containedin=texChapterZone" or (better if it works
that way) "containedin=texDocGroup".  Proper use of clusters is a little
beyond what I know of syntax highlighting.

HTH --Benji Fisher


Re: Automatic updating file content

2006-08-01 Thread Peter Hodge
Hi Tien,

You can use ':e[dit]' to reload the current file.  Perhaps you could set up
something with an autocommand based on the CursorHold event and reduce the
updatetime to half a second?  For example:

  set updatetime=500
  augroup RefreshFile
  autocmd!
  autocmd CursorHold somefile.log edit
  augroup end

However, this may not work so well if you have multiple files open in Vim.

regards,
Peter



--- Tien Pham <[EMAIL PROTECTED]> wrote:

> Hi all
> 
> Is there any key stroke to update content of a currently open file when its 
> content has been changed?
> 
> Reason for this is that I want to look at my log file from a simulation, as 
> I run simulation so frequently, it is so tedious to click "open" and 
> "select" the same file name to see the changes that a new simulation is 
> recorded in the log file. I would appreciate very much if someone teach me 
> a quick way to update content of the file I have opened, of course the same 
> file name.
> 
> Your help is greatly appreciated.
> Kind regards
> tien
> 
> 


Send instant messages to your online friends http://au.messenger.yahoo.com 


Re: Automatic updating file content

2006-08-01 Thread Tien Pham

Hi Peter

Thank you very much for the tip. ":e" works so nicely. I will try out those 
commands soon. Should I insert them in my vimrc file ?


Again, many thanks
tien

At 12:59 PM 2/08/2006 +1000, Peter Hodge wrote:

Hi Tien,

You can use ':e[dit]' to reload the current file.  Perhaps you could set up
something with an autocommand based on the CursorHold event and reduce the
updatetime to half a second?  For example:

  set updatetime=500
  augroup RefreshFile
  autocmd!
  autocmd CursorHold somefile.log edit
  augroup end

However, this may not work so well if you have multiple files open in Vim.

regards,
Peter



--- Tien Pham <[EMAIL PROTECTED]> wrote:

> Hi all
>
> Is there any key stroke to update content of a currently open file when 
its

> content has been changed?
>
> Reason for this is that I want to look at my log file from a 
simulation, as

> I run simulation so frequently, it is so tedious to click "open" and
> "select" the same file name to see the changes that a new simulation is
> recorded in the log file. I would appreciate very much if someone teach me
> a quick way to update content of the file I have opened, of course the 
same

> file name.
>
> Your help is greatly appreciated.
> Kind regards
> tien
>
>


Send instant messages to your online friends http://au.messenger.yahoo.com





Re: Automatic updating file content

2006-08-01 Thread Tien Pham

Hi Peter

The refresh command works well.  I put my log file name such as "autocmd 
CursorHold regression.log edit". Even I have a few files open at the same 
time, whenever I re-run my regression, I only need to click my 
regression.log window and new info is updated. Fantastic!


Many thanks
tien




At 12:59 PM 2/08/2006 +1000, you wrote:

Hi Tien,

You can use ':e[dit]' to reload the current file.  Perhaps you could set up
something with an autocommand based on the CursorHold event and reduce the
updatetime to half a second?  For example:

  set updatetime=500
  augroup RefreshFile
  autocmd!
  autocmd CursorHold somefile.log edit
  augroup end

However, this may not work so well if you have multiple files open in Vim.

regards,
Peter



--- Tien Pham <[EMAIL PROTECTED]> wrote:

> Hi all
>
> Is there any key stroke to update content of a currently open file when 
its

> content has been changed?
>
> Reason for this is that I want to look at my log file from a 
simulation, as

> I run simulation so frequently, it is so tedious to click "open" and
> "select" the same file name to see the changes that a new simulation is
> recorded in the log file. I would appreciate very much if someone teach me
> a quick way to update content of the file I have opened, of course the 
same

> file name.
>
> Your help is greatly appreciated.
> Kind regards
> tien
>
>


Send instant messages to your online friends http://au.messenger.yahoo.com





Re: Automatic updating file content

2006-08-01 Thread Peter Hodge
>
> Thank you very much for the tip. ":e" works so nicely. I will try out those 
> commands soon. Should I insert them in my vimrc file ?
>

Hi Tien,

Sorry, it seems I was a little naive with that autocommand I showed you, it
doesn't work because CursorHold won't trigger again until you press a key. 
After a little experimentation, I think you would best add something like this
to your .vimrc:

  function! s:ReloadWhileWaiting()
while ! getchar(1)
  edit
  normal G
  sleep 1
endwhile
  endfunction

  augroup RefreshFile
  autocmd!
  autocmd CursorHold somefile.log call s:ReloadWhileWaiting()
  augroup end

The automatic refresh ('s:ReloadWhileWaiting()') only begins after Vim is idle
for 4 seconds; after that it will reload the file ('edit'), move to the end
('normal G') and wait for a second before it tries again ('sleep 1').  Pressing
any key will stop the automatic refreshing ('while ! getchar(1)'), but it will
resume as soon as Vim is idle for 4 seconds again.  I hope that's all clear and
does what you need or that you can customize it easily.

regards,
Peter



Send instant messages to your online friends http://au.messenger.yahoo.com 


Re: Automatic updating file content

2006-08-01 Thread Tien Pham

Hi Peter

Thank you very much for your time/help. The previous group of commands 
works really well for me already. I have enjoyed the convenience it's 
brought so far. A click to update the content was what I wished for, but 
now I have more than what I wished for!


Many many thanks again
Regards
tien


At 02:41 PM 2/08/2006 +1000, you wrote:

>
> Thank you very much for the tip. ":e" works so nicely. I will try out 
those

> commands soon. Should I insert them in my vimrc file ?
>

Hi Tien,

Sorry, it seems I was a little naive with that autocommand I showed you, it
doesn't work because CursorHold won't trigger again until you press a key.
After a little experimentation, I think you would best add something like this
to your .vimrc:

  function! s:ReloadWhileWaiting()
while ! getchar(1)
  edit
  normal G
  sleep 1
endwhile
  endfunction

  augroup RefreshFile
  autocmd!
  autocmd CursorHold somefile.log call s:ReloadWhileWaiting()
  augroup end

The automatic refresh ('s:ReloadWhileWaiting()') only begins after Vim is idle
for 4 seconds; after that it will reload the file ('edit'), move to the end
('normal G') and wait for a second before it tries again ('sleep 
1').  Pressing

any key will stop the automatic refreshing ('while ! getchar(1)'), but it will
resume as soon as Vim is idle for 4 seconds again.  I hope that's all 
clear and

does what you need or that you can customize it easily.

regards,
Peter



Send instant messages to your online friends http://au.messenger.yahoo.com





Re: Put the cursor in the middle of screen when replacing

2006-08-01 Thread Carlos Liu

On 8/2/06, Tim Chase <[EMAIL PROTECTED]> wrote:

> How to put cursor in the middle of screen when replacing words? I have
> to see the next few lines to know replace or not, but the word always
> sit in the bottom of the screen.

Sounds like you're looking for the 'scrolloff' setting.

:help 'scrolloff'

will provide details on this.  It allows you to keep a certain
number of lines on the screen at the same time.  If you set it to
an outrageously high value, it will keep the cursor centered
vertically on the screen.


That's exactly what I want. Thank you!

--
Best Regards
Carlos


substituting only in visual block

2006-08-01 Thread Dr. Johannes Zellner
Hi,

having marked a visual block with ctrl-v, I'd like to so a search /
replace only in that visual block. E.g. when selecting the right block
in:

xx xx
xx xx
xx xx
xx xx

I'd to do something like s/xx/yy/g which applies only to the selected
block. How can I do this?

-- 
Johannes


Re: substituting only in visual block

2006-08-01 Thread Bernd Strohhäcker

Dr. Johannes Zellner schrieb:

Hi,

having marked a visual block with ctrl-v, I'd like to so a search /
replace only in that visual block. E.g. when selecting the right block
in:

xx xx
xx xx
xx xx
xx xx

I'd to do something like s/xx/yy/g which applies only to the selected
block. How can I do this?

  

Hi,

try Charles Campell's vis-script: 
http://www.vim.org/scripts/script.php?script_id=1195


HTH, Bernd