Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

vim · Vim (Vi IMproved) text editor users list

The Yahoo! Groups Product Blog

Check it out!

Group Information

? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Messages

Advanced
Messages Help
Messages 46409 - 46438 of 137779   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#46409 From: "Dennis W. Disney" <ddisney@...>
Date: Fri Jan 2, 2004 3:27 pm
Subject: Re: Quickest way to lowercase all characters in a file EXCEPT those in single quotes?
ddisney@...
Send Email Send Email
 
I asked earlier what is the quickest way to lowercase all characters in
a file EXPECT those in single quotes.  Let me provide a bit more
background - I am trying to write something to reformat SQL generated
by a reporting tool.  It generates SQL that looks like:
SELECT
   PRODUCT.PRODUCT_NAME,
   STORE.REGION,
   SUM(SALES.AMOUNT)
FROM
   PRODUCT,
   STORE,
   SALES
WHERE
   ( PRODUCT.PRODUCT_ID=SALES.PRODUCT_ID  )
   AND  ( STORE.STORE_ID=SALES.STORE_ID  )
   AND  ( PRODUCT.CATEGORY='BEER'  )
GROUP BY
   PRODUCT.PRODUCT_NAME,
   STORE.REGION

And I want to reformat the SQL to look like:
SELECT product.product_name,
        store.region,
        SUM(sales.amount)
FROM   product,
        store,
        sales
WHERE  product.product_id=sales.product_id
   AND  store.store_id=sales.store_id
   AND  product.category='BEER'
GROUP  BY product.product_name,
        store.region

My plan is to convert everything that is not between a pair of single
quotes into lowercase, then change all of the SQL keywords into
uppercase.  Next, remove the pointless parenthesis in the WHERE and AND
lines.  Then, go through the file to get the words lined up as I like.


I was going to do this as a plug in, but I couldn't get the plugin to
use the \< and \> atoms, which I need to find the SQL keywords.  Now, I
plan on writing a script file and executing that.

Back to the initial problem of putting everything in lowercase
characters EXCEPT those in single quotes.  Benji Fisher suggested:
******************************************************************
qqv/\('\|\%$\)<CR>unnq

and then 999@q (depending on the length of your file).

qq Record into register q (easier, I find, than qa or qx or ...)
v Enter Visual mode (characterwise).
/\('\|\%$\)<CR> Find the next 'single quote' or the end of the file.
u Make lower case, return to Normal mode at start of selection.
nn Go to the ' (or EOF) that you just found, and then the next one.
q End recording
999@q Repeat the macro recorder into register @q lots of times.
******************************************************************

I don't understand what the parentheis in the >> /\('\|\%$\)<CR> << is
suppose to do.  If I change that portion to >> /\'\|\%$<CR> <<, I
almost get what I want.  It works great as I go through the file, but
then it wraps around and starts through the file again.  The second
time through it changes to lowercase all of the text between the single
quotes.  I thought I would change it use a while loop, but I don't know
how to determine if I am at the end of the file.

Roberto Bonvallet suggested:
******************************************************************
qqguf';;q:1,$norm 99@q
:1,$norm $guF'

Yeah, I know he said 'quickest way', so what? :)

Mine works for files of any number of lines, but there can't be more
than 99 quoted strings per line. There also can't be quoted string
which start in one line and end in another.

Explanation:
qq              starts recording
gu              waits to lowercase on move
f'              goes to next '
;;              repeat last move twice
q               stops recording
:1,$norm 99@q   executes register q 99 times in every line
:1,$norm $guF'  lowercases from the end of each line to the last
******************************************************************
Unfortunately, this doesn't work for lines without single quotes.  The
f' doesn't find anything, so no characters get changed to lower case.

Any help would be greatly appreciated.

DWD

__________________________________
Do you Yahoo!?
Find out what made the Top Yahoo! Searches of 2003
http://search.yahoo.com/top2003

#46410 From: Benji Fisher <benji@...>
Date: Fri Jan 2, 2004 3:53 pm
Subject: Re: Quickest way to lowercase all characters in a file EXCEPT those in single quotes?
benji@...
Send Email Send Email
 
On Fri, Jan 02, 2004 at 07:27:47AM -0800, Dennis W. Disney wrote:
> I asked earlier what is the quickest way to lowercase all characters in
> a file EXPECT those in single quotes.  Let me provide a bit more
> background - I am trying to write something to reformat SQL generated
> by a reporting tool.  It generates SQL that looks like:
> SELECT
>   PRODUCT.PRODUCT_NAME,
>   STORE.REGION,
>   SUM(SALES.AMOUNT)
> FROM
>   PRODUCT,
>   STORE,
>   SALES
> WHERE
>   ( PRODUCT.PRODUCT_ID=SALES.PRODUCT_ID  )
>   AND  ( STORE.STORE_ID=SALES.STORE_ID  )
>   AND  ( PRODUCT.CATEGORY='BEER'  )
> GROUP BY
>   PRODUCT.PRODUCT_NAME,
>   STORE.REGION
>
> And I want to reformat the SQL to look like:
> SELECT product.product_name,
>        store.region,
>        SUM(sales.amount)
> FROM   product,
>        store,
>        sales
> WHERE  product.product_id=sales.product_id
>   AND  store.store_id=sales.store_id
>   AND  product.category='BEER'
> GROUP  BY product.product_name,
>        store.region
>
> My plan is to convert everything that is not between a pair of single
> quotes into lowercase, then change all of the SQL keywords into
> uppercase.  Next, remove the pointless parenthesis in the WHERE and AND
> lines.  Then, go through the file to get the words lined up as I like.
>
>
> I was going to do this as a plug in, but I couldn't get the plugin to
> use the \< and \> atoms, which I need to find the SQL keywords.  Now, I
> plan on writing a script file and executing that.

      If you want help with that, provide a more complete description of
the problem.

> Back to the initial problem of putting everything in lowercase
> characters EXCEPT those in single quotes.  Benji Fisher suggested:
[snip]
> Roberto Bonvallet suggested:
[snip]

      If you want to do this from a script, I suggest that you do not use
