Re: Fwd: A replacement for syntax/zsh.vim

2007-03-13 Thread Martin Krischik
Am Montag 12 März 2007 schrieb Nikolai Weibull:

 As nothing has happened with this yet, Im sending it out again.  I
 really think it's time we make the switch.  Felix has had ample
 opportunity to oppose this (over two years, in fact), and yet has not
 responded even once.  I don't want to seem like a yerk, but my syntax
 definition is better.

The syntax files for Z-Shell are realy out of date and it is time to replace 
them. I would suggest you add your stuff to http://www.vim.org so we can all 
have a look. Only last week I was looking for a better Z-Shell mode and found 
none ;-)

I did the same for the Ada Syntax - which I now maintain [1]. I did not only 
go for the syntax itself but for a more integrated solution. Wit Vim 7 there 
are al lot more options open. For example I maintain a directory of Ada 
keywords, pragmas, attributes which I then use for both syntax highlight, 
code completions and other stuff. Of corse all inside an autoload script 
which will only be loaded when Ada code is actually edited.

Martin

[1] http://www.vim.org/scripts/script.php?script_id=1609
-- 
Martin Krischik
mailto://[EMAIL PROTECTED]


pgpNNKbnLASPc.pgp
Description: PGP signature


Re: Fwd: A replacement for syntax/zsh.vim

2007-03-13 Thread Bram Moolenaar

Nikolai Weibull wrote:

 As nothing has happened with this yet, Im sending it out again.  I
 really think it's time we make the switch.  Felix has had ample
 opportunity to oppose this (over two years, in fact), and yet has not
 responded even once.  I don't want to seem like a yerk, but my syntax
 definition is better.

OK, I'll include this version.

-- 
**  Hello and Welcome to the Psychiatric Hotline **
If you are obsessive-compulsive, please press 1 repeatedly.
If you are co-dependent, please ask someone to press 2.
If you have multiple personalities, please press 3, 4, 5 and 6.
If you are paranoid-delusional, we know who you are and what you want
   - just stay on the line so we can trace the call.
If you are schizophrenic, listen carefully and a little voice will
   tell you which number to press next.
If you are manic-depressive, it doesn't matter which number you press
   - no one will answer.
If you suffer from panic attacks, push every button you can find.
If you are sane, please hold on - we have the rest of humanity on the
other line and they desparately want to ask you a few questions.

 /// 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///


Financial report ICCF available

2007-03-13 Thread Bram Moolenaar

Greetings, Vim users!

The ICCF Holland foundation is Vim's charity.  Vim users are asked to
consider helping needy children in Kibaale, Uganda.  Since April 2006
the Vim sponsorship and registration is also destined for this project.

The financial report for 2006 is now available.  You can find it here:
http://iccf-holland.org/jaar2006.pdf

There is also a Dutch version:
http://iccf-holland.org/jaar2006n.pdf

I'm glad to report that the total revenue has increased by 25%.  Mainly
because of Vim sponsorship.  Thanks to all the people who donated!

More information about ICCF Holland on the website:
http://iccf-holland.org

I hope to visit the project before the summer and report how the money
is being used.

-- 
Proverb: A nightingale that forgets the lyrics is a hummingbird.

 /// 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: Fwd: A replacement for syntax/zsh.vim

2007-03-13 Thread Nikolai Weibull

On 3/13/07, Bram Moolenaar [EMAIL PROTECTED] wrote:


Nikolai Weibull wrote:

 As nothing has happened with this yet, Im sending it out again.  I
 really think it's time we make the switch.  Felix has had ample
 opportunity to oppose this (over two years, in fact), and yet has not
 responded even once.  I don't want to seem like a yerk, but my syntax
 definition is better.

OK, I'll include this version.


Thank you.

 nikolai


Re: Best way to repeat a sequence of keystrokes/commands with a single keypress ?

2007-03-13 Thread Ivan Vecerina
Tim Chase [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
:  While editing a file, I decide to rename someIdentifier to
:  someIdentifier_ - I will need to append the underscore to
:  several (but usually not all) instances of the word.
: 
: The typical way to do this would be something like
: 
:   :%s/\someIdentifier\/_/g
: 
: If you want confirmation, you can use
: 
:   :%s/\someIdentifier\/_/gc

Ok. So a possible shortcut to type this could be:
   *:%s/C-R//_/gc
Then: yn to accept/reject substitutions.

:  The same would happen if I want to rename wonderfulFoo to
: 
:  wonderfulBar.  I tend to type:   *fFceBarESC
: 
: Similarly, one would do something like
: 
:   :%s/\wonderfulFoo\/wonderfulBar/g

Makes sense.
Yet I liked the alternative:

: [...]  For your second example, you have to do a
: little tweaking, as you want to be 3 characters from the
: end, you have to use
: 
:   /someIdentifier/e-2

Nice!  Damn, I remember reading about this flag,
but I failed to think of using it !
So here, the find + replace end of word can be
typed as:   */C-R//e-2CRceBarESC
Then: n.n to accept/reject substitutions.

[ snipped: examples of the power of :s/.../ ]

I like the simplicity/predictability of n., especially when reworking a 
function/small block within a larger file.
But I am not petrified by regular expressions either -- I have been doing some 
perl programming (though I really am a C++ veteran).
After 8 months of vimming (I started with http://www.viemu.com/), it is time 
for me to get more fluent with Ex commands.

Just let me first enjoy the /../e trick for a couple of weeks...

: Hope this helps,

It did !  Thanks a lot.

[ Thank you Tony as well for the additional references and advice for 
multi-file substitutions. ]


Kind regards,
Ivan


-- 
http://ivan.vecerina.com/





 

TV dinner still cooling? 
Check out Tonight's Picks on Yahoo! TV.
http://tv.yahoo.com/


Maximize gvim at startup

2007-03-13 Thread Mr. Shawn H. Corey

Hi,

I'm running Ubuntu 6.10 on a PowerBook 4 under GNOME. Is there any 
command I can put inn my .gvimrc that will maximize the window at 
startup? I tried:


  :autocmd GUIEnter * simalt F10

But simalt does not work in Linux.

I may not know much about GUIs but ever one I read so far has an API 
call that maximizes the window. So, what's the best way to do this?



--
Just my 0.0002 million dollars worth,
   Shawn

For the things we have to learn before we can do them, we learn by 
doing them.

  Aristotle


match html tag

2007-03-13 Thread Akbar

Hi,

I have this part of html file:
div id=bu
 phaha/p
/div

The cursor is in first line (the opening div). When I hit certain key,
the cursor will go to the third line (the closing div). There is a
script to achieve this. I just forgot the name. Could you tell me the
name?

Thank you.


Re: match html tag

2007-03-13 Thread Albie Janse van Rensburg
You are looking for %.  In order to enable the use of it, you need to 
enable the matchit plugin.  See :help matchit


Regards
Albie

Akbar wrote:

Hi,

I have this part of html file:
div id=bu
 phaha/p
/div

The cursor is in first line (the opening div). When I hit certain key,
the cursor will go to the third line (the closing div). There is a
script to achieve this. I just forgot the name. Could you tell me the
name?

Thank you.





--
Albie Janse van Rensburg (neonpill)

Registered Linux User 438873 | http://counter.li.org

and composed by a woman's three best comforters, - kind words, a 
baby,find even your light yoke heavy.


Re: Selecting tag opens file in a new tab - how?

2007-03-13 Thread A.J.Mechelynck

Zarko Coklin wrote:

And Tony does it again ;-)

Thanks Tony!

~~~
Zarko Coklin wrote:

Is it possible to have a setup in .vimrc so that

every

time I select tag either through CTRL-] or by
holding CTRL and pressing left mouse click to open a
new buffer in a new tab?

