feature request: v:mousecol and v:mouseline

2006-10-21 Thread Hari Krishna Dara

When maps for mouse clicks are executed, can we have the location (in
the form of line and column number) made available through v: variables?
I just observed that getchar() works even with mouse clicks, but this is
almost useless without knowing where the user clicked. Capturing mouse
clicks along with expr maps or getchar() can do wonders if the mouse
click position is also available.

-- 
Thank you,
Hari

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Re: feature request: v:mousecol and v:mouseline

2006-10-21 Thread A.J.Mechelynck

Hari Krishna Dara wrote:

When maps for mouse clicks are executed, can we have the location (in
the form of line and column number) made available through v: variables?
I just observed that getchar() works even with mouse clicks, but this is
almost useless without knowing where the user clicked. Capturing mouse
clicks along with expr maps or getchar() can do wonders if the mouse
click position is also available.



The mouse position is already available from within a 'balloonexpr' 
expression, but I can't find it for the general case. Maybe an additional 
parameter value for the line() and col() functions? Let's say col(m) and 
line(m)? Perhaps also some way to find out over which window the mouse is 
hovering or has just clicked?



Best regards,
Tony.


completion marks buffer modified too soon

2006-10-21 Thread Hari Krishna Dara

When using |completion-function|, Vim is marking the buffer as modified,
as soon as the popup is triggered. When a plugin offers matches using
'completefunc' the user should be able to cancel by pressing C-E
and this shouldn't leave the buffer as modified.

Here is a sample function to show what I mean:

function! TComplete(findstart, base)
if a:findstart
return 0
else
return [a:base]+['test1', 'test2']
endif
endfunction
setl completefunc=TComplete

Thinking about it, it might be that Vim automatically chooses the first
item in the completion, but this provides no option to leave buffer as
not modified when completion is cancelled without selecting an item. I
even tried explicitly setting nomodified (though it is ugly), something
like:

inoremap C-XC-U C-XC-UC-R=ResetModified()
function! ResetModified()
  setl nomodified
  return ''
endfunction

But Vim seems to ignore this, as the buffer is still modified at the
end.

-- 
Thanks,
Hari

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Re: feature request: v:mousecol and v:mouseline

2006-10-21 Thread Bram Moolenaar

Hari Krishna Dara wrote:

 When maps for mouse clicks are executed, can we have the location (in
 the form of line and column number) made available through v: variables?
 I just observed that getchar() works even with mouse clicks, but this is
 almost useless without knowing where the user clicked. Capturing mouse
 clicks along with expr maps or getchar() can do wonders if the mouse
 click position is also available.

Good point, getchar() should somehow make the position of the click
available.

It's not that easy, since the click could be in any of the windows.  I
suppose we need:
v:mouse_window
v:mouse_column
v:mouse_line

The position could be in screen columns and lines, or in text column and
line.  I suppose text position is more useful.  You wouldn't need the
position of a click halfway a tab, right?

-- 
hundred-and-one symptoms of being an internet addict:
87. Everyone you know asks why your phone line is always busy ...and
you tell them to send an e-mail.

 /// 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: completion marks buffer modified too soon

2006-10-21 Thread Bram Moolenaar

Hari Krishna Dara wrote:

 When using |completion-function|, Vim is marking the buffer as modified,
 as soon as the popup is triggered. When a plugin offers matches using
 'completefunc' the user should be able to cancel by pressing C-E
 and this shouldn't leave the buffer as modified.
 
 Here is a sample function to show what I mean:
 
 function! TComplete(findstart, base)
 if a:findstart
 return 0
 else
 return [a:base]+['test1', 'test2']
 endif
 endfunction
 setl completefunc=TComplete
 
 Thinking about it, it might be that Vim automatically chooses the first
 item in the completion, but this provides no option to leave buffer as
 not modified when completion is cancelled without selecting an item. I
 even tried explicitly setting nomodified (though it is ugly), something
 like:
 
 inoremap C-XC-U C-XC-UC-R=ResetModified()
 function! ResetModified()
   setl nomodified
   return ''
 endfunction
 
 But Vim seems to ignore this, as the buffer is still modified at the
 end.

The completion itself is seen as a change.  If you cancel completion
it's like changing the text back to what it was.  It's very difficult to
do this otherwise.

-- 
hundred-and-one symptoms of being an internet addict:
88. Every single time you press the 'Get mail' button...it does get new mail.

 /// 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: Extra [No Name] Buffers from mksession

2006-10-21 Thread Bram Moolenaar