macros, as in the snipped suggestions.  Is it safe to assume that
strings are always on the same line, or do we have to worry about
'strings that span
multiple lines, like this'?

      In your example, the original file is ALL CAPS.  Is it safe to
assume this, or may there be strings with 'mIxEd CaPs' that you want to
preserve?

					 --Benji Fisher

#46411 From: Bram Moolenaar <Bram@...>
Date: Fri Jan 2, 2004 3:53 pm
Subject: Re: Setting window center line in autocommands
Bram@...
Send Email Send Email
 
Benji Fisher wrote:

> On Sun, Dec 07, 2003 at 11:34:57PM -0500, Benji Fisher wrote:
> > On Mon, Dec 08, 2003 at 12:29:36AM +0100, Haakon Riiser wrote:
> > >
> > > >> The following example triggers the bug here:  Create a
> > > >> 25 line skeleton file (~/test.skel), and use the following autocmd:
> > > >>
> > > >>   au BufNewFile *.xxx r ~/test.skel | 22 | normal zz
> >
> >      I do notice two oddities.  First, despite the :r command, the
> > 'modified' option is not set.  I am not sure if this is supposed to
> > happen or not, but I would expect the buffer to be marked as modified.

When editing a new file the 'modified' flag is not set, so that you can
do ":quit" without trouble.  The text you add with the autocommand can
be easily added again, thus that is not a reason to set 'modified'.
When I would change this I'm sure people will complain that they get a
"no write since last change" error when using a skeleton.

If you do want to mark the new buffer as being modified you can set the
'modified' flag in the autocommand.

> > If I undo ("u" in Normal mode) then the lines from the skeleton file
> > are removed, and 'modified' is still not set.  I can then redo (<C-R>)
> > and undo and ... and it is still not set.

The 'modified' flag is stored and restored with undo and redo commands.

> On Mon, Dec 08, 2003 at 12:09:19PM +0100, Haakon Riiser wrote:
> > I have noticed many strange things while trying to set up these
> > skeleton files. :-)  For one, there's the bug I described in
> > vim-dev where :append, :insert and :change  always insert an
> > extra blank line when the buffer is empty (the case for :append
> > and :insert) or when it contains less than two lines (:change).
> > Also, when you take a buffer consisting of multiple lines, delete
> > all lines but the first, and :change the last remaining line,
> > Vim inserts a blank line below the new text that is displayed
> > as NonText.  In other words, it LOOKS like NonText, but BEHAVES
> > like a blank line (lets you move your cursor over it for example).

I made a remark in the todo list to look into this.

> > And something else that seems weird is that when I modify
> > the contents of the buffer with a substitute command in the
> > autocommand,
> >
> >   :%s/foo/bar/g
> >
> > the undo history does not register this event.  If I undo one
> > time, the substitute command is not undone, but the entire buffer
> > is emptied.

I assume this is only when using the BufNewFile autocommand.  Starting
to edit a new file is considered as one action.  Thus you can't undo
part of the autocommands.

--
hundred-and-one symptoms of being an internet addict:
120. You ask a friend, "What's that big shiny thing?" He says, "It's the sun."

  /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net   \\\
///          Creator of Vim - Vi IMproved -- http://www.Vim.org          \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  \\\  Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html  ///

#46412 From: "Dennis W. Disney" <ddisney@...>
Date: Fri Jan 2, 2004 4:28 pm
Subject: Re: Quickest way to lowercase all characters in a file EXCEPT those in single quotes?
ddisney@...
Send Email Send Email
 
--- Benji Fisher <benji@...> wrote:
> On Fri, Jan 02, 2004 at 07:27:47AM -0800, Dennis W. Disney wrote:
> > I was going to do this as a plug in, but I couldn't get the plugin
> > to use the \< and \> atoms, which I need to find the SQL keywords.
> > Now, I plan on writing a script file and executing that.
>
> If you want help with that, provide a more complete description
> of the problem.

On 12/17, I posted a message, "Can't use special atoms in script" where
I said:
********************************************************************
I am using VIM version on Windows. I am trying to uppercase keywords
in a file. If I do
/\<from\>
I find the next instance of the word "from". If I enter the following
at the colon prompt:
:echo search("\<from\>", "w")
I get only 0. Is there something I must do to be able to use the
special character atoms in a script?
********************************************************************
and nobody replied to the message.

> Is it safe to assume that strings are always on the same line, or do
> we have to worry about 'strings that span
> multiple lines, like this'?

The single quotes enclosing the string will always been on the same
line.  So, you may have:
       decode(appeal_rating, 0, 'Ug-ly', 10, 'HOT STUFF!!!')