Regards,
Zarko Coklin


:map C-]  :exe tab stag
expand(cword)CR
:map C-LeftMouse  :exe tab stag
expand(cword)CR

See
:help :tab
:help :stag
:help cword

Note:
:tab wincmd ]CR
ought to work but doesn't.



Best regards,
Tony.


Starting with patchlevel 7.0.216, :tab wincmd ] now opens the definition of 
the tag under the cursor in a new tab. The table of contents of the patches 
(with a one-line description of each) is available at (for Vim 7.0) 
http://ftp.vim.org/pub/vim/patches/7.0/README


For a mapping in the vimrc, ':exe tab stag expand(cword)' (without the 
single quotes) might be safer, since it also works with earlier patchlevels of 
Vim 7.



Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
105. When someone asks you for your address, you tell them your URL.



Re: Maximize gvim at startup

2007-03-13 Thread A.J.Mechelynck

Mr. Shawn H. Corey wrote:

Hi,

I'm running Ubuntu 6.10 on a PowerBook 4 under GNOME. Is there any 
command I can put inn my .gvimrc that will maximize the window at 
startup? I tried:


  :autocmd GUIEnter * simalt F10

But simalt does not work in Linux.

I may not know much about GUIs but ever one I read so far has an API 
call that maximizes the window. So, what's the best way to do this?





The portable way to maximize gvim at startup (well, with maybe at times a 
one-character-cell rounding error in the size of the Vim screen) is


if has(gui_running)
set lines= columns=
endif

The above (which is in my .vimrc) used to work for me on Windows, and still 
works for me now that I'm on SuSE Linux.


Like the 'guifont' setting (and maybe others), 'lines' and 'columns', when set 
in the vimrc, are remembered by gvim, and applied at GUI startup.



Best regards,
Tony.
--
With a gentleman I try to be a gentleman and a half, and with a fraud I
try to be a fraud and a half.
-- Otto von Bismark



Re: match html tag

2007-03-13 Thread Akbar

I still have problem. % does perfectly in C source code (mathing curly
braces). But it does nothing in html tag for html file. Any idea?

Sorry for double post for Albie.

On 3/13/07, Albie Janse van Rensburg [EMAIL PROTECTED] wrote:

You are looking for %.  In order to enable the use of it, you need to
enable the matchit plugin.  See :help matchit

Regards
Albie

Akbar wrote:
 Hi,

 I have this part of html file:
 div id=bu
  phaha/p
 /div

 The cursor is in first line (the opening div). When I hit certain key,
 the cursor will go to the third line (the closing div). There is a
 script to achieve this. I just forgot the name. Could you tell me the
 name?

 Thank you.




--
Albie Janse van Rensburg (neonpill)

Registered Linux User 438873 | http://counter.li.org

and composed by a woman's three best comforters, - kind words, a
baby,find even your light yoke heavy.



Re: Maximize gvim at startup

2007-03-13 Thread Mr. Shawn H. Corey

A.J.Mechelynck wrote:
The portable way to maximize gvim at startup (well, with maybe at times 
a one-character-cell rounding error in the size of the Vim screen) is


if has(gui_running)
set lines= columns=
endif

The above (which is in my .vimrc) used to work for me on Windows, and 
still works for me now that I'm on SuSE Linux.


Like the 'guifont' setting (and maybe others), 'lines' and 'columns', 
when set in the vimrc, are remembered by gvim, and applied at GUI 
startup.


Yes, except for the help for columns:

'columns' 'co'  number  (default 80 or terminal width)
global
{not in Vi}
Number of columns of the screen.  Normally this is set by the terminal
initialization and does not have to be set by hand.  Also see
|posix-screen-size|.
When Vim is running in the GUI or in a resizable window, setting this
option will cause the window size to be changed.  When you only want
to use the size for the GUI, put the command in your |gvimrc| file.
When you set this option and Vim is unable to change the physical
number of columns of the display, the display may be messed up.
Minimum value is 12, maximum value is 1.

It's the part about messing up the display that concerns me. I have 
tried this on other systems and sometimes it works and other times it 
creates a window very much larger than the screen. Why it's there a 
command to simply maximize the window?



--
Just my 0.0002 million dollars worth,
   Shawn

For the things we have to learn before we can do them, we learn by 
doing them.

  Aristotle


Re: match html tag

2007-03-13 Thread Albie Janse van Rensburg

Hello Akbar

You replied to my address only, so I'm copying the list in on this.  In 
future, use Reply to list if your mail client supports it, or Reply 
to All, just so we all can share.


Have you set the filetype correctly in your HTML file?  Matchit works 
off the filetype definitions to determine pairings.  To set it, use:


:set ft=html

Regards
Albie

Akbar wrote:

I still have problem. % does perfectly in C source code (mathing curly
braces). But it does nothing in html tag for html file. Any idea?

On 3/13/07, Albie Janse van Rensburg [EMAIL PROTECTED] wrote:

You are looking for %.  In order to enable the use of it, you need to
enable the matchit plugin.  See :help matchit

Regards
Albie

Akbar wrote:
 Hi,

 I have this part of html file:
 div id=bu
  phaha/p
 /div

 The cursor is in first line (the opening div). When I hit certain key,
 the cursor will go to the third line (the closing div). There is a
 script to achieve this. I just forgot the name. Could you tell me the
 name?

 Thank you.







Re: Maximize gvim at startup

2007-03-13 Thread François Ingelrest

On 3/13/07, Mr. Shawn H. Corey [EMAIL PROTECTED] wrote:
Why it's there a command to simply maximize the window?


Because it's managed by the window manager, not by the app itself. You
may be able to set the size to what your screen is able to display,
but I don't think you'll be able to really maximize the window.


Re: How to switch between horizontal split and vertical split?

2007-03-13 Thread Jean-Rene David
* Peng Yu [2007.03.13 12:15]:
 Suppose I have horizontal splited window1 and
 window2, is there any way to change them into
 vertical split and vice versa?

CTRL-W H
CTRL-W J

Note the capital H and J.

-- 
JR


Re: match html tag

2007-03-13 Thread Albie Janse van Rensburg
Matchit seems to come standard with all versions of Vim I have had the 
pleasure to use these days.  On the standard Vim 7.0 you get for 
Windows, as well as for Gentoo, I have had matchit included, with 
specific instructions in the help using matchit as the typical example 
for plugins.


From usr_05.txt:

*05.5*Adding a help file*add-local-help* *matchit-install*