Bill McCarthy wrote:

 When I open a session created by mksession, a [No Name]
 buffer is created for each tab that is created.  My
 'sessionoptions' contains all the options except sesdir,
 slash and unix.  I checked buffers with 'ls!' before saving
 the session.  I startup with:
 
 gvim -S session_file_name.vim
 
 In the session file, each tab is created and filled with
 
 tabnew
 edit file
 
 Trying that same sequence in a .vim file like this
 
 edit file 1
 tabnew
 edit file 2
 tabnew
 edit file 3
 tabnew
 edit file 4
 
 And then sourcing it with:
 
 gvim +so myfile.vim
 or
 gvim -S myfile.vim
 
 does not generate any [No Name] files in ls!.  It generates
 3 of those files when I save that session and load it later.
 
 I am running gvim 7.0.136 on Windows XP Pro with all
 updates.

This happens when the edited file already is in the buffer list.
I'll fix it by using tabedit instead of tabnew | edit.

-- 
hundred-and-one symptoms of being an internet addict:
91. It's Saturday afternoon in the middle of May and you
are on computer.

 /// 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: Fighting with comments - Close the gap between vimtutor and :help

2006-10-21 Thread vim

Gary Johnson wrote:

I don't think that's true. Vim :help comprises two manuals:

Vim User Manual - :help user-manual
Vim Reference Manual - :help reference

This is even discussed in :help 01.1. The User Manual is written
in a different style than the Reference Manual and is more readable.
I believe the User Manual is intended to be the intermediate-level
guide you're looking for.

Regards,
Gary

Well, I said that's basically it, I didn't really want to go through 
the details of :help and analyse what's missing in it because I don't 
think there is anything missing in it.


I'm more talking about a tutorial that will take you by the hand and 
bring you through the Vim universe in a nice and easy way to quote 
myself.  I believe that an official well-written tutorial that goes nice 
and easy with lengthy descriptions and good examples is missing.  
Something to turn people from novices to Vim addict.


I'm always surprised that not every single coder doesn't use Vim on an 
everyday basis.  Especially when I can say that since I've made the 
effort to learn the 'basics' of the software, I code two to three times 
faster, even tho I believe I don't use more than 20% of Vim.


I've also had a look at the FAQ as suggested by belgian compatriot Tony 
and I think that it could be the perfect start for a good tutorial.  Yet 
the tutorial needs to be adressed to novices with the objective to get 
them hooked asap :)


I'll be in touch with the FAQ team and see if it is possible to start 
such a project.


Laurent


Re: Quickfix behaviour

2006-10-21 Thread Marius Roets

On 10/20/06, Yegappan Lakshmanan [EMAIL PROTECTED] wrote:


The above problem with the quickfix window and the 'switchbuf' option
set to 'usetab' is now fixed by patch 7.0.146.

- Yegappan


Thanks, I will check it out.

Marius


Re: completion marks buffer modified too soon

2006-10-21 Thread Hari Krishna Dara

On Sat, 21 Oct 2006 at 1:59pm, Bram Moolenaar wrote:


 Hari Krishna Dara wrote:

  When using |completion-function|, Vim is marking the buffer as modified,
  as soon as the popup is triggered. When a plugin offers matches using
  'completefunc' the user should be able to cancel by pressing C-E
  and this shouldn't leave the buffer as modified.
 
  Here is a sample function to show what I mean:
 
  function! TComplete(findstart, base)
  if a:findstart
  return 0
  else
  return [a:base]+['test1', 'test2']
  endif
  endfunction
  setl completefunc=TComplete
 
  Thinking about it, it might be that Vim automatically chooses the first
  item in the completion, but this provides no option to leave buffer as
  not modified when completion is cancelled without selecting an item. I
  even tried explicitly setting nomodified (though it is ugly), something
  like:
 
  inoremap C-XC-U C-XC-UC-R=ResetModified()
  function! ResetModified()
setl nomodified
return ''
  endfunction
 
  But Vim seems to ignore this, as the buffer is still modified at the
  end.

 The completion itself is seen as a change.  If you cancel completion
 it's like changing the text back to what it was.  It's very difficult to
 do this otherwise.

How about adding an option something like showonly in 'completeopt',
that when set brings up the menu, but doesn't automatically choose the
first item? However this should probably be better controlled at per
buffer level. There were requests before for this same issue, e.g.,
someone was trying to map . to bring up omni-completion menu, but
didn't want the first item to be automatically chosen (as it is the case
in *all* the IDEs), and the workaround was to include the . also as
part of completion (it solves the problem, but I think is ugly, as you
need to type C-N or C-P twice to get to the real first item or last
item in the matches). If there is a way for the |complete-function| to
indicate this option, it will solve this problem.