but never
       decode(appeal_rating, 0, 'Ug-ly', 10, 'HOT
              STUFF!!!')

> In your example, the original file is ALL CAPS.  Is it safe to
> assume this, or may there be strings with 'mIxEd CaPs' that you want
> to preserve?

The text outside of single quotes can be upper, lower or mixed case and
I want to make it all lower case.  The text inside of single quotes can
be upper, lower or mixed case and the case should be preserved.

DWD

__________________________________
Do you Yahoo!?
Find out what made the Top Yahoo! Searches of 2003
http://search.yahoo.com/top2003

#46413 From: "Charles E. Campbell, Jr." <drchip@...>
Date: Fri Jan 2, 2004 4:55 pm
Subject: Re: Quickest way to lowercase all characters in a file EXCEPT those in single quotes?
drchip@...
Send Email Send Email
 
Dennis W. Disney wrote:
  >I asked earlier what is the quickest way to lowercase all characters in
  >a file EXCEPT those in single quotes.  Let me provide a bit more
  >background - I am trying to write something to reformat SQL generated
  >by a reporting tool...snip
---------------------------------------------------------------------

Hello!

Hope you find the following helpful; it converts most of the text
to lowercase as you requested.  It does depend upon sql syntax
highlighting being enabled.  I took the liberty of also preventing
the conversion of sql keywords and statements which I think you
also wanted.

Regards,
Chip Campbell

" ---------------------------------------------------------------------
let strid  = synIDtrans(hlID("String"))
let stmtid = synIDtrans(hlID("Statement"))
let specid = synIDtrans(hlID("Special"))
let wwkeep = &ww
let vekeep = &ve
set lz ve= ww=l

" preparation
let lastline= line("$")
$
let lastcol = col("$")
norm! 1G0

" convert case
while 1
  let synid= synIDtrans(synID(line("."),col("."),1))
  if synid != strid && synid != stmtid && synid != specid
   norm! vul
  else
   norm! l
  endif
  if line(".") == lastline && col(".") == lastcol
   break
  endif
endwhile

" restore
let &ww= wwkeep
let &ve= vekeep

set nolz
" ---------------------------------------------------------------------

#46414 From: Benji Fisher <benji@...>
Date: Fri Jan 2, 2004 6:35 pm
Subject: Re: Quickest way to lowercase all characters in a file EXCEPT those in single quotes?
benji@...
Send Email Send Email
 
On Fri, Jan 02, 2004 at 08:28:54AM -0800, Dennis W. Disney wrote:
> --- Benji Fisher <benji@...> wrote:
> > On Fri, Jan 02, 2004 at 07:27:47AM -0800, Dennis W. Disney wrote:
> > > I was going to do this as a plug in, but I couldn't get the plugin
> > > to use the \< and \> atoms, which I need to find the SQL keywords.
> > > Now, I plan on writing a script file and executing that.
> >
> > If you want help with that, provide a more complete description
> > of the problem.
>
> On 12/17, I posted a message, "Can't use special atoms in script" where
> I said:
> ********************************************************************
> I am using VIM version on Windows. I am trying to uppercase keywords
> in a file. If I do
> /\<from\>
> I find the next instance of the word "from". If I enter the following
> at the colon prompt:
> :echo search("\<from\>", "w")
> I get only 0. Is there something I must do to be able to use the
> special character atoms in a script?
> ********************************************************************
> and nobody replied to the message.

      I thought I replied to that; maybe I am thinking of another
question.  Try

:echo "\<from\>"

to get a hint of what is going on, then read

:help expr-string
:help literal-string

> > Is it safe to assume that strings are always on the same line, or do
> > we have to worry about 'strings that span
> > multiple lines, like this'?
>
> The single quotes enclosing the string will always been on the same
> line.  So, you may have:
>       decode(appeal_rating, 0, 'Ug-ly', 10, 'HOT STUFF!!!')
> but never
>       decode(appeal_rating, 0, 'Ug-ly', 10, 'HOT
>              STUFF!!!')

      I forgot to ask whether 'escaped \' quotes' are an issue, or if
there is any other sort of nesting to worry about.  If so, it might be
better to follow Chip Campbell's advice, in another reply, using syntax
highlighting.  If nesting is not an issue, the following solution might
be faster on large files.

      First, lower-case everything up to the first single quote on each
line:

:%s/[^']*/\L&

(For \L and & , see :help sub-replace-special ; for [^...], see
:help /[] .)  Then, break the line up into "'foo'bar" (without the outer
quotes), where the single quotes are literal, "foo" and "bar" represent
as many non-single quote characters as possible.  The pattern
"\('[^']*'\)\([^']*\)" will match one copy of "'foo'bar", with "'foo'"
being the first group (represented by "\1") and "bar" being the second
group (represented by "\2").  So

:%s/\('[^']*'\)\([^']*\)/\1\L\2/ge

should do it:  the /g flag means to look for as many copies of
"'foo'bar" as possible, and the /e flag means not to complain if there
are none.

      I have only tested these two commands on this e-mail.  You should
test them a little further before putting this into production.

HTH 			 --Benji Fisher

#46415 From: "Zink, Rich" <rich.zink@...>
Date: Fri Jan 2, 2004 7:00 pm
Subject: E68 Error
rich.zink@...
Send Email Send Email
 
When I right click on a text file and select "Edit with Vim" I get a GVIM
window which contains the full path to the file being opened plus 3 lines in
red "E68:  Invalid character after \z" followed by "Hit ENTER or type
command to continue".  All appears to be well after I hit the Enter key.

I'm running on Windows 2000.  I was getting the same error in gVim6.1 and
did an uninstall and reinstalled it with no improvement. I upgraded to gVim
6.2 hoping it would fix the problem without success.  It  appears that I get
a new "E68" error for each time I run the install utility, i.e. if I would
uninstall and reinstall gVim 6.2 I would have four (4) "E68: Invalid
character after /z" line.

Any thoughts on getting the text file to open cleanly with gVim?

#46416 From: "Charles E. Campbell, Jr." <drchip@...>
Date: Fri Jan 2, 2004 8:43 pm
Subject: Re: E68 Error
drchip@...
Send Email Send Email
 
Zink, Rich wrote:

>When I right click on a text file and select "Edit with Vim" I get a GVIM
>window which contains the full path to the file being opened plus 3 lines in
>red "E68:  Invalid character after \z" followed by "Hit ENTER or type
>command to continue".  All appears to be well after I hit the Enter key.
>
>
Hello!

Oddball characters/error messages etc show up when starting vim:

     a. Check for corrupted <.viminfo>
           Goto home directory (usually ${HOME} or where your <_vimrc>
resides)
           Remove/delete .viminfo

           Does this cure the problem?

     b. Check for naughty <.vimrc> and/or plugins

           vim -u NONE -U NONE whatever

           Does this cure the problem?
        If so, you probably have a misbehaving <.vimrc> or <.vim/plugin>

     c. Check for misbehaving <.vimrc>

        mv .vimrc  DOTVIMRC
        ren _vimrc DOTVIMRC

           Does this cure the problem?
        If so, start delving into your <.vimrc> for problems.

     d. Check for misbehaving plugins
           mv  .vim      DOTVIM       (unix)
           ren _vimfiles DOTVIMFILES  (windows)

           Does this cure the problem?  If so, presuming you like your
plugins,
           try moving them back in a few at a time and narrow down the
starting
           problem.

#46417 From: Klaus Bosau <kbosau@...>
Date: Sat Jan 3, 2004 12:05 pm
Subject: :bad and :b
kbosau@...
Send Email Send Email
 
Hi,

I encountered difficulties when issuing

   :bad aux | b aux

1) Can anybody reproduce 'this'? (GVim 6.2/W98)
2) Did I misinterpret the description of :bad/:b (insofar as I presumed
    {fname}/{filename} may denote non-existing files too)?