If you are lucky, the plugin you installed also comes with a help file.  We
will explain how to install the help file, so that you can easily find help
for your new plugin.
  Let us use the matchit.vim plugin as an example (it is included with
Vim).  This plugin makes the % command jump to matching HTML tags,
if/else/endif in Vim scripts, etc.  Very useful, although it's not backwards
compatible (that's why it is not enabled by default).
  This plugin comes with documentation: matchit.txt.  Let's first 
copy the

plugin to the right directory.  This time we will do it from inside Vim, so
that we can use $VIMRUNTIME.  (You may skip some of the mkdir commands if
you already have the directory.) 

Regards
Albie

Jean-Rene David wrote:

* Albie Janse van Rensburg [2007.03.13 10:00]:
  

You are looking for %.  In order to enable the
use of it, you need to enable the matchit
plugin.  See :help matchit



matchit is an external plugin.

http://www.vim.org/scripts/script.php?script_id=39

  



--
Albie Janse van Rensburg (neonpill)

Registered Linux User 438873 | http://counter.li.org

and composed by a woman's three best comforters, - kind words, a 
baby,find even your light yoke heavy.


Re: Maximize gvim at startup

2007-03-13 Thread Mr. Shawn H. Corey

fREW wrote:

What you may want to do is look into your GNOME documentation.  Most
window managers have options on what to do with certain apps when they
run.  For instance I have firefox load in one virtual desktop, and I
have amaroK load in another, and I have eclipse run fullscreen.
Surely there are options similar to that for whatever GNOME uses
nowadays (metacity?).
-fREW


I notice that many applications re-open with the whatever size they had 
when they were closed. I think GNOME records their size and since they 
don't request any size at startup, GNOME resets it to what it was at the 
last close.


I will look in the documentation to see if I can find something but I 
expect it to be a long time.



--
Just my 0.0002 million dollars worth,
   Shawn

For the things we have to learn before we can do them, we learn by 
doing them.

  Aristotle


Re: Maximize gvim at startup

2007-03-13 Thread A.J.Mechelynck

Mr. Shawn H. Corey wrote:

A.J.Mechelynck wrote:
The portable way to maximize gvim at startup (well, with maybe at 
times a one-character-cell rounding error in the size of the Vim 
screen) is


if has(gui_running)
set lines= columns=
endif

The above (which is in my .vimrc) used to work for me on Windows, and 
still works for me now that I'm on SuSE Linux.


Like the 'guifont' setting (and maybe others), 'lines' and 'columns', 
when set in the vimrc, are remembered by gvim, and applied at GUI 
startup.


Yes, except for the help for columns:

'columns' 'co'number(default 80 or terminal width)
global
{not in Vi}
Number of columns of the screen.  Normally this is set by the terminal
initialization and does not have to be set by hand.  Also see
|posix-screen-size|.
When Vim is running in the GUI or in a resizable window, setting this
option will cause the window size to be changed.  When you only want
to use the size for the GUI, put the command in your |gvimrc| file.
When you set this option and Vim is unable to change the physical
number of columns of the display, the display may be messed up.
Minimum value is 12, maximum value is 1.

It's the part about messing up the display that concerns me. I have 
tried this on other systems and sometimes it works and other times it 
creates a window very much larger than the screen. Why it's there a 
command to simply maximize the window?





The messing up mostly applies (IIUC) to Vim running in a non-resizable 
console, such as /dev/tty where the number of lines and columns can only take 
a discrete set of values, not independently of each other, and with 'columns' 
often fixed at 80.


In the GUI, I have never had problems.

When gvim realizes that the user is trying to set more lines or columns than 
the viewport can hold, it resizes its application window down.


See another reply in this thread about the fact that maximizing is a function 
of the window manager, not of the application. (But then, why does :suspend 
-- a Vim ex-command -- _minimize_ the app window?)



Best regards,
Tony.
--
I'm for peace -- I've yet to see a man wake up in the morning and say
I've just had a good war.
   -- Mae West


Re: Maximize gvim at startup

2007-03-13 Thread Michael Klier
Mr. Shawn H. Corey wrote:
 François Ingelrest wrote:
 Because it's managed by the window manager, not by the app itself. You
 may be able to set the size to what your screen is able to display,
 but I don't think you'll be able to really maximize the window.
 
 Yes, but I thought there is a command in the window manager API that 
 allowed an application to make a request to maximize the window.

You may have a look at devilspie [1]  [2]. It`s a small app which
enables you to control the behavior of any application when it`s started
like resizing, pinning, skipping the pager, moving to another workspace
etc..  Also it doesn`t depend on a certain window manager (I`ve used
with GNOME and XFCE).

[1] http://live.gnome.org/DevilsPie
[2] http://www.burtonini.com/blog/computers/devilspie (official hp)

Regards
Michael

-- 
Michael Klier


signature.asc
Description: Digital signature


Re: Maximize gvim at startup

2007-03-13 Thread A.J.Mechelynck

Mr. Shawn H. Corey wrote:

François Ingelrest wrote:

Because it's managed by the window manager, not by the app itself. You
may be able to set the size to what your screen is able to display,
but I don't think you'll be able to really maximize the window.



Yes, but I thought there is a command in the window manager API that 
allowed an application to make a request to maximize the window.





Maybe there is, yet even if there is, it doesn't mean that gvim takes 
advantage of it. In particular, and in constrast with M$-Windows, under X 
there are many possible different window managers. (I don't know but I suspect 
that) this multiplicity might make the matter more difficult.



Best regards,
Tony.
--
Dare to be naive.
-- R. Buckminster Fuller


Re: Maximize gvim at startup

2007-03-13 Thread J. Erik Heinz
Mr. Shawn H. Corey [EMAIL PROTECTED] words
on 13.03.2007 - 09:28 (-0400 Zulu-Time):

 I'm running Ubuntu 6.10 on a PowerBook 4 under GNOME. Is there any 
 command I can put inn my .gvimrc that will maximize the window at 
 startup? I tried:
 
   :autocmd GUIEnter * simalt F10
 
 But simalt does not work in Linux.
 
 I may not know much about GUIs but ever one I read so far has an API 
 call that maximizes the window. So, what's the best way to do this?

on X the most application take the params --geometry or -g. With this
you can define the with, height and startposition ( top, left )

In gnome I have mapped the C-ö to maximise/unmaximize the current
window. Works perfect for me. 


Cheers -- Erik 
-- 
J. Erik Heinz
Keyboard-samuraing in process

:: All non-mailinglist mail to this emailadress will be deleted.

Xing: https://www.xing.com/profile/JErik_Heinz
Blog: http://jerik.blogspot.com


Re: Maximize gvim at startup

2007-03-13 Thread A.J.Mechelynck

Mr. Shawn H. Corey wrote:

fREW wrote:

What you may want to do is look into your GNOME documentation.  Most
window managers have options on what to do with certain apps when they
run.  For instance I have firefox load in one virtual desktop, and I
have amaroK load in another, and I have eclipse run fullscreen.
Surely there are options similar to that for whatever GNOME uses
nowadays (metacity?).
-fREW


I notice that many applications re-open with the whatever size they had 
when they were closed. I think GNOME records their size and since they 
don't request any size at startup, GNOME resets it to what it was at the 
last close.


I will look in the documentation to see if I can find something but I 
expect it to be a long time.





Gvim compiled with GNOME support (which is not the default: a configure option 
is required) transparently restarts its latest session, with your latest 
editfile(s), at GNOME or kde startup when it was *implicitly* shut down at the 
previous shutdown of the GNOME or kde window manager (shut down by a message 
from the window manager and *not* by a ZZ or :q command). This session startup 
script is stored in a separate GNOME directory in order to avoid interference 
with your own sessions; it doesn't store the position and size of the Vim 
window since restoring that is the window manager's job However, the window 
role (whatever that is) is stored and restored by gvim versions compiled for 
GTK2+GNOME.


See :help gnome-session.

GNOME support requires a GTK1 or GTK2 GUI; it is mentioned on the 3rd or 4th 
line of output of the :version command, for instance as follows:


Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):


