Re: new text object feature request

2007-05-16 Thread Peter Hodge
--- Larson, David [EMAIL PROTECTED] wrote:

 I often need to replace parameter text and usually try to remember the
 text object that selects the inner parameter, only to come up short
 since that type isn't defined. It seems natural to have a parameter
 text object, where it would act on the text between commas or
 parentheses, i.e. from (, to ,).
 
 What say you? Something worthy of the todo list?

Hello,

I believe that can be done using Vimscript, so you could try that first.

regards,
Peter



  
___
How would you spend $50,000 to create a more sustainable environment in 
Australia?  Go to Yahoo!7 Answers and share your idea.
http://advision.webevents.yahoo.com/aunz/lifestyle/answers/y7ans-babp_reg.html



Re: wish: allow a: in the function def

2007-04-24 Thread Peter Hodge

--- Nikolai Weibull [EMAIL PROTECTED] wrote:

 On 4/23/07, Yakov Lerner [EMAIL PROTECTED] wrote:
  wish: allow a: in the function definition line:
function foo(a:line1, a:line2)
  This is currently not allowed. But it seems logical to allow it.
 
 Why should it be?  Extra typing?

So that the name is consistent everywhere. Makes it much easier to search. I
would appreciate this addition, too.

regards,
Peter


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


RE: wish: collaboration of N vim instances editing same file

2007-04-23 Thread Peter Hodge
Hello,

Couldn't the 'patch' command do this?  E.g., Vim#1 has made some changes to
example.c (but not saved them), and Vim#2 makes some different changes and
saves them.  Vim#1 sees that example.c has changed, and makes a diff between
the new example.c and what it originally was, and also makes a diff between
Vim#1's modifications and what example.c originally was, patches the original
with both those diffs and *bingo* you have the merged file (so far as you can
trust the patch utility).

Shouldn't this be possible through the autocommands? I think you could write
this as a plugin, Yakov.

regards,
Peter

 
--- Gene Kwiecinski [EMAIL PROTECTED] wrote:

 I'd be seriously uncomfortable with that as a feature.  Imagine
 absentmindedly editing the same file 2x or more.  Make some changes in
 one instance, make different changes in another instance, save/quit
 the
 first, save/quit the second, trash all the edits made in the first
 instance.
 
 In the orininal post, I wrote about the feature where two+ instances
 of vim show and merge changes made by other instances. With
 such collaboration enabled, the 2nd instance would show and merge
 changes made by 1st instance, and 1st instance would absorb, merge
 and show changes made by 2nd instance. In this scenario, loss of
 edits does not happen. So I don't underastand why you say you are
 against it if it avoids exactly what you cited as unwanted ?
 
 -- Ability of N instances of vim to absorb, merge and show changes
 to the same file made by other running vim instances
 
 Because I don't trust such mechanisms.  Especially if editing the same
 block of text/code/etc., where subtle changes in a program can be
 disastrous.
 
 Eg, just yesterday, I wanted to split off some functionality to a
 separate variable, so made another one called avg from the original
 average.  What if the second instance just assumed that I wanted to
 make similar changes to the original instance of average when I in
 fact wanted/needed it to be the same.  There's no easy way to absorb
 or merge changes automagically;  sometimes even the order of
 implementation is rather significant.  Just ask anyone who uses
 sccs/rcs/etc., about forked code, and some of the nightmares trying to
 reconcile different disparate versions.
 


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


Re: wish: collaboration of N vim instances editing same file

2007-04-11 Thread Peter Hodge
Hello Yakov,

Couldn't you hook into the FileChangedShell autocmd event and merge the changes
into your buffer from there? You can also handle the swap file message with
SwapExists event.

regards,
Peter