TIA

Klaus

#46418 From: Luiz Siqueira <cybersamurai@...>
Date: Sat Jan 3, 2004 12:24 pm
Subject: unicode problem in Vim for Mac os X
cybersamurai@...
Send Email Send Email
 
The unicode don't work in Vim for Mac os X, what can I do?

#46419 From: Wouter <uws@...>
Date: Sat Jan 3, 2004 2:13 pm
Subject: Re: unicode problem in Vim for Mac os X
uws@...
Send Email Send Email
 
På Sat, Jan 03, 2004 at 10:24:31AM -0200, Luiz Siqueira skrev:
> The unicode don't work in Vim for Mac os X, what can I do?

What does :version say?

   mvrgr, Wouter

--
:wq                                                       mail uws@...

don't let the world bring you down :: experience the warmth       -- incubus

#46420 From: Benji Fisher <benji@...>
Date: Sat Jan 3, 2004 2:22 pm
Subject: Re: :bad and :b
benji@...
Send Email Send Email
 
On Sat, Jan 03, 2004 at 01:05:46PM +0100, Klaus Bosau wrote:
> Hi,
>
> I encountered difficulties when issuing
>
>   :bad aux | b aux
>
> 1) Can anybody reproduce 'this'? (GVim 6.2/W98)
> 2) Did I misinterpret the description of :bad/:b (insofar as I presumed
>    {fname}/{filename} may denote non-existing files too)?

      I tried

:bad foo.bar | b foo.bar

(with no existing file of that name) and got an empty [New file] buffer.
This is on Linux with vim 6.2.128 .  What sort of problems did you find?

					 --Benji Fisher

#46421 From: Brian Burns <brian_p_burns@...>
Date: Sat Jan 3, 2004 2:17 pm
Subject: Re: script inside XML
brian_p_burns@...
Send Email Send Email
 
Thanks for the pointer.

I modified indent/xml.vim as shown below.  I lifted the code from
indent/html.vim where it searches for a <pre> tag and modified it so
that it looks for a <script> tag and calls GetJavaIndent.  However, I
don't think GetJavaIndent is being found because no indentation is
occuring inside the <script> tag.  I'm assuming I need to include
indent/java.vim.  Do I need to temporarily set indentexpr to
GetJavaIndent function?  Am I on the right path here?

Thanks,
Brian


fun! XmlIndentGet(lnum, use_syntax_check)
     " Find a non-empty line above the current line.
     let lnum = prevnonblank(a:lnum - 1)

     " Hit the start of the file, use zero indent.
     if lnum == 0
         return 0
     endif

     if getline(a:lnum) =~ '\c</script>'
         \ || 0 < searchpair('\c<script>', '', '\c</script>', 'nWb')
         \ || 0 < searchpair('\c<script>', '', '\c</script>', 'nW')
         " we're in a line with </pre> or inside <pre> ... </pre>
         "return -1
         include !runtime/indent/java.vim
         return GetJavaIndent()
     endif

     if getline(lnum) =~ '\c</script>'
         " line before the current line a:lnum contains
         " a closing </pre>. --> search for line before
         " starting <pre> to restore the indent.
         let preline = prevnonblank(search('\c<script>', 'bW') - 1)
         if preline > 0
                 return indent(preline)
         endif
     endif


     if a:use_syntax_check
         if 0 == <SID>XmlIndentSynCheck(lnum) || 0 ==
<SID>XmlIndentSynCheck(a:lnum)
             return indent(a:lnum)
         endif
     endif

     let ind = <SID>XmlIndentSum(lnum, -1, indent(lnum))
     let ind = <SID>XmlIndentSum(a:lnum, 0, ind)

     return ind
endfun




On Thu, 2004-01-01 at 19:38, Benji Fisher wrote:
> On Thu, Jan 01, 2004 at 11:28:06AM -0500, Brian Burns wrote:
> > Hello,
> >
> > I would like to modify indent/xml.vim so that a script language such as
> > JavaScript could be properly indented inside a CDATA section.
> >
> > For example,
> >
> > <somenamespace:Foo>
> >   <![CDATA[
> >   function foo()
> >   {
> >      blah;
> >   }
> >   ]]>
> > </somenamespace:Foo>
> >
> > The logic can be fairly simple in my case.  I would just need to
> > detect an open CDATA tag and switch to javascript mode, then switch
> > back to XML mode at the end of the CDATA section.  I'm new to indent
> > and syntax files so I don't know exactly where to begin?
> >
> > Any ideas ?
>
>      First, read the docs (following some links) under
>
> :help 'indentexpr'
>
> Then, start to look at the java.vim and xml.vim files in
> $VIMRUNTIME/indent/ .  (Or is JavaScript going to be enough different
> from Java that this will not help?)  Both of these are pretty well
> commented.  Once you get an idea of what is going on, you can modify
> XmlIndentGet() to call GetJavaIndent() when appropriate; if you are
> lucky, the latter will not need any modifications.
>
>      Once you get started, feel free to ask for more specific help.
>
> HTH 			 --Benji Fisher

#46422 From: Benji Fisher <benji@...>
Date: Sat Jan 3, 2004 2:30 pm
Subject: Re: unicode problem in Vim for Mac os X
benji@...
Send Email Send Email
 
On Sat, Jan 03, 2004 at 10:24:31AM -0200, Luiz Siqueira wrote:
> The unicode don't work in Vim for Mac os X, what can I do?

      I am not sure which versions have this trouble:  I am pretty sure
that you will have trouble with the Carbon GUI on OS X, I am not sure
about a terminal vim, and I think that gvim on X11 will work OK.  In
fact, I am not sure whether it matters whether you run terminal vim in
Terminal.app or an xwindow .

      In the short term, find the simplest version to install that works.