Best regards,
Tony.
--
Computers are not intelligent.  They only think they are.


OmniCompletion for C#/.NET

2007-03-13 Thread fREW

Does anyone here know if there is anyone trying to set up
omnicompletion for C#/.NET?  I know that you can get vim for visual
studio, but that doesn't work with the express editions, which is what
I am stuck with when I code almost anywhere other than my personal
computer.

Thanks in advance!
-fREW


Re: match html tag

2007-03-13 Thread A.J.Mechelynck

Akbar wrote:

Hi,

I have this part of html file:
div id=bu
 phaha/p
/div

The cursor is in first line (the opening div). When I hit certain key,
the cursor will go to the third line (the closing div). There is a
script to achieve this. I just forgot the name. Could you tell me the
name?

Thank you.



matchit. It is distributed with Vim but not installed by default, because it 
conflict with the vi use of the % key. To install it, use the following 
shell commands in an xterm or Dos Box:


- On Unix/Linux:

cd $HOME
mkdir -vp .vim/plugin
mkdir -vp .vim/doc
cd .vim/plugin
ln -vs /usr/local/share/vim/vim70/macros/matchit.vim
cd ../doc
ln -vs /usr/local/share/vim/vim70/macros/matchit.txt
vim --cmd helptags . |quit

- On Windows (untested):

cd %HOMEDRIVE%%HOMEPATH%
if not exist vimfiles md vimfiles
if not exist vimfiles\plugin md vimfiles\plugin
if not exist vimfiles\doc md vimfiles\doc
copy con vimfiles\plugin\matchit.vim
runtime macros/matchit.vim
^Z
copy C:\Program Files\Vim\vim70\macros\matchit.txt vimfiles\doc
gvim --cmd helptags ~/vimfiles/doc |quit

where ^Z means hit the Ctrl-Z key to close the file being typed-in at the 
console.


Once matchit is installed, then starting at the next Vim startup, (1) hitting 
% will go shuttle between  and  of the div tag, or between div and 
/div, depending on the cursor position within the tag, and (2) :help 
matchit.txt will give you more details about how to use it.



Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
106. When told to go to your room you inform your parents that you
 can't...because you were kicked out and banned.


Re: VimTips Wiki: New Direction

2007-03-13 Thread Martin Krischik
Am Dienstag 06 März 2007 schrieb Tobias Pflug:
 If I might add my impression:

 Generally I think it is indeed quite likable. Just some thoughts :

 Looking at :
 http://en.wikibooks.org/wiki/Learning_the_vi_editor/Vim/TipsSandbox/Tip_1:_
the_super_star

Hello,

The first thing I noticed it the endless additional notes. That is not how 
things are done on Wikibooks - if you want to add comments then they have to 
go to the discussion page which is attached to each article page.

Remember Wikibooks is not an Internet-Forum - it's about Books and you would 
not write a book this way.

Martin
-- 
Martin Krischik
mailto://[EMAIL PROTECTED]


pgpM4pPfpqjG7.pgp
Description: PGP signature


Re: How to switch between horizontal split and vertical split?

2007-03-13 Thread A.J.Mechelynck

Peng Yu wrote:

Hi,

Suppose I have horizontal splited window1 and window2, is there any
way to change them into vertical split and vice versa?

Thanks,
Peng



To change *two* vertically split windows to horizonally split

^Wt^WK

Horizontally to vertically:

^Wt^WH

where ^W means hit Ctrl-W.
Explanations:

^Wt makes the first (topleft) window current
^WK moves the current window to full-width at the very top
^WH moves the current window to full-height at far left

see
:help window-move-cursor
:help window-moving


Best regards,
Tony.
--
Down with categorical imperative!


@=

2007-03-13 Thread Michael Phillips
Would someone please explain the usage of @=.  I am getting confuse from the
help file.

[EMAIL PROTECTED]   Matches the preceding atom with zero width. {not in Vi}
Like (?=pattern) in Perl.
Example matches ~
foo\(bar\)[EMAIL PROTECTED] foo in foobar
foo\(bar\)[EMAIL PROTECTED] nothing


To me, the second example matches nothing because there is no foo in between
the \( and \)

The first example, I am all confused.  If someone can enlighten me, I would be
greatful.






Michael D. Phillips - A computer science enthusiast
I do not hate Windows, I just like the alternatives better.
Linux is my primary choice.


 

Don't get soaked.  Take a quick peek at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather


Re: OmniCompletion for C#/.NET

2007-03-13 Thread A.J.Mechelynck

fREW wrote:

Does anyone here know if there is anyone trying to set up
omnicompletion for C#/.NET?  I know that you can get vim for visual
studio, but that doesn't work with the express editions, which is what
I am stuck with when I code almost anywhere other than my personal
computer.

Thanks in advance!
-fREW



Omnicompletion is for editing files within Vim. This bears no relation with 
embedding Vim in Visual Studio.


Have you tried using it? You may need to run Exuberant Ctags first in order to 
generate a tags file for your project.


See :help ft-c-omni.

A _limited_ form of omnicompletion can be used with almost any filetype and 
without tags, provided that syntax highlighting is on (because it relies on 
syntax keywords etc.). It is set up by


:setlocal omnifunc=syntaxcomplete#Complete

To set it only when no other omni completion is set up by the filetype plugin, 
use

:autocmd Syntax * if omnifunc == 
\ | setl omnifunc=syntaxcomplete#Complete
\ | endif


Best regards,
Tony.
--
The Schizophrenic: An Unauthorized Autobiography


Re: Best way to repeat a sequence of keystrokes/commands with a single keypress ?

2007-03-13 Thread Karl Guertin

I flip between ex commands and macros for semi-automated file
conversion and most of what I'd say has been covered, but I'll toss in
a personal quirk from my .vimrc.

By default, both ` and ' do approximately the same thing in that they
jump to a mark (' is a linewise `, it positions the cursor at ^ in the
destination line). Since I don't find ' to be particularly useful, I
remap it to @a and record my macros to a (qa...q):

 executes the macro in register a
 nnoremap ' @a

 repeats the macro in register a for the entire visual selection
 xnoremap ' :normal @aCR

I find this to be convenient and it provided an easy way to
record/execute macros when I was learning vim.


Re: VimTips Wiki: New Direction

2007-03-13 Thread Martin Krischik
Am Dienstag 06 März 2007 schrieb Tobias Pflug:
 If I might add my impression:

 Generally I think it is indeed quite likable. Just some thoughts :

 Looking at :
 http://en.wikibooks.org/wiki/Learning_the_vi_editor/Vim/TipsSandbox/Tip_1:_
the_super_star

Hello,

The first thing I noticed it the endless additional notes. That is not how 
things are done on Wikibooks - if you want to add comments then they have to 
go to the discussion page which is attached to each article page.

Remember Wikibooks is not an Internet-Forum - it's about Books and you would 
not write a book this way.

Martin
-- 
Martin Krischik
mailto://[EMAIL PROTECTED]


pgptMzFsl6ruA.pgp
Description: PGP signature


Re: @=

2007-03-13 Thread Tim Chase

Would someone please explain the usage of @=. I am getting
confuse from the  help file.

[EMAIL PROTECTED]   Matches the preceding atom with zero width. {not in Vi}
Like (?=pattern) in Perl.
Example matches ~
foo\(bar\)[EMAIL PROTECTED] foo in foobar
foo\(bar\)[EMAIL PROTECTED] nothing


