Loading ...
Sorry, an error occurred while loading the content.
 

RE: Cant use matchit.vim in sql code

Expand Messages
  • Sanjeev Sapre
    Sorry for that. Actually it is a wrapping issue by mail client. My cursor was in between the two lines. In other words it was on its own line which is blank.
    Message 1 of 7 , Nov 30, 2004
      Sorry for that. Actually it is a wrapping issue by mail client.
      My cursor was in between the two lines. In other words it was on its own line which is blank.


      Regards,
      Sanjeev Sapre

      -----Original Message-----
      From: David Fishburn [mailto:fishburn@...]
      Sent: Thursday, November 25, 2004 9:38 PM
      To: Sanjeev Sapre; vim@...
      Subject: RE: Cant use matchit.vim in sql code

      matchit.vim works by matching the character/pattern in *the current cursor*
      position.
      So if your <cursor> is at the end of the TRUNC statement, nothing there
      tells matchit.vim to match to the BEGIN ... END block.

      I have uploaded a new version of ftplugin/sql.vim.
      http://vim.sourceforge.net/scripts/script.php?script_id=454

      Several new maps have been created to:
      ]] - next BEGIN
      [[ - previous BEGIN
      ][ - next END
      [] - previous END

      ]} - Next CREATE statement
      [{ - Previous CREATE statement

      ]" - Next comment
      [" - End of previous comment

      So if your <cursor> is below, then you could press [[ to go to the previous
      BEGIN block.

      I have also updated additional items for matchit.vim to support
      FOR/WHILE/LOOPs, Oracle MERGE statements and EXCEPTION clauses.

      If you could try this out that would be great.

      I will also submit this (after sufficient testing) to Bram for the inclusion
      in Vim 7.0 and Vim 6.4 (if one is included).

      Dave

      --
      Do you use Vim to edit SQL?
      <Plug>
      Check the description of these plugins:
      dbext.vim - Provides database access to 10 databases (Oracle, Sybase, SQL
      Server, MySQL,...) (http://www.vim.org/scripts/script.php?script_id=356)
      SQLUtilities - Formatting SQL, generate - columns lists, procedures for
      databases (http://www.vim.org/scripts/script.php?script_id=492)
      sql.vim - SQL indent file for Sybase ASA and Oracle
      (http://www.vim.org/scripts/script.php?script_id=495)
      Intellisense for Vim : SQL, C++, CSharp, Java, JSP, XML, HTML
      (http://www.vim.org/scripts/script.php?script_id=747)
      </Plug>



      > -----Original Message-----
      > From: Sanjeev Sapre [mailto:SanjeevS@...]
      > Sent: Monday, November 22, 2004 1:59 AM
      > To: David Fishburn; vim@...
      > Subject: RE: Cant use matchit.vim in sql code
      >
      > Following is the code
      > My cursor was at <CURSOR>
      > I am in command mode
      >
      >
      >
      > BEGIN
      > V_TOOL_INVEST :=
      > cur_outbound_var.TOOLING_INVESTMENT -
      > TRUNC(cur_outbound_var.TOOLING_INVESTMENT) ; <CURSOR>
      > IF V_TOOL_INVEST = 0 THEN
      > TOOL_COST :=
      > TRUNC(cur_outbound_var.TOOLING_INVESTMENT) ;
      > TOOL_COST := LPAD(TOOL_COST,7,0); --|| '00' ;
      > ELSE--IF V_TOOL_INVEST < 1 THEN
      > -- TOOL_COST :=
      > cur_outbound_var.TOOLING_INVESTMENT -
      > TRUNC(cur_outbound_var.TOOLING_INVESTMENT) ;
      > -- TOOL_COST :=
      > LPAD(TRUNC(cur_outbound_var.TOOLING_INVESTMENT),5,0) ||
      > RPAD(SUBSTR(TOOL_COST,2),2,0) ;
      > TOOL_COST := LPAD(TOOL_COST,7,0);
      > END IF ;
      >
      > Regards,
      > Sanjeev Sapre
      >
      > -----Original Message-----
      > From: David Fishburn [mailto:fishburn@...]
      > Sent: Friday, November 19, 2004 8:00 PM
      > To: Sanjeev Sapre; vim@...
      > Subject: RE: Cant use matchit.vim in sql code
      >
      > Okay, next shop a snippet of code.
      > Show where your cursor is.
      > Tell us what mode you are in, and what key you pressed.
      >
      > Dave
      >
      >
      > > -----Original Message-----
      > > From: Sanjeev Sapre [mailto:SanjeevS@...]
      > > Sent: Friday, November 19, 2004 2:21 AM
      > > To: David Fishburn; vim@...
      > > Subject: RE: Cant use matchit.vim in sql code
      > >
      > > I checked it out, It shows the two variable set as in sql.vim in
      > > ftplugin
      > >
      > > Regards,
      > > Sanjeev Sapre
      > >
      > > -----Original Message-----
      > > From: David Fishburn [mailto:fishburn@...]
      > > Sent: Thursday, November 18, 2004 7:23 PM
      > > To: Sanjeev Sapre; vim@...
      > > Subject: RE: Cant use matchit.vim in sql code
      > >
      > >
      > >
      > > > -----Original Message-----
      > > > From: Sanjeev Sapre [mailto:SanjeevS@...]
      > > > Sent: Thursday, November 18, 2004 5:15 AM
      > > > To: vim@...
      > > > Subject: Cant use matchit.vim in sql code
      > > >
      > > > Hello List
      > > > I am using gvim 6.3 on win2k
      > > > I was trying to use matchit.vim.
      > > > I expect that it shows me BEGIN and END of the block surrounding
      > > > current cursor position. I copied matchit.vim to plugins
      > > folder , when
      > > > I tried it shows me if /end if but not other matching words.
      > > > What I need to do to get it working on BEGIN / END ?
      > Please suggest
      > >
      > > There are a few things that must be in place to correctly use
      > > matchit.vim with SQL.
      > >
      > > Edit a SQL file:
      > > :e dave.sql
      > >
      > > Then run a few echo commands:
      > > echo b:match_ignorecase
      > > echo b:match_words
      > >
      > > Vim 6.3 ships with the ftplugin that I wrote that setups up
      > the above
      > > buffer
      > > variables:
      > > $VIMRUNTIME\ftplugin\sql.vim
      > >
      > > So first check to see if those variables exist.
      > >
      > > Dave
    Your message has been successfully submitted and would be delivered to recipients shortly.