If you are using X.iii (Panther), then you can install X11 from the OS X
installation disk.

      In the long term, solutions will be discussed on the vim-mac list
(and I am adding vim-mac to my cc list for this note).

HTH 			 --Benji Fisher

#46423 From: François Pinard <pinard@...>
Date: Sat Jan 3, 2004 4:51 pm
Subject: RELEASED: Allout-Vim 040103
pinard@...
Send Email Send Email
 
Hi, my Vim and Python friends.

Here is another release of Allout-Vim, on the road of my learning about
how to write Python extensions for Vim.  An enjoyable road so far! :-)

Since the first release, I reorganised mappings and commands a bit,
added new ones, and support for Visual mode in a few places it applies.
Known bugs have been corrected.  Besides the `.tgz' distribution, there
is also a `.zip' distribution which should be easier for non-Unix users.

With this release, edition of Allout files in Vim, despite still a bit
different than with Emacs, is now of comparable comfort in my opinion.

As your comments and help could ease my learning, they are very welcome!

==============================================================================
Allout files are a handy synoptic (or tree-like) representation of a
document.  Such files were originally introduced as a GNU Emacs mode.
Vim offers tools and help for browsing or editing these Allout files.

The Allout-Vim package may be downloaded from:
     http://fp-etc.progiciels-bpi.ca/showfile.html?mode=archives
while installation directives may be found at:
     http://fp-etc.progiciels-bpi.ca/showfile.html?name=allout/vim/README
More documentation is also available on the Web as:
     http://fp-etc.progiciels-bpi.ca/showfile.html?name=allout/vim/doc.txt

While syntax colouring of Allout files should work in almost any Vim,
Allout specific commands and mappings require a Python-enabled Vim.

--
François Pinard   http://www.iro.umontreal.ca/~pinard

#46424 From: Benji Fisher <benji@...>
Date: Sat Jan 3, 2004 6:19 pm
Subject: Re: script inside XML
benji@...
Send Email Send Email
 
On Sat, Jan 03, 2004 at 09:17:13AM -0500, Brian Burns wrote:
> Thanks for the pointer.
>
> I modified indent/xml.vim as shown below.  I lifted the code from
> indent/html.vim where it searches for a <pre> tag and modified it so
> that it looks for a <script> tag and calls GetJavaIndent.  However, I
> don't think GetJavaIndent is being found because no indentation is
> occuring inside the <script> tag.  I'm assuming I need to include
> indent/java.vim.  Do I need to temporarily set indentexpr to
> GetJavaIndent function?  Am I on the right path here?
>
> Thanks,
> Brian
[snip]

      Without actually scrutinizing the code that I just snipped, I think
what you need to do is source indent/java.vim in order to have the
GetJavaIndent() function defined.  You can test

if exists("*GetJavaIndent")

to see whether it already exists.  I do not think you need to
temporarily set 'indentexpr', although this is likely to happen when you
source the Java indent script.

      In short, this is what I suggest trying.  Near the top of your
modified indent/xml.vim (after the part that sets 'indentexpr' each time
an xml file is loaded, perhaps right before defining the XmlGetIndent()
function, or whatever it is called)

if !exists("*GetJavaIndent")
   " only one of the following two lines!
   source $VIMRUNTIME/indent/java.vim " if you want to insist on the
					 " version from the ditro
   runtime! indent/java.vim " if you want to allow custom versions
   " further lines to undo the options set in indent/java.vim
endif

HTH 			 --Benji Fisher

#46425 From: Klaus Bosau <kbosau@...>
Date: Sat Jan 3, 2004 6:21 pm
Subject: Re: :bad and :b
kbosau@...
Send Email Send Email
 
On Sat, 3 Jan 2004, Benji Fisher wrote:

>      I tried
>
> :bad foo.bar | b foo.bar
>
> (with no existing file of that name) and got an empty [New file] buffer.

This command works fine here as well. Have you tried for 'aux' instead
of 'foo.bar' too?

> This is on Linux with vim 6.2.128 .  What sort of problems did you find?

Vim froze. I had to reboot to regain control. (Right now I tried

   gvim.exe -u NONE -U NONE
   :bad aux | b aux

Same result.)

Klaus

#46426 From: "George V. Reilly" <george@...>
Date: Sat Jan 3, 2004 6:31 pm
Subject: Re: :bad and :b
george@...
Send Email Send Email
 
'aux', like 'com1' and 'nul' is a special device name under Windows. (Part
of the DOS legacy.) You can't use it for a regular filename. Buffer names
have to be regular filenames, I believe.