To me, the second example matches nothing because there is
no foo in between the \( and \)

The first example, I am all confused.  If someone can
enlighten me, I would be greatful.


The pattern

\(...\)[EMAIL PROTECTED]

is interpreted as make sure that this matches here, but don't 
consume any of the characters so that things after the '=' begin 
at the same point as this.


In the first example, as stated it matches the foo in foobar 
because the bar can be found after the foo, but it doesn't 
become part of the match.  To see this as you're playing around, 
it's helpful to have


:set hls

so you can see what matches.

In the second example, the regexp is asking for two disjoint 
things:  foo followed by bar and also followed by a second 
foo.  It might be more clear if foo wasn't used twice:


/foo\(bar\)[EMAIL PROTECTED]

This would match nothing as well, as it asks for foo followed 
immediately by bar as well as foo followed immediately by fred.


For most uses, this isn't very helpful and can be more clearly 
expressed as


/foo\zebar

where the \ze means and I want the pattern to stop matching here.

I can concoct crazy uses for the [EMAIL PROTECTED] where it might be useful 
but most of them are refactorable:


/foo\([[:print:]]+\)[EMAIL PROTECTED]

could become

/foo[a-z]\ze[[:print:]]*

One could also use it for crazy filtering:

/foo\(\%(.[aeiou]\)\{5}\)[EMAIL PROTECTED]

This would ensure that you have five pairs of word-characters 
(\w) followed by a vowel following foo, and that the 4th 
letter following foo is an a.  The above could be written 
without using [EMAIL PROTECTED] as something ilke


/foo\w[aeiou]\wa\w[aeiou]\w[aeiou]\w[aeiou]

Readability is in the eye of the beholder. :)  With 2 characters 
times 5 instances plus 3+1+6, they balance out to about the same. 
 As those numbers get larger, using the [EMAIL PROTECTED] notation might prove 
more helpful.


This allows you to do some pattern intersection (in the 
set-theory definition of intersection) which might allow you to 
shorten the pattern if you have long stretches of things.  It 
might be helpful in DNA sequencing or something of the like, 
where one is hunting for certain patterns of A/C/G/T and want to 
ensure that a certain repeating pattern exists, and then at a 
certain point in that pattern a given item is more constrained. 
One might have an alternating sequence where you know you want 
something like agct followed by 75 alternating pairs


/agct\(\%([at][cg]\)\{75,}\)[EMAIL PROTECTED]

You can then tack on but position 28 through 30 must be 'gag' 
(I might be off-by-one here)


/agct\(\%([at][cg]\)\{75,}\)[EMAIL PROTECTED](.\{27}gag\)[EMAIL 
PROTECTED]

The result will only be the agct, but it will be followed by 
the context you need, as there might be many other instances of 
agct that you don't care about because they lack this context.


(the genetics example chosen as I've seen a couple 
genetics-searching related questions on the list)


As cautioned, they're fairly contrived instances, but I hope the 
above ramblings shed more light than they bewilder, and that 
using :set hls helps see what's considered when using the [EMAIL PROTECTED].


-tim






clone a vim session into a new tab

2007-03-13 Thread Kamaraju S Kusumanchi
Let's say I opened a 6 files in a 3X2 grid inside vim. Now I want to clone
this and have all the files at the same position, same window sizes etc.,
and put it into a new tab under the same vim session. Is there a command to
do this?

commands like tabe etc., open only a single file. But I want to open about 6
files and have the correct window sizes etc.,

Any ideas?

raju

-- 
Kamaraju S Kusumanchi
http://www.people.cornell.edu/pages/kk288/
http://malayamaarutham.blogspot.com/



Re: @= (thanks)

2007-03-13 Thread Michael Phillips
Thanks for replying.  The examples you gave me has help me to understand the
command.  I may not every use it.

Thanks for the info
Michael

--- Tim Chase [EMAIL PROTECTED] wrote:

  Would someone please explain the usage of @=. I am getting
  confuse from the  help file.
 
  [EMAIL PROTECTED]   Matches the preceding atom with zero width. {not in Vi}
  Like (?=pattern) in Perl.
  Example matches ~
  foo\(bar\)[EMAIL PROTECTED] foo in foobar
  foo\(bar\)[EMAIL PROTECTED] nothing
  
  
  To me, the second example matches nothing because there is
  no foo in between the \( and \)
  
  The first example, I am all confused.  If someone can
  enlighten me, I would be greatful.
 
 The pattern
 
   \(...\)[EMAIL PROTECTED]
 
 is interpreted as make sure that this matches here, but don't 
 consume any of the characters so that things after the '=' begin 
 at the same point as this.
 
 In the first example, as stated it matches the foo in foobar 
 because the bar can be found after the foo, but it doesn't 
 become part of the match.  To see this as you're playing around, 
 it's helpful to have
 
   :set hls
 
 so you can see what matches.
 
 In the second example, the regexp is asking for two disjoint 
 things:  foo followed by bar and also followed by a second 
 foo.  It might be more clear if foo wasn't used twice:
 
   /foo\(bar\)[EMAIL PROTECTED]
 
 This would match nothing as well, as it asks for foo followed 
 immediately by bar as well as foo followed immediately by fred.
 
 For most uses, this isn't very helpful and can be more clearly 
 expressed as
 
   /foo\zebar
 
 where the \ze means and I want the pattern to stop matching here.
 
 I can concoct crazy uses for the [EMAIL PROTECTED] where it might be useful 
 but most of them are refactorable:
 
   /foo\([[:print:]]+\)[EMAIL PROTECTED]
 
 could become
 
   /foo[a-z]\ze[[:print:]]*
 
 One could also use it for crazy filtering:
 
   /foo\(\%(.[aeiou]\)\{5}\)[EMAIL PROTECTED]
 
 This would ensure that you have five pairs of word-characters 
 (\w) followed by a vowel following foo, and that the 4th 
 letter following foo is an a.  The above could be written 
 without using [EMAIL PROTECTED] as something ilke
 
   /foo\w[aeiou]\wa\w[aeiou]\w[aeiou]\w[aeiou]
 
 Readability is in the eye of the beholder. :)  With 2 characters 
 times 5 instances plus 3+1+6, they balance out to about the same. 
   As those numbers get larger, using the [EMAIL PROTECTED] notation might 
 prove 
 more helpful.
 
 This allows you to do some pattern intersection (in the 
 set-theory definition of intersection) which might allow you to 
 shorten the pattern if you have long stretches of things.  It 
 might be helpful in DNA sequencing or something of the like, 
 where one is hunting for certain patterns of A/C/G/T and want to 
 ensure that a certain repeating pattern exists, and then at a 
 certain point in that pattern a given item is more constrained. 
 One might have an alternating sequence where you know you want 
 something like agct followed by 75 alternating pairs
 
   /agct\(\%([at][cg]\)\{75,}\)[EMAIL PROTECTED]
 
 You can then tack on but position 28 through 30 must be 'gag' 
 (I might be off-by-one here)
 
   /agct\(\%([at][cg]\)\{75,}\)[EMAIL PROTECTED](.\{27}gag\)[EMAIL 
 PROTECTED]
 
 The result will only be the agct, but it will be followed by 
 the context you need, as there might be many other instances of 
 agct that you don't care about because they lack this context.
 
 (the genetics example chosen as I've seen a couple 
 genetics-searching related questions on the list)
 
 As cautioned, they're fairly contrived instances, but I hope the 
 above ramblings shed more light than they bewilder, and that 
 using :set hls helps see what's considered when using the [EMAIL 
 PROTECTED].
 
 -tim
 
 
 
 
 