-- 
Thank you,
Hari

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


RE: Fighting with comments - Close the gap between vimtutor and :help

2006-10-21 Thread Java Bob


Gary Johnson wrote:
 I don't think that's true. Vim :help comprises two manuals:

 Vim User Manual - :help user-manual
 Vim Reference Manual - :help reference

 This is even discussed in :help 01.1. The User Manual is written
 in a different style than the Reference Manual and is more readable.
 I believe the User Manual is intended to be the intermediate-level
 guide you're looking for.

 Regards,
 Gary

Well, I said that's basically it, I didn't really want to go through 
the details of :help and analyse what's missing in it because I don't 
think there is anything missing in it.

I'm more talking about a tutorial that will take you by the hand and 
bring you through the Vim universe in a nice and easy way to quote 
myself.  I believe that an official well-written tutorial that goes nice 
and easy with lengthy descriptions and good examples is missing.  
Something to turn people from novices to Vim addict.

I'm always surprised that not every single coder doesn't use Vim on an 
everyday basis.  Especially when I can say that since I've made the 
effort to learn the 'basics' of the software, I code two to three times 
faster, even tho I believe I don't use more than 20% of Vim.

I've also had a look at the FAQ as suggested by belgian compatriot Tony 
and I think that it could be the perfect start for a good tutorial.  Yet 
the tutorial needs to be adressed to novices with the objective to get 
them hooked asap :)

I'll be in touch with the FAQ team and see if it is possible to start 
such a project.

Laurent


I agree, thats why I am reading 60 emails a day from the Vim list.

Robert



Re: Extra [No Name] Buffers from mksession

2006-10-21 Thread Bill McCarthy
On Sat 21-Oct-06 6:59am -0600, Bram Moolenaar wrote:

 This happens when the edited file already is in the buffer list.
 I'll fix it by using tabedit instead of tabnew | edit.

Ah, thanks for explaining that.  I knew that making that
replacement solved the problem but didn't know why.

I had used a shell script to fix the problem.  Since I don't
know how to do a multi-line replace is SED, I used console
Vim as a super SED!  The one-liner is simply:

vim -u NONE -i NONE -Nnes +%%s/tabnew\nedit/tabedit/|wq %1

where '%1' is the placeholder for the sessionfile and '%%s'
is needed in 4nt because '%s' would be thought of as an
environment variable.  This was an interesting and
productive exercise, because it taught me how to use console
Vim as a very powerful batch tool (I had never used the
'-es' combo before).

This afternoon, I wrote a ':command' to do this within Gvim
(or Vim) for my _vimrc:

com! -narg=1 MS mks! args
\|sil sp args
\|sil %s/tabnew\nedit/tabedit/
\|sil w
\|bw
\|redr!
\|echohl Warning
\|echomsg Session saved using tabedit
\|echohl NONE

This works fine.

One last question is how can I get my restored session to
have buffer numbers 1 - n instead of 2 - n+1 (which is the
way mksession does things)?

-- 
Best regards,
Bill



Re: feature request: v:mousecol and v:mouseline

2006-10-21 Thread Hari Krishna Dara

On Sat, 21 Oct 2006 at 11:19am, Hari Krishna Dara wrote:


 On Sat, 21 Oct 2006 at 1:59pm, Bram Moolenaar wrote:

 
  Hari Krishna Dara wrote:
 
   When maps for mouse clicks are executed, can we have the location (in
   the form of line and column number) made available through v: variables?
   I just observed that getchar() works even with mouse clicks, but this is
   almost useless without knowing where the user clicked. Capturing mouse
   clicks along with expr maps or getchar() can do wonders if the mouse
   click position is also available.
 
  Good point, getchar() should somehow make the position of the click
  available.
 
  It's not that easy, since the click could be in any of the windows.  I
  suppose we need:
  v:mouse_window
  v:mouse_column
  v:mouse_line
 
  The position could be in screen columns and lines, or in text column and
  line.  I suppose text position is more useful.  You wouldn't need the
  position of a click halfway a tab, right?

 For most purposes the window and text position is all that matters, but
 there can be some interesting possibilities if clicks outside any buffer
 (such as at the command-line the way inputlist() works) can also be
 made available (using something like v:mouse_region that can have
 window, tab, cmdline).

Also want to propose that these v: variables should be settable by the
scripts in case the RHS of a map is a Mouse key. E.g., the following
should work (note: it is just indented to show the usage, not
particularly a useful example):

 Make F12 always RightMouse at the center of the current window.