--
We're so busy catching minnows, we forget we're standing on a whale.
(Get Witty Auto-Generated Signatures from http://SmartBee.org)
George V. Reilly  george@...
http://george.reilly.org/
Read my weblog: http://erablog.net/blogs/george_v_reilly/



----- Original Message -----
From: "Klaus Bosau" <kbosau@...>
To: "Benji Fisher" <benji@...>
Cc: "Vim Mailing List" <vim@...>
Sent: Saturday, January 03, 2004 10:21 AM
Subject: Re: :bad and :b


> On Sat, 3 Jan 2004, Benji Fisher wrote:
>
> >      I tried
> >
> > :bad foo.bar | b foo.bar
> >
> > (with no existing file of that name) and got an empty [New file] buffer.
>
> This command works fine here as well. Have you tried for 'aux' instead
> of 'foo.bar' too?
>
> > This is on Linux with vim 6.2.128 .  What sort of problems did you find?
>
> Vim froze. I had to reboot to regain control. (Right now I tried
>
>   gvim.exe -u NONE -U NONE
>   :bad aux | b aux
>
> Same result.)
>
> Klaus
>

#46427 From: "Suresh Govindachar" <sgovindachar@...>
Date: Sat Jan 3, 2004 7:59 pm
Subject: exists() "vim option" vs. "vim feature"
sgovindachar@...
Send Email Send Email
 
Hello,

:help exists mentions "option-name" and refers to it
as "Vim option".  What is a "Vim option" and what is
a "Vim feature (the things listed by the :version command"?

A comment to a tip on vim.sf.net led me to think that
these two things were the same, but some tests (see
below) reveal that they are not the same.

--Suresh

________Tests___________________
arabic is both an option and a feature:
----------------------------------------------
[arabic is present in output] :version
[returns 1] :echo exists("&arabic")
[returns 1] :echo exists("+arabic")
[returns 0] :echo exists("-arabic")
ruler is an option that is not a feature:
----------------------------------------------
[ruler is absent in output]    :version
[returns 1] :echo exists("&ruler")
[returns 1] :echo exists("+ruler")
[returns 0] :echo exists("-ruler")

Although the following perl and python commands
work, the exists() function returns 0 for perl and python:
perl is a feature that is not an option
--------------------------------------------------
[works]     :perl $curbuf->Set(2, "Line1", "Line2")
[works]     :python print "Hello"
[returns 0] :echo exists("&perl")
[returns 0] :echo exists("+perl")
[returns 0] :echo exists("-perl")
[returns 0] :echo exists("&perl/dyn")
[returns 0] :echo exists("+perl/dyn")
[returns 0] :echo exists("-perl/dyn")
and likewise for the python counterparts.
Also
[printer is present in output] :version
[returns 0] :echo exists("&printer")
[returns 0] :echo exists("+printer")
[returns 0] :echo exists("-printer")

#46428 From: Wouter <uws@...>
Date: Sat Jan 3, 2004 8:26 pm
Subject: Re: exists() "vim option" vs. "vim feature"
uws@...
Send Email Send Email
 
På Sat, Jan 03, 2004 at 11:59:52AM -0800, Suresh Govindachar skrev:
> :help exists mentions "option-name" and refers to it
> as "Vim option".  What is a "Vim option" and what is
> a "Vim feature (the things listed by the :version command"?
>
> A comment to a tip on vim.sf.net led me to think that
> these two things were the same, but some tests (see
> below) reveal that they are not the same.

A feature is a complete set of functionality, whereas an option is just a
single "switch" to control (part of) some functionality. So a feature may
provide multiple options.

   mvrgr, Wouter

--
:wq                                                       mail uws@...

spread your love like a fever                 -- black rebel motorcycle club

#46429 From: Dan Sharp <dwsharp@...>
Date: Sat Jan 3, 2004 8:46 pm
Subject: Re: exists() "vim option" vs. "vim feature"
dwsharp@...
Send Email Send Email
 
Suresh Govindachar wrote:
> Hello,
>
> :help exists mentions "option-name" and refers to it
> as "Vim option".  What is a "Vim option" and what is
> a "Vim feature (the things listed by the :version command"?

A Vim option is anything that is set with a :set command and affects how
Vim runs.  A feature is listed in the :version output and is more
generic than an option (the existence of a feature may enable more than
one option).  You check the whether Vim has a particular feature with
the has() function.  You check whether Vim has a particular option with
the exists() function.

> A comment to a tip on vim.sf.net led me to think that
> these two things were the same, but some tests (see
> below) reveal that they are not the same.

Your tests only use exists(), so it only checks whether Vim has an
option by the given name.  The reason the & and + work but the - always
fails is because the - prefix is not a valid prefix for the exists()
function.  From :he exists() :

====
exists({expr}) The result is a Number, which is non-zero if {expr} is
		 defined, zero otherwise.  The {expr} argument is a
		 string, which contains one of these:
		 &option-name Vim option (only checks if it exists,
				 not if it really works)
		 +option-name Vim option that works.
====


> Although the following perl and python commands
> work, the exists() function returns 0 for perl and python:
> perl is a feature that is not an option

Right.  Since there is no 'perl' or 'python' option, the exists()
function will return 0.  If you check "has('perl')" or "has('python')",
though, it will return 1.  :he feature-list will show you the possible
values that can be checked with the has() function.

Dan Sharp

#46430 From: "Antoine J. Mechelynck" <antoine.mechelynck@...>
Date: Sat Jan 3, 2004 9:47 pm
Subject: Re: exists() "vim option" vs. "vim feature"
antoine.mechelynck@...
Send Email Send Email
 
Suresh Govindachar <sgovindachar@...> wrote:
> Hello,
>
> > help exists mentions "option-name" and refers to it
> as "Vim option".  What is a "Vim option" and what is
> a "Vim feature (the things listed by the :version command"?
>
> A comment to a tip on vim.sf.net led me to think that
> these two things were the same, but some tests (see
> below) reveal that they are not the same.
>
> --Suresh

A "feature" is a functionaliy, corresponding to a certain amount of program
code, which may or may not be included at compile-time. It can be present or
absent, and to change that one must recompile Vim. Some features can be
"dynamic", in that case they require an external library. They are shown in
the output of the ":version" command, like this:

     +feature    feature is compiled-in
     +feature/dyn    feature is available if Vim can find the proper external
library
     -feature    feature is not available in this version of Vim.

See
     :help has()
     :help :version
     :help feature-list

An "option" is a kind of internal variable, which has a value which is
either Boolean, Number, or String. Its value can be modified at run-time
using the ":set" command. It can be used as a variable in an expression or a
":let" command by prefixing its name with an &. Some options are global for
all of Vim, others have also a buffer-local or window-local value in
addition.

See
     :help options.txt
     :help :set
     :help :setlocal
     :help :setglobal
     :help global-local
     :help exists()
     :help option-list
     :help option-summary

HTH,
Tony.

#46431 From: "Suresh Govindachar" <sgovindachar@...>
Date: Sun Jan 4, 2004 2:02 am
Subject: Almost possible to use h,j,k,l keys to replace the mouse
sgovindachar@...
Send Email Send Email
 
Hello,

I just found out that Microsoft (via the "Accessibility Options"
in the "Control Panel") allows one to use the arrow keys on the
key pad as a replacement for the mouse (including selecting,
draging etc.)!!!  In fact, just as vi has modes (input, normal etc.)
so too Windows can be configured to have a mode in which arrow
keys act as mouse and another mode in which arrow keys are as usual.

This is good news for those like me who don't like going
"clickety-clickety" with the mouse.

The user has the option of specifying that the arrow keys replace
the mouse only when "Num Lock" is on.  This leads me to wonder if
the hjkl keys can be made to work as the arrow keys when Num-Lock
is on -- thereby replacing the mouse by hjkl!!!!!

So does anyone know how to map the hjkl keys to the arrow keys
when Num-Lock is on (I have win98)?

(In the arrow mode, selection is done by the 5-key on the key-pad,
so one would need to pick a suitable key to map to the 5-key on
the key pad when Num-Lock is on.)

--Suresh

PS:  if you try out arrow mode, be sure to set the speed and
acceleration options to 100% high.

#46432 From: "Dave Rahardja" <drahardja@...>
Date: Sun Jan 4, 2004 5:08 am
Subject: guifontset in Win32 gvim
drahardja@...
Send Email Send Email
 
Hi,

Has anyone successfully used the 'guifontset' option in win32 gvim? Is there
a prebuilt binary with this option enabled?

I've successfully edited various languages on gvim by setting the guifont to
those that support the particular language (SimSun for Chinese characters,
for example), but I was hoping that vim could intelligently swap fonts to
handle each character set.


---
Dave Rahardja

#46433 From: "Antoine J. Mechelynck" <antoine.mechelynck@...>
Date: Sun Jan 4, 2004 5:52 am
Subject: Re: guifontset in Win32 gvim
antoine.mechelynck@...
Send Email Send Email
 
Dave Rahardja <drahardja@...> wrote:
> Hi,
>
> Has anyone successfully used the 'guifontset' option in win32 gvim?
> Is there a prebuilt binary with this option enabled?
>
> I've successfully edited various languages on gvim by setting the
> guifont to those that support the particular language (SimSun for
> Chinese characters, for example), but I was hoping that vim could
> intelligently swap fonts to handle each character set.
>
>
> ---
> Dave Rahardja

On my gvim 6.2.170 for Win32, as compiled by Steve Hall and distributed at
http://cream.sourceforge.net/vim.html , I have:

     exists("&guifontset") == 1
     exists("+guifontset") == 0

meaning the option is present, but not functional.

With the statement

     set guifont=Courier_New:h11:cDEFAULT

I can display together Latin, Cyrillic and Arabic characters in a single
UTF-8 file in gvim. Replace the 11 in h11 by a larger or smaller number to
get a larger or smaller font. DEFAULT is the language option and AFAICT
setting it that way allows gvim to choose the proper glyph from the various
"Courier New" fonts present in the system. ("Lucida Console" is prettier but
it has 2 problems: (a) no Arabic glyphs; (b) its bold-Cyrillic glyphs are
just a microcuntshair too wide.)

I do not use CJK ideograms (yet).

I append the full output from my :version statement.

Best regards,
Tony.




VIM - Vi IMproved 6.2 (2003 Jun 1, compiled Dec 31 2003 01:40:05)
MS-Windows 32 bit GUI version with OLE support
Included patches: 1-170
Modified by Dan Sharp's TCL stub, Vince Negri's
&conceal/&cursorbind/:ownsyntax patch.
Compiled by digitect@...
Big version with GUI.  Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent
+clientserver
+clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +conceal
+cryptv +cscope
+cursorbind +dialog_con_gui +diff +digraphs -dnd -ebcdic +emacs_tags +eval
+ex_extra +extra_search
+farsi +file_in_path +find_in_path +folding -footer
+gettext/dyn -hangul_input +iconv/dyn
+insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent
+listcmds +localmap +menu
  +mksession +modify_fname +mouse +mouseshape +multi_byte_ime/dyn +multi_lang
+netbeans_intg +ole
-osfiletype +path_extra +perl/dyn -postscript +printer +python/dyn +quickfix
+rightleft +ruby/dyn
+scrollbind +signs +smartindent -sniff +statusline -sun_workshop +syntax
+tag_binary
+tag_old_static -tag_any_white +tcl/dyn -tgetent -termresponse +textobjects
+title +toolbar
+user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore
+wildmenu +windows +writebackup -xfontset -xim -xterm_save -xpm_w32
    system vimrc file: "$VIM\vimrc"
      user vimrc file: "$HOME\_vimrc"
  2nd user vimrc file: "$VIM\_vimrc"
       user exrc file: "$HOME\_exrc"
   2nd user exrc file: "$VIM\_exrc"
   system gvimrc file: "$VIM\gvimrc"
     user gvimrc file: "$HOME\_gvimrc"
2nd user gvimrc file: "$VIM\_gvimrc"
     system menu file: "$VIMRUNTIME\menu.vim"
Compilation:
C:\BCC55\BIN\Bcc32 -w-aus -w-par -w-pch -IC:\TCL84\include;C:\RUBY16\lib\rub
y\1.6\i586-mswin32;C:\PYTHON22\include;C:\PERL\lib\core;C:\BCC55\include;.;p
roto -d -x- -RT- -k- -Oi -H -H=vim.csm -Hc -f- -DFEAT_BIG -DWIN32 -DPC -DHAV
E_PATHDEF   -DWINVER=0x400 -D_WIN32_WINNT=0x400 -DFEAT_OLE -DFEAT_CSCOPE -DF
EAT_NETBEANS_INTG -DFEAT_GUI_W32 -DFEAT_CLIPBOARD  -DFEAT_MBYTE -DFEAT_MBYTE
_IME -DDYNAMIC_IME -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT  -DFEAT_PERL -DDYNAMIC_
PERL -DDYNAMIC_PERL_DLL=\"perl58.dll\" -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNA
MIC_PYTHON_DLL=\"python22.dll\" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DL
L=\"mswin32-ruby16.dll\" -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"tcl84.
dll\" -O2 -f- -d -Ocavi -O -vi- -WE -3 -a4
Linking: C:\BCC55\BIN\ILink32 -OS -Tpe -c -m -LC:\BCC55\lib  -aa

#46434 From: "Antoine J. Mechelynck" <antoine.mechelynck@...>
Date: Sun Jan 4, 2004 6:20 am
Subject: Re: guifontset in Win32 gvim
antoine.mechelynck@...
Send Email Send Email
 
Antoine J. Mechelynck <antoine.mechelynck@...> wrote:
> Dave Rahardja <drahardja@...> wrote:
> > Hi,
> >
> > Has anyone successfully used the 'guifontset' option in win32 gvim?
> > Is there a prebuilt binary with this option enabled?
> >
> > I've successfully edited various languages on gvim by setting the
> > guifont to those that support the particular language (SimSun for
> > Chinese characters, for example), but I was hoping that vim could
> > intelligently swap fonts to handle each character set.
> >
> >
> > ---
> > Dave Rahardja
>
> On my gvim 6.2.170 for Win32, as compiled by Steve Hall and
> distributed at http://cream.sourceforge.net/vim.html , I have:
[...]

Attentive reading of the help for 'guifontset' shows that it is only
available on X11 versions other than GTK+2, with the +xfontset functionality
compiled-in. I think your chances of finding that on W32 are very thin :-).
But my other answer (use 'guifont' with cDEFAULT and a well-chosen font-name
like Courier_New) will work in at least some cases.