Michael D. Phillips - A computer science enthusiast
I do not hate Windows, I just like the alternatives better.
Linux is my primary choice.


 

Food fight? Enjoy some healthy debate 
in the Yahoo! Answers Food  Drink QA.
http://answers.yahoo.com/dir/?link=listsid=396545367


Re: clone a vim session into a new tab

2007-03-13 Thread Andy Wokula

Kamaraju S Kusumanchi schrieb:

Let's say I opened a 6 files in a 3X2 grid inside vim. Now I want to clone
this and have all the files at the same position, same window sizes etc.,
and put it into a new tab under the same vim session. Is there a command to
do this?

commands like tabe etc., open only a single file. But I want to open about 6
files and have the correct window sizes etc.,

Any ideas?

raju


Simple way (recommended or not, at least quick) with sessions:

:mks
 use ! to overwrite existing Session.vim
:tabnew
:so Session.vim

Just guessed it might work and it works.
Now I think sessions don't include tabpages.

Andy

--
EOM



___ 
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de


RE: [PATCH] minor doc update

2007-03-13 Thread Bram Moolenaar

Michael Wookey wrote:

  OTOH, the svn repository is known to lag behind the other
  repositories, sometimes by a week or more: diffing against it runs
  the risk of forking the code. IIUC, the latest on nluug.nl is also
  the latest official version at any point in time. You can compare
  the first line of the version you have with the one I showed above.
  I think it is wise to always diff against the latest known version,
  whichever it be: IOW, if your version is earlier than mine, it
  will imminently be obsoleted, even if your patch is not accepted.
 
 Excellent point.  Bram - what is your preference for documentation
 patches?

Mostly it doesn't matter much, especially for small changes like this
one.  For larger changes it's better to diff against the runtime files
on the ftp site.  These are more recent, since I don't send out patches
for runtime files (except when it's related to source code changes).

See http://www.vim.org/runtime.php

-- 
[clop clop]
GUARD #1:  Halt!  Who goes there?
ARTHUR:It is I, Arthur, son of Uther Pendragon, from the castle of
   Camelot.  King of the Britons, defeator of the Saxons, sovereign of
   all England!
GUARD #1:  Pull the other one!
  The Quest for the Holy Grail (Monty Python)

 /// 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: clone a vim session into a new tab

2007-03-13 Thread Kamaraju S Kusumanchi
Andy Wokula wrote:
 
 Simple way (recommended or not, at least quick) with sessions:
 
 :mks
  use ! to overwrite existing Session.vim
 :tabnew
 :so Session.vim
 
 Just guessed it might work and it works.
 Now I think sessions don't include tabpages.
 

This works although I use tabe instead of tabn. But there is a small
problem. If I have three already existing tabs, and if I want to clone only
the second tab into a new tab then it does not work. Any other suggestions?

thanks
raju

-- 
Kamaraju S Kusumanchi
http://www.people.cornell.edu/pages/kk288/
http://malayamaarutham.blogspot.com/



Financial report ICCF available

2007-03-13 Thread Bram Moolenaar

Greetings, Vim users!

The ICCF Holland foundation is Vim's charity.  Vim users are asked to
consider helping needy children in Kibaale, Uganda.  Since April 2006
the Vim sponsorship and registration is also destined for this project.

The financial report for 2006 is now available.  You can find it here:
http://iccf-holland.org/jaar2006.pdf

There is also a Dutch version:
http://iccf-holland.org/jaar2006n.pdf

I'm glad to report that the total revenue has increased by 25%.  Mainly
because of Vim sponsorship.  Thanks to all the people who donated!

More information about ICCF Holland on the website:
http://iccf-holland.org

I hope to visit the project before the summer and report how the money
is being used.

-- 
Proverb: A nightingale that forgets the lyrics is a hummingbird.

 /// 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: clone a vim session into a new tab

2007-03-13 Thread Andy Wokula

Kamaraju S Kusumanchi schrieb:

Andy Wokula wrote:

Simple way (recommended or not, at least quick) with sessions:

:mks
 use ! to overwrite existing Session.vim
:tabnew
:so Session.vim

Just guessed it might work and it works.
Now I think sessions don't include tabpages.



This works although I use tabe instead of tabn. But there is a small
problem. If I have three already existing tabs, and if I want to clone only
the second tab into a new tab then it does not work. Any other suggestions?

thanks
raju


Ok tabpages are included in the session per default.  Try
:set sessionoptions-=tabpages
first.

:help 'sessionoptions'

Then use again
:mks
 use ! to overwrite existing Session.vim
:tabnew
:so Session.vim 


Andy

--
EOM





___ 
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de


Case-sensitive match for :e under cygwin?

2007-03-13 Thread John Wiersba

When I use 
   :e file* 
under cygwin (a Unix emulator running on
Windows), I get an error saying E77: Too many filenames.  But in fact
there is only one such file.  However, there are other files matching
FILE*.  How can I turn off this behavior so that vim under cygwin performs
case-sensitive globbing?  I've searched the vim help pages but can't
seem to find it, if it exists.  For comparison, bash has a nocaseglob
option which, if set, matches  filenames in a case-insensitive fashion
when performing pathname expansion.  

P.S.  Thanks for vim!  Like thousands of other people, I use it everywhere: 
unix, windows, cygwin.

:version
VIM - Vi IMproved 7.0 (2006 May 7, compiled Oct 10 2006 10:07:11)
Included patches: 1-122
Compiled by
 [EMAIL PROTECTED]
Huge version without GUI.  Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+cryptv +cscope +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic
+emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path
+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
-xterm_clipboard -xterm_save
   system vimrc file: $VIM/vimrc
 user vimrc file: $HOME/.vimrc
  user exrc file: $HOME/.exrc
  fall-back for $VIM: /usr/share/vim
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2
Linking:
gcc   -L/usr/local/lib -o vim.exe   -lncurses  -liconv -lintl



 

We won't tell. Get more on shows you hate to love 
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265


Re: clone a vim session into a new tab

2007-03-13 Thread Kamaraju S Kusumanchi
Andy Wokula wrote:

 Ok tabpages are included in the session per default.  Try
 :set sessionoptions-=tabpages
 first.
 

Awesome! Thanks a lot!

 :help 'sessionoptions'
 

The help is a bit confusing. It says

There is no option to include tab pages yet, only the current tab page
is stored in the session. |tab-page|

But in reality, it stores all the tab pages. Is this a bug in the
documentation? or am I misreading something?

raju

-- 
Kamaraju S Kusumanchi
http://www.people.cornell.edu/pages/kk288/
http://malayamaarutham.blogspot.com/



How to paste while keep the cursor at the same place?

2007-03-13 Thread Peng Yu

Hi,

Suppose I use p to paste something, the cursor always goes to the end
of the pasted text. Is there any other key to paste will keep the
cursor before the pasted text?

Thanks,
Peng


How can a script know if we're running without X ?

2007-03-13 Thread A.J.Mechelynck

How can a Vim script know if we're running without an X connection?

Of course, some cases are obvious, such as

if has('unix')  !has('x11')

meaning we're on Unix with no X11 support compiled-in.

But what about an X-enabled Vim running in console mode, either with the -X 
command-line switch, or in a terminal with no access to an X server?


For instance, I might want to map the following

:map S-F5 ccC-R+

in my vimrc, to replace the current line with the clipboard. However that 
mapping should not be enabled if we have no access to the clipboard. So I wrap 
it in


if has(clipboard)  (term != linux)
:map S-F5 ccC-R+
:imap S-F5 C-OccC-R+
endif

which takes care of two cases:
- running with no clipboard support compiled-in
- running in the (non-X) linux console (aka /dev/tty)
It doesn't take care, however, of the case when an X-enabled Vim was started 
as vim -X in an xterm. Is there a way to check for that in vimscript?



Best regards,
Tony.
--
The government [is] extremely fond of amassing great quantities of
statistics.  These are raised to the _nth degree, the cube roots are
extracted, and the results are arranged into elaborate and impressive
displays.  What must be kept ever in mind, however, is that in every
case, the figures are first put down by a village watchman, and he puts
down anything he damn well pleases.
-- Sir Josiah Stamp


Re: clone a vim session into a new tab

2007-03-13 Thread Andy Wokula

Kamaraju S Kusumanchi schrieb:

Andy Wokula wrote:


Ok tabpages are included in the session per default.  Try
:set sessionoptions-=tabpages
first.



Awesome! Thanks a lot!


:help 'sessionoptions'



The help is a bit confusing. It says

There is no option to include tab pages yet, only the current tab page
is stored in the session. |tab-page|

But in reality, it stores all the tab pages. Is this a bug in the
documentation? or am I misreading something?

raju


Confuses me too.  Looks like some forgotten beta version note.

Andy

--
EOM


___ 
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de


Re: How can a script know if we're running without X ?

2007-03-13 Thread Cameron Simpson
On 13Mar2007 23:29, A.J.Mechelynck [EMAIL PROTECTED] wrote:
| How can a Vim script know if we're running without an X connection?
| Of course, some cases are obvious, such as
|   if has('unix')  !has('x11')
| meaning we're on Unix with no X11 support compiled-in.
| 
| But what about an X-enabled Vim running in console mode, either with the -X 
| command-line switch, or in a terminal with no access to an X server?

Examine the $DISPLAY environment variable. If non-empty, you have a X11
display.
-- 
Cameron Simpson [EMAIL PROTECTED] DoD#743
http://www.cskk.ezoshosting.com/cs/

...when my mood gets too hot and I find myself wandering beyond control I pull
out my motor-bike and hurl it at top speed through these unfit roads for hour
after hour. My nerves are jaded and gone near dead, so that nothing less than
hours of voluntary danger will prick them into life... - T.E. Lawrence 1923


Re: How can a script know if we're running without X ?

2007-03-13 Thread A.J.Mechelynck

Cameron Simpson wrote:

On 13Mar2007 23:29, A.J.Mechelynck [EMAIL PROTECTED] wrote:
| How can a Vim script know if we're running without an X connection?
| Of course, some cases are obvious, such as
|   if has('unix')  !has('x11')
| meaning we're on Unix with no X11 support compiled-in.
| 
| But what about an X-enabled Vim running in console mode, either with the -X 
| command-line switch, or in a terminal with no access to an X server?


Examine the $DISPLAY environment variable. If non-empty, you have a X11
display.


$DISPLAY means Vim was started from a shell running within X11. It doesn't 
mean Vim is aware of that X11 server. In particular, if Vim was started as 
vim -X in an xterm, $DISPLAY will be nonempty but attempts to read or write 
the clipboard or to use the +clientserver feature (both of which rely on X 
functions other than reading the keyboard or wtiting to the display) wouldn't 
work, even if they don't give an error (for instance, in that case reading @+ 
or writing to it gives no error, but the keyboard is neither read nor written).


