fortran indentation

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

fortran indentation

Peng Yu
Hi,

I have the following f90 program indented as such in vim.

      program hello
      print *, "Hello World!"
      end program hello

However, it might be better to have the code indented like the
following (notice the "print" line). Does anybody know if there is a
plugin for it in vim? Thanks!

       program hello
          print *, "Hello World!"
       end program hello


Regards,
Peng

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: fortran indentation

Rudra Banerjee
On Friday, January 4, 2013 1:22:49 PM UTC, Peng Yu wrote:

> Hi,
>
>
>
> I have the following f90 program indented as such in vim.
>
>
>
>       program hello
>
>       print *, "Hello World!"
>
>       end program hello
>
>
>
> However, it might be better to have the code indented like the
>
> following (notice the "print" line). Does anybody know if there is a
>
> plugin for it in vim? Thanks!
>
>
>
>        program hello
>
>           print *, "Hello World!"
>
>        end program hello
>
>
>
>
>
> Regards,
>
> Peng

Hi,
use fortran code complete.
This will solve your problem

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: fortran indentation

Peng Yu
> use fortran code complete.
> This will solve your problem

Hi,

I don't understand what you mean by "fortran code complete". Would you
please help elaborate a little more? Thanks!

--
Regards,
Peng

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: fortran indentation

stosss
On Sat, Jan 5, 2013 at 1:40 PM, Peng Yu <[hidden email]> wrote:
>> use fortran code complete.
>> This will solve your problem
>
> Hi,
>
> I don't understand what you mean by "fortran code complete". Would you
> please help elaborate a little more? Thanks!
>

I think he means a plugin for Vim called "fortran code complete".

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: fortran indentation

Joe-261
In reply to this post by Peng Yu
Hi Peng, if you google "vim fortran codecomplete" you should find a few links, such as:


"This script allows you to complete Fortran 90 structures by pressing <F7>. 

The plugin in written in python, so you need to have your vim compiled with python support in order to use it. 

The intention is to complete “program”, “type”, “interface”, “module”, “subroutine”, “function”, “do”, and “select” constructs. You write the first line of such a construct (e.g. “subroutine foo(a, b)”, then press <F7>, and the script will add the closing line “end subroutine foo” and put the cursor between the two lines, _indented_ by one level.
..."


On Sat, Jan 5, 2013 at 7:40 PM, Peng Yu <[hidden email]> wrote:
> use fortran code complete.
> This will solve your problem

Hi,

I don't understand what you mean by "fortran code complete". Would you
please help elaborate a little more? Thanks!

--
Regards,
Peng

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php



--
joe gain

jacob-burckhardt-str. 16
78464 konstanz
germany

+49 (0)7531 60389

(...otherwise in ???)

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: fortran indentation

Peng Yu
On Sat, Jan 5, 2013 at 12:55 PM, Joe Gain <[hidden email]> wrote:

> Hi Peng, if you google "vim fortran codecomplete" you should find a few
> links, such as:
>
> http://www.vim.org/scripts/script.php?script_id=2487
>
> "This script allows you to complete Fortran 90 structures by pressing <F7>.
>
> The plugin in written in python, so you need to have your vim compiled with
> python support in order to use it.
>
> The intention is to complete “program”, “type”, “interface”, “module”,
> “subroutine”, “function”, “do”, and “select” constructs. You write the first
> line of such a construct (e.g. “subroutine foo(a, b)”, then press <F7>, and
> the script will add the closing line “end subroutine foo” and put the cursor
> between the two lines, _indented_ by one level.
> ..."


<F7> is already taken on my vim. I use the following for indentation.
Is there a way to change the shortcut from <F7> to --.

Also, I disabled my <F7> definition in ~/.vimrc, but I don't see <F7>
can indent the code block. Does <F7> work for you? Thanks!

187 "full file indent
188 fun BenIndent()
189   let oldLine=line('.')
190   normal gg=G
191   execute ':' . oldLine
192 endfun
193 "map -- :call BenIndent()<Bar>normal zz<CR>
194 map -- :call BenIndent()<CR>

--
Regards,
Peng

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: fortran indentation

Rudra Banerjee
<F7> with code complete completes the blocks.
But, if you do not want to complete the block and want to write all, i.e. disabling <F7>, still for me, it indents do-end do etc.
This is my f90 specific directives in vimrc
" Fortran stuff
:let fortran_do_enddo=1
:let fortran_more_precise=1
:let fortran_free_source=1
:let fortran_have_tabs=1
filetype on
filetype plugin on
filetype indent on

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|

Re: fortran indentation

Peng Yu
On Sat, Jan 5, 2013 at 2:51 PM, rudra <[hidden email]> wrote:

> <F7> with code complete completes the blocks.
> But, if you do not want to complete the block and want to write all, i.e. disabling <F7>, still for me, it indents do-end do etc.
> This is my f90 specific directives in vimrc
> " Fortran stuff
> :let fortran_do_enddo=1
> :let fortran_more_precise=1
> :let fortran_free_source=1
> :let fortran_have_tabs=1
> filetype on
> filetype plugin on
> filetype indent on

       program hello
       print *, "Hello World!"
       end program hello

<F7> indeed can complete a block. But it won't indent the above code
like the following.

       program hello
          print *, "Hello World!"
       end program hello

--
Regards,
Peng

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php