Best regards,
Tony.

#46435 From: Benji Fisher <benji@...>
Date: Sun Jan 4, 2004 2:09 pm
Subject: Re: Almost possible to use h,j,k,l keys to replace the mouse
benji@...
Send Email Send Email
 
On Sat, Jan 03, 2004 at 06:02:20PM -0800, Suresh Govindachar wrote:
> Hello,
>
> I just found out that Microsoft (via the "Accessibility Options"
> in the "Control Panel") allows one to use the arrow keys on the
> key pad as a replacement for the mouse (including selecting,
> draging etc.)!!!  In fact, just as vi has modes (input, normal etc.)
> so too Windows can be configured to have a mode in which arrow
> keys act as mouse and another mode in which arrow keys are as usual.
>
> This is good news for those like me who don't like going
> "clickety-clickety" with the mouse.
>
> The user has the option of specifying that the arrow keys replace
> the mouse only when "Num Lock" is on.  This leads me to wonder if
> the hjkl keys can be made to work as the arrow keys when Num-Lock
> is on -- thereby replacing the mouse by hjkl!!!!!
>
> So does anyone know how to map the hjkl keys to the arrow keys
> when Num-Lock is on (I have win98)?
>
> (In the arrow mode, selection is done by the 5-key on the key-pad,
> so one would need to pick a suitable key to map to the 5-key on
> the key pad when Num-Lock is on.)
>
> --Suresh
>
> PS:  if you try out arrow mode, be sure to set the speed and
> acceleration options to 100% high.

      I doubt that this will work, since the OS interprets the arrow keys