imap expr F12 CenterRightMouse()
function! CenterRightMouse()
  let v:mouse_window = winnr()
  let v:mouse_line = winheight('.')/2
  let v:mouse_col = winwidth('.')/2
  return \RightMouse\RightRelease
endfunction

-- 
Thanks,
Hari

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


REQ: gq and swap file stuff?

2006-10-21 Thread Pero Brbora

Hi ...

When there is no empty lines bellow the long line (at the end of file)
you can't format the line using gq option...

Also it would be less annoying when opening file and swap file is found
(another vim is running in this case). Then you click on Quit and you
have to press a key! IMHO annoying...

This stands for gvim 7.0.109 on Windows 2000, MinGW compile (gcc
3.4.2)... I did the compiles but this was in previous releases of gvim I
didn't compile by myself...

One more thing. Syntax highlighting doesn't work well when fdm=marker
is set... I have encountered this mostly on shell scripts (bash). For
example when you unqoute string text bellow highlights as string but,
doesnt unhighlights when you qoute it agsin.

Thanks, bye

_
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/




Re: REQ: gq and swap file stuff?

2006-10-21 Thread Kim Schulz
On Sat, 21 Oct 2006 22:40:32 +0200
Pero Brbora [EMAIL PROTECTED] wrote:

 Hi ...
 
 When there is no empty lines bellow the long line (at the end of file)
 you can't format the line using gq option...


This one I completely agree with. I always start out by adding a lot of
empty lines to the bottom of the file before adding contents. this way
this annoyance isn't activated as often. 
Would be super to get rid of this annoyance which I tend consider a
bug - even though it probably has its roots in some line-editing ideas
from old days. 

-- 
Kim Schulz| Private :  http://www.schulz.dk
[EMAIL PROTECTED] | Business:  http://www.devteam.dk
+45 5190 4262 | Sparetime: http://www.fundanemt.com


Re: REQ: gq and swap file stuff?

2006-10-21 Thread Bill McCarthy
On Sat 21-Oct-06 3:40pm -0600, Pero Brbora wrote:

 When there is no empty lines bellow the long line (at the
 end of file) you can't format the line using gq option...

What are you doing?  If I use this test file:

=== testfile ===
 vim: set tw=10 fo=tcq2:

this line has a blank line after it.

Now for a long line with no blank line after it.
= end testfile =

And open with:

gvim -u NONE -i NONE -N testfile

I can format the paragraphs with, for example, 'gqq' or
'gq}' or '{visual}gq' without a problem.

Since there is no 'gq option', I'm assuming you're using the
normal command gq followed by a q, a motion or proceeded by
a visual selection.

-- 
Best regards,
Bill



Re: REQ: gq and swap file stuff?

2006-10-21 Thread Benji Fisher
On Sat, Oct 21, 2006 at 10:40:32PM +0200, Pero Brbora wrote:
 Hi ...
 
 When there is no empty lines bellow the long line (at the end of file)
 you can't format the line using gq option...

 I agree with one of the other replies:  gqq works for me.

 Also it would be less annoying when opening file and swap file is found
 (another vim is running in this case). Then you click on Quit and you
 have to press a key! IMHO annoying...
 
 This stands for gvim 7.0.109 on Windows 2000, MinGW compile (gcc
 3.4.2)... I did the compiles but this was in previous releases of gvim I
 didn't compile by myself...
 
 One more thing. Syntax highlighting doesn't work well when fdm=marker
 is set... I have encountered this mostly on shell scripts (bash). For
 example when you unqoute string text bellow highlights as string but,
 doesnt unhighlights when you qoute it agsin.

 You should mention this to Dr. C, who maintains the syntax file (in
this case $VIMRUNTIME/syntax/sh.vim).  First, check his web site in case
there is a newer version of the syntax file that already fixes the
problem:
http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax
If not, try e-mailing him directly.  Both the web site and his e-mail
address (the latter somewhat obfuscated) are in the comments at the top
of the syntax file.

HTH --Benji Fisher


Re: REQ: gq and swap file stuff?

2006-10-21 Thread Pero Brbora

 I agree with one of the other replies:   gqq works for me.


Ok, my bad. It works for me too... :)
I learned gqCR and didn't know about gqq -
much better...

Thanks

_
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/




How to use vim as sed?

2006-10-21 Thread Peng Yu

Hi,

Suppose I need to regular expression replacement for a bunch of files.
Of cause, I can use sed. However, it seems that sed is not fully
compatible with vim. I'm more familiar with vim. I know the vim
commands that I should use to do the replacements.

