Home Explore Blog CI



neovim

15th chunk of `runtime/doc/indent.txt`
c126e0ec58d2483f07df414be8138d83959703dda9abd7c60000000100000d48
		*ft-vhdl-indent*

Alignment of generic/port mapping statements are performed by default. This
causes the following alignment example: >

  ENTITY sync IS
  PORT (
         clk        : IN  STD_LOGIC;
         reset_n    : IN  STD_LOGIC;
         data_input : IN  STD_LOGIC;
         data_out   : OUT STD_LOGIC
       );
  END ENTITY sync;

To turn this off, add >

  let g:vhdl_indent_genportmap = 0

to the vimrc file, which causes the previous alignment example to change: >

  ENTITY sync IS
  PORT (
    clk        : IN  STD_LOGIC;
    reset_n    : IN  STD_LOGIC;
    data_input : IN  STD_LOGIC;
    data_out   : OUT STD_LOGIC
  );
  END ENTITY sync;


Alignment of right-hand side assignment "<=" statements are performed by
default. This causes the following alignment example: >

  sig_out <= (bus_a(1) AND
             (sig_b OR sig_c)) OR
             (bus_a(0) AND sig_d);

To turn this off, add >

  let g:vhdl_indent_rhsassign = 0

to the vimrc file, which causes the previous alignment example to change: >

  sig_out <= (bus_a(1) AND
    (sig_b OR sig_c)) OR
    (bus_a(0) AND sig_d);


Full-line comments (lines that begin with "--") are indented to be aligned with
the very previous line's comment, PROVIDED that a whitespace follows after
"--".

For example: >

  sig_a <= sig_b; -- start of a comment
                  -- continuation of the comment
                  -- more of the same comment

While in Insert mode, after typing "-- " (note the space " "), hitting CTRL-F
will align the current "-- " with the previous line's "--".

If the very previous line does not contain "--", THEN the full-line comment
will be aligned with the start of the next non-blank line that is NOT a
full-line comment.

Indenting the following code: >

  sig_c <= sig_d; -- comment 0
         -- comment 1
               -- comment 2
    --debug_code:
    --PROCESS(debug_in)
         --BEGIN
            --  FOR i IN 15 DOWNTO 0 LOOP
             --    debug_out(8*i+7 DOWNTO 8*i) <= debug_in(15-i);
            --  END LOOP;
     --END PROCESS debug_code;

      -- comment 3
  sig_e <= sig_f; -- comment 4
           -- comment 5

results in: >

  sig_c <= sig_d; -- comment 0
                  -- comment 1
                  -- comment 2
  --debug_code:
  --PROCESS(debug_in)
  --BEGIN
  --  FOR i IN 15 DOWNTO 0 LOOP
  --    debug_out(8*i+7 DOWNTO 8*i) <= debug_in(15-i);
  --  END LOOP;
  --END PROCESS debug_code;

  -- comment 3
  sig_e <= sig_f; -- comment 4
                  -- comment 5

Notice that "--debug_code:" does not align with "-- comment 2"
because there is no whitespace that follows after "--" in "--debug_code:".

Given the dynamic nature of indenting comments, indenting should be done TWICE.
On the first pass, code will be indented. On the second pass, full-line
comments will be indented according to the correctly indented code.


VIM							*ft-vim-indent*
							*g:vim_indent_cont*
For indenting Vim scripts there is one variable that specifies the amount of
indent for a continuation line, a line that starts with a backslash: >

	:let g:vim_indent_cont = shiftwidth() * 3

Three times shiftwidth is the default value.

YAML							*ft-yaml-indent*

By default, the yaml indent script does not try to detect multiline scalars.
If you want to enable this, set the following variable: >

  let g:yaml_indent_multiline_scalar = 1
<
 vim:tw=78:ts=8:noet:ft=help:norl:

Title: VHDL, Vim, and YAML Indentation Options
Summary
This section explains VHDL indentation options in Vim, specifically how to disable the default alignment of generic/port mapping statements and right-hand side assignment statements using `g:vhdl_indent_genportmap` and `g:vhdl_indent_rhsassign` variables in the vimrc file. It also describes how full-line comments are indented relative to the previous comment line or the next non-blank line. Additionally, it covers Vim script indentation using `g:vim_indent_cont` for continuation lines and YAML indentation, where multiline scalar detection can be enabled using `g:yaml_indent_multiline_scalar`.