before passing them to applications.  So there may be a Win98 way to do
this, but I doubt there is a vim way.

      If, despite my nay-saying, you want to give it a try, use <C-V> in
Insert mode to input cursor keys with and without the "cursor for mouse"
mode turned on.  You can also use it in Command-line mode, as in

:nmap h <C-V><Left>

where the <C-V> and <Left> are *not* typed literally.

:help i_CTRL-V
:help :ascii

HTH 			 --Benji Fisher

#46436 From: Luiz Siqueira <cybersamurai@...>
Date: Sun Jan 4, 2004 2:35 pm
Subject: Re: unicode problem in Vim for Mac os X
cybersamurai@...
Send Email Send Email
 
My version is 6.2 (2003 Jun 1, compiled Oct 21 2003 12:15:54)

I can't find a easy way to install the gvim version. I have the X11
installed, I try
use Fink package but I have a lot of problems with it. Maybe have some
mac package
with gvim. :(


Benji Fisher wrote:

>On Sat, Jan 03, 2004 at 10:24:31AM -0200, Luiz Siqueira wrote:
>
>
>>The unicode don't work in Vim for Mac os X, what can I do?
>>
>>
>
>     I am not sure which versions have this trouble:  I am pretty sure
>that you will have trouble with the Carbon GUI on OS X, I am not sure
>about a terminal vim, and I think that gvim on X11 will work OK.  In
>fact, I am not sure whether it matters whether you run terminal vim in
>Terminal.app or an xwindow .
>
>     In the short term, find the simplest version to install that works.
>If you are using X.iii (Panther), then you can install X11 from the OS X
>installation disk.
>
>     In the long term, solutions will be discussed on the vim-mac list
>(and I am adding vim-mac to my cc list for this note).
>
>HTH 			 --Benji Fisher
>
>
>

#46437 From: Juan Lanus <jlanus@...>
Date: Sun Jan 4, 2004 10:38 pm
Subject: [VIM] my vin has lost contact with the OS
jlanus@...
Send Email Send Email
 
HI,
please help.
My vim can't run OS programs any more.  It's vim 6.2 in Windows 2K
professional.

The command !!dir  instead of a directory listing returns:
E485: Can't read file F:\TMP\VIo8.tmp

:diffsplit ... returns:
E97: cannot create diffs

The temporary directory F:\TMP exists and vim has enough persissions to
write there. For example I can :w F:\TMP\qqqq,txt The temporary files
vim mentions do not whow in the TMP directory.
I also tried deleting the temp file locatio option.
I reinstalled 6.2 (the windows fix-all procedure). vim showed it's
traditional stability by returning exactly the same errors.
I renamed the rc file to operate uder default settings and still the same.

I don't have the skills to find out where the problem is located by
debugging vin, for example. My guess is that I did something to the OS
thet is preventing vim to work properly.
Maybe somebody con send me a hint on where to look in the Windows
paraphernalia to find out what the problem is

TIA
--
Juan Lanus
TECNOSOL
Argentina

#46438 From: Timothy Washington <timothyjwashington@...>
Date: Mon Jan 5, 2004 3:52 am
Subject: mechnism for autoindent
timothyjwashington@...
Send Email Send Email
 
Does anyone know the mechanism autoindent uses to place the correct
amount of indents after going to a new line? My vim is autoindenting
with 1 too may tabs on the next line and I'm trying to fix it. Thanks
in advance.



Timothy Washington
timothyjwashington@...
416.457.6599

Messages 46409 - 46438 of 137779   Oldest  |  < Older  |  Newer >  |  Newest
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help