For more clarification, please read the _whole_ of my previous post.


Best regards,
Tony.


Re: How can a script know if we're running without X ?

2007-03-13 Thread Luc Hermitte
Hello,

* On Tue, Mar 13, 2007 at 11:29:28PM +0100, A.J.Mechelynck [EMAIL PROTECTED] 
wrote:
 How can a Vim script know if we're running without an X connection?
 
 Of course, some cases are obvious, such as
 
   if has('unix')  !has('x11')
 
 meaning we're on Unix with no X11 support compiled-in.
 
 But what about an X-enabled Vim running in console mode, either with
 the -X command-line switch, or in a terminal with no access to an X
 server?
 [...]
 It doesn't take care, however, of the case when an X-enabled Vim was 
 started as vim -X in an xterm. Is there a way to check for that in 
 vimscript?

What about checking whether .gvimrc is sourced or not?
Testing also for has('x11') could be a way to be sure vim is compiled
for x11, and running with an X connection.

Reading the documentation from |.gvimrc|, it seems there are a few other
way to test for the fact you are running with graphics support.

Unless you want to also support vim running in console, and with X-term
support [1], this should do it. Otherwise, what about testing the
options vim was launched with (thanks to a system('ps
-relevant-options')) ?

HTH,


[1] I don't know whether it is relevant or not.
-- 
Luc Hermitte
http://hermitte.free.fr/vim/


gtk+ gvim and dwm

2007-03-13 Thread Michael F. Lamb

Hello,

I'm using the 'dwm' window manager in tiled layout, which enforces a 
fixed-size window. http://www.suckless.org/wiki/dwm


Using gtk+ gvim 7.0.122, with some combinations of guifont and 
guioptions settings, the vim command line ends up half-outside its 
window. It seems like it miscalculates the proper value for 'lines' 
given the available real estate. Makes it difficult to see what I'm 
typing, and further it corrupts any command output written on the bottom 
line (such as that from :make or :!ls).


My temporary solution has to bind something to ':set lines-=1' and punch 
it every time the window manager makes gvim resize, but that's annoying.


If I switch dwm to floating layout (which does not strictly enforce 
window size) the problem goes away; the number of lines is rounded down 
to fit on the screen, and the window manager's window decorations shrink 
to match that.


The problem does not seem to occur with lesstif gvim, however, lesstif 
gvim does not support the anti-aliased truetype font that I like.


If anybody has seen or solved this problem already, I'd be grateful for 
info. I haven't ruled out the (fairly new, very minimalist) window 
manager as the culprit, which is why I'm asking for advice here rather 
than posting a bug report. :)


If a proper solution isn't immediately apparent, is there instead 
perhaps a way to hook into the resize event, so I can do ':set lines-=1' 
automatically?


Thanks,
-Mike



Re: How can a script know if we're running without X ?

2007-03-13 Thread A.J.Mechelynck

Luc Hermitte wrote:

Hello,

* On Tue, Mar 13, 2007 at 11:29:28PM +0100, A.J.Mechelynck [EMAIL PROTECTED] 
wrote:

How can a Vim script know if we're running without an X connection?

Of course, some cases are obvious, such as

if has('unix')  !has('x11')

meaning we're on Unix with no X11 support compiled-in.

But what about an X-enabled Vim running in console mode, either with
the -X command-line switch, or in a terminal with no access to an X
server?
[...]
It doesn't take care, however, of the case when an X-enabled Vim was 
started as vim -X in an xterm. Is there a way to check for that in 
vimscript?


What about checking whether .gvimrc is sourced or not?
Testing also for has('x11') could be a way to be sure vim is compiled
for x11, and running with an X connection.

Reading the documentation from |.gvimrc|, it seems there are a few other
way to test for the fact you are running with graphics support.

Unless you want to also support vim running in console, and with X-term
support [1], this should do it. Otherwise, what about testing the
options vim was launched with (thanks to a system('ps
-relevant-options')) ?

HTH,


[1] I don't know whether it is relevant or not.


I'm on Linux, and I definitely want to support Vim running in console. Console 
Vim may access the clipboard and clientserver features but only if the 
following conditions are all fulfilled:

- compiled with +x11
- compiled with either +clipboard or +clientserver
- running in an X11 terminal emulator (xterm, konsole, gnome-terminal, etc.), 
not in a true (non-X) console

- the -X switch was not used on the command-line.

The ps solution is difficult to use, because there may be several instances of 
Vim running in parallel (whose prognames might or might not be different) and 
I want to make sure to access the current instance: so I would have to know 
the process ID of the current Vim and I don't know how to do that. Using 
system('ls -l /proc/self') wouldn't work, because that would return the PID of 
the ls process called by a subshell called by Vim.


system('ps -fC ' . v:progname)

will narrow the problem somewhat; but if the result is

UIDPID  PPID  C STIME TTY  TIME CMD
root 24547  4008  0 01:42 pts/500:00:00 vim
root 24919  3971  0 02:40 pts/200:00:00 vim -X
root 24929 25532  1 02:43 tty2 00:00:00 vim

then what? Are we 24547 (without the -X switch), 24919 (with the switch) or 
24929 (without the switch, but in /dev/tty2 which cannot access X)?




Maybe I'vound something... or have I?

(first try omitted, it didn't work)
(second try is better)
(third try:)

 (try to) detect whether we have clipboard and X
if has('clipboard')
let x = @+
let @+ = '--' . x
redir @
silent reg
redir END
let @+ = x
unlet x
let clipboard_present = (@ =~ '^+ ')
else
let clipboard_present = 0
endif
let X_available = has('x11')  clipboard_present

The above would fail in a Vim compiled with X support but without clipboard 
support. I think that that risk is negligible. Do you (or does anyone) see 
other cases where the above algorithm would fail? It relies on the fact that 
when the clipboard is not available (for whatever reason: not compiled-in, -X, 
or terminal with no X access) the :reg command never lists the + register, 
not even if we just yanked a nonempty value into it.


The above clobbers the unnamed register but anyway, I never expect it to be 
conserved by long-timed operations such as restarting Vim or sourcing a Vim 
script. I expect the following results from the above code snippet:


X_available == 0
clipboard_present == 1
non-X with clipboard (e.g. Windows version)

X_available == 1
clipboard_present == 1
Vim is connected to X server (gvim, or Console Vim with X)

X_available == 1
clipboard_present == 0
never

X_available == 0
clipboard_present == 0
no clipboard (for whatever reason)


Best regards,
Tony.
--
Pittsburgh Driver's Test

(8) Pedestrians are

(a) irrelevant.
(b) communists.
(c) a nuisance.
(d) difficult to clean off the front grille.

The correct answer is (a).  Pedestrians are not in cars, so they are
totally irrelevant to driving; you should ignore them completely.


Re: gtk+ gvim and dwm

2007-03-13 Thread A.J.Mechelynck

Michael F. Lamb wrote:

Hello,

I'm using the 'dwm' window manager in tiled layout, which enforces a 
fixed-size window. http://www.suckless.org/wiki/dwm


Using gtk+ gvim 7.0.122, with some combinations of guifont and 
guioptions settings, the vim command line ends up half-outside its 
window. It seems like it miscalculates the proper value for 'lines' 
given the available real estate. Makes it difficult to see what I'm 
typing, and further it corrupts any command output written on the bottom 
line (such as that from :make or :!ls).


My temporary solution has to bind something to ':set lines-=1' and punch 
it every time the window manager makes gvim resize, but that's annoying.


If I switch dwm to floating layout (which does not strictly enforce 
window size) the problem goes away; the number of lines is rounded down 
to fit on the screen, and the window manager's window decorations shrink 
to match that.


The problem does not seem to occur with lesstif gvim, however, lesstif 
gvim does not support the anti-aliased truetype font that I like.


If anybody has seen or solved this problem already, I'd be grateful for 
info. I haven't ruled out the (fairly new, very minimalist) window 
manager as the culprit, which is why I'm asking for advice here rather 
than posting a bug report. :)


If a proper solution isn't immediately apparent, is there instead 
perhaps a way to hook into the resize event, so I can do ':set lines-=1' 
automatically?


Thanks,
-Mike




GTK+1 or GTK+2? In some respects, these are quite different animals.

Otherwise I can't much help you: I'm using kwm, not dwm, and it behaves 
differently: e.g. there is an Unclutter Windows command, but it will only 
tile the windows if they are already small enough to all fit on the screen 
without resizing.



Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
108. While reading a magazine, you look for the Zoom icon for a better
 look at a photograph.


Re: Case-sensitive match for :e under cygwin?

2007-03-13 Thread fREW

On 3/13/07, John Wiersba [EMAIL PROTECTED] wrote:


When I use
   :e file*
under cygwin (a Unix emulator running on
Windows), I get an error saying E77: Too many filenames.  But in fact
there is only one such file.  However, there are other files matching
FILE*.  How can I turn off this behavior so that vim under cygwin performs
case-sensitive globbing?  I've searched the vim help pages but can't
seem to find it, if it exists.  For comparison, bash has a nocaseglob
option which, if set, matches  filenames in a case-insensitive fashion
when performing pathname expansion.

P.S.  Thanks for vim!  Like thousands of other people, I use it everywhere: 
unix, windows, cygwin.

:version
VIM - Vi IMproved 7.0 (2006 May 7, compiled Oct 10 2006 10:07:11)
Included patches: 1-122
Compiled by
 [EMAIL PROTECTED]
Huge version without GUI.  Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+cryptv +cscope +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic
+emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path
+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
-xterm_clipboard -xterm_save
   system vimrc file: $VIM/vimrc
 user vimrc file: $HOME/.vimrc
  user exrc file: $HOME/.exrc
  fall-back for $VIM: /usr/share/vim
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2
Linking:
gcc   -L/usr/local/lib -o vim.exe   -lncurses  -liconv -lintl




___
We won't tell. Get more on shows you hate to love
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265



I hope I am not speaking prematurely here, but I really think that
this has more to do with the underlying Windows Filesystem stuff.  As
you probably know the files in windows are NOT case sensitive and I
think that vim is probably using some form of Filesystem globbing,
which would find both file1 and FILE2.

On the other hand I remember reading about a cygwin feature that would
allow you to have funky filenames not supported by windows in a cygwin
partition  (just escapes in the filenames really) that might change
things.

This is where I read about the cygwin filename stuff:
http://gentoo-wiki.com/HOWTO_Gentoo_on_Cygwin#.22Managed.22_mounts

I hope that helps!

-fREW

--
-fREW


Re: How to paste while keep the cursor at the same place?

2007-03-13 Thread Gary Johnson
On 2007-03-13, Peng Yu [EMAIL PROTECTED] wrote:
 Hi,
 
 Suppose I use p to paste something, the cursor always goes to the end
 of the pasted text. Is there any other key to paste will keep the
 cursor before the pasted text?

See

:help `[

You could either type `[ after the p to move the cursor, or you 
could remap p like this

:noremap p p`[

to have it behave that way all the time.

HTH,
Gary

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