--- Yakov Lerner [EMAIL PROTECTED] wrote:

 Hello Bram,
 Is it possible to add this item to the vim voting list ?:
 
   collaboration of N vim instances editing same file
   -- Ability of N instances of vim to absorb, merge and show changes
   to the same file made by other running vim instances [ either by reading
   other vim's swapfiles, or somehow else ] ?
 
 Can this be added to SOC ?
 
 Yakov
 


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


Re: Using variables in syntax definitions

2007-04-10 Thread Peter Hodge
Hello,

You'll probably need to use 'execute':

  execute 'syn match myPattern' s:mypattern

but again, highlighting won't work for you then.

regards,
Peter


  

--- Ian Tegebo [EMAIL PROTECTED] wrote:

 Is doesn't seem possible to store my patterns in variables for use in syntax
 definitions like the following:
 
 let s:mypattern = '#.*'
 syn match myPattern s:mypattern
 
 I get 'pattern delimiter not found' and what not.  Is there a way to achieve
 this?
 
 The general problem I'm trying to solve is having to update patterns in
 syntax files when they're used in multiple places and to reduce the line
 length of syntax definitions; I've tried using line continuations but
 highlighting in the definition file itself seems to fail in this case.
 
 -- 
 Ian Tegebo
 


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


Re: case of very slow regex search

2007-04-03 Thread Peter Hodge

--- Yakov Lerner [EMAIL PROTECTED] wrote:

 I use sometimes the regex that finds paragraphs
 containing given words w1,w2,... in any order ( I define paragraph
 as separated by lines, \n\n).
 
 I use the pattern like this: (two-word example, w1 and w2, but easily
 expandable for N words):
 /\c\(.\|.\n\)*\w1\\\(.\|.\n\)*\w2\
(and I set :set maxmempattern=2 )
 This works. But search time is unbelievably slow on big files.
 
 My question is; is there a rewrite of this  regex that works faster.
 
 To see the testcase how of how slow this works:
1. wget http://www.vmunix.com/~gabor/c/draft.html
   # this is ~1.3 MB file.
2. vim draft.html
3. /\c\(.\|.\n\)*\w1\\\(.\|.\n\)*\w2\

Try this pattern:

  /\c\n\zs\%(\%(.\|.\n\)\{-}\international\\\%(.\|.\n\)\{-}\although\\)

It has the \n at the start so it will match at most once per line and uses \{-}
instead of * to prevent backtracking. That search ends in 30 seconds (on a Dual
1.8ghz G5).  You won't need to tweak maxmempattern either.

regards,
Peter


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


Re: Newbee question:Why don't I have the syntax highlighting when editing files like *.sh *.xml,etc?

2007-04-02 Thread Peter Hodge
Hello,

Also you can use

  :set ft? syntax?

to see which filetype has been detected, and which syntax has been activated.

regards,
Peter



--- Xi Juanjie [EMAIL PROTECTED] wrote:

 syntax on should be ok.
 
 Please use :version to confirm your vim was compiled with +syntax
 function and keep the corresponding syntax file in vim runtime folder.
 
 Also to check if there has any syntax off in /etc/vim/vimrc.local.
 
 wangxu wrote:
  Why don't I have the syntax highlighting when editing files like *.sh
  *.xml,etc?
  After commands like syntax on,still nothing happened.
  below is my /etc/vim/vimrc,what else should I do to turn the syntax
  highlighting on?
  Thanks,
  shell.
  
  
  set
 

runtimepath=~/.vim,/etc/vim,/usr/share/vim/vimfiles,/usr/share/vim/addons,/usr/share/vim/vim63,/usr/share/vim/vimfiles,/usr/share/vim/addons/after,~/.vim/after
  
  set nocompatible  Use Vim defaults instead of 100% vi compatibility
  set backspace=indent,eol,start  more powerful backspacing
  
  set autoindent  always set autoindenting on
  set textwidth=0  Don't wrap lines by default
  set viminfo='20,\50  read/write a .viminfo file, don't store more than
   50 lines of registers
  set history=50  keep 50 lines of command line history
  set ruler  show the cursor position all the time
  
  set
 

suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
  
  if term =~ xterm-debian || term =~ xterm-xfree86 || term =~ xterm
  set t_Co=16
  set t_Sf=[3%dm
  set t_Sb=[4%dm
  endif
  
  vnoremap p Esc:let current_reg = @CRgvdiC-R=current_regCREsc
  
  
  syntax on
  
  
  if has(autocmd)
   Enabled file type detection
   Use the default filetype settings. If you also want to load indent files
   to automatically do language-dependent indenting add 'indent' as well.
  filetype plugin on
  
  endif  has (autocmd)
  
  augroup filetype
  au BufRead reportbug.* set ft=mail
  au BufRead reportbug-* set ft=mail
  augroup END
  
  try
  if filereadable('/etc/papersize')
  let s:papersize = matchstr(system('/bin/cat /etc/papersize'), '\p*')
  if strlen(s:papersize)
  let printoptions = paper: . s:papersize
  endif
  unlet! s:papersize
  endif
  catch /E145/
  endtry
  
  
  if filereadable(/etc/vim/vimrc.local)
  source /etc/vim/vimrc.local
  endif
  
  
  
  if t_Co  2 || has(gui_running)
  syntax on
  set hlsearch
  endif
  
  
  
  
 


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


Re: completion menu colors

2007-04-02 Thread Peter Hodge

--- fREW [EMAIL PROTECTED] wrote:

 Hi all,
 Is there a way to change the completion menu colors?

Change the highlighting options for the Pmenu* highlight groups:

  :hi Pmenu  ctermfg=Cyanctermbg=Blue cterm=None guifg=Cyan 
guibg=DarkBlue
  :hi PmenuSel   ctermfg=White   ctermbg=Blue cterm=Bold guifg=White
guibg=DarkBlue gui=Bold
  :hi PmenuSbar  ctermbg=Cyanguibg=Cyan
  :hi PmenuThumb ctermfg=White   guifg=White

etc.  The 'cterm*' settings are for colour terminal, the 'gui*' settings are
for GUI.

You can see all colour groups by using ':runtime syntax/hitest.vim', or in GUI
Vim use the menu selection Syntax - Highlight Test.

regards,
Peter


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


Re: Any way to have multiple setfiletype's?

2007-03-08 Thread Peter Hodge

--- Kevin Old [EMAIL PROTECTED] wrote:

 Hello everyone,
 
 I've recently found the new HTML.zip
 (http://www.vim.org/scripts/script.php?script_id=453) utility and want
 to use it with my setup.  By itself HTML.zip works fine.
 
 Thing is, I use HTML::Mason as my template language for Perl and I
 have my setfiletype defined in filetypes.vim as:
 
 au! BufRead,BufNewFile *.htmlsetfiletype mason
 
 But, when it's defined this way, I'm not able to use the HTML.zip as
 it's not loaded.
 
 Is there any way I can have the best of both worlds and have my mason
 syntax highlighting and the usage of HTML.zip?

You can set multiple filestypes by using:

  set filetype=html.mason

regards,
Peter


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


Re: hi Comment guifg=white guibg=black in ~/.vimrc ignored

2007-03-01 Thread Peter Hodge

--- Hugh Sasse [EMAIL PROTECTED] wrote:

 On Thu, 1 Mar 2007, Alexander Farber wrote:
 
  Hello Hugh,
  
  On 3/1/07, Hugh Sasse [EMAIL PROTECTED] wrote:
  
  Actually I edit .sh, .pl, .c, .h, .java and .as files
  and like to have similar colors (like inverted comments)
  everywhere. So probably this is not the best way?
 
 Then I'm not really sure what is, hopefully someone else will
 jump in here

Hello,

If you insist on having your colors inside .vimrc, then you can do it like
this:

  augroup MyColors
  autocmd!
  autocmd ColorScheme * hi Cursor term=inverse   ctermfg=black 
  guifg=black guibg=green
  autocmd ColorScheme * hi Visual term=inverse   ctermfg=yellow
ctermbg=black guifg=yellow guibg=black
  autocmd ColorScheme * hi Commentterm=inverse   ctermfg=white 
ctermbg=black guifg=white guibg=black
  autocmd ColorScheme * hi Identifier term=NONE  ctermfg=black 
  guifg=black
  autocmd ColorScheme * hi Constant   term=underline ctermfg=red   
  guifg=red
  autocmd ColorScheme * hi Statement  term=bold  ctermfg=blue  
  guifg=blue
  autocmd ColorScheme * hi PreProcterm=NONE  ctermfg=black 
  guifg=black gui=underline
  autocmd ColorScheme * hi Specialterm=NONE  ctermfg=red   
  guifg=red
  autocmd ColorScheme * hi Type   term=bold  ctermfg=blue  
  guifg=blue
  augroup end

otherwise, you can download my AfterColors plugin:

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

and move your highlight commands into $HOME\vimfiles\after\colors\common.vim'.

regards,
Peter



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


Re: Suggestion for :syn-nextgroup enhancement

2007-02-27 Thread Peter Hodge
I would find this feature very useful as well.
+1

regards,
Peter


--- Nikolai Weibull [EMAIL PROTECTED] wrote:

 I'm a firm believer in the nextgroup directive for defining syntaxes.
 It allows you to define grammars, which I really enjoy doing.
 However, one problem is that many languages allow things to appear in
 their input that's not part of the language's grammar.  For example,
 many languages allow comments to appear almost anywhere in the input,
 which are stripped out of the input while lexing the input into tokens
 that are then fed to the actual parser.  Now comments could be a part
 of the grammar, simply being thrown away at that point in the process,
 but it forces you to provide for the possibility of a comment
 appearing basically anywhere between terminals/non-terminals.
 
 Anyway, what I'm actually suggesting is a way to get around this issue
 by adding a new directive to the :syntax command that can be used
 alongside nextgroup to skip certain syntax groups before trying the
 groups defined by nextgroup.  This is much like skipwhite, skipnl, and
 skipempty, but for arbitrary syntax groups.
 
 Here's an example of what I intend for it to do:
 
 syn keyword tocTodo
   \ contained
   \ TODO
   \ FIXME
   \ XXX
   \ NOTE
 
 syn match   tocComment
   \ contains=tocTodo,@Spell
   \ '//.*$'
 
 syn keyword tocHeaderKeyword
   \ nextgroup=tocCatalogNumber
   \ skip=tocComment
   \ skipwhite
   \ skipempty
   \ CATALOG
 
 syn match   tocCatalogNumber
   \ contained
   \ '\d\{13\}'
 
 This is a partial grammar that matches comments and the CATALOG
 keyword in the header part of a cdrdao(1) TOC file (yes, I'm writing a
 grammar for such files).  Comments begin with a set of slashes and can
 appear anywhere in the file.  The CATALOG keyword is followed by a
 (optional, but let's keep it simple for this example) catalog number.
 The idea here is that the skip=tocComment directive to
 tocHeaderKeyword will tell the syntax highlighting engine that it
 should skip any matches to tocComment that follow tocHeaderKeyword,
 just as the skipwhite and skipempty pair tells it to skip whitespace
 and empty lines (before and after any tocComments) before it tries to
 match a tocCatalogNumber.
 
 I have no idea how hard this would be to implement, but I'm thinking
 that it can't be too difficult.  It should only be to add some
 handling around the code that handles skipwhite/skipnl/skipempty to go
 through a list of syntax groups and try to match them, highlighting
 them, and then trying to highlight whatever is in nextgroup
 afterwards.
 
 I'm sure there are edge cases to consider, but I can't think that it
 should be impossible.  I sadly don't have any understanding of the Vim
 syntax highlighter, so someone with more knowledge will have to help
 me out.
 
 Comments?  Patches?  Complaints?
 
   nikolai
 
 P.S.
 Yes, I know that this can be solved by keeping track of the context by
 adding a tocXComment for each and every :syntax ... X ... definition
 (production) that keeps track of what the nextgroup of the production
 in question was and adding the tocXComment production to that
 productions nextgroup, but that doubles the number of productions and
 makes it a lot harder to change it later on.
 
 Here's an example of what that looks like for the grammar above:
 
 syn keyword tocTodo
   \ contained
   \ TODO
   \ FIXME
   \ XXX
   \ NOTE
 
 syn match   tocComment
   \ contains=tocTodo,@Spell
   \ '//.*$'
 
 syn keyword tocHeaderKeyword
   \ nextgroup=
   \   tocCatalogNumberComment,
   \   tocCatalogNumber
   \ skipwhite
   \ skipempty
   \ CATALOG
 
 syn match   tocCatalogNumberComment
   \ nextgroup=tocCatalogNumber
   \ skipwhite
   \ skipempty
   \ contains=tocTodo,@Spell
   \ contained
   \ '//.*$'
 
 syn match   tocCatalogNumber
   \ contained
   \ '\d\{13\}'
 
 Of course, all those additional groups can be automatically generated,
 given a grammar, but again, it makes it harder to follow, harder to
 change, and more memory-hungry than what a grammar using the (still
 fictional) skip directive.
 D.S.
 


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


Re: Optimum syntax file size...

2007-02-19 Thread Peter Hodge
Hello,

If it is a C-style syntax where you're matching together lots of { } areas (or
if/endif blocks, etc), using regions, then you should provide an option to turn
it on/off, because this can be slow on large files (and get out of sync).

Thousands of keywords probably isn't an issue, but if you put them all on one
line it might slow things down (that might be a myth).  For readability sake,
maybe 12-50 per line?

Folding using regions is slow, you definitely should provide a way to turn this
feature off.

The new PHP syntax (http://www.vim.org/scripts/script.php?script_id=1571) is
quite large, but the only speed issue I've seen is with folding.

Try opening multiple windows of the same file and see if editting becomes slow
as Vim tries to re-sync the other windows in real-time.

Hope that helps,

regards,
Peter
  


--- Robert Hicks [EMAIL PROTECTED] wrote:

 Is there a size limit that one should set as a ceiling for syntax file size?
 
 Robert
 
 


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


Re: Web-based editing [Was :wq vs ZZ]

2007-02-14 Thread Peter Hodge
--- Bram Moolenaar [EMAIL PROTECTED] wrote:

 
 Pete Johns wrote:
 
  On Tue, 2007-02-13 at 16:07:32 -0700, [EMAIL PROTECTED] sent:
  (Sorry guys, my web-based editor, which I must use at work
  becauseof IT paranoia about SMTP, simply will not let me reply
  at the end rather than beginning of the thread.)=20
  
  Web-based editor? Why not use Vim as your editor from within
  Firefox? Works a treat for me!
  
  ViewSourceWith http://dafizilla.sourceforge.net/viewsourcewith/
 
 Don't see something about Vim here...
 
 I'm using It's All Text! now.  Just had to create a shell script to
 start gvim, because it doesn't allow you to give arguments to the
 command.

Mozex (http://mozex.mozdev.org/) is working quite well for me on Windows and
Mac.

regards,
Peter


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


Re: Folding to produce a high-level index of code

2007-01-09 Thread Peter Hodge
Hello,

Try this script:

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

regards,
Peter



--- Noah Spurrier [EMAIL PROTECTED] wrote:

 
 I have folding set to use expr. I have a foldexpr that
 identifies lines for functions and classes in PHP.
 Lines that are part of a function are folded.
 Function definition lines are NOT folded.
 This gives me a single level of folding that works like
 an index to my code. This works great.
 
 Is it possible to have an open fold include a few lines BEFORE the
 beginning of the fold? For example, it's common in PHP to have a
 phpdoc comment before the function definition.
 When all folds are closed I see just a list of function names.
 When I open a fold I see the entire body of the function, but
 I don't see the comment before the function.
 
 I'm sure I could get the fold expression to work so that it starts the
 fold on the comment BEFORE the function definition, but then when I closed
 the fold I would not see the function name.
 
 Perhaps I could set the fold to start at the comment before the
 function definition and set the 'foldtext' to be the
 text of the line with the function definition. I shall mull that over.
 In the mean time, if anyone has any suggestions or has already done
 this then please let me know.
 
 So when I have all folds closed I see my code like this:
 
 function reverse_zipcode ($zipcode)
 +-- 10 lines: {
 function get_inventory ()
 +-- 28 lines: {
 function delete_inventory ()
 +--  5 lines: {
 function touch_sql ($sql)
 +-- 21 lines: {
 function see_sql ($sql,$fetch_mode=DB_FETCHMODE_OBJECT)
 +-- 20 lines: {-
 
 If I wanted to view delete_inventory I would click on the + to open
 the fold to see something like this (note how the comment BEFORE
 the function is also show):
 
 function reverse_zipcode ($zipcode)
 +-- 10 lines: {
 function get_inventory ()
 +-- 28 lines: {
 /**
  * This deletes unqualified inventory from t_inventory.
  * The table inv_delete is used to find unqualified inventory
  * scheduled for deletion.
  * @see function create_inv_delete
  */
 function delete_inventory ()
 {
 $sql = DELETE inventory FROM inventory, inv_delete WHERE
 inventory.inventory_id=inv_delete.inventory_id;;
 touch_sql ($sql);
 }
 function touch_sql ($sql)
 +-- 21 lines: {
 function see_sql ($sql,$fetch_mode=DB_FETCHMODE_OBJECT)
 +-- 20 lines: {-
 
 Currently, the best I can do is to show everything below the fold.
 This is nice, but the documentation comment remains hidden, like this:
 
 function reverse_zipcode ($zipcode)
 +-- 10 lines: {
 function get_inventory ()
 +-- 28 lines: {
 function delete_inventory ()
 {
 $sql = DELETE inventory FROM inventory, inv_delete WHERE
 inventory.inventory_id=inv_delete.inventory_id;;
 touch_sql ($sql);
 }
 function touch_sql ($sql)
 +-- 21 lines: {
 function see_sql ($sql,$fetch_mode=DB_FETCHMODE_OBJECT)
 +-- 20 lines: {-
 
 Yours,
 Noah
 
 
 


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


Re: Help with syntax file

2006-12-21 Thread Peter Hodge
Hello,

The raw syntax string item is defined so as to skip over a [\].  You just need
to remove the 'skip=+\\+' part from this line:

  syn region dRawString start=+r+ skip=+\\+ end=+[cwd]\=+ [EMAIL PROTECTED]

change to

  syn region dRawString start=+r+ end=+[cwd]\=+ [EMAIL PROTECTED]

regards,
Peter


--- jose isaias cabrera [EMAIL PROTECTED] wrote:

 
 Greetings vim'ers.
 
 I have a syntax file for the D Programming Language.  The D language has a 
 Raw String, which starts with r and ends with .  Anything in there is 
 taken as is.  But I have one problem with the D syntax file (d.vim):  When I 
 have this code,
 
 a = rc:\temp\ ~ GetUserName() ~ \test.db;
 
 everything after \ gets highlighted as Raw String, where it should not. 
 The Raw String stops at the second, or \.  I know why it's happening: the 
 syntax file is taking \ and is assuming that it is a normal D String and it 
 is making the second  escaped, where it should not be.
 
 Any idea on how to fix this?  Attached is the d.vim syntax file.
 
 thanks,
 
 josé 
 


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


Re: finding extra { braces

2006-11-30 Thread Peter Hodge
Hello Yakov,

One way is to have Vim fold the { } regions.  I think this is already set up in
the C syntax, so you just need to ':set foldmethod=syntax'.  You may also want
to ':set foldcolumn=4' (or whatever number works for you).  Note how the left
side of the display shows you where each fold (each { } region) starts and
ends.

regards,
Peter



--- Yakov Lerner [EMAIL PROTECTED] wrote:

 It is easy to identify extra '}' in the .c source, compiler
 points us to the exact line. Rarely, I have the opposite error,
 the extra '{' somewhere in the source. For example
  int foo() {
  {

   }
 In this case, gcc points me to the end of file. This is not helpful.
 Can anyone suggest quick method of finding the function
 that contains extra '{' brace ?
 
 Thanks
 Yakov
 


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


Re: Matching JUST the nth occurence of a text in a line

2006-11-30 Thread Peter Hodge
Hello,

Try:

  /^.\{-}home.\{-}\zshome


for your reference:

  \{-} makes the '.' match as little as possible
  \zs makes the search match begin at this point in the pattern


regards,
Peter


--- zzapper [EMAIL PROTECTED] wrote:

 Hi given a sample text below
 
 home
 
 home gg home xxx
 
 home ggg ggg home home
 
 home home
 
 How do you match JUST the second home in any of the above lines (ie avoid 
 greediness)
 
 
 -- 
 zzapper
 http://successtheory.com/tips/ Vim, Zsh, MySQL Tips
 
 


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


Re: Matching JUST the nth occurence of a text in a line

2006-11-30 Thread Peter Hodge

--- Bill McCarthy [EMAIL PROTECTED] wrote:

 On Thu 30-Nov-06 9:20pm -0600, Peter Hodge wrote:
 
  Try:
 
/^.\{-}home.\{-}\zshome
 
 
  for your reference:
 
\{-} makes the '.' match as little as possible
\zs makes the search match begin at this point in the pattern
 
 One might think so, but also note:
 
 :help non-greedy
 
 In particular, ready the sentence starting with BUT.  All
 that is needed is:
 
 /home.\{-}\zshome
 
 Earliest is preferred to shortest.

Yes, but that could also match a 3rd or 4th or 5th occurance of 'home' in one
line, so it's slightly safer to anchor the pattern to the start of the line.

regards,
Peter

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


Re: Matching JUST the nth occurence of a text in a line

2006-11-30 Thread Peter Hodge

--- Bill McCarthy [EMAIL PROTECTED] wrote:

 On Thu 30-Nov-06 10:24pm -0600, you wrote:
 
  --- Bill McCarthy [EMAIL PROTECTED] wrote:
 
  On Thu 30-Nov-06 9:20pm -0600, Peter Hodge wrote:
  
   Try:
  
 /^.\{-}home.\{-}\zshome
  
  
   for your reference:
  
 \{-} makes the '.' match as little as possible
 \zs makes the search match begin at this point in the pattern
  
  One might think so, but also note:
  
  :help non-greedy
  
  In particular, ready the sentence starting with BUT.  All
  that is needed is:
  
  /home.\{-}\zshome
  
  Earliest is preferred to shortest.
 
  Yes, but that could also match a 3rd or 4th or 5th occurance of 'home' in
 one
  line, so it's slightly safer to anchor the pattern to the start of the
 line.
 
 Given the use of the shortest match first algorithm I
 don't see how that's possible.  Please give an example.

'/home.\{-}\zshome' will match every 2nd home in the following text:

  home home home home
  home home home home home home home home
  home home home home home

This is assuming you are doing a normal search using '/', not using a command
like ':g' or ':s' with the 'g' flag.

regards,
Peter


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


Re: I look for php abbreviations configuration script...

2006-11-27 Thread Peter Hodge
Hello,

What does a 'php abbreviations configuration script' do?

regards,
Peter


--- KLEIN Stéphane [EMAIL PROTECTED] wrote:

 Hello,
 
 I look for php abbreviations configuration script. There aren't ?
 
 Thanks
 Stephane
 


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


Re: compile code from within vim

2006-11-26 Thread Peter Hodge
Hello,

Probably the most straightforward way to do this in your ~/.vimrc file:

  nnoremap F3 :call CompileScript()CR

  function! CompileScript()
 the name of the current file
let fname = expand('%')

 can't compile unless the file is saved
if modified
  echo printf('Please save %s before compiling', fname)
  return
endif

 decide how to execute the script:
if filetype == 'perl'
  execute printf('!perl %s', fname)

elseif filetype == 'ruby'
  execute printf('!ruby %s', fname)

elseif filetype == 'bash' || filetype == 'sh'
  execute printf('!source %s', fname)

else
  echo printf(Don't know how to compile filetype '%s', filetype)
endif
  
  endfunction


I hope that's enough to get you started.

regards,
Peter


--- atstake atstake [EMAIL PROTECTED] wrote:

 I'm using vim 6.4.7 on Fedora Core 5. I would like to compile C,
 Perl, ruby  bash script from within vim. I want vim to recognize a file
 by extenstion and if I map it to, say, F3 vim would be able to compile
 the code based on the extension; eg. if it's a .pl file it would do
 perl filename, show the result and if there's any error it would take
 me to the line where the error is.
 
 Is there any easy way to do this with functions? Any example would be
 greatly appreciated.
 
 Thanks.
 


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


Re: vim.org refreshed mockup

2006-11-07 Thread Peter Hodge

--- Ricardo SIGNES [EMAIL PROTECTED] wrote:

 * Panos Laganakos [EMAIL PROTECTED] [2006-11-07T12:59:57]
  I made a mockup of a refreshed version of vim.org, trying to maintain
  as much of the original look as possible:
  
  http://panos.solhost.org/mockups/vimorg-01.png
  
  vim tangofied icon by toZth
 
 I like it.  The light grey used in the dates/names in the sripts section is a
 bit too light for easy reading.  I think that if the V icon is going to be
 used (as opposed to the (unofficial?) Vim icon), you should do SOMETHING to
 get Vim in the header.  After all, it isn't V the editor.

No, 'V' is in fact an energy drink, quite well-known in Australia, so it's good
to keep the whole 'Vim' name on the page!

http://www.frucor.com/brands/aus/new_age.html

regards,
Peter

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


Re: Agonized by auto changed cursor to next line when typing.

2006-11-02 Thread Peter Hodge

--- Shark Wang [EMAIL PROTECTED] wrote:

 Hi,
 
 I was agonized by GVim 7.0, the editor always auto changed my cursor
 to next line, when I typed
 with long line ( less than the wrap margin ) or end tag element, such
 as /table.
 
 the following is my vimrc, you could see that I had disabled autoindent :
 =
 * display *
 colo darkblue
 syntax on
 set gfn=Bitstream\ Vera\ Sans\ Mono:h11
 set anti
 set nonu
 * wrap and tab *
 set wm=78
 set ts=2
 set sw=2
 set et
 * indent *
 set noai
 set nosi
 set nocin
 set ic
 
 What should I do for this issue ? thanks for your help.

Hello,

If you have 'wrapmargin' or 'wm' set to 78, Vim is going to wrap your text 78
characters *before* the right margin.  That means if you have 110 columns of
screen space, Vim will wrap after just 32 characters.  Perhaps 'textwidth' is
the option you are trying to set in your vimrc where you have:

  set wm=78

maybe you should use

  set textwidth=78

See also
  :help 'wm'
  :help 'tw'

Also, AFAIK indenting options don't insert newlines, they only adjust the
number of tabs/spaces at the start of the line.

regards,
Peter

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


Re: syntax region match with braces

2006-11-01 Thread Peter Hodge
Hello,

I have the same problem with large PHP files, Vim gets confused in the midst of
all the curly braces ... :-S  Unfortunately I'm not yet familiar with the 'syn
sync' commands, partly because they're so hard to test.

You can use a command like ':syn on' to refresh the syntax, and that should
make everything match up properly again.  Also, make sure you don't have the
'display' option added to the wrong syntax items, that can also mess up
matching of { and }.

regards,
Peter




--- Виктор Кожухаров [EMAIL PROTECTED] wrote:

 В ср, 2006-11-01 в 23:26 +1100, Peter Hodge написа:
  --- Виктор Кожухаров
 [EMAIL PROTECTED] wrote:
  
   Ð’ ÑÑ€, 2006-11-01 в 10:53 +1100, Peter Hodge
 напиÑа:
--- ÃøúÑþѬ
 ÃaþöђÑðѬþò
   [EMAIL PROTECTED] wrote:

 Hello,
 
 I'm working on a syntax file for .edc files. The problem before me is
 that I want to use a different syntax file for a script part. I've
 created the syntax file for the script syntax, and I've read how yto
 use
 syn include.
 
 The real problem is, that in the .edc files, scripts are located
 within:
 script {
   SCRIPT HERE
 }
 ,however, the scripts themselves can also have {} braces. I've
 written
 the following, but it only uncludes the script syntax upto the first
 }
 brace, and I have no idea how to make it end on the _matching_ }
 brace
 instead:
 

 ---
 syn include   @edcEmbryo  syntax/embryo.vim
 unlet b:current_syntax
 syn regionedcScript   start=\script\\s*\n*\s*{ end=}
 [EMAIL PROTECTED],edcScriptTag
 syn keyword edcScriptTagcontained script

 ---
 
 So the question is, if I have:
 script {
   if (foo) {
   bar;
   } else {
   baz;
   }
 }
 how do I make vim use the script syntax all the way up to the closing
 }
 brace for the script?

Hello,

Your syntax file 'embryo.vim' will need regions match up all {} pairs
 as
   well.

  syn region embryoBraces matchgroup=Delimiter start=/{/ end=/}/
   transparent

regards,
Peter

   
   actually, after adding this region, what really happens, is that all the
   '}' in the script part are of group Delimeter, including the '}' for the
   'script {' itself. so, if there's another '}' after that, it becomes of
   region edcScript (even though logically it's out of the script's scope).
   There are times however, where a '}' won't follow the script's own
   closing '}', thus the edcScript region will never end, as I observed in
   the first case.
  
  try:
  
syn region edcScript matchgroup=edcScriptTag start=\script\_s*{
 end=}
  keepend [EMAIL PROTECTED]
  
syn region embryoBraces matchgroup=Delimiter start=/{/ end=/}/
 transparent
  keepend extend
  
  I'm not sure if 'transparent' is going to mess things up ... if it does,
 take
  out 'transparent' and use '[EMAIL PROTECTED]'
  
 that worked almost perfectly. the only problem now, is that if the
 script part is too long, if I scroll to where it ends, the edc stuff is
 not highlighted anymore, untill i reload the file, and if i do, they are
 highlighted, but I have to scroll up until close to the begining of the
 script, so that the script itself is highlighted. And for small scripts,
 even reloading the file doesn't return the .edc highlighting, after the
 script.
 
 I'm not sure why that happens, and out of pure guessing, i'd say it's
 something to do with syn sync, which I got from other syn files. I have
 both edc and embryo sync with the following line:
 syn sync ccomment edc(embryo)Comment minlines=50
 
 if I make the minlines too big, edc isn't highlighted after a script
 even after reload. with a value of 1, it exhibits the above behaviour.
 
  regards,
  Peter
  
  
  Send instant messages to your online friends http://au.messenger.yahoo.com 
 -- 
 Виктор Кожухаров /Viktor Kojouharov/
 


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


Re: syntax region match with braces

2006-10-31 Thread Peter Hodge

--- ÐикÑоѬ ÐaожÑ#146;ÑаѬов [EMAIL PROTECTED] wrote:

 Hello,
 
 I'm working on a syntax file for .edc files. The problem before me is
 that I want to use a different syntax file for a script part. I've
 created the syntax file for the script syntax, and I've read how yto use
 syn include.
 
 The real problem is, that in the .edc files, scripts are located within:
 script {
   SCRIPT HERE
 }
 ,however, the scripts themselves can also have {} braces. I've written
 the following, but it only uncludes the script syntax upto the first }
 brace, and I have no idea how to make it end on the _matching_ } brace
 instead:
 
 ---
 syn include   @edcEmbryo  syntax/embryo.vim
 unlet b:current_syntax
 syn regionedcScript   start=\script\\s*\n*\s*{ end=}
 [EMAIL PROTECTED],edcScriptTag
 syn keyword edcScriptTagcontained script
 ---
 
 So the question is, if I have:
 script {
   if (foo) {
   bar;
   } else {
   baz;
   }
 }
 how do I make vim use the script syntax all the way up to the closing }
 brace for the script?

Hello,

Your syntax file 'embryo.vim' will need regions match up all {} pairs as well.

  syn region embryoBraces matchgroup=Delimiter start=/{/ end=/}/ transparent

regards,
Peter


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


Re: FW: elastic tabstops and gvim's GTK text widget

2006-10-30 Thread Peter Hodge

--- Nick Gravgaard [EMAIL PROTECTED] wrote:

 Hi Zdenek,
 
 On 30/10/06, Zdenek Sekera [EMAIL PROTECTED] wrote:
 
  Hi, Nick,
 
   -Original Message-
   From: [EMAIL PROTECTED]
   [mailto:[EMAIL PROTECTED] On Behalf Of Nick Gravgaard
   Sent: 19 October 2006 13:42
   To: vim-dev@vim.org
   Subject: elastic tabstops and gvim's GTK text widget
  
   Hi all,
  
   I am the creator of a mechanism called elastic tabstops (see
   nickgravgaard.com/elastictabstops/). Right now, my plan is to try and
   implement this in as many text widgets as possible so that the editors
   that use them will be able to easily add this as a feature. Since vim
   (well, gvim really) is my editor of choice I thought I'd start with
   that. Could someone tell me which GTK widget gvim uses and what
   problems they think I might encounter?
  
   Any other comments are also welcome.
  
 
  I went to your side and read all about it, sounds very
  (read *very*) interesting. I would surely love it.
  As a comment, I'd suggest you reconsider implementing it
  only for gvim+GTK (as that's what I understood from all
  I read). First, it will quite significantly limit number
  of people who would be interested (not all have GTK when
  you go outside Linux) second, some people just do not
  use gvim (I for one use almost only console vim, I can't
  get gvim running with pleasing fonts and if it is not pleasing
  to my eyes, I don't like it). You seem to see a big advantage
  is being able to use non-monospce fonts. Sure, it is an
  advantage (perhaps even a big one), however, one gets very
  far with monospaced fonts, and I feel lots of people
  would think that way. In other words, those who can/want
  to run non-monospaced, great!, but don't leave out all
  the rest of us who have accomodated themselves well with monospaced
  outside of your project.
 
  Brief: consider seriously also the console vim.
 
 I think you may be right - I have a feeling vim is probably just
 treating it's GTK widget in a similar way to how it treats a console.
 If that's true, adding proportional font support is probably a much
 bigger task than I would like to solve right now...
 
 BTW, does anyone know if it's possible to implement elastic tabstops
 as a vim script? It would need to be called whenever a character is
 inserted or deleted and would then modify the size of the tabstops.
 The tabstops would need to have different widths on different lines.
 Is this possible?

Actually, you might be able to get it done with Vimscript, but you'd need to
use space characters instead of tabs.  You would map TAB to call a function
which examines the current line, the line above, the line below, and inserts
the
correct number of spaces, and also adjusts the lines above or below
accordingly.  Also, if you're inserting spaces instead of tabs, it's backwards
compatible with just about everything, which would be great.

cheers,
Peter


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


Re: Key mapping on , and . with CTRL

2006-10-27 Thread Peter Hodge
Hello,

I think it depends on what your terminal can understand.  One way you can find
it out is to type ':map ' (using command mode), then press CTRL-V and then the
key sequence you want to map.  For example, to map CTRL-L you could use ':map
CTRL-VCTRL-L'.

regards,
Peter



--- Zhaojun WU [EMAIL PROTECTED] wrote:

 Hi, Vimmers,
 
 Is there any way to map the comma and period with CTRL such as:
 map C-,  :foo
 map C-.  :foo
 It seems the , and . cannot be used here directly. How can I do in
 this case?
 
 Another question is how I can check all of the current key mappings in
 VIM? I remembered I saw something about it before, but failed to find
 it out.
 
 Thanks,
 -- 
 Best,
 Zhaojun
 


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


Re: Bold font in OS X GUI?

2006-10-25 Thread Peter Hodge

--- A.J.Mechelynck [EMAIL PROTECTED] wrote:

 Peter Hodge wrote:
  Hello,
  
  I am having trouble with OS X GUI, none of the highlighting is in Bold.  Is
  this a Bug, or does Bold font just not work in the OS X gui?
  
  regards,
  peter
 
 
 It may depend on your 'guifont'. Some font faces have no bold glyphs, others 
 no italic, etc. Here, when I set 'guifont' to SUSE Sans Mono 9, all italics
 
 appear bolded; on BH LucidaTypewriter there are no italics at all, ...
 
 If your GUI flavour accepts it, try :set gui=* (without the quotes) and 
 select the regular version of a font which has also bold italic etc.
 
 If it doesn't accept it, you'll have to find from another source which font 
 names are valid on your system, and then find by hit-and-miss some font
 having 
 regular, bold, etc.

I can use guifont=*, and have tried many different fonts which have bold and
italic glyphs. The problem is that no matter which font I choose, Vim refuses
to show text in Bold (Unless I choose a font which has only a bold glyph).  I
get the impression it's a shortcoming of the OS X GUI, because underlined text
doesn't work either (Vim reverses the bg/fg colors instead).

regards,
Peter







 
On Yahoo!7 
Messenger: Share up to 1GB of files in the IM window
http://au.messenger.yahoo.com 



Re: Need to write a language

2006-10-25 Thread Peter Hodge
--- Billy Patton [EMAIL PROTECTED] wrote:

 I'm in the semiconductor industry.  My job is to create data and to run
 regression tests on that data for the validation of physical layout rules.
 
 Skip to bottom for questions, if you don't want to read my ramblings. 
 
 
 The current problem is tha the rules are not in a computer readable form.
 Many paople have a hand in writing different sections of the rules, so you
 can imagine that the wording is widely varied.  There is no standard to
 wording or even the dialog used.
 
 One of the things I have been ask to do is to try and get a handle on how
 the rules may be written that that they are computer readable.
 I've been working with perl hash's and excel spread sheets.
 The main problem I was having was that I was trying to decreace the
 relationship words and increase the number of variables.  This was quickly
 resulting in a spread sheet that was growing (number of columns) very
 rapidly.  I assume excel has a limit to the number of columns.
 
 The idea that I have come up with is to create a language with limited
 descriptive words.  Here is an example of a rule that might be written in a
 human readable form but also parsable by puter.
 
 MET1 spacing to MET1 is 45 if MET1 width is = 245 and = 100
 
 By looking at this
 MET1 is a layer
 Spacing width = = are relationships
 If is a constraint
 #'s are #'s
 
 I want to have them write correct by construction.
 
 Is it possible, in vim/gvim to open a special version of vim so that the
 user can begin to type, spac , and it would complete the word?
 Would it also be possible to not allow a word to be type'd if that word was
 not in a list.
 
 Vim would have to open in edit mode and remain there for most users, until
 save/exit.  Most of the users of this would be hard core pc users who think
 the only editor is word.  But there are a few unix users.
 
 My questions.
 1. Can vim be configured to automatically start in edit mode?
 2. Can vim monitor each word that is being typed?
 3. Can vim do word completion?
 4. Can vim offer all possible spellings for partial word completion?
 If the answer to most of qeustion above is yes
 5. Can I do the programming?  I do perl, c, c++, csh and sh programming.


Hello,

As well as completing words, it would be very helpful if you wrote a syntax
file for your language. If your users see things in color, they can be sure
they have typed the commands correctly, but if the text is *not* colored, then
they will know they've got something wrong.

Something else you may want to consider - Map F5 to call a perl script which
examines the line under the cursor and prints a message explaining what needs
to be typed next.

regards,
Peter




 
On Yahoo!7 
Win VIP tickets to meet R'n'B stars superstars Ne-Yo and Rihanna 
http://advision.webevents.yahoo.com/aunz/music/jay_z_promotion/index.htm 



Re: containedin can't include clusters

2006-10-24 Thread Peter Hodge

--- Nikolai Weibull [EMAIL PROTECTED] wrote:

 I figured that it was easier to add items to a cluster using
 containedin= for a syntax definition I'm writing, but it seems that
 one can't do it that way.  Is there a reason for this, or is it an
 oversight?  Can we add this to the todo?  I've never needed it before,
 but for this particular grammar, it made a lot of sense.

I think you're maybe a little confused.  Using 'syn keyword SomeKeyword foo
[EMAIL PROTECTED]' does not add SomeKeyword to the cluster @SomeCluster,
rather, it allows SomeKeyword be contained in all the items in @SomeCluster. 
It's a little confusing because the syntax is 'syn cluster SomeCluster
contains=...', but that's different from when a region or a match contains=
something.  In the case of a region or match, contains= means 'allow something
to be matched inside of this syntax item', but in the case of a cluster,
contains= means 'add these items to the cluster's array of syntax items'.

Hope that explains everything for you.

regards,
Peter




 
Do you Yahoo!? 
Upgrade to Internet Explorer 7, optimised for Yahoo!7
http://au.rd.yahoo.com/evt=44716/*http://au.downloads.yahoo.com/internetexplorer/index.php


Bold font in OS X GUI?

2006-10-24 Thread Peter Hodge
Hello,

I am having trouble with OS X GUI, none of the highlighting is in Bold.  Is
this a Bug, or does Bold font just not work in the OS X gui?

regards,
peter




 
On Yahoo!7 
Want to make technology work harder for your business? 
http://au.mobile.yahoo.com/mobile-business-solutions/index.html 



Spam on vim.org

2006-10-22 Thread Peter Hodge
Hello,

Can the person responsible please remove this spam from vim.org?

http://www.vim.org/tips/tip.php?tip_id=1367

regards,
Peter



 
Do you Yahoo!? 
Yahoo!7 Time Capsule - Make your mark and be a part of history
http://www.yahoo7.com.au/timecapsule


Re: elastic tabstops and gvim's GTK text widget

2006-10-19 Thread Peter Hodge
Hello,

Do you intend to make Elastic Tabs available in a console vim as well?

regards,
Peter


--- Nick Gravgaard [EMAIL PROTECTED] wrote:

 Hi all,
 
 I am the creator of a mechanism called elastic tabstops (see
 nickgravgaard.com/elastictabstops/). Right now, my plan is to try and
 implement this in as many text widgets as possible so that the editors
 that use them will be able to easily add this as a feature. Since vim
 (well, gvim really) is my editor of choice I thought I'd start with
 that. Could someone tell me which GTK widget gvim uses and what
 problems they think I might encounter?
 
 Any other comments are also welcome.
 
 Thanks,
 Nick
 




 
On Yahoo!7 
Fuel Price Watch: Find the cheapest petrol in your area 
http://au.maps.yahoo.com/fuelwatch/


Re: elastic tabstops and gvim's GTK text widget

2006-10-19 Thread Peter Hodge
 I don't think so - just the GTK version. One of the advantages of the
 elastic tabstop system is that proportional fonts can be used without
 breaking vertical alignment, and obviously this advantage is invalid
 in a monospaced console.

I'm not fussed about proportional fonts, I'm interested in not having to
manually add and remove whitespace.  But I only run OS X and Windows GUIs
anyway.

regards,
Peter



 
Do you Yahoo!? 
Yahoo!7 Time Capsule - Make your mark and be a part of history
http://www.yahoo7.com.au/timecapsule


Re: elastic tabstops and gvim's GTK text widget

2006-10-19 Thread Peter Hodge

--- Nick Gravgaard [EMAIL PROTECTED] wrote:

 On 20/10/06, Peter Hodge [EMAIL PROTECTED] wrote:
   I don't think so - just the GTK version. One of the advantages of the
   elastic tabstop system is that proportional fonts can be used without
   breaking vertical alignment, and obviously this advantage is invalid
   in a monospaced console.
 
  I'm not fussed about proportional fonts, I'm interested in not having to
  manually add and remove whitespace.  But I only run OS X and Windows GUIs
  anyway.
 
 Yeah well the proportional fonts thing is only a side benefit. There
 are other more important advantages such as the one you mention.
 
 Do you know if gvim uses a standard GTK text widget?

I have absolutely no idea, sorry.  If you download the Vim source, you should
find everything GTK-related in these files:

  gui_gtk.c
  gui_gtk_f.c
  gui_gtk_f.h
  gui_gtk_vms.h
  gui_gtk_x11.c

If no one else on this list can help you, then Bram ([EMAIL PROTECTED]) is the
person to ask.

regards,
Peter



 
On Yahoo!7 
Photos: Unlimited free storage – keep all your photos in one place! 
http://au.photos.yahoo.com 



Re: the plugin startup check

2006-10-19 Thread Peter Hodge
I think it is because you may have a copy of the plugin in $VIMRUNTIME as well
as in your .vim folder.  In this way, your .vim copy is sourced first (well,
according to 'rtp'), sets the g:plugin_name variable and when the $VIMRUNTIME
plugins are sourced, and it sees the variable and prevents loading that copy of
the plugin also.

regards,
Peter


--- Yakov Lerner [EMAIL PROTECTED] wrote:

 Almost every plugin begins with this check:
 if exists(g:plugin_name) | finish | endif
 let g:plugin_name = 1
 I understand this tries to save time if vim tries to load plugins 2nd time.
 But aren't plugins loaded only at vim startup ? Does vim *ever*
 ever try to load plugins 2nd time ? In which situation can vim load
 plugin 2nd time (except for some manual command) ?
 
 Yakov
 




 
Do you Yahoo!? 
Yahoo!7 Time Capsule - Make your mark and be a part of history
http://www.yahoo7.com.au/timecapsule


Re: Mapping doesn't work in putty.

2006-10-18 Thread Peter Hodge
Perhaps you could use:

  map [ctrl-v][ctrl-left] :tabpCR
  map [ctrl-v][ctrl-right] :tabnCR

Except instead of typing 'ctrl-v' and 'ctrl-left' literally, you type those
combinations instead.  This will map the exact escape sequences that your
terminal is sending.

regards,
Peter



--- J A G P R E E T [EMAIL PROTECTED] wrote:

 Hi There,
I have these mappings defined in my .vimrc file.
 
 map C-t :tabnew
 map C-left :tabpCR
 map C-right :tabnCR
 
 I'm using putty(terminal emulator) to access the unix server.
 
 The fist mapping works absolutely fine.
 The other two doesn't work at all and gives the error(E388: Couldn't find
 definition).
 Furthermore I checked C-left shows the definition for the variable under
 cursor.
 No clues why its not overridden from my mapping.
 
 When I changed map C-left : tabpCR to
 Map F2 : tabpCR
 It works.
 
 Another point is the mapping(C-left, C-right) works if I use Exceed or
 x-Manager.
 I have no clue at all why its not working in putty.
 As far as I know for mapping at least; graphics support is not a must.
 
 Whats missing for this mapping in putty.
 
 Regards,
 Jagpreet 
 
 
 
 




 
On Yahoo!7 
Men's Health: What music do you want to hear on Men's Health Radio? 
http://www.menshealthmagazine.com.au/ 


Re: Fighting with comments

2006-10-18 Thread Peter Hodge

--- Gary Johnson [EMAIL PROTECTED] wrote:

 On 2006-10-18, eric1235711 [EMAIL PROTECTED] wrote:
 
  Yakov Lerner-3 wrote:
   
   On 10/18/06, eric1235711 [EMAIL PROTECTED] wrote:
  
   Hello
  
   I´m PHP programmer and I started programming in gVim last weak, and I´m
   liking it very much
  
   But I got a trouble...
  
   When I´m commenting (// or /* or #) and I type SPACE it breaks the
 line
   automatically. Always I start a comment, i have to go to normal mode and
   type :set nostaCR :set noaiCR :set nosiCR
  
   I find that only nosta or nosi is enought to make it stop breaking the
   line
   automatically, but I want to configure to it stop doing it forever...
  
   I took a look in syntax/php.vim but I just don´t know where correct
 it...
  
   Do you have any idea of how I fix it?
   
   Does this help:
  :set tw=0
   ?
 
  I can fix it when I´m programming, i´m doing it... but I´m getting tired of
  doing that.
  
  I want to alter the syntax file (or what ever else) to fix it permanently.
 
 First of all, don't alter any of the files that are in the
 $VIMRUNTIME directory.  For Vim-7.0 on Windows, this is commonly
 
 C:\Program Files\Vim\vim70
 
 Doing so will cause you to lose those changes when you upgrade your
 vim installation.
 
 The way to fix this problem is to create two new directories:
 
 $VIM\vimfiles\after
 $VIM\vimfiles\after\ftplugin
 
 on Windows or
 
 ~/.vim/after
 ~/.vim/after/ftplugin
 
 on Unix.  Then create a new file in the after/ftplugin directory
 named php.vim and put in it those commands that fix the problem,
 e.g.,
 
 setlocal nosta
 setlocal noai
 setlocal nosi

I wouldn't have thought those options would make a difference? You should be
able to just use (in after/ftplugin/php.vim):

   don't auto-wrap text
  setlocal formatoptions-=t

   don't auto-wrap comments either.
  setlocal formatoptions-=c

regards,
Peter



 
On Yahoo!7 
Men's Health Radio: Chill out or work out, or just tune in 
http://au.launch.yahoo.com/mens-health-radio/index.html


BUG: formatoptions+=t makes comments wrap (incorrectly) when they shouldn't

2006-10-18 Thread Peter Hodge
Hello,

When I have formatoptions=t, it makes comment lines wrap when they shouldn't,
and it also ignores whatever comment leader is defined in 'comments'.  To
reproduce:


  :set formatoptions=roc
  :set comments=b:%
  :set textwidth=30

  % type these lines of text
  % as one line, and notice
  % how Vim automatically
  % wraps the lines and adds
  % '%' at the start of each
  % line.

Now remove 'c' from formatoptions and add 't'.
  :set formatoptions-=c
  :set formatoptions+=t
From the help pages (:help fo-table)
t   Auto-wrap text using textwidth (does not apply to comments)
c   Auto-wrap comments using textwidth, inserting the current comment
leader automatically.
With 'formatoptions' now set to 'rot', Vim should wrap normal text, but not
comments.

  % but when you type this
  next set of comments, Vim
  will wrap them (when it
  shouldn't, because they are
  comments), and it will also
  miss out the comment leader.

I hope it's clear what's going on here.  I'm running Vim 7 with patches 1-101.

regards,
Peter



 
Do you Yahoo!? 
Cars: Buy and sell, news, reviews, videos and more 
http://yahoo.drive.com.au/


Re: Match something that not in the pattern

2006-10-18 Thread Peter Hodge

--- Peng Yu [EMAIL PROTECTED] wrote:

 Hi,
 
 I have the following file segments. I want to concatenate all the
 lines with their next lines, except that it ends with }}. I want to
 use the pattern \(}}\)[EMAIL PROTECTED]. It seems not working.

[EMAIL PROTECTED] is the look-ahead assersion, you want the look-behind 
assertion which is
\@!

So you could use \(}}\)\@!\n^ instead.

regards,
peter



 
On Yahoo!7 
Break a world record with Total Girl's World’s Largest Slumber Party 
http://www.totalgirl.com.au/slumberparty


Re: What's the exact meaning of the set 'background'?

2006-10-18 Thread Peter Hodge
Hello,

If you change the background=light, Vim reloads the colorscheme so it has a
chance to give you new colors.  But if the colorscheme changes background=dark
again, then Vim knows that the colorscheme isn't capable of picking colors for
a light background.  In that case, Vim will just ignore whatever the
colorscheme says and will use default colors instead.

Therefore, your colorscheme could just read the value of 'background' and
choose appropriate colors, or it could set it the value of background to light
or dark, and choose those colors, because if Vim sees the colorscheme trying to
set 'dark' when you have just selected 'light', it ignores your colorscheme.

regards,
peter



--- [EMAIL PROTECTED] wrote:

 
 Hi Vimmers,
 
 Recently, I've been thinking what this option is designed for.
 
 The document saids that:
 
   when 'background' is set Vim will adjust the default color groups for the
 new value. But the colors used for syntax highlighting will not change.
 
 But in fact, I had tested and found that when I set the 'background'
 option, Vim will source the color scheme script again. The idea seems to be
 good, if the color scheme script reads the 'background' option and set a
 different color according to the option everything should work...
 
 However, we could imagine... what will happen if I set background=light
 while the color scheme set background=dark inside the script? When we set
 background=light in command line, the script will be launched, and the
 background set to dark. then we will never be able to set background=light.
 Then, if another color scheme wants the value, it will always get
 background=dark even if the user set background=light. (Okay the System
 will try to set the 'background' option too, and that will more more
 confusing...)
 
 So, is 'background' option designed so that the color scheme should not
 read or write it at all? In my opinion it is introducing more confusing
 than good if it works this way.
 
 Could anyone explains what this option exactly means and what it is
 designed to and how should we use it? I've been quite confused now.
 
 --
 Sincerely, Pan, Shi Zhu. ext: 2606
 
 




 
Do you Yahoo!? 
Spring Racing Carnival - Check out Sonia Kruger's blog
http://au.sports.yahoo.com/racing/


Re: How to find a file.

2006-10-17 Thread Peter Hodge
--- Zheng Da [EMAIL PROTECTED] wrote:

 Hello.
 I want to open a file, and I know its name, but don't know the path.
 I want to use the command find. For example I want to open the file
 space.cc, and use the command :find space.cc. I know the file may be
 in the current directory, or the subdirectories, but always get the
 error E345: Cannot find file space.cc in path. I use the default
 path, it should be .,/usr/include,,. (I use Linux).
 So what's the problem? And how to open the file I want?

Hello,

If you prefix '**/' to the filename, Vim should search through subdirectories
for the file:

  :edit **/space.cc
  :find **/space.cc

Also, if you use CTRL+D, Vim will show you a list of matching files:

  :find **/space.ccCTRL+D
src/space.cc
src/backup/space.cc

regards,
Peter




 
On Yahoo!7 
Music: Create your own personalised radio station. 
http://au.launch.yahoo.com/ 



Re: Contextual 'iskeyword'?

2006-10-17 Thread Peter Hodge
--- Benji Fisher [EMAIL PROTECTED] wrote:

 On Tue, Oct 17, 2006 at 05:43:08AM -0500, Tim Chase wrote:
  In some text, I've got compound words separated by a single 
  hyphen.  For convenience of yanking, I've added the hyphen to my 
  iskeyword setting which works nicely for the most part.  However, 
  I also use a doubled-hyphen to the effect one would use an 
  em-dash which leads to the unwanted situation that a yank of a 
  word now includes the first word of the subordinate sentence 
  structure--such as this where the dashes are doubled--and effects 
  my ^N/^P searching (as duplicates appear for entries followed by 
  the double-dash).
  
  I'm on the prowl for some way to keep the iskeyword behavior for 
  things like doubled-hyphen and em-dash in the above 
  paragraph, but exclude things like structure--such and 
  doubled--and, limiting the word to things with a dash only if 
  that dash is not repeated.  Something like \w-\w but not 
  \w-\+\w (assuming that - isn't part of iskeyword for this 
  example)
  
  Any hints?
 
  Let's think big and look for a generic solution.  IMHO, it is way
 too restrictive to insist that a word is anything matching the pattern
 /\k\+/ .  I want a new option, 'wordpat', with a default value of
 '\k\+', that specifies what should be recognized as a word, for purposes
 of search patterns, Normal-mode commands such as w and b, and maybe
 other uses.  (Oh, yes:  Insert-mode completion.)
 
 Examples:
 
 :let l:wordpat = '\k\+\(-\k\+\)*'
 
 allows words-with-hyphens but--as requested--does not match double
 hyphens.  Change the '*' to '\=' to allow no more than one hyphen per
 word.  C programmers may like to use '\.' instead of '-'.
 
 :let l:wordpat = '\\\=\k\+'
 
 matches TeX commands like \def and \input and caters to the (lazy but
 common) style of omitting optional white space:
   $ \alpha\beta\gamma=\alpha+\beta+\gamma $.
 
 :let l:wordpat = '\a\l*'
 
 matches Capitalized words but rejects CamelCase words.
 
  What do you think?  Would this solve enough problems to be worth
 the effort?  How many vim users would add it to their wish lists?

I have exactly the same problem with '_' and '__' in words, so I would like the
feature also, if it is possible.

That said, you can use something like the following to get by in the meantime:

  function! SelectCustomWord()
let l:oldISK = isk
let l:oldSearch = @/

set isk+=\-
normal! v?\\|--?e+1
mto`t/\\|--/s-1

let isk = l:oldISK
let @/ = l:oldSearch
nohls
  endfunction

   enable using 'yi-' just like you use 'yiw'
  onoremap i-  :call SelectCustomWord()CR
  vnoremap i- v:call SelectCustomWord()CR

   a mapping for you to try stuff out
  map F5 ayi-:echo @aCR

Then you can use 'i-' just like you would use 'iw'.  here's some words for you
to try it on (press F5 with the cursor over different words):

  one-word
  two--words
  first-word--second-word--thirdword!

See ':help text-objects' and ':help iw' for more information on how to use 'iw'
and your new 'i-' command.

regards,
Peter




 
Do you Yahoo!? 
Spring Racing Carnival - Check out Sonia Kruger's blog
http://au.sports.yahoo.com/racing/


Re: cursor moves back with ESC

2006-10-16 Thread Peter Hodge

--- Yakov Lerner [EMAIL PROTECTED] wrote:

 On 10/16/06, Lev Lvovsky [EMAIL PROTECTED] wrote:
  Hello,
 
  I've never actually figured out why upon after typing in insert mode,
  the cursor moves back one character to the left after pressing
  escape.  What's the reason behind this, and is there any way to turn
  it off?
 
 IIRC there was a post some months a go on list with
 location of unofficial patch that changes this behaviour.
 (I dont have the location of the patch at hand).
 
 You can try this:
 au InsertLeave * norm l
 , not that I find it convenient. YMMV.

You can also try:

  inoremap ESC ESCl

which will work a little quicker in a terminal Vim.

cheers,
Peter




 
On Yahoo!7 
Fuel Price Watch: Find the cheapest petrol in your area 
http://au.maps.yahoo.com/fuelwatch/


Re: substitude, write and close with one command

2006-10-16 Thread Peter Hodge
--- Tomas Lovetinsky [EMAIL PROTECTED] wrote:

 Hi,
 I would like to ask you for help with my problem. I think it is simple but in
 fact I'm not able to 
 find the solution as quickly as I need.
 I need to do sometink like
 :s/a/b/g :wq
 It means to substitute, write and close file.

Hello,

You can separate multiple commands using '|', therefore:

  :s/a/b/g | wq

regards,
Peter



 
On Yahoo!7 
Caller tones: Replace your ring tone with your favourite sound clip! 
http://callertones.yahoo7.mnetcorporation.com/ctonesmailtag



Re: replace using variable

2006-10-16 Thread Peter Hodge

--- Akbar [EMAIL PROTECTED] wrote:

 Hi, I have these words:
 
 p1. I am good/p
 p2. You sucks!/p
 p3. Take that, moron/p
 
 I want to change those sentences into:
 p id=11. I am good/p
 p id=22. You sucks!/p
 p id=33. Take that, moron/p
 
 How do I do that using vim replace command?
 All I can think  is this:
 :%s/p\d/p id=\d\d/igc
 
 But that does not work. Any idea? Yeah, I can change them using vim
 macro or using scripting language but it will be nice if I can change
 them using vim replace command.

Hello, you're looking for backreferences:

  :help /\1

You want this command:

  :%s/p\(\d\+\)/p id=\1\1/igc

regards,
Peter

P.S. If you are feeling frustrated (Vim can do that to you), try writing
something more soothing, e.g.:

  p1. I am happy/p
  p2. You are beautiful!/p
  p3. Take that, as a token of my love/p





 
On Yahoo!7 
Music: Create your own personalised radio station. 
http://au.launch.yahoo.com/ 



Re: Planet Vim

2006-10-12 Thread Peter Hodge
--- Panos Laganakos [EMAIL PROTECTED] wrote:

 I searched the archives, but didn't find any reference to this.

Google can't find it either, so therefore it can't exist.

 Are there enough people out there users/developers that blog about Vim?

Personally I don't think so, but one way is to set up the aggregator and see
for yourself.  It depends how much volume you call 'enough'.  I would love to
see a planet Vim site, but unfortunately most Vim articles I read tend to be
very technical and rather boring.  :-(

 If so, it would be great to have a planet vim to aggregate these blog posts.

Absolutely.  I don't want to traul the web myself to find those Vim bloggers,
if/when they exist.  You might also be able to pinch the source code from
another OS 'planet' site.

All the best,
Peter



 
On Yahoo!7 
Music: Create your own personalised radio station. 
http://au.launch.yahoo.com/ 



Re: VimL and Exuberant tags - Suggestions please

2006-10-12 Thread Peter Hodge
Hello David,

Can I suggest support for these commands:

  :set/setlocal/setglobal
  :syntax
  :highlight (and maybe :HiLink because it is so commonly used)

Some examples:

  set foldmethod=syntax
  setlocal formatoptions+=roq
  setglobal completeopt-=preview

  syntax keyword phpFunction ...
  syn match phpIdentifier ...
  syn region phpRegion ...
  sy cluster phpClTop ...
  syntax clear phpMethods

  highlight String ...
  hi clear Constant ...
  hi link Number ...
  hi! link Number ...
  hi def link Function ...
  HiLink Number ...

These are all pretty straightforward to find.

Also, for dictionary functions would it make sense to mark them twice, since
they get a new 'name' if the dictionary is copied to a new variable?  For
example:

  let foo = { }
  function! foo.func1() dict
  endfunction
  let bar = foo

There is now a function called 'bar.func1()', so maybe func1 should be tagged
as:

  Dictionary Functions
  foo.bar /^function! foo.bar() dict/
  .bar  /^function! foo.bar() dict/


I wouldn't mind if mappings could be tagged as well.

Is there or will there be any way to toggle options for the way ctags scans vim
files?

regards,
Peter




--- David Fishburn [EMAIL PROTECTED] wrote:

 
 I have taken over maintenance of the VimL exuberant tags component.
 
 For the vim plugin writers, are there any outstanding bugs or new feature
 requests you have for ctags.exe?
 
 Hari just mentioned Vim7 introduces some additional syntax items to function
 names:
 
 function mydict.len() dict
 endfunction
 
 function autoloadFunc#subdirname#Funcname()
 endfunction
 
 Support for this has been added to the next version of ctags (possibly 5.7).
 
 I noticed a bug in variables which shows up in Vim7, since we introduced the
 for/endfo construct.  Ctags starts generating variable tags for tags that
 are within functions after encountering an endfo since the short form for
 a endfunction is endf.
 - Also fixed in the next version.
 
 
 These are the items ctags currently flags:
 augroup,  autocommand groups
 function, function definitions
 variable, variable definitions
 
 Does it make sense to also identify autocommands?
 Or possibly only autocommands if they are outside of an augroup?
 
 
 When variables are identified we strip off the scope:
   let s:ignoreNextCursorMovedI = 0 == ignoreNextCursorMovedI 
 Should the scope be left on == s:ignoreNextCursorMovedI 
 
 
 Instead of simply grouping everything under variables, should we distinguish
 between different types?
 let forms#form = {
   \ 'title': 'Address Entry Form',
   \ 'fields': [],
   \ 'defaultbutton': 'ok',
   \ 'fieldMap': {},
   \ 'hotkeyMap': {},
   \ }
 
 Right now this is identified as a variable, should we identify it as a
 Dictionary by adding another kind of tag?
 
 
 What about identifying commands:
 command! -nargs=+ Select :call s:DB_execSql(select  . q-args)
 
 
 What about [ion]maps (though we cannot give them a name really, but at least
 identifying where they are in the source?
 
 
 We could also pick up local variables (have this off by default) and produce
 something like this:
 function! s:DB_runCmd(cmd, sql)
 let l:display_cmd_line = 'blah'
 let display_shell = 'blah'
 endf
 
 Local variables
 s:DB_runCmd.display_cmd_line
 s:DB_runCmd.display_shell
 
 
 
 I am open to suggestions.
 If you have suggestions, please provide code snippets so I have examples to
 work from.
 
 We can add these tags and leave them on or off by default, so having that
 information is useful as well.
 
 
 At this point the sky is the limit, we can hash out details as we move
 forward.  Somethings might not be worth the effort.  
 
 
 TIA,
 Dave
 
 




 
On Yahoo!7 
Caller tones: Replace your ring tone with your favourite sound clip! 
http://callertones.yahoo7.mnetcorporation.com/ctonesmailtag



Re: syntax highlighting not working when loading a session

2006-10-11 Thread Peter Hodge
Ok, the problem is in your .vimrc:

 this only works if the filetype plugin indent on command precedes the
 syntax on command
let s:extfname = expand(%:e)
if s:extfname ==? f90
let fortran_free_source=1
unlet! fortran_fixed_source
else
let fortran_fixed_source=1
unlet! fortran_free_source
endif

If you don't start Vim with a .f90 file, then 'fortran_fixed_source' is set to
'1' and all .f90 files will try to highlight as fixed source (looking for
numbers).  You should put the block of code into your ftplugin/fortran.vim and
make it to use the buffer-local variables instead:


  ~/.vim/ftplugin/fortran.vim

 Don't do other file type settings for this buffer
let b:did_ftplugin = 1

+use free source format for all .f90 files:
+   let s:extfname = expand(%:e)
+   if s:extfname ==? f90
+   let b:fortran_fixed_source = 0
+   else
+   let b:fortran_fixed_source = 1
+   endif

regards,
Peter



--- Kamaraju Kusumanchi [EMAIL PROTECTED] wrote:

 On Wednesday 11 October 2006 19:31, Peter Hodge wrote:
 
  At any rate, using ':setfiletype fortran' should fix the problem straight
  away.
 
 No. This does not change the behavior. I cannot get the correct syntax 
 highlighting even after doing this.
 
  The distributed ftplugin file for fortran sets a variable called
  'b:fortran_fixed_source' to let the syntax file know how to highlight.  The
  'bad highlighting' is because the ftplugin file isn't being executed (for
  some reason?) and so the syntax defaults to using wrong highlighting (it's
  looking for numbers at the start of each line). 
 
 This could be the reason. I have changed the default
 .vim/ftplugin/fortran.vim 
 quite a bit and might have messed it up somewhere.
 
  Curiously, my Vim doesn't 
  have a problem with opening a session and choosing the correct
  highlighting, so I wonder if something in your custom ftplugin or syntax
  files is preventing the distributed ftplugin file from detecting the
  fortran format correctly? Is there any chance you could paste the contents
  of your .vim/ftplugin/fortran.vim into an email?
 
 I think this list does not allow any attachements (my messages were not 
 delivered when I attached the files). So I posted 
 my .vimrc, .gvimrc, .vim/ftplugin/fortran.vim, .vim/indent/fortran.vim at 
 http://kamaraju.googlepages.com/vim_problems .
 
 Please forgive me for not tidying up those configuration files. But I hope 
 you guys wont have any trouble digging through them.
 
 Thanks for all the replies so far.
 
 raju
 
 -- 
 http://groups.google.com/group/ask-anything/about
 




 
On Yahoo!7 
Photos: Unlimited free storage – keep all your photos in one place! 
http://au.photos.yahoo.com 



Re: syntax highlighting not working when loading a session

2006-10-11 Thread Peter Hodge
 
 Thanks a lot. Your solution works perfectly. One small question. In my 
 previous .vimrc, I had this varible called fortran_free_source. Do I need to 
 worry about it in ~/.vim/ftplugin/fortran.vim or can I just forget about its 
 existence completely?

It shouldn't exist any more once you take that code out of your .vimrc.  (It
was the 'global' variable for choosing the free-source format, but the code
I've shown you uses a the per-buffer variable.)

regards,
Peter







 
On Yahoo!7 
Messenger: Plug-in the fun with handy plug-ins 
http://au.messenger.yahoo.com 



Re: BUG: syntax region overlaps keyword *sometimes*

2006-10-07 Thread Peter Hodge
 
 I can reproduce the problem.  Indeed looks like a bug.  Removing
 containedin=NOTHING solves it, while it should not change anything.
 

Sorry for finding a bug while you are so busy.  But I am addicted to syntax
highlighting, it's such a wonderful feature.

regards,
Peter


 -- 
 hundred-and-one symptoms of being an internet addict:
 10. And even your night dreams are in HTML.
 
  /// 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///
 




 
On Yahoo!7
Check back weekly for  Trixi's new online adventures 
http://www.trixi.com.au


BUG: syntax region overlaps keyword *sometimes*

2006-10-05 Thread Peter Hodge
Hello,

I have discovered that it is possible for a syntax region to overlap a syntax
keyword, even though the region is not contained in the keyword.  Take the
following code example and apply the syntax commands below:

  TEST CODE:

(is_array($foo))
( is_array($foo) )

  SYNTAX COMMANDS:

syntax keyword Function is_array
syntax region r1 matchgroup=Typedef start=/array(/ end=/)/ keepend extend

Now what is even more odd, if I add another region for the ( and ) arround the
test code, the overlap doesn't happen in the first example:

syntax region r2 matchgroup=Delimiter start=/(/ end=/)/ keepend extend 
contains=ALL

What is going on here?

regards,
Peter




 
On Yahoo!7 
Caller tones: Replace your ring tone with your favourite sound clip! 
http://callertones.yahoo7.mnetcorporation.com/ctonesmailtag



Re: BUG: syntax region overlaps keyword *sometimes*

2006-10-05 Thread Peter Hodge

--- Ilya Bobir [EMAIL PROTECTED] wrote:

 Peter Hodge wrote:
  Hello,
 
  I have discovered that it is possible for a syntax region to overlap a
 syntax
  keyword, even though the region is not contained in the keyword.  Take the
  following code example and apply the syntax commands below:
 
TEST CODE:
 
  (is_array($foo))
  ( is_array($foo) )
 
SYNTAX COMMANDS:
 
  syntax keyword Function is_array
  syntax region r1 matchgroup=Typedef start=/array(/ end=/)/ keepend
 extend
 
  Now what is even more odd, if I add another region for the ( and ) arround
 the
  test code, the overlap doesn't happen in the first example:
 
  syntax region r2 matchgroup=Delimiter start=/(/ end=/)/ keepend extend 
  contains=ALL
 
  What is going on here?
 
  regards,
  Peter

 I do not see anything special.  For me r1 does not contribute to 
 highlighting at all, and r2 cause parenthesis to be highlighted.
 
 I have VIM - Vi IMproved 7.0 (2006 May 7, compiled Sep 22 2006 22:03:35)
 MS-Windows 32 bit GUI version with OLE support
 Included patches: 1-109
  
 Also with changes from patch 117.

Thanks for your help, I had another look and found out you need another syntax
command to reproduce it properly.  Here is the revised bug report

Start vim using

  vim -u NONE

insert the following test code (note that the 4th line must be indented).

  array($foo)
  is_array $foo
  is_array($foo)
is_array($foo)

Apply the following syntax commands:

  syn on
  syn keyword Function is_array
  syn region r1 matchgroup=Type start=/array(/ end=/)/
  syn keyword Error foo containedin=NOTHING

You will find that the keyword is_array and region r1 are confused over how to
highlight is_array(...) when it doesn't start at the beginning of the line, and
it has something to do with the 'foo' keyword having a 'containedin=' option.

regards,
Peter




 
On Yahoo!7 
Break a world record with Total Girl's World’s Largest Slumber Party 
http://www.totalgirl.com.au/slumberparty


vim -u NONE (was: Re: Vim 7.0 (1-109 patches) completion bug.)

2006-10-05 Thread Peter Hodge
 BTW, using
 
 gvim -u NONE -U NONE
 
 is both redundant (in the case of -U NONE), dangerous (since
 default settings may truncate your viminfo on exit), and put
 you in vi compatible mode.  Better is:
 
 gvim -u NONE -i NONE -N
 

I wouldn't think the -i option is necessary, because 'viminfo' is empty by
default anyway.  Perhaps there should be a shell script distributed with vim so
that anyone can start up vim cleanly.

  cleanvim.sh:
vim -u NONE -i NONE -N --noplugin --cmd 'set rtp=$VIMRUNTIME' '+set rtp'

  cleanvim.bat:
gvim.exe -u NONE -i NONE -N --noplugin --cmd set rtp=$VIMRUNTIME +set
rtp

regards,
Peter




 
On Yahoo!7 
Men's Health: What music do you want to hear on Men's Health Radio? 
http://www.menshealthmagazine.com.au/ 


Re: compilation of regular expressions/ enhancement?

2006-10-04 Thread Peter Hodge

--- Nikolai Weibull [EMAIL PROTECTED] wrote:

 On 10/4/06, Peter Hodge [EMAIL PROTECTED] wrote:
 
  --- Nikolai Weibull [EMAIL PROTECTED] wrote:
 
Great idea,
Nikolei!
  ^- gaah!
  
 nikolai
  
 
  iabbrev Nikolei Nikolai
  match Error /Nikol[^a]i/
 
 I'd extended to
 
 match Error /\Ni[^k]ol[^a][^i]\/
 
 You'd be surprised how often people come up with their very own
 spelling of my name.

It's alright, once your name has been out there for a couple thousand years
(like mine), people will start getting it right more often.

- Peter




 
On Yahoo!7 
Fuel Price Watch: Find the cheapest petrol in your area 
http://au.maps.yahoo.com/fuelwatch/


Re: Time to remove naming restrictions?

2006-10-04 Thread Peter Hodge
 
 Seeing as you've identified the location and apparent fix, why not you?


Because I don't want to maintain my own set of patches, that would be more
tiring than using upper-case commands.






 
On Yahoo!7 
Messenger - IM with Windows Live™ Messenger friends. 
http://au.messenger.yahoo.com 



Re: Time to remove naming restrictions?

2006-10-03 Thread Peter Hodge
 Argh.  This is exactly why all the hacks one has to employ never
 really quite make it.  There's always some base you haven't covered,
 some point you can't reach.
 
 Seriously, if people want to f**k up their session, let them.  No one
 who isn't prepared to get burned is going to override :quit.  No one
 who isn't prepared for an unpredictable future (is there a second
 kind?) is going to install a plugin that adds a command called :vfold.
  Let us who really want our Vim to be what we want it to be have the
 tools to make it so.  I'm obviously not the only person who feels this
 way.  And I haven't even spent time writing a plugin to circumvent
 this, like Hari has.

There's about 4 lines of vim source code which you need to remove so that you
can have lower-case user commands.  You're not interested in making your own
patch?

regards,
Peter







 
On Yahoo!7 
Messenger - IM with Windows Live™ Messenger friends. 
http://au.messenger.yahoo.com 



BUG? getchar(0) and getchar(1) do not detect ESC

2006-10-03 Thread Peter Hodge
Hello all,

I am having trouble with getchar() detecting ESC.  If I use getchar(0) or
getchar(1), it will not pick up an ESC keystroke.  You can replicate this by
using the command:

  :sleep 3 | echo getchar(0)

... and pressing ESC quickly before the getchar() function is called.  In GUI
Vim, I correctly see 27 returned by getchar(0), but in Terminal Vim, getchar(0)
is returning '0', even though ESC has been pressed.  Is this a bug in Vim?

regards,
Peter




 
On Yahoo!7 
Answers:  25 million answers and counting. Learn something new today
http://www.yahoo7.com.au/answers


Re: Local scope ?

2006-10-03 Thread Peter Hodge
Hello,

 Hi,
 
  when writing a function in vim script sometimes it makes sense to
  change options of vim.
 
  Are these changes local to the function ?

No, they persist after the function is ended.  As a simple example, you could
use a function like the following to toggle the 'number' option.

  map F5 :call ToggleNumberOption()CR
  function! ToggleNumberOption()
set number!
  endfunction

You'll see that the ToggleNumberOption function is changing the 'number' option
and the change persists after the function is ended.

  And if not: Can I simply assign the current value of the option to a 
  variable, change the option and restore the option value from the
  value stored in that variable?

Occasionally it is useful to store the value of an option and restore it later.
 You can do it like this:

   store the value
  let l:old_isk = iskeyword

   restore the value
  let iskeyword = l:old_isk

regards,
Peter




 
On Yahoo!7 
New Idea: Catch up on all the latest celebrity gossip 
http://www.newidea.com.au


Re: Colorschemes Need Updating

2006-10-02 Thread Peter Hodge
Hello,

 I found no way to change Gvim's default highlighting for
 these groups.  What I found is a mapping of the groups to
 group names in the setting 'highlight'.

I believe you're supposed to change these default mappings in your .vimrc file,
but unfortunately your changes will get lost as soon as you change colorscheme
or change the 'background' setting, and maybe under some other circumstances as
well, so .vimrc actually doesn't work so well for customizing colors.  I've
made a small plugin which lets me use 'after/colors/' scripts in the same way I
would have '/after/syntax/' scripts, and I find this system works very well for
customizing colorschemes (individually or all at once).
(http://www.vim.org/scripts/script.php?script_id=1641)

regards,
Peter



 
On Yahoo!7 
Photos: Unlimited free storage – keep all your photos in one place! 
http://au.photos.yahoo.com 



Re: Spell and Perl source highlighting

2006-09-28 Thread Peter Hodge
Hello,

 Finally, when spell check is enabled and syntax highlighting is also
 enabled, there vim is highlighting some text in a way that the
 foreground and background colors are the same -- so the text vanishes
 from view.  Maybe the solution is to not have syntax and spell
 highlighting enabled at the same time?

You could just change your highlighting for spelling errors. If you use the
following command:

  :source $VIMRUNTIME/syntax/hitest.vim

Vim will show you all the colors currently being used.  Then you can just use a
command like:

  :highlight SpellBad ctermbg=Red ctermfg=Blue cterm=Underline

... to fix your highlighting.  Just add that to your .vimrc and you should be
fine.

regards,
Peter




 
On Yahoo!7 
Caller tones: Replace your ring tone with your favourite sound clip! 
http://callertones.yahoo7.mnetcorporation.com/ctonesmailtag



Re: vim is scrambling my files

2006-09-26 Thread Peter Hodge
Just my 2c worth, is it a display problem that goes away when you press CTRL+L?

regards,
Peter


--- jinxjinx [EMAIL PROTECTED] wrote:

 
 :verbose set makeprg? makeef? autowrite? autowriteall?
 makeprg=make
 makeef=
 noautowrite
 noautowriteall
 
 :verbose setlocal filetype?
filetype=c
  Las set from /usr/share/vim/vim64/filetype.vim
 
 :version
 VIM - Vi IMproved 6.4 (2005 Oct 15, compiled May 23 2006 12:03:57)
 Included patches: 1-6
 Compiled by [EMAIL PROTECTED]
 Big 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 +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 -netbeans_intg
 -osfiletype
 +path_extra -perl +postscript +printer -python +quickfix +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 -O2 -g -Wall
 Linking: gcc   -L/usr/local/lib -o vim   -lncurses -lgpm
 
 
 :echo current_compiler did not work
 
 the scrambled colum is a column of characters that match what ever character
 is next to it
 or sometimes just copys of text from other parts of the file.
 
 thanks for the responce
 
 
 
 
 A.J.Mechelynck wrote:
  
  jinxjinx wrote:
  when i do a save and then a make, for somereason my file gets scrambled.
  vim
  adds a colum of letters. and i get all these compile errors. so i quit
  without saving, and the extra letters go away! what could be going on
  here?
  
  here is my vimrc
  syn region myFold start={ end=} transparent fold
  syn sync fromstart
  set foldmethod=syntax
  set nowrap
  set mouse=a
  
  
  also when i get into vim i do :syntax on
  
  What are the first 3 or 4 lines of the reply to :version [until and 
  including Features included (+) or not (-):]? (To copy the whole
  :version 
  output to the clipboard, use:
  :set nomore
  :redir @*
  :version
  :redir END
  :set more
  :let @+ = @*
  [the last line above is not necessary on Windows]. You can trim the result 
  after pasting it into an email.)
  
  What does Vim answer to the following? (entered with the question marks,
  and 
  with the problematic source file, not some help file, being current)
  
  :verbose set makeprg? makeef? autowrite? autowriteall?
  :verbose setlocal filetype?
  :echo current_compiler
  
  What does that column of letters look like? Any recognizable pattern?
  Could 
  you paste an example into an email? (To copy the whole editfile to the 
  clipboard, use [in Normal mode] ggVG followed by +y -- assuming that your 
  version of Vim has access to the clipboard).
  
  
  Best regards,
  Tony.
  
  
 
 -- 
 View this message in context:
 http://www.nabble.com/vim-is-scrambling-my-files-tf2336221.html#a6519686
 Sent from the Vim - Dev mailing list archive at Nabble.com.
 
 




 
On Yahoo!7
Check back weekly for  Trixi's new online adventures 
http://www.trixi.com.au


Re: glued Cursor trick anyone ?

2006-09-19 Thread Peter Hodge

--- Meino Christian Cramer [EMAIL PROTECTED] wrote:

 Hi,
 
  I would like to accomplish three tricks:
 
  1.) Suppose you have a source code and have started an new search
task recently. With n you are jumping from match to
match. Sometimes the next match is right on the last line
currently visible. Pressing n let the cursor jump there. The
screen is not scrolled, cause the target is still on the screen --
but the context is not.
 
Is it possible to always scroll the screen that way, that pressing
n wll always take you to the middle of the screen (or in other
words: The cursor is glued to the middle of the screen and the text
jumps under the cursor)?
 
  2.) This is similiar: I want to scroll through text and keep the
cursor glued to a certain position on the screen.
 
  3.) Last glued cursor thingy: I want to glue the cursor on the text
and using up and down will not move the cursor on the text but
the text on the screen.
 

Sounds like you want to use the 'scrolloff' option.  Try ':help scrolloff',
it's pretty straightforward.  Personally I find 'set scrolloff=4' makes
everything much easier to read.

cheers,
Peter



 
On Yahoo!7 
Check out the new Great Outdoors site with video highlights and more 
http://au.travel.yahoo.com/great-outdoors/index.html


Re: find word under cursor

2006-09-16 Thread Peter Hodge
Hello,

What * picks up depends on the value of the 'iskeyword' option.  It seems as
though your value of 'iskeyword' is including '('.  Try ':set isk-=('.  Also
have a look at ':set iskeyword?' and ':help iskeyword'.

regards,
Peter


--- Fabian Braennstroem [EMAIL PROTECTED] wrote:

 Hi,
 
 I have small problem to find words under the cursor with '*'
 for certain constellations, e.g. in a python script I have
 some functions with:
 
 convert_different(tab)
 
 Pressing '*' marks me the whole function name and '(tab'
 without the last ')'. Is there a way to tell vim 6.4, just
 to mark the function name without the variable list?
 
 Greetings!
  Fabian
 
 




 
On Yahoo!7 
Check out PS Trixi - The hot new online adventure 
http://www.trixi.com.au


Re: distributing experimental patches with vim ?

2006-09-14 Thread Peter Hodge
Hello Yakov,

If I recall correctly, didn't you write the shell script which automatically
patches and installs Vim 7?  If so, why not expand on it to allow (optionally)
installing unofficial patches from vim.org as well?  Maybe a
'--with-patch=script_id' argument would work?

regards,
Peter



--- Yakov Lerner [EMAIL PROTECTED] wrote:

 Vim patches submitted by external submitters are either
 'incorporated' or 'outsude of vim sources'. That's black-and-white.
 I thought it's possible to add some intermediate state, where
 'experimental-patch' is neither outside of vim nor inside-vim. This
 is useful because people can try experimental patches easier,
 with clear understandnig that they are trying experimental patches.
 It can work as follows.
 
(BTW I think Vince Negri conceal patch deserves this status.)
 
 It can work as follows. Experimental patch is added as a _feature_
 named 'x-*', say 'x-conceal'. It has it's #ifdef, FEAT_X_CONCEAL, and
 none of x-* features are built by  'huge' (largest) built. The builder
 needs to enable them manually with --enable-x-conceal or similar
 configure flag.
 
 To make it very clear that build includes experimental
 features, the :version will have line seen from large distance:
    CONTAINS EXPERIMENTAL FEATURES *
 
 But then more people can try these experimental patches
 and feedback on them, improve them, or report their uselessness.
 
 Yakov
 




 
Do you Yahoo!? 
Take part in Total Girl’s Ultimate Slumber Party and help break a world record 
http://www.totalgirl.com.au


Re: Two problems

2006-09-14 Thread Peter Hodge

--- Andrea Spadaccini [EMAIL PROTECTED] wrote:
 
 Well.. the vim book is for vim 5.7.. Are there any plans to make a new
 version for vim 7.x?
 
 I would buy it if only it was up-to-date! :)


Many of Vim's best features were included in 5.7.  It is still a great book to
get you from a novice to intermediate user quickly.

regards,
Peter



 
 -- 
 [ Andrea Spadaccini - a.k.a. Lupino - from Catania - ICQ #: 91528290 ]
 [ GPG ID: 5D41ABF0 - key on keyservers - Gentoo GNU / Linux - 2.6.17 ]
 [ Linux Registered User 313388 - @: a.spadaccini(at)catania.linux.it ]
 




 
Do you Yahoo!? 
Take part in Total Girl’s Ultimate Slumber Party and help break a world record 
http://www.totalgirl.com.au


Fixed: prevent slowness from Insert mode completion

2006-09-13 Thread Peter Hodge
Hello,

Backspacing or typing while the Vim 7 Insert completion popup window is running
is very difficult when the completion list is long or comes from many sources. 
Because the popup menu refreshes itself on each backspace, each keystroke can
take up to half a second to appear, and it was actually easier to hit escape
and re-enter insert mode to stop the popup menu guzzling CPU cycles on each
keystroke.

Miraculously, it was very easy for me to create an extra value for
'completeopt' which stops the popup menu as soon as something is backspaced or
added, and allows me to have the popup menu turned on, but without it getting
in my way as I type.

Do you think it would be worthwhile adding this patch into Vim?

regards,
Peter



Patch for the online help:
==

*** /usr/share/vim/vim70/doc/options.txtWed Sep 13 13:44:48 2006
--- doc/options.txt Wed Sep 13 14:59:04 2006
***
*** 1660,1665 
--- 1660,1671 
   preview  Show extra information about the currently selected
completion in the preview window.
  
+  stop Stop Insert mode completion and close the popup menu when
+   you start typing again, or when you backspace part of the
+   completed text.  This is useful when the completion list
+   is taking too long to refresh its contents while you are
+   typing.
+ 
*'confirm'* *'cf'* *'noconfirm'* *'nocf'*
  'confirm' 'cf'boolean (default off)
global



Patch for Vim 7 source (after patch 101)


*** vim70.orig/src/edit.c   Wed Sep 13 14:35:14 2006
--- vim70/src/edit.cWed Sep 13 14:26:45 2006
***
*** 3019,3024 
--- 3019,3031 
  p = line + curwin-w_cursor.col;
  mb_ptr_back(line, p);
  
+ /*
+  * PETER HODGE - if completeopt contains 'stop', then stop
+  * insert completion when backspace is used
+  */
+ if (vim_strchr(p_cot, 's') != NULL)
+ return K_BS;
+ 
  /* Stop completion when the whole word was deleted. */
  if ((int)(p - line) - (int)compl_col = 0)
return K_BS;
***
*** 3125,3130 
--- 3132,3146 
  else
  #endif
ins_char(c);
+ 
+ /*
+  * PETER HODGE - if completeopt contains 'stop', then we want to
+  * clear completion mode
+  */
+ if (vim_strchr(p_cot, 's') != NULL) {
+ ins_compl_prep(' ');
+ return;
+ }
  
  /* If we didn't complete finding matches we must search again. */
  if (compl_was_interrupted)
*** vim70.orig/src/option.c Wed Sep 13 14:35:15 2006
--- vim70/src/option.c  Wed Sep 13 14:27:19 2006
***
*** 2848,2854 
  static char *(p_fcl_values[]) = {all, NULL};
  #endif
  #ifdef FEAT_INS_EXPAND
! static char *(p_cot_values[]) = {menu, menuone, longest, preview,
NULL};
  #endif
  
  static void set_option_default __ARGS((int, int opt_flags, int compatible));
--- 2848,2855 
  static char *(p_fcl_values[]) = {all, NULL};
  #endif
  #ifdef FEAT_INS_EXPAND
! /* PETER HODGE - added extra option 'stop' */
! static char *(p_cot_values[]) = {menu, menuone, longest, preview,
stop, NULL};
  #endif
  
  static void set_option_default __ARGS((int, int opt_flags, int compatible));






 
Do you Yahoo!? 
Take part in Total Girl’s Ultimate Slumber Party and help break a world record 
http://www.totalgirl.com.au


Re: Fixed: prevent slowness from Insert mode completion

2006-09-13 Thread Peter Hodge
 
 1. The second title above is misleading. Bram uses (after patch nnn) 
 when a patch _depends_ on another, i.e., requires patch nnn to have been 
 applied previously, usually because the later patch fixes a bug 
 introduced by the earlier one. For instance, official patch 7.0.057 is 
 labeled (extra; after 7.0.45); both are about compilation trouble with 
 various W32 compilers.


Sorry, what I meant is that the diff was made after applying all patches up to
101.  I'm not sure my patch would work without those patches added first, and
I'm not sure it will still work after the next 100 patches from Bram.

 
 Sorry if I sound griping, but it's easier for everyone if patches follow 
 uniform conventions. (Here I'm intentionally calling your email one 
 patch: look at Bram's patches in ftp://ftp.vim.org/pub/vim/patches/7.0/ 
 , they are the raw text of his emails, with sig and all. Each of them 
 patches at least two files and sometimes half a dozen or so.)

I was a little unsure exactly how to go about things, I'll try to be more
consistent if I make another patch.

Thanks for your time,
Peter




 
On Yahoo!7 
360°: Your blog, photos, interests, and what matters to you
http://www.yahoo7.com.au/360


Re: Two problems

2006-09-13 Thread Peter Hodge
Hello,

--- Meino Christian Cramer [EMAIL PROTECTED] wrote:
 
  1.) Splitting line into two from normal mode.
  My current concept (hu...great word...;) to split a line into
  two is (starting and ending in normal mode, which is wanted):
  
   i Ctrl-j esc
 
  Are there any shorter ways to split a line, may be without the
  detour around insert mode ?


I found the following mapping helpful:

  nmap TAB i#ESCr

Basically that lets you hit TAB in normal mode and insert a single character.
 With that mapping in place, you could use TABENTER to insert a linebreak
quickly.

regards,
Peter



 
On Yahoo!7 
Answers: 25 million answers and counting. Learn something new today 
http://www.yahoo7.com.au/answers


How do I get back the old insert-completion behaviour?

2006-09-11 Thread Peter Hodge
Hello,

In Vim 6.2, insert-completion would start when I type CTRL-X or CTRL-N, but
it would stop as soon as I used typed another letter or pressed backspace.  Now
in Vim 7, when I type BS or another character, insert-completion does a
'refresh' to give me the complete list of ... er, completions.  While this
makes sense, it is a real problem for me because I am on a 'low-end' machine
(1.25ghz G4) and refreshing the popup-window takes so long (almost half a
second) that I can't see what I'm doing as I am typing!  It is quicker for me
to leave insert mode and come back than to try and type or backspace because
the refresh is so slow.

Is there any way to make it so that changing text will de-activate the
popup-window rather than refresh it?

regards,
Peter



 
Do you Yahoo!? 
Take part in Total Girl’s Ultimate Slumber Party and help break a world record 
http://www.totalgirl.com.au


Re: Counts for mapping

2006-09-11 Thread Peter Hodge

--- Benji Fisher [EMAIL PROTECTED] wrote:
 
 :nnoremap = @='3l'CR
 

Thank you!  I've been trying to figure out how to do that for 2 years.

cheers,
Peter



 
Do you Yahoo!? 
Yahoo! Dating: Get busy flirting with your 7-day free pass 
http://au.personals.yahoo.com


Re: question about syntax highlighting

2006-09-07 Thread Peter Hodge
Hello,

--- A.J.Mechelynck [EMAIL PROTECTED] wrote:

 
 If you have found a colorscheme which satisfies you almost, but not 
 completely, copy it to ~/.vim/colors/ under a different name (ending in 
 .vim) and modify it there. Then you can set gui=bold for Function or 
 cFunction in your own version of that colorscheme.

Alternatively, if you have Vim 7, you can download my AfterColors plugin
(http://vim.sourceforge.net/scripts/script.php?script_id=1641) and create your
customizations in ~/.vim/after/colors/colorscheme.vim, and you won't need to
make a copy of the entire colorscheme.

regards,
Peter




 
On Yahoo!7 
Check out PS Trixi - The hot new online adventure 
http://www.trixi.com.au


+clientserver on Mac OS X

2006-09-07 Thread Peter Hodge
Hello,

Is it possible to run the clientserver feature on Mac OS X?  I cannot see
anywhere in the help that directly states that clientserver only runs on
Windows or X11.

regards,
Peter

regards,
Peter



 
On Yahoo!7 
Answers: 25 million answers and counting. Learn something new today 
http://www.yahoo7.com.au/answers


Re: question about syntax highlighting

2006-09-07 Thread Peter Hodge
Hello,


 
 Does this actually work for you? IIRC, after colorschemes didn't work 
 for me, so I concluded that :colorscheme foobar is equivalent to 
 :runtime colors/foobar.vim not :runtime! colors/foobar.vim.


I'm not quite sure what you mean.  'after' colorschemes had never worked for me
because, as you said, it uses ':runtime ...' rather than ':runtime! ...' which
is why I made that plugin - it just uses the ColorScheme event to call
'runtime!  after/colors/colors_name.vim'.

regards,
Peter




 
On Yahoo!7 
Answers: 25 million answers and counting. Learn something new today 
http://www.yahoo7.com.au/answers


Re: indenting weirdness

2006-09-06 Thread Peter Hodge
Hello scott,

The 'filetype=' message is what happens when you use ':set filetype=' and don't
specify any filetype.

If you have 'cindent' turned on, Vim will add an indent after a line ending in
a comma (,) and your sample sentence does.  Use ':set cindent?' to check if it
is turned on.

regards,
Peter



--- scott [EMAIL PROTECTED] wrote:

 help!
 
 i'm at 7.0.90, but i've noticed the indenting weirdness before,
 so i don't know when it really started
 
 i think the other time(s) too it was in my 'ai' module, which,
 although it has a .txt extenstion, comes up with 'filetype='
 
 so weird
 
 ok -- no filetype is defined -- fine -- this still should not
 happen, in my opinion
 
 with tw=70, which i set with an f-key defined in my .vimrc,
 typing the following gives:
 
 an optimistic man might be tempted to celebrate -- we have proven,
after
 
 see?
 
 what the @[EMAIL PROTECTED]@? kind of indenting rule says to create a hanging
 indent after the first word...
 
 dunno why filetype is undefined, but i have filetype indent off,
 i've gotten so frustrated with unexpected indenting behavior
 
 if it's relevant, i open my 'ai' modules with a script
 that sources a vim script that does (after the comments):
 
 let s:name = '~/documents/txt/ai_' . strftime(%Y%m) . '.txt'
 execute e + s:name
 
 which *may* help explain why filetype is undefined, but
 not in any way explains why 'an' is something that requires
 a hanging indent to be created on the next line
 
 i've got:
 
 filetype on
 filetype indent off
 filetype plugin on
 filetype plugin indent off
 
 in my .vimrc, which is an attempt on my part to get control
 over how indenting happens, yet i STILL get surprised with
 unexpected behavior
 
 any clues will be appreciated
 
 sc
 
 







 
On Yahoo!7 
Messenger - Make free PC-to-PC calls to your friends overseas. 
http://au.messenger.yahoo.com 



Re: Syntax question regarding \%[

2006-09-06 Thread Peter Hodge
Hello everyone,

Thank you for your help ...

 
  syn keyword Error inte[ger] inte[rval]
 

Unfortunately I need to use matches because the 'words' contain the '.'
character, and I also need to be able to use a look-behind assertion.  The
thing is, I wanted to be able to write each match so that it is fairly
independent of the previous one, because it is very easy to generate this
automatically from an array of strings:

  syntax match phpIniKey /[']\@=s\%[ession\.cache_expire]/
  syntax match phpIniKey /[']\@=s\%[ession\.cache_limiter]/
  syntax match phpIniKey /[']\@=s\%[ession\.cookie_domain]/
  syntax match phpIniKey /[']\@=s\%[ession\.cookie_httponly]/
  syntax match phpIniKey /[']\@=s\%[ession\.cookie_lifetime]/
  syntax match phpIniKey /[']\@=s\%[ession\.cookie_path]/
  syntax match phpIniKey /[']\@=s\%[ession\.cookie_secure]/

Unfortunately, the last match always takes priority, so something like this:

  'session.cache_ex'

it gets matched by the last item and the highlighting goes as far as
'session.c'.  The only solution I can come up with is to write the patterns
like this:

  syntax match phpIniKey /[']\@=s\%[ession\.cache_expire]/
  syntax match phpIniKey /[']\@=session\.cache_l\%[imiter]/
  syntax match phpIniKey /[']\@=session\.co\%[okie_domain]/
  syntax match phpIniKey /[']\@=session\.cookie_h\%[ttponly]/
  syntax match phpIniKey /[']\@=session\.cookie_l\%[ifetime]/
  syntax match phpIniKey /[']\@=session\.cookie_p\%[ath]/
  syntax match phpIniKey /[']\@=session\.cookie_s\%[ecure]/

This way, the newer matches only take priority when they are long enough to be
different from the previous match.  But that is much more complicated to
generate, and I really wanted to avoid comlexity.

regards,
Peter




 
On Yahoo!7 
Check out the new Great Outdoors site with video highlights and more 
http://au.travel.yahoo.com/great-outdoors/index.html


Re: Syntax question regarding \%[

2006-09-06 Thread Peter Hodge
Hello,

--- A.J.Mechelynck [EMAIL PROTECTED] wrote:

 
 So, it matches a part-word. Try adding an end-of-word pattern atom \ 
 before the ending slash (but after the ending bracket) on each line. You 
 wouldn't want session.cookie_nomatch to be matched as far as 
 session.cookie_ would you?
 

Sorry, it isn't that simple.  I want to match as much as possible regardless of
what comes next.  What I am trying to do is:

  ?php
  ini_get('session.gc_maxlifetime');

There are only 150 or so possibilities for the argument to ini_get(), I am
trying to highlight them.  If I make a spelling mistake or put in the wrong
item, then I would want to highlight the error:

  ?php
  // should only highlight 'session.gc_' as correct
  // 'axlifetime' highlights as Error
  ini_get('session.gc_axlifetime');
  // the whole 'not.a_real_option' string should be higlighted as an error
  // (except for the quotes)
  ini_get('not.a_real_option');

So I use the following commands to set it all up:

   find the ini_get function
  syntax keyword phpFunctions ini_get contained nextgroup=phpIniParents
  syntax region phpIniParents contained matchgroup=Delimiter start=/(/ end=/)/
keepend
\ contains=phpIniError

   highlight a string inside ini_get() as an Error
  syntax match phpIniError contained /(\@=\%(\\.\|[^]\)*\=/
[EMAIL PROTECTED]
  syntax match phpIniError contained /(\@='\%(\\.\|[^']\)*'\=/
[EMAIL PROTECTED]
  hi link phpIniError Error

   highlight string quotes inside ini_get() as a normal color
  syntax cluster phpIniInside add=phpIniQuotes
  syntax match phpIniQuotes contained /[']/ containedin=phpIniError
  hi link phpIniQuotes Define

   highlight settings and partial settings inside the string:
   - phpIniKey is a correct keyword
   - phpIniKeyPartial matches part of a keyword
  syntax cluster phpIniInside add=phpIniKey,phpIniKeyPartial
  syntax match phpIniKeyPartial contained /[']\@=S\%[MT]/
  syntax match phpIniKeycontained /[']\@=SMTP/
  syntax match phpIniKeyPartial contained
/[']\@=a\%[llow_call_time_pass_referenc]/
  syntax match phpIniKeycontained
/[']\@=allow_call_time_pass_reference/
  syntax match phpIniKeyPartial contained /[']\@=allow_u\%[rl_fope]/
  syntax match phpIniKeycontained /[']\@=allow_url_fopen/
  syntax match phpIniKeyPartial contained /[']\@=allow_url_i\%[nclud]/
  syntax match phpIniKeycontained /[']\@=allow_url_include/
  syntax match phpIniKeyPartial contained
/[']\@=alw\%[ays_populate_raw_post_dat]/
  syntax match phpIniKeycontained
/[']\@=always_populate_raw_post_data/
  syntax match phpIniKeyPartial contained /[']\@=ar\%[g_separator\.inpu]/
  syntax match phpIniKeycontained /[']\@=arg_separator\.input/
  syntax match phpIniKeyPartial contained /[']\@=arg_separator\.o\%[utpu]/
  syntax match phpIniKeycontained /[']\@=arg_separator\.output/
  syntax match phpIniKeyPartial contained /[']\@=as\%[p_tag]/
  syntax match phpIniKeycontained /[']\@=asp_tags/
  syntax match phpIniKeyPartial contained /[']\@=ass\%[ert\.activ]/
  syntax match phpIniKeycontained /[']\@=assert\.active/
  syntax match phpIniKeyPartial contained /[']\@=assert\.b\%[ai]/
  syntax match phpIniKeycontained /[']\@=assert\.bail/
  syntax match phpIniKeyPartial contained /[']\@=assert\.c\%[allbac]/
  syntax match phpIniKeycontained /[']\@=assert\.callback/
  syntax match phpIniKeyPartial contained /[']\@=assert\.q\%[uiet_eva]/
  syntax match phpIniKeycontained /[']\@=assert\.quiet_eval/
  syntax match phpIniKeyPartial contained /[']\@=assert\.w\%[arnin]/
  syntax match phpIniKeycontained /[']\@=assert\.warning/
  syntax match phpIniKeyPartial contained /[']\@=au\%[to_append_fil]/
  syntax match phpIniKeycontained /[']\@=auto_append_file/
  syntax match phpIniKeyPartial contained /[']\@=auto_d\%[etect_line_ending]/
  syntax match phpIniKeycontained /[']\@=auto_detect_line_endings/
  syntax match phpIniKeyPartial contained /[']\@=auto_g\%[lobals_ji]/
  syntax match phpIniKeycontained /[']\@=auto_globals_jit/
  syntax match phpIniKeyPartial contained /[']\@=auto_p\%[repend_fil]/
  syntax match phpIniKeycontained /[']\@=auto_prepend_file/
  syntax match phpIniKeyPartial contained /[']\@=b\%[rowsca]/
  syntax match phpIniKeycontained /[']\@=browscap/
  syntax match phpIniKeyPartial contained /[']\@=d\%[ate\.default_latitud]/
  syntax match phpIniKeycontained /[']\@=date\.default_latitude/
  syntax match phpIniKeyPartial contained /[']\@=date\.default_lo\%[ngitud]/
  syntax match phpIniKeycontained /[']\@=date\.default_longitude/
  syntax match phpIniKeyPartial contained /[']\@=date\.s\%[unrise_zenit]/
  syntax match phpIniKeycontained /[']\@=date\.sunrise_zenith/
  syntax match phpIniKeyPartial contained /[']\@=date\.suns\%[et_zenit]/
  syntax match phpIniKeycontained /[']\@=date\.sunset_zenith/
  syntax match phpIniKeyPartial contained 

Re: syntax borked

2006-09-05 Thread Peter Hodge

--- Jorge Almeida [EMAIL PROTECTED] wrote:


 It appears there is a bug in the syntax file (see reply by Peter Hodge).
 This brings  up the question: How to install a syntax file without
 poluting the distribution system? In gentoo, the file is (for version
 6.4):
 /usr/share/vim/vim64/syntax/perl.vim
 Replacing this is not a good idea, since it would be replaced next time
 I updated vim in gentoo. So, is there a way to tell vim where to look
 for [some] syntax files? (Something like /usr/local/share/...)?
 

Well, there was a bug in the older syntax file I used (the one from 2005), but
the newer syntax file I downloaded is fine.  If you don't want to put the new
syntax file in your home directory (~/.vim/syntax/perl.vim), you can also put
it in /usr/share/vim/vimfiles/syntax/perl.vim.  That directory should already
be scanned by default ... check the value of 'runtimepath' to be sure.


 And about the indenting problem? Could you check with your vim and the
 above piece of code? If you place the cursor on line 796 and press 'o'
 in normal mode, it should open a line with the cursor above the '$' of
 $heavy. What happened to me is that the cursor would be below the 'f'
 of for.
 

The indenting works fine for me, without installing any new indent scripts. 
Have you enabled 'autoindent' and/or 'smartindent'?

regards,
Peter




 
On Yahoo!7 
Check out PS Trixi - The hot new online adventure 
http://www.trixi.com.au


Syntax question regarding \%[

2006-09-05 Thread Peter Hodge
Hello all,

Given the following text:

  inte
  integ
  intege
  integer
  inter
  interv
  interva
  interval

is there any easy way to make these two commands work?

  syntax match Error /int\%[eger]/
  syntax match Error /int\%[erval]/

The second match begins taking priority as soon as the word is 'inte', and
prevents 'integer' from being matched correctly.

regards,
Peter




 
Do you Yahoo!? 
The new TV home page features highlights, popular picks, and the best of 
homemade TV 
http://au.tv.yahoo.com/tv/


Re: syntax borked

2006-09-04 Thread Peter Hodge
Hello Jorge,

The problem is solved if you change this line:

  768 sub reloadlist{

to this:

  768 sub reloadlist {

It looks as though it is a bug in the perl syntax file.  You should send the
maintainer an email with your perl code snippet, and he should be able to fix
it.  It probably never even crossed his mind that someone might leave out the
whitespace there.

You can fix your copy of the perl syntax by changing this line:

   363 syn match  perlFunctionName  \h\w*[^:] contained

to this:

   363 syn match  perlFunctionName  \h\w*[^:{] contained

regards,
Peter


 
 Vim does a very good job dealing with perl syntax. This problem came as
 a really bad surprise.

 Jorge 
 




 
Do you Yahoo!? 
Take part in Total Girl’s Ultimate Slumber Party and help break a world record 
http://www.totalgirl.com.au


Re: syntax borked

2006-09-04 Thread Peter Hodge
--- A.J.Mechelynck [EMAIL PROTECTED] wrote:

 
 It doesn't. After pasting into an empty buffer via the clipboard, 
 block-deleting the column of numbers (from the left margin up to, but 
 not including, the s in sub at top and the last } at bottom) and 
 setting 'filetype' to perl, I see all reserved words in brown, 
 identifiers starting @ or $ in green including a preceding backslash if 
 present, the identifier D also in green, strings and numbers in pink 
 with the exception of backslash-escaped single quotes which are in 
 mauve, regular expressions in pink and mauve between brown slashes, and 
 the rest in black, all of it on a white background (this is gvim) from 
 top to bottom of the text. The only thing doubtful (to me) is that, 
 inside the double-quoted strings, ${logdir} is in pink but $! is in green.
 
 My Vim distribution uses ftplugin/perl.vim by Dan Sharp (2005 Dec 16) 
 and syntax/perl.vim by Nick Hibma (2006 Aug 9).


That explains alot, then.  I was using perl syntax by Nick Hibma, October 18,
2005 (probably what was packaged with vim 7 when it was released).  Downloading
the latest version from ftp://ftp.vim.org/pub/vim/runtime/syntax/perl.vim
corrected the problem.

regards,
Peter




 
On Yahoo!7 
360°: Share your blog, photos, interests and what matters most to you 
http://www.yahoo7.com.au/360


Re: unmatched strings

2006-09-02 Thread Peter Hodge

--- Tim Chase [EMAIL PROTECTED] wrote:

  Is there a way to highlight unmatched strings for  and ' in a syntax file?
 
 What is an unmatched string?

Here's two matches which will find a string that extends to the end of the
line:

  syntax match Error /\%(\\.\|[^]\)*$/
  syntax match Error /'\%(\\.\|[^']\)*$/

regards,
Peter 



 
Do you Yahoo!? 
Take part in Total Girl’s Ultimate Slumber Party and help break a world record 
http://www.totalgirl.com.au


Re: Re [2]: again: % does not work with ' ( '

2006-08-30 Thread Peter Hodge
Hey,

Thanks for that important clue.  It seems the secret to making it work is in
the values of the b:match_skip and b:match_words variables.  Thank you, this
problem has been bugging me for a while.

regards,
Peter


 
 Addendum: It depends on the 'filetype' and possibly on whether %-jumping 
 is done by Vim C code or by the matchit script: with the same file, if
 
   :set filetype=vim
 
 % jumps between 1 and 6 (but here the matchit plugin comes into play), 
 and matchparen pairs 1 with 6 too.
 
 
 Best regards,
 Tony.
 




 
Do you Yahoo!?  
Great meals in less than 30 mins - Family Circle Sept – out now 
http://www.familycircle.com.au 



Re: cursorline highlight error

2006-08-29 Thread Peter Hodge
Hi Paul,

You are doing the same as this:

  :set highlight - shows contents of 'highlight' option
  :set cursorline - activates 'cursorline' option

... but in the one command:

  :set highlight cursorline - shows contents of 'highlight' option and
activate 'cursorline' option

Just use 'set cursorline' and leave out the 'highlight' part.

regards,
Peter


--- Paul van Erk [EMAIL PROTECTED] wrote:

 Hi,
 
 I'm having a problem with Vim 7.0.17's cursorline highlighting. When I have
 in 
 my .gvimrc 'set highlight cursorline', I get the next error in gvim:
 

highlight=8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete,T:DiffText,:SignColumn,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,

+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine
 
 It also happens when I have a default .gvimrc
 
 The highlighting DOES work, though. What am I missing?
 
 Grts,
 Paul van Erk
 




 
On Yahoo!7 
Answers: Ask a question on any topic and get answers from real people 
http://www.yahoo7.com.au/answers


again: % does not work with ' ( '

2006-08-29 Thread Peter Hodge
Hello,

I don't know what I was smoking last time I posted this question, but it
definitely is not working for me now: If I have the following code:

  if('string(string')

and I press % while the cursor is on the last ')', it correctly jumps to the
first '('.   But, if I change the quotes to single-quotes, it doesn't jump
correctly, it jumps to the '(' in 'string(string'.

Is there a way to fix this?

regards,
Peter






 
On Yahoo!7 
Messenger - Make free PC-to-PC calls to your friends overseas. 
http://au.messenger.yahoo.com 



Re: again: % does not work with ' ( '

2006-08-29 Thread Peter Hodge
Sorry,

In my example I meant to use

  if(string(string)

and not

  if('string(string')

because double-quotes DO work, single-quotes do not.

- Peter


--- Peter Hodge [EMAIL PROTECTED] wrote:

 Hello,
 
 I don't know what I was smoking last time I posted this question, but it
 definitely is not working for me now: If I have the following code:
 
   if(string(string)
 
 and I press % while the cursor is on the last ')', it correctly jumps to the
 first '('.   But, if I change the quotes to single-quotes, it doesn't jump
 correctly, it jumps to the '(' in 'string(string'.
 
 Is there a way to fix this?
 
 regards,
 Peter
 




 
On Yahoo!7 
360°: Share your blog, photos, interests and what matters most to you 
http://www.yahoo7.com.au/360


Re: How to create a plugin that runs after any skeletons are loaded as part of BufNewFile.

2006-08-27 Thread Peter Hodge
Hello,

--- Elliot Shank [EMAIL PROTECTED] wrote:

 What I'm trying to do is create a plugin that acts based upon the contents of
 an arbitrary file buffer as soon after it has loaded its contents as
 possible.
 
 For existing files, using a BufReadPost autocmd is fine.
 
 For new file buffers that have text loaded into them via a BufNewFile
 autocmd, I can't just create a BufNewFile autocmd myself because I can't
 guarantee that mine will run last.
 
 So, the obvious thing to do is use BufEnter and/or BufWinEnter.
 
 However, I've got other plugins that will need the result of the new plugin
 and that want to use BufEnter and BufWinEnter themselves, which leads me back
 to the ordering problem.  I can't make sure that the plugin will run first.
 
 It looks like FileType and Syntax events can occur between BufNewFile and
 BufWinEnter, but this only happens for files that a file type can be figured
 out for.  If I edit a non-existent file called blah, there aren't any
 events between BufNewFile and BufWinEnter.
 
 
 Any suggestions?
 

Hi Elliot,

Perhaps put your plugin in after/plugin/yourplugin.vim, because the :runtime
command used to load all the plugins looks in plugin/ before it looks in
after/plugin.  If your plugin is loaded last, then hopefully it's autocommands
will also be the last BufNewFile commands to be executed.  I can't remember
correctly, but there may be another event which runs every time your run a
vimscript using ':source' or 'runtime'.  If that is the case, you could maybe
use that ~ScriptRun~ event to clear and redefine your BufNewFile autocommands
so that they are always added last after every other script of any kind, and
hopefully they will then always be the last BufNewFile commands.

I have no idea if any of that will work, all the best!

regards,
Peter






 
On Yahoo!7 
Messenger - Make free PC-to-PC calls to your friends overseas. 
http://au.messenger.yahoo.com 



Re: Python Script Execution Support in ViM

2006-08-23 Thread Peter Hodge
Hello Barry,

For PHP, I use a command like ':!php %' (or ':!php %' for windows) to run a
file through PHP.  From there, it's not hard to set up a mapping ':nnoremap
F5 :!python %' or a menu command ':nnoremenu Python.Run :!python %', or an
auto-command to run the script when it is saved ':autocmd! BufWritePost *.py
:!python %'.

regards,
Peter



--- Carroll, Barry [EMAIL PROTECTED] wrote:

 Greetings:
 
  
 
 This is my first posting to this list.  I have used ViM off and on for many
 years.  For the past year I have been using it exclusively to write Python
 programs for the Windows (2000/XP) and Linux (Fedora) platforms.  I am using
 version 6.3 with python/dyn enabled on Windows and 6.2 with Python enabled on
 Linux.  
 
  
 
 Currently, when I want to run a script I am working on I have to open a
 separate command or interpreter window and do my work there.  I would like to
 be able to execute the open buffer from inside ViM, open a split window and
 have the Python interpreter start automatically and import the open buffer, 
 and other IDE-like actions.  Does ViM offer this kind of support for Python? 
 I have read tantalizing bits on various web pages that indicate it might be
 so, but can find nothing that tells just what is supported and how to make it
 work.  
 
  
 
 Can someone point me in the right direction?  Thank you in advance for your
 help.  
 
  
 
 Regards,
 
  
 
 Barry
 
 [EMAIL PROTECTED]
 
 541-302-1107
 
 
 
 We who cut mere stones must always be envisioning cathedrals.
 
 -Quarry worker's creed
 
  
 
 
 




 
On Yahoo!7 
360°: Your own space to share what you want with who you want! 
http://www.yahoo7.com.au/360


Re: % does not work with ' ( ' - never mind

2006-08-22 Thread Peter Hodge
Sorry, disregard last post, % wasn't working because I didn't actually have %
in cpoptions yet.



--- Peter Hodge [EMAIL PROTECTED] wrote:

 Hello,
 
 Is there any way to make % jump to the correct parenthesis and ignore a '('
 inside a single-quoted string?  For example:
 
   if('string(string')
 
 Pressing % while the cursor is at the end of the line will jump to the wrong
 '('.  Is there any way to fix this?  The help page on % does not mention any
 way to make % skip over single-quoted strings unless '(' is the whole string.
 
 regards,
 Peter
 
 
 
   
  
 On Yahoo!7 
 The new Yahoo!7 home page - scan your email inbox, start an IM conversation
 or update your blog 
 http://au.yahoo.com/
 




 
On Yahoo!7 
360°: Your own space to share what you want with who you want! 
http://www.yahoo7.com.au/360


Re: highlight setting overwritten

2006-08-22 Thread Peter Hodge
Hello,

Another way to get around this is to add something like this to your _vimrc:

  augroup MyColors
  au!
  au ColorScheme * highlight Comment guifg=Darkgreen
  au ColorScheme * highlight Identifier guifg=Blue
  [ ... etc ... ]
  augroup end

   execute the commands now in case they aren't triggered immediately:
  do MyColors ColorScheme


Each time colors are reloaded (like when you use ':syn on'), the highlight
commands will be executed.

regards,
Peter



--- [EMAIL PROTECTED] wrote:

 Hello,
 
 in my old gvim62 installation I do a few highlight commands in the
 $VIM/_gvimrc:
 
 highlight Comment guifg=DarkGreen guibg=background
 ...
 
 Now in my new vim70 installation this seems to be overwritten somewhere.
 The _gvimrc *is* sourced (- :scriptnames)
 If I do the highlight command manually it works.
 
 Where may the highlight be overwritten resp. where should I place the
 highlight command instead?
 
 Thank You
 
 Joachim
 
 [gvim70 WinXP]
 ###
 
 This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
 For more information, connect to http://www.f-secure.com/
 




 
Do you Yahoo!? 
Yahoo! Dating: It's free to check out our great singles! 
http://au.personals.yahoo.com


Re: Problem with completion

2006-08-21 Thread Peter Hodge
Hi Srinath,

 For now, I am just going to set noignorecase to get around this, but
 it would be nice if this were fixed. On another note, I would like an
 option which only ignores case when searching. When doing completion,
 I have taken the trouble of typing Graph with a capital G, so I
 don't want case to be ignored. Is there a way to do this? Aah... there
 is... 'smartcase'. Cool... That seems to partly solve the problem. It
 works when I have atleast one upper case character typed before I
 press C-p. Doesn't completely solve it though.

This probably won't make you perfectly happy either, but you can also use '\c'
in the search string to force ignore-case, or '\C' to force case-matching.  See
':help /\c' for more info.

regards,
Peter




 
On Yahoo!7 
The new Yahoo!7 home page - scan your email inbox, start an IM conversation or 
update your blog 
http://au.yahoo.com/


% does not work with ' ( '

2006-08-21 Thread Peter Hodge
Hello,

Is there any way to make % jump to the correct parenthesis and ignore a '('
inside a single-quoted string?  For example:

  if('string(string')

Pressing % while the cursor is at the end of the line will jump to the wrong
'('.  Is there any way to fix this?  The help page on % does not mention any
way to make % skip over single-quoted strings unless '(' is the whole string.

regards,
Peter




 
On Yahoo!7 
The new Yahoo!7 home page - scan your email inbox, start an IM conversation or 
update your blog 
http://au.yahoo.com/


Re: can we set vim to use magic=very ??

2006-08-10 Thread Peter Hodge
Hi Martin,

Unfortunately, I don't think there's any way to use \v by default for every
pattern.

It may help to remember that when you have the default 'magic' option set, Vim
only recognizes 5 special characters without backslash:
  ^
  $
  .
  *
  [ (if there is a matching ] to make a collection)

Every other special sequence needs a '\'.

regards,
Peter



 martin kraegeloh wrote:
 all,
 
 rtfm didn't help ... I'd like to *always* make my regexes behave like 
 perl, but I find no way to set it as a default. will I have to always 
 use \v ??
 I tend to think that if I can't get vim to do something it's because I 
 don't know why, not because it is not possible ... so how do I do this?
 
 cheers, martin



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


Re: PCRE? Perl Compatible Regular Expressions?

2006-08-08 Thread Peter Hodge
Hi David,

If you begin your pattern with '\v', then every character except [_a-z0-9]
becomes 'special'.  This allows you to use tokens like '?', '(' and '+' without
a backslash.  Unfortunately, you can't use '(?:' and friends.

Maybe there should be a modifier like '\v' which makes the pattern compatible
with PCRE. '\!' hasn't been taken yet, i.e., :s/\!(?:foo|bar)/---/

But this could potentially cause some headaches, because PCRE does not support
any of the Vim-only goodness such as \x\o\h\a\l\u\i\k etc (not to mention \%#
and \%c etc), and some items such as '\f' are ambigous?  Vim treats it as any
file name character (from 'isfname') but PCRE treats it as the form-feed
character (\x0B I think).  And then there is the question of where you want to
put the PCRE after-delimiter modifiers.

regards,
Peter


--- David Conrad [EMAIL PROTECTED] wrote:

 The regular expression syntax that Vim uses is, I'm sure, compatible with Vi.
 There were always a number of different regex dialects to choose from:
 grep, egrep, sed. But in the last few years, pcre's have become popular, and
 virtually standard across a lot of different languages, from Perl to Python
 to
 Ruby to JavaScript to C# to Java.
 
 Is there any way to use them in Vim? I've learned to used the Vim-style
 regex's
 in my s///'s, but if I could use one regex syntax across everything I
 work with, it
 would free up a few more brain cells for more constructive purposes.
 
 Any advice is appreciated.
 
 Thanks,
 David Conrad
 


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


Re: Smarter Indent (an odd problem)

2006-08-05 Thread Peter Hodge
Hi Yakov,

--- Yakov Lerner [EMAIL PROTECTED] wrote:

 Must be possible using CursorMoves autoevent, except
 that I don't see in syntax/html.vim how ?php ... ? is handled.
 Is is indeed in syntax /html.vim ?

PHP stuff is in syntax/php.vim which loads html.vim inside it.

regards,
Peter


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


Re: Sorting columns in a file

2006-08-03 Thread Peter Hodge
Hi Eric,

I am assuming you want to re-order the columns horizontally, in which case
Visual Block Mode is what you want.  Press CTRL+V to start selecting a column,
use 'x' to delete it, and 'P' (upper-case P) to paste it (I find upper-case P
is more logical for Visual Block paste).

HTH,
regards,
Peter



--- Eric Leenman [EMAIL PROTECTED] wrote:

 Hi,
 
 I have file which contains hexadecimal numbers like below:
 
 04F  ---  05F  ---  052  ---  188  ---  2D4  ---  173  ---  040  ---  18D
 051  ---  040  ---  05F  ---  1CA  ---  2E8  ---  14F  ---  040  ---  1E2
 051  ---  040  ---  069  ---  1B9  ---  2D7  ---  15E  ---  040  ---  1A6
 051  ---  040  ---  06F  ---  1ED  ---  2EB  ---  12E  ---  040  ---  209
 051  ---  040  ---  078  ---  1F9  ---  2E3  ---  122  ---  040  ---  220
 051  ---  045  ---  063  ---  1C8  ---  2D1  ---  146  ---  040  ---  1F4
 051  ---  046  ---  05A  ---  1BB  ---  2D7  ---  158  ---  040  ---  1D3
 051  ---  052  ---  04F  ---  1B6  ---  2E3  ---  154  ---  040  ---  1BB
 052  ---  040  ---  045  ---  1BC  ---  2D6  ---  146  ---  040  ---  1CE
 052  ---  040  ---  04A  ---  1BC  ---  2DD  ---  146  ---  040  ---  1D3
 
 How can I sort the columns so that they are as the first column?
 
 Best regards,
 
 Eric
 
 _
 FREE pop-up blocking with the new MSN Toolbar  get it now! 
 http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
 
 


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


Re: Automatic updating file content

2006-08-01 Thread Peter Hodge
Hi Tien,

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

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

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

regards,
Peter



--- Tien Pham [EMAIL PROTECTED] wrote:

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


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


Re: au! failure in vimrc

2006-07-31 Thread Peter Hodge
Hi Bill,

vimrc is read before plugins, so your au! command in .vimrc can't replace the
AsNeeded autocommand because AsNeeded hasn't been defined yet.

regards,
Peter



--- Bill McCarthy [EMAIL PROTECTED] wrote:

 Hello Vim List,
 
 Suppose two plugins define autocmds, so after start Vim,
 
 :au FuncUndefined
 
 displays:
 
 * call AsNeeded(1,expand(afile))
 Tlist_*   source C:\vim\vimfiles\plugin\taglist.vim
 
 Now I add a line to my _vimrc:
 
 au! FuncUndefined * call Foo()
 
 Now after starting Vim and typing :au FuncUndefined
 
 * call Foo()
   call AsNeeded(1,expand(afile))
 Tlist_*   source C:\vim\vimfiles\plugin\taglist.vim
 
 It did not replace!
 
 Now removing the line I added to _vimrc, starting Vim and
 typing :au! FuncUndefined * call Foo()
 
 I get what I expected from :au FuncUndefined
 
 Tlist_*   source C:\vim\vimfiles\plugin\taglist.vim
 * call Foo()
 
 Vim only appears to fail in startup - it is not just a
 script error.  If I write a small script file that just
 contains the line:  au! FuncUndefined * call Foo()
 
 Sourcing that script works just like typing the command.
 
 -- 
 Best regards,
 Bill
 
 


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


Syntax Feature Request

2006-07-27 Thread Peter Hodge
Hello all,

I just want to throw this idea out there as a potential solution to the
problems I am having with the PHP syntax.  It would be helpful to be able to
name sequential 'nextgroups' for regions and matches, so that the syntax will
highlight an area using certain groups in specific order. I.e:

For example, the PHP function preg_replace(), takes 3 arguments like this:

  /* print 'Goodbye name' instead of 'Hello name' */
  $text = 'Hello Peter';
  print preg_replace('/Hello (\w+)/', Goodbye \1, $text);

Preg_replace works just like Vim's substitute() function, except preg_replace
takes the subject as the last argument rather than the first.  There is
actually a major bug in that code sample which A) most people would not notice;
and B) the highlighting in most text editors would only confuse people even
more (I will explain further down).

For preg_replace, the first argument, '/Hello (\w+)/' is a perl-style regular
expression; the second argument is the replacement pattern which may contain
backreferences, and the third argument can be any variable, expression, etc.

Currently I am finding and highlighting the regular expression string like
this:

  syntax keyword pregFunction preg_replace nextgroup=pregOpenParent
  syntax match pregOpenParent /(/ nextgroup=pregString
  syntatx region pregString start=/'/ end=/'/ skip=...

I have a couple of problems with this; first of all, pregOpenParent matches a
lone opening '(', which means the parenthesis errors syntax items (which match
( and ) together to spot errors) will find another ')' seemingly all by itself
at the end of the call to preg_replace() and highlight it as an error.  I would
like to turn pregOpenParent into a region to take care of the closing ')', but
then how do I specify that the first argument (and only the first) to that
function call is a string with a PCRE pattern in it?

Also very important is that I am able to highlight the 2nd argument to
preg_replace using a specific group for Preg replacement strings, because
(!major bug explanation!) in the string Goodbye \1, most people will see the
\1 and think 'backreference', and in fact the best text editors around might
highlight the \1 in a separate color from the rest of the string, and then most
would think 'definitely backreference!', when really it's octal (\x01) and not
a backreference at all.  So for the 2nd argument to preg-replace, I would like
to be able to highlight \1 as an Error so that people might think What's up
with that? and hopefully they will work out that they need to use '\1' or
\\1 instead; at any rate it would be obvious to them that if the
backreference doesn't seem to be working, the \1 is definitely the problem
and they have a good idea where to start investigating.

My hope is that the new highlighting will save people from wasting hours on
PCRE regular expressions; even though I was fairly good with Vim REs when I
started using PHP's preg functions, a single line of code containing a
15-character preg RE would usually take me 10 or 15 minutes to write correctly
because A) I couldn't remember what needed to have a '\' before it and what
didn't, and B) if I had a misplaced '\', the syntax highlighting would not help
me to find it and I had to fiddle with the pattern endlessly to get it working.

So in order to make an effective PHP syntax, I need to be able to do something
like this in Vim:

  syntax keyword preg_replace nextgroup=pregReplaceParents
  syntax region pregReplaceParents matchgroup=Delimiter start=/(/ end=/)/
\ first=pregPattern,phpIdentifier
\ second=phpComma
\ third=pregReplacement,phpIdentifier
\ fourth=phpComma
\ fifth=phpIdentifier,phpString

... so that inside the pregReplaceParents region, Vim would first try and match
a 'pregPattern' or a 'phpIdentifier', followed by a comma, followed by a
'pregReplacement' or a 'phpIdentifier', followed by a comma, followed by a
phpIdentifier or phpString.

An alternative to this which isn't as tidy but might be simpler to implement,
and might be useful elsewhere, is to allow the 'nextgroup' on a syntax cluster:

  syntax keyword preg_replace nextgroup=pregReplaceParents
  syntax region pregReplaceParents matchgroup=Delimiter start=/(/ end=/)/
\ [EMAIL PROTECTED]
  syntax cluster pregReplaceFirst add=pregPattern,phpIdentifier
[EMAIL PROTECTED]
  syntax cluster pregReplaceSecond add=phpComma [EMAIL PROTECTED]
  syntax cluster pregReplaceThird add=pregReplacement,phpIdentifier
[EMAIL PROTECTED]
  syntax cluster pregReplaceFourth add=phpComma [EMAIL PROTECTED]
  syntax cluster pregReplaceFifth add=phpIdentifier,phpString

*end of suggestions*
==

Does anyone else think that one or both of these features might be useful?

Are there any specific plans for the future of Vim's highlighting?

Is there any possibility of these Feature Requests becoming reality, even if I
have to finish learning C and code them myself?  I would really like to push
the PHP 

Syntax Feature Request

2006-07-27 Thread Peter Hodge
Hello all,

I just want to throw this idea out there as a potential solution to the
problems I am having with the PHP syntax.  It would be helpful to be able to
name sequential 'nextgroups' for regions and matches, so that the syntax will
highlight an area using certain groups in specific order. I.e:

For example, the PHP function preg_replace(), takes 3 arguments like this:

  /* print 'Goodbye name' instead of 'Hello name' */
  $text = 'Hello Peter';
  print preg_replace('/Hello (\w+)/', Goodbye \1, $text);

Preg_replace works just like Vim's substitute() function, except preg_replace
takes the subject as the last argument rather than the first.  There is
actually a major bug in that code sample which A) most people would not notice;
and B) the highlighting in most text editors would only confuse people even
more (I will explain further down).

For preg_replace, the first argument, '/Hello (\w+)/' is a perl-style regular
expression; the second argument is the replacement pattern which may contain
backreferences, and the third argument can be any variable, expression, etc.

Currently I am finding and highlighting the regular expression string like
this:

  syntax keyword pregFunction preg_replace nextgroup=pregOpenParent
  syntax match pregOpenParent /(/ nextgroup=pregString
  syntatx region pregString start=/'/ end=/'/ skip=...

I have a couple of problems with this; first of all, pregOpenParent matches a
lone opening '(', which means the parenthesis errors syntax items (which match
( and ) together to spot errors) will find another ')' seemingly all by itself
at the end of the call to preg_replace() and highlight it as an error.  I would
like to turn pregOpenParent into a region to take care of the closing ')', but
then how do I specify that the first argument (and only the first) to that
function call is a string with a PCRE pattern in it?

Also very important is that I am able to highlight the 2nd argument to
preg_replace using a specific group for Preg replacement strings, because
(!major bug explanation!) in the string Goodbye \1, most people will see the
\1 and think 'backreference', and in fact the best text editors around might
highlight the \1 in a separate color from the rest of the string, and then most
would think 'definitely backreference!', when really it's octal (\x01) and not
a backreference at all.  So for the 2nd argument to preg-replace, I would like
to be able to highlight \1 as an Error so that people might think What's up
with that? and hopefully they will work out that they need to use '\1' or
\\1 instead; at any rate it would be obvious to them that if the
backreference doesn't seem to be working, the \1 is definitely the problem
and they have a good idea where to start investigating.

My hope is that the new highlighting will save people from wasting hours on
PCRE regular expressions; even though I was fairly good with Vim REs when I
started using PHP's preg functions, a single line of code containing a
15-character preg RE would usually take me 10 or 15 minutes to write correctly
because A) I couldn't remember what needed to have a '\' before it and what
didn't, and B) if I had a misplaced '\', the syntax highlighting would not help
me to find it and I had to fiddle with the pattern endlessly to get it working.

So in order to make an effective PHP syntax, I need to be able to do something
like this in Vim:

  syntax keyword preg_replace nextgroup=pregReplaceParents
  syntax region pregReplaceParents matchgroup=Delimiter start=/(/ end=/)/
\ first=pregPattern,phpIdentifier
\ second=phpComma
\ third=pregReplacement,phpIdentifier
\ fourth=phpComma
\ fifth=phpIdentifier,phpString

... so that inside the pregReplaceParents region, Vim would first try and match
a 'pregPattern' or a 'phpIdentifier', followed by a comma, followed by a
'pregReplacement' or a 'phpIdentifier', followed by a comma, followed by a
phpIdentifier or phpString.

An alternative to this which isn't as tidy but might be simpler to implement,
and might be useful elsewhere, is to allow the 'nextgroup' on a syntax cluster:

  syntax keyword preg_replace nextgroup=pregReplaceParents
  syntax region pregReplaceParents matchgroup=Delimiter start=/(/ end=/)/
\ [EMAIL PROTECTED]
  syntax cluster pregReplaceFirst add=pregPattern,phpIdentifier
[EMAIL PROTECTED]
  syntax cluster pregReplaceSecond add=phpComma [EMAIL PROTECTED]
  syntax cluster pregReplaceThird add=pregReplacement,phpIdentifier
[EMAIL PROTECTED]
  syntax cluster pregReplaceFourth add=phpComma [EMAIL PROTECTED]
  syntax cluster pregReplaceFifth add=phpIdentifier,phpString

*end of suggestions*
==

Does anyone else think that one or both of these features might be useful?

Are there any specific plans for the future of Vim's highlighting?

Is there any possibility of these Feature Requests becoming reality, even if I
have to finish learning C and code them myself?  I would really like to push
the PHP 

  1   2   >