I'm wondering if there is any automatic way (say, from command line or
shell script) to process these files.

Thanks,
Peng


Re: How to use vim as sed?

2006-10-21 Thread Bill McCarthy
On Sat 21-Oct-06 8:37pm -0600, Peng Yu wrote:

 Suppose I need to regular expression replacement for a bunch of files.
 Of cause, I can use sed. However, it seems that sed is not fully
 compatible with vim. I'm more familiar with vim. I know the vim
 commands that I should use to do the replacements.

 I'm wondering if there is any automatic way (say, from command line or
 shell script) to process these files.

From the command line, you could use something like the
following to replace all occurrences of 'foo' with 'bar' in
the current directory files named *.fb:

For speed, using a standard startup, not in vi mode, in ex
batch mode with undo off and no swap files:

  vim -u NONE -i NONE -Nnes +se ul=-1 +argdo %s/foo/bar/ge|up +q *.fb

To use regular settings:

  vim -nes +se ul=-1 +argdo %s/foo/bar/ge|up +q *.fb

I've written these so everything in the second pair of
quotes is the variable part where you substitute the action
you want (as is the file selection part) - easy to turn into
a shell script.

BTW, if your shell is 4nt, replace %s with %%s - so that
%s isn't treated as a variable.  This is a good practice for
CMD users also, even though not necessary for this example.

-- 
Best regards,
Bill



Re: Fighting with comments - Close the gap between vimtutor and :help

2006-10-21 Thread Hal

On Oct 21, 2006, at 11:46 AM, Java Bob wrote:




Gary Johnson wrote:

I don't think that's true. Vim :help comprises two manuals:

Vim User Manual - :help user-manual
Vim Reference Manual - :help reference

This is even discussed in :help 01.1. The User Manual is written
in a different style than the Reference Manual and is more readable.
I believe the User Manual is intended to be the intermediate-level
guide you're looking for.

Regards,
Gary


Well, I said that's basically it, I didn't really want to go through
the details of :help and analyse what's missing in it because I don't
think there is anything missing in it.

I'm more talking about a tutorial that will take you by the hand and
bring you through the Vim universe in a nice and easy way to quote
myself.  I believe that an official well-written tutorial that goes  
nice

and easy with lengthy descriptions and good examples is missing.
Something to turn people from novices to Vim addict.

I'm always surprised that not every single coder doesn't use Vim on an
everyday basis.  Especially when I can say that since I've made the
effort to learn the 'basics' of the software, I code two to three  
times

faster, even tho I believe I don't use more than 20% of Vim.

I've also had a look at the FAQ as suggested by belgian compatriot  
Tony
and I think that it could be the perfect start for a good  
tutorial.  Yet

the tutorial needs to be adressed to novices with the objective to get
them hooked asap :)

I'll be in touch with the FAQ team and see if it is possible to start
such a project.

Laurent


I agree, thats why I am reading 60 emails a day from the Vim list.

Robert

I'm an long time computer user but a relatively new user of Vim.  At  
this point, I think I'm 'hooked', but I am somewhat troubled by how  
difficult it is to appreciate what Vim offers.  About five years ago,  
I tried Vim and gave up, couldn't see the benefit and it sure seemed  
confusing with many options and settings.  All detail; no structure  
was my reaction, and I didn't then have the time to invest in it.   
When I tried it this time I had the same initial reaction, but  
persevered and started to see some of the neat, efficient things it  
can do.


What seems to me to be lacking is a fairly 'simple' set of concepts  
or examples that would have helped me understand what Vim offers.   
Not so simple that Vim appears to be 'just an other text editor' and  
not so complex or long that it seems like an overwhelming bucket of  
keystrokes.  Given the flexibility of Vim, a longish document would  
be needed to describes its many features with examples, but that may  
not be the answer.  If we want to make Vim enticing, I think brevity  
would  be a virtue.  Since a good sense of who the audience for a  
document is always important, possibly a series of shorter pieces  
focused on various activities: c coding, xml coding, scripting,  
network connections, etc.  The list of titles/section headings in  
itself could give an idea of the scope and flexibility Vim provides.   
The current FAQ material might provide a good starting point, and it  
might be worth considering different packaging; for instance in a  
wiki format.


Just my 2 cents worth.

Hal



Re: Plain TeX support ?

2006-10-21 Thread Meino Christian Cramer
From: Benji Fisher [EMAIL PROTECTED]
Subject: Re: Plain TeX support ?
Date: Fri, 20 Oct 2006 15:31:33 -0400

 On Mon, Sep 25, 2006 at 08:07:22PM +0200, Meino Christian Cramer wrote:
   [snip]
