1

initial begin
if () begin
a=b;
c=d;
end
else begin
c=d;
c=a;
end
end

I have already tried, gg=G or selecting code and = is not working. Could you please help me here. code is unreadable.

Akheel
  • 23
  • 4

1 Answers1

0

You can set the filetype to verilog by :set filetype=verilog. Or you can save the file as tmp.v and reopen it.

Below is from $VIMRUNTIME/filetype.vim which defines the relationship between filetype and file extension.

" Vera
au BufNewFile,BufRead *.vr,*.vri,*.vrh      setf vera

" Verilog HDL
au BufNewFile,BufRead *.v           setf verilog

" Verilog-AMS HDL
au BufNewFile,BufRead *.va,*.vams       setf verilogams

" SystemVerilog
au BufNewFile,BufRead *.sv,*.svh        setf systemverilog

" VHDL
au BufNewFile,BufRead *.hdl,*.vhd,*.vhdl,*.vbe,*.vst,*.vho  setf vhdl

leaf
  • 1,624
  • 11
  • 16
  • It might be useful to mention that all that checking and setting is done automatically when you have, at minimum, `syntax on` or `filetype on` in your `vimrc`. – romainl Jul 13 '21 at 10:37
  • I have did the changes mentioned above its not helping. or I missed anything not sure. – Akheel Jul 13 '21 at 18:02
  • After `set filetype=verilog`, did the file highlighting look different then? Which vim version are you using? – leaf Jul 14 '21 at 01:51
  • After **set filetype==verilog**, code highlighting is not changing. I am using below vim version. **VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Mar 8 2017 11:07:09)** **Included patches: 1-314** – Akheel Jul 14 '21 at 05:56
  • **set filetype=verilog**, please ignore my above syntax error – Akheel Jul 14 '21 at 06:03
  • You can add `filetype plugin indent on` and `syntax enable` to your `vimrc` and see if it works. – leaf Jul 14 '21 at 09:00