verilog_systemverilog.vim icon indicating copy to clipboard operation
verilog_systemverilog.vim copied to clipboard

Can I get this indent? if yes what settings do I need to use...

Open vineyg opened this issue 3 years ago • 20 comments

What I want is:

  assign abc = def
             & ghi
             & ( jkl
               | mno)
             & pqr;

what I am getting by default is (set shiftwidth=2):

  assign abc = def
  & ghi
  & ( jkl
    | mno)
               & pqr;

vineyg avatar Feb 14 '22 23:02 vineyg

Hi @vineyg,

While not exactly as in your example, by default the script should indent as following:

 assign abc = def
              & ghi
              & ( jkl
                | mno)
              & pqr;

Please confirm that you have set 'autoindent' Vim setting, which is required for automatic indentation to work.

Cheers, Vitor

vhda avatar Feb 26 '22 17:02 vhda

I did but still doesn't work the way you are describing set autoindent in .vimrc

vineyg avatar Feb 28 '22 22:02 vineyg

I am running zsh shell not bash, does it have to do anything with that

vineyg avatar Feb 28 '22 23:02 vineyg

What does it show when you run :set filetype?

vhda avatar Mar 01 '22 11:03 vhda

verilog_systemverilog

vineyg avatar Mar 01 '22 18:03 vineyg

If I use operation end of the line it works fine:

  assign abc = def &
               ghi &
               ( jkl |
                 mno) &
               pqr;

but I would like to use the operator at the beginning...

vineyg avatar Mar 01 '22 18:03 vineyg

Don't understand why you're getting different results than me. Let's try the following:

:let b:verilog_verbose=1
:messages clear

Then select those 5 lines and press =. Finally, copy&paste the contents of the window after you run:

:messages

vhda avatar Mar 11 '22 00:03 vhda

When I wrote code it shows as:

  assign abc = def
  & ghi
  & ( jkl
    | mno)
               & pqr;

When I select 5 lines and press =, it gets updated to

  assign abc = def
               & ghi
               & ( jkl
                 | mno)
               & pqr;

Following are the messages:

Found possible end of instance on line 5 with level 2
GetContextIndent:4:     output  out
GetContextIndent:3:     input   in,
GetContextIndent:2:   (
GetContextIndent:1: module test
Inside a module.
GetContextIndent:7:   assign abc = def
Increasing indent for an open statement.
GetContextIndent:8:                & ghi
Increasing indent for an open statement.
GetContextIndent:7:   assign abc = def
GetContextIndent:9:                & ( jkl
Increasing indent for an open statement.
Inside a '()' block.
GetContextIndent:10:                  | mno)
Increasing indent for an open statement.
GetContextIndent:9:                & ( jkl
GetContextIndent:8:                & ghi
GetContextIndent:7:   assign abc = def
5 lines indented

vineyg avatar Mar 11 '22 20:03 vineyg

Branch indent/indent_assign_on_symbol was created to add a new option to enable the behavior you expected. Please test it and report back.

vhda avatar Mar 21 '22 22:03 vhda

this is what I get when I type same code:

  assign abc = def
  & ghi
  $ ( jkl
    | mno)
               & pqr;

and when I select text and press = it changes to

  assign abc = def
               & ghi
  $ ( jkl
    | mno)
               & pqr;

vineyg avatar Mar 22 '22 06:03 vineyg

What does this show?

:set indentexpr?

Also, have you tried disabling all addons except this one?

vhda avatar Mar 23 '22 22:03 vhda

What addons are you referring to?

vineyg avatar Mar 24 '22 05:03 vineyg

I am unable to replicate your behavior, so I'm suspecting it's either a difference in vim's settings or a plugin that's modifying the indent behavior. For the first possibility I am trying to confirm that your indentexpr setting is correct. For the second the only way is to remove all plugins, except this one.

vhda avatar Mar 24 '22 09:03 vhda

:set indentexpr?

shows

indentexpr=GetVerilogSystemVerilogIndent()

and I don't think I am using any other plugin...

vineyg avatar Mar 29 '22 07:03 vineyg

Hi @vineyg, Completely forgot about this issue, sorry. Do you have any updates?

vhda avatar Sep 11 '22 20:09 vhda

Still same issue as mentioned above

vineyg avatar Sep 11 '22 21:09 vineyg

On the third line you have a dollar ($) instead of an ampersand (&).

vhda avatar Sep 12 '22 00:09 vhda

That might be a typo but irrespective the behavior remains same. When you use this extension, what output you get?

On Sun, Sep 11, 2022 at 5:36 PM Vitor Antunes @.***> wrote:

On the third line you have a dollar ($) instead of an ampersand (&).

— Reply to this email directly, view it on GitHub https://github.com/vhda/verilog_systemverilog.vim/issues/209#issuecomment-1243084024, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARUWD2M2SFDSC4FPGHKS2WTV5Z3HXANCNFSM5OM4SGZQ . You are receiving this because you were mentioned.Message ID: @.***>

vineyg avatar Sep 12 '22 04:09 vineyg

I get this by default:

assign abc = def
             & ghi
             & ( jkl
               | mno)
             & pqr;

And with g:verilog_indent_assign_on_symbol=1:

assign abc = def
           & ghi
           & ( jkl
             | mno)
           & pqr;

vhda avatar Sep 12 '22 09:09 vhda

Have you confirmed these results?

vhda avatar Sep 17 '22 23:09 vhda

@vhda I tested and confirmed your results. I see the same behavior as you.

pat-lall avatar Nov 19 '22 23:11 pat-lall

Thanks @pat-lall

vhda avatar Nov 20 '22 00:11 vhda