Automatically collapse Oracle embedded views in Vim using .vimrc

I saw the Vim magic commands before you could add to your .vimrc to have folds created when opening a particular file type. I remember that I had code that would create creases when opening a file with every method and Ruby class. Then, with one command, I can collapse all these folds of the method. Does anyone know how to do this with inline views in PL / SQL? Let's say I have the following SQL:

SELECT blah,
       teh_max
FROM (
       SELECT blah,
              MAX(bar) AS teh_max
       FROM (
              SELECT blah,
                     bar
              FROM foo
            )
       GROUP BY blah
     )
ORDER BY blah

I would like creases to be created when I open it in Vim to go to a line FROM (, click zcin command mode and minimize the inline view starting from that line. It would be nice to collapse all the folds with one command.

+5
2

foldmethod syntax:

" for all windows
set foldmethod=syntax
" for the current window
setlocal foldmethod=syntax

, fold , . :

The "fold" argument makes the fold level increase by one for this item.
Example: 
   :syn region myFold start="{" end="}" transparent fold
   :syn sync fromstart
   :set foldmethod=syntax
This will make each {} block form one fold.

, , , fold . C/++ , .

/usr/share/vim/vimXX/syntax Linux ( <vim-directory>\vimXX\syntax Windows?), XX - (, 72). /usr/share/vim/vimfiles/syntax ~/.vim/syntax.

+3

SQL-. , . , , 10- PL/SQL. . SQL- .

, .

, PL/SQL . vim vim.org script.

0

All Articles