After I wrote my first TeX-text without Emacs/AucTeX spontaneous I
would say the following things are missing:

A Keystrokes to insert {\bf X }, {\it X \/} and such where X marks the
  cursor position after doing the keystroke.

B Interface to run TeX and a viewer (configurable) on the file one is
  editing which ensures, that the file on the HD is uptodate.

C Defintions to automatically map word to ``word'' and to remap 
  - in my case - german umlauts to the TeX-commandsequences. This
  should be done for any non-ASCII-character. Most of the bugs I had
  to remove while trying to tex my file were of such kind.

I have not proofen that this is not already implemented, I only read
the few lines of the help text for ft-tex-plugin. And didn't fiddle
with quickfix and such. May be quickfix can be misused for texing ?
Dont know. 
 
  I am sorry to have left this alone for so long.  I have been busy.
 I spent too much time, shortly after the last note on this thread,
 trying to get the 'errorformat' right for plain TeX, then I did not have
 time to let you know about it.
 
  I just posted a preliminary version of plaintex support at
 http://vim.sourceforge.net/scripts/script.php?script_id=1685
 Please try it out.  If I get any feedback (from you or others) then I am
 more likely to improve it.
 
 A. I chose C-B for \bf and C-T for \it .  (Why not C-I?  Because
 vim sees that as a Tab, and I do not want to remap that.)  In Insert
 mode, you get {\bf }++ or {\it \/}++, with the cursor inside the
 braces, and C-J will jump to the ++ marker.  In Visual mode, you get
 the Visual selection wrapped in {\bf  and } or {\it  and \/}.
 In Normal mode, the word under the cursor is wrapped.
 
  If you have similar requests, they are easy to add.
 
 B. Next version.  This is not too hard to do.  What viewer do you use?
 xdvi maybe?
 
 C. I map  (in Insert mode) to produce either `` or '' (or  if it is
 after a \ or in Math mode).  Do you also want something, maybe C-Q, to
 act like C-B, so that it will work in Normal, Visual, and Insert
 modes?
 
  I have not tried it, but there is already a script that translates
 various non-ASCII characters into TeX commands.  I think it does the
 translation when reading and writing the file.  Unfortunately,
 www.vim.org is not responding right now, so I cannot give you a pointer.
 
 [snip]
   PS: By the way: Are you using Ruby, Benji? I know The principle of
   least surprise from programming Ruby...
 
  No, I do not use Ruby.  I think the principle is older than that
 language.
 
 HTH   --Benji Fisher
 

Hi Benji,

 thank you very much for implementing this! I will test it... :O)

Keep hacking!
 mcc

 


Terminating search in function

2006-10-21 Thread Meino Christian Cramer
Hi,

 I wrote this snippet:


fun! Ffunchdr()
let date = strftime( %F )

put='/*-*/'
put='/**'
put=' * desc'
put=' *'
put=' *'
put=' *'
put=' * Created: ' . date . '
put=' *'
put=' * parameter:
put=' * parameter:
put=' * parameter:
put=' * parameter:
put=' * parameter:
put=' *'
put=' * result 0 - Success, -1 - Failure'
put=' *'
put=' */'
?desc
endfun
command! Funchdr :call Ffunchdr()



This should give nme the header comment for function definitions in C.
My problem seems to be the ?desc command at the end.
It /should/ move the cursor onto the desc keyword right in the
beginning of the comment block.

But it move the cursor to here:

  * desc 
  ^
  |
  cursor position

My analysis (a too big word...) of the problem is: ? is still
waiting for input. I tried


?descCR

instead, but now ? tries to find descCR literally and did not
find it.

There seem to be an exception of the type the commands as you would
do normally-rule here...but what is the rule to recognize that the
current situation is an exception and what is the solution?

Thank you very much in advance for any help ! :)

Have a nice weekend!
mcc



Re: bash syntax does not handle bitwise left shift

2006-10-21 Thread A.J.Mechelynck

Olaf Hering wrote:

The shell syntax highlighting does not work for the bash 'left bitwise shifts'.
I have uploaded the example script and screen show to
http://www.aepfle.de/linux/vim/

The offending line is:

(( of_disk_addr = ( (of_disk_scsi_chan16) | (of_disk_scsi_id8) 
|  of_disk_scsi_lun ) )); #

If I change it to of_disk_scsi_chan16 or of_disk_scsi_chan16, it
looks better. 


How can this be fixed properly?
This is vim7, it did not work with older versions either.




