vim-commentary icon indicating copy to clipboard operation
vim-commentary copied to clipboard

Fortran fixed format

Open hholst80 opened this issue 9 years ago • 6 comments

I would like to be able to comment Fortran source using a capital C in column 1. It does not have to be the default mode of action but it would be nice to manually set it, for instance if fortran_fixed_source is set.

Pressing 3gcc on the first line below should toggle between the two code snippets

      IF (DBG) THEN
        WRITE(*,*) 'DEBUG: ', XDATA
      END IF
C     IF (DBG) THEN
C       WRITE(*,*) 'DEBUG: ', XDATA
C     END IF

hholst80 avatar Jun 23 '16 12:06 hholst80

I'd entertain providing some sort of generic hook for this (which could also be used for other weird comment schemes like COBOL).

tpope avatar Jun 24 '16 20:06 tpope

To expand on @hholst80's request, I recently came across this fork of vim-commentary that handles the functionality that I think accommodates his request and your rebuttal: forcing vim-commentary to insert the comment character in a particular column. In this instance, new variables are introduced: g:commentary_fixed and g:commentary_fixed_pos.

It doesn't look like @foodbag has made a pull request, but I hope you might consider adding it to your own plugin with proper attribution.

P.S. Sorry for the previous misfired issue in vim-pathogen (too much clicking, not enough reading).

jkulesza avatar Jun 05 '17 19:06 jkulesza

Original request concerned support for the formatting requirements of specific languages, while the fork in question is a global behavior override with motivations I can only guess.

tpope avatar Jun 05 '17 19:06 tpope

The fork I wrote is for the purpose of fixed format comments (specifically I'm using it for f77), but it's implementation is fairly crude. I only activate the new global settings for f77 source files in my .vimrc (and the original behavior is retained for all other file types). A cleaner implementation would be desirable, but I would need @tpope's guidance as to what would fit best.

On Jun 5, 2017, at 1:39 PM, Tim Pope [email protected] wrote:

Original request concerned support for the formatting requirements of specific languages, while the fork in question is a global behavior override with motivations I can only guess.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

nitej avatar Jun 05 '17 20:06 nitej

Original request concerned support for the formatting requirements of specific languages, while the fork in question is a global behavior override with motivations I can only guess.

My thought was that the fork might provide a mechanism to satisfy @hholst80's goal of specifying a Fortran fixed-format comment (and perhaps your COBOL comment scheme remark). My goal is also fixed-format Fortran and misc. input files that have a similar comment format. While a cleaner implementation is preferable, @foodbag's method of setting g:commentary_fixed and g:commentary_fixed_pos in .vimrc (or ftdetect or ???) would work for me.

Any time/effort you put toward including the ability for fixed-position comments would be appreciated!

jkulesza avatar Jun 06 '17 02:06 jkulesza

Start by making it a single buffer local variable.

tpope avatar Jun 06 '17 04:06 tpope