vhda / verilog_systemverilog.vim

Verilog/SystemVerilog Syntax and Omni-completion
366 stars 89 forks source link

Syntax folding doesn't work #214

Closed aggressivemonk closed 2 years ago

aggressivemonk commented 2 years ago

syntax folding doesn't work for my verilog file. It can't find where to fold, when I run set foldmethod=syntax (syntax folding does work for my C file.)

` module ripple_carry_counter(q, clk, reset);

output [3:0] q;

input clk, reset;

T_FF tff0(q[0], clk, reset);
T_FF tff1(q[1], q[0], reset);
T_FF tff2(q[2], q[1], reset);
T_FF tff3(q[3], q[2], reset);

endmodule

module T_FF(q, clk, reset);

output q;
input clk, reset;
wire d;

D_FF dff0(q, d, clk, reset);
not n1(d,q);

endmodule `

Below is my .vimrc file ` " Turn synatx highlighting on syntax on

" Add numbers and relative number to each line on the left-hand side. set relativenumber number

" Disable compatibility with vi which can cause unexpected issues. set nocompatible

" Enable type file detection. Vim will be able to try to detect the type of file in use. filetype on

" Enable plugins and load plugin for the detected file type. filetype plugin on

" Load an indent file for the detected file type. filetype indent on

" Set shift width to 4 spaces. set shiftwidth=4

" Set tab width to 4 columns. set tabstop=4

" Use space characters instead of tabs. set expandtab

" Do not save backup files. set nobackup

" Do not let cursor scroll below or above N number of lines when scrolling. set scrolloff=10

" While searching though a file incrementally highlight matching characters as you type. set incsearch

" Show partial command you type in the last line of the screen. set showcmd

" Show the mode you are on the last line. set showmode

" Show matching words during a search. set showmatch

" Use highlighting when doing a search. set hlsearch

" Set the commands to save in history default number is 20. set history=1000

" Enable auto completion menu after pressing TAB. set wildmenu

" Make wildmenu behave like similar to Bash completion. set wildmode=list:longest

" There are certain files that we would never want to edit with Vim. " Wildmenu will ignore files with these extensions. set wildignore=.docx,.jpg,.png,.gif,.pdf,.pyc,.exe,.flv,.img,.xlsx

" This allows the user to usee newtrw, Vim's built in file-explorer set nocp filetype plugin on

" setup grepprg so that the :grep Vim command uses ripgrep set grepprg=rg\ --vimgrep\ --smart-case\ --follow

" Move between buffers without saving it. Think before you use q! changes may " not be saved yet. set hidden set hidden

" This option: Typing the strings in lowercase allows case insensitive search, " while typing at least one uppercase letter switch to case sensitive search. set ignorecase smartcase

" PLUGINS ---------------------------------------------------------------- {{{

" Plugin code goes here. call plug#begin('~/.vim/plugged')

Plug 'dense-analysis/ale'

Plug 'vim-scripts/delimitMate.vim'

Plug 'preservim/nerdtree'

Plug 'junegunn/fzf.vim' Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }

Plug 'vhda/verilog_systemverilog.vim'

call plug#end()

" }}}

" MAPPINGS --------------------------------------------------------------- {{{

" Mappings code goes here. " Set the backslash as the leader key. let mapleader = '\'

" Press \ to jump back to the last cursor position. nnoremap \ ``

" Type jj to exit insert mode quickly. inoremap jj

" Press the space bar to type the : character in command mode. nnoremap :

" Center the cursor vertically when moving to the next word during a search. nnoremap n nzz nnoremap N Nzz

" Yank from cursor to the end of line. nnoremap Y y$

" You can split the window in Vim by typing :split or :vsplit. " Navigate the split view easier by pressing CTRL+j, CTRL+k, CTRL+h, or CTRL+l. nnoremap j nnoremap k nnoremap h nnoremap l

" Resize split windows using arrow keys by pressing: " CTRL+UP, CTRL+DOWN, CTRL+LEFT, or CTRL+RIGHT. noremap + noremap - noremap > noremap <

" NERDTree specific mappings. " Map the F3 key to toggle NERDTree open and close. nnoremap :NERDTreeToggle

" Have nerdtree ignore certain files and directories. let NERDTreeIgnore=['.git$', '.jpg$', '.mp4$', '.ogg$', '.iso$', '.pdf$', '.pyc$', '.odt$', '.png$', '.gif$', '.db$']

" Below is all keyboard mapping for fzf "To search inside files, you can use the :Rg command. nnoremap f :Rg

" To finnd file much easier nnoremap ff :Files

"More fzf map nnoremap b :Buffers nnoremap / :BLines nnoremap ' :Marks nnoremap g :Commits nnoremap H :Helptags nnoremap hh :History nnoremap h: :History: nnoremap h/ :History/

" Disable highlight by typing nnoremap :noh

" Create undo break point when deleting chunk of words inoremap u inoremap u

" Make auto completion from all included file easier inoremap

" }}}

" VIMSCRIPT -------------------------------------------------------------- {{{

" More Vimscripts code goes here. " Enable the marker method of folding. augroup filetype_vim autocmd! autocmd FileType vim setlocal foldmethod=marker augroup END

" If the current file type is HTML, set indentation to 2 spaces. autocmd Filetype html setlocal tabstop=2 shiftwidth=2 expandtab

" If Vim version is equal to or greater than 7.3 enable undofile. " This allows you to undo changes to a file even after saving it. if version >= 703 set undodir=~/.vim/backup set undofile set undoreload=10000 endif " }}}

" STATUS LINE ------------------------------------------------------------ {{{

" Status bar code goes here.

" Clear status line when vimrc is reloaded. set statusline=

" Status line left side. set statusline+=\ %F\ %M\ %Y\ %R

" Use a divider to separate the left side from the right side. set statusline+=%=

" Status line right side. set statusline+=\ ascii:\ %b\ hex:\ 0x%B\ row:\ %l\ col:\ %c\ percent:\ %p%%

" Show the status on the second to last line. set laststatus=2

" }}} `

Do I have some wrong setup in the .vimrc file that cause syntax folding doesn't work?

vhda commented 2 years ago

Going to submit a documentation (README.md) update that I had here laying around since May... Hopefully it will help you resolve the issue.