1) Check whether ftp://ftp.vim.org/pub/vim/runtime/syntax/sh.vim isn't by any 
chance more recent than the $VIMRUNTIME/syntax/sh.vim you're using (check the 
Last Change date in the comments at the top of the script).


2) If it isn't, check whether by any chance there isn't a newer version at the 
HTTP address mentioned in the URL line in the comments at the top of the script;


3) If there isn't, explain your troubles to Dr. Chip (aka Charles E. Campbell, 
PhD) at the address obtained by removing the letters N,O,S,P,A and M from the 
address listed in the Maintainer line at the top of the syntax script.



Best regards,
Tony.


Re: insert-mode :map-alt-keys and 8-bit locales

2006-10-21 Thread Alexey I. Froloff
* A.J.Mechelynck antoine.mechelynck@ [061021 08:01]:
 IMHO, the way to configure it is not by hacking Vim but (at
 least in console Vim) by having a properly-built
 termcap/terminfo which tells Vim which codes correspond to
 which keys.
IIRC, only user can tell what will Meta+Key send and it has
nothing to do with term*.  I'm talking about convert-meta
(inputrc) and eightBitInput (xterm).

 but no program can discriminate between different keypresses
 which your keyboard driver translates to the same keycode (or
 keycode sequence).
Vim assumes that Meta+Key always generates (Key | 0x80).  Code:

/*
 * Try to include modifiers in the key.
 * Changes Shift-a to 'A', Alt-A to 0xc0, etc.
 */
int
extract_modifiers(key, modp)
int key;
int *modp;
{
...
if ((modifiers  MOD_MASK_ALT)  key  0x80
...
)
{
key |= 0x80;
modifiers = ~MOD_MASK_ALT; /* remove the META modifier */
}
...

Add extra condition, '8bitmeta' option checking (which is on by
default) for example.  However, this will not solve all problems,
I will look further.


P.S. Why am I doing all this?  latexsuite plugin imaps M-x keys
and this generates problems in ru_RU.KOI8-R locale (8bit).  This
can't be fixed without hacking into latexsuite code and this bug
happend only if (x | 0x80) means something in current locale.
One workaround is to switch to UTF-8 locale.

-- 
Regards,
Sir Raorn.


signature.asc
Description: Digital signature


Re: Paste as HTML

2006-10-21 Thread Bram Moolenaar

Igor Dvorkin wrote:

 Many windows apps support a clipboard pasting format of HTML. This is
 how you can copy code in Visual Studio 2005 and paste it into outlook
 and see syntax highlighting.
 
 I recommend something similar be done for VIM. Today, we have toHTML,
 that's reasonable, but ideally we'd able to yank as HTML. I've created
 a patch that can yank HTML to the clipboard as type HTML. I don't
 think this patch should be submitted, instead used by the person
 considering this feature request.
 
 
 Ideally this patch will be extended to allow the user to decide to :
 
 a) yank text , convert it to HTML, and have show up as type HTML.
 b) yank HTML, and have it have it show up as type HTML
 c) yank text, and have it show up as HTML
 
 My patch only implements 'b'
 
 Thoughts?

Your patch appears to mostly change indent...

With a simple script you can invoke 2html.vim on highlighted text and
yank the result into the clipboard.  What is the added value of marking
it as HTML on the clipboard?

-- 
hundred-and-one symptoms of being an internet addict:
86. E-mail Deficiency Depression (EDD) forces you to e-mail yourself.

 /// 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: insert-mode :map-alt-keys and 8-bit locales

2006-10-21 Thread A.J.Mechelynck

Alexey I. Froloff wrote:

* A.J.Mechelynck antoine.mechelynck@ [061021 08:01]:

IMHO, the way to configure it is not by hacking Vim but (at
least in console Vim) by having a properly-built
termcap/terminfo which tells Vim which codes correspond to
which keys.

IIRC, only user can tell what will Meta+Key send and it has
nothing to do with term*.  I'm talking about convert-meta
(inputrc) and eightBitInput (xterm).


As you told me recently, you don't know what you're talking about. Most 
nontechnical users don't know (and don't care) what binary keycodes their 
keyboard interface is sending to their program when they hit which key 
combination. Only the programmers of the keyboard interface (and the admins 
who write keyboard-interface configuration files) can decide which keycodes 
correspond to which keypresses, and it takes quite some technical expertise to 
find out with certainty what key combinations are sent by which keypresses on 
which systems for all possible combinations of modifier and other keys. It 
might be relatively straightforward (if not necessarily easy) for programs 
running only on Windows or only on X11 but Vim has to cater for not only 
Windows, X11 and Carbon but also tens of different text consoles and console 
emulators. Vim relies on such things as the termcap/terminfo libraries (both 
builtin and disk-resident) and the $TERM environment variable to tell it what 
terminal it is running on, which influences how it will interpret the keycodes 
sent to it by the keyboard interface. If the termcap is broken or $TERM set to 
a wrong value (both of which happen more often than you might think), Vim will 
misunderstand what the keyboard sends.





but no program can discriminate between different keypresses
which your keyboard driver translates to the same keycode (or
keycode sequence).

Vim assumes that Meta+Key always generates (Key | 0x80).  Code:

[snip]

What I'm saying, is that, if my (fr_BE) keyboard interface is sending the same 
keycode when I hit é (SMALL LATIN LETTER E WITH ACUTE ACCENT) and when I hit 
Alt-i (SMALL LATIN LETTER I with the Alt modifier), then Vim won't be able to 
see the difference between é and Alt-i, and in that case, if I use imap M-i 
{rhs} I'll get that {rhs} instead of an e-acute whenever I hit é in Insert 
mode. With such a keyboard interface I should avoid mapping Alt-keys in Insert 
mode if I want to be able to type French text: IOW, with that kind of keyboard 
interface, é and Alt-i are, как говорят Французы, белый колпак и колпак белый, 
или как говорят Англичане, шесть одного и полдюжина другого: /bonnet blanc et 
blanc bonnet/, or six of one and half a dozen of the other.



Regards,
Tony.


Re: Paste as HTML

2006-10-21 Thread Mathias Michaelis
Hello *

 What is the added value of marking
 it as HTML on the clipboard?
 
The added value is that you are able to paste the text into a word
processing program like AbiWord, MS Word or StarWriter in a way that
the HTML-Tags are not shown, but are interpreted by the word
processing program in order to format the text as it would be
formatted in a HTML browser.

To achieve this know, I only see one way: Convert your text to HTML,
then save it as HTML, open it with a web browser, copy it from here
into the clipboard and paste it into a word processing program.

With best regards

Mathias


Re: Paste as HTML

2006-10-21 Thread A.J.Mechelynck

Mathias Michaelis wrote:

Hello *


What is the added value of marking
it as HTML on the clipboard?


The added value is that you are able to paste the text into a word
processing program like AbiWord, MS Word or StarWriter in a way that
the HTML-Tags are not shown, but are interpreted by the word
processing program in order to format the text as it would be
formatted in a HTML browser.

To achieve this know, I only see one way: Convert your text to HTML,
then save it as HTML, open it with a web browser, copy it from here
into the clipboard and paste it into a word processing program.

With best regards

Mathias



What about opening the HTML file directly as RTF in a word processor?


Best regards,
Tony.


Re: Paste as HTML

2006-10-21 Thread Bram Moolenaar

Mathias Michaelis wrote:

  What is the added value of marking
  it as HTML on the clipboard?
  
 The added value is that you are able to paste the text into a word
 processing program like AbiWord, MS Word or StarWriter in a way that
 the HTML-Tags are not shown, but are interpreted by the word
 processing program in order to format the text as it would be
 formatted in a HTML browser.
 
 To achieve this know, I only see one way: Convert your text to HTML,
 then save it as HTML, open it with a web browser, copy it from here
 into the clipboard and paste it into a word processing program.

Why don't these programs offer the option paste as HTML?  I mean, the
user must have a choice if he wants the HTML as text or the resulting
markup.

-- 
From know your smileys:
 :}  You lie like Pinocchio

 /// 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: Paste as HTML

2006-10-21 Thread Mathias Michaelis
Hello Tony

 To achieve this know, I only see one way: Convert your text to HTML,
 then save it as HTML, open it with a web browser, copy it from here
 into the clipboard and paste it into a word processing program.
 
 What about opening the HTML file directly as RTF in a word processor?

I guess the original poster wants to insert code snippets into an
already existing documentation.

Regards

Mathias


Re: insert-mode :map-alt-keys and 8-bit locales

2006-10-21 Thread Martin Stubenschrott
On Sun, Oct 22, 2006 at 01:31:09AM +0400, Alexey I. Froloff wrote:
  Vim should _support_ Meta-Sends-Escape mode which is A Must Have
  for non-ascii 8-bit locales
 Patch attached.
 
 New option - 'eightbitmeta' ('em'), default on.  If unset, two
 things happen:

I like the idea, but did not test the patch yet. I did not get alt-keys
work properly with the meta8 option in urxvt set.

--
Martin