0

I have the following lines in my .vimrc.

colorscheme elflord

set incsearch

set guifont=Monospace\ 13 
" <Ctrl-l> redraws the screen and removes any search highlighting.
nnoremap <silent> <C-l> :nohl<CR><C-l>

runtime macros/matchit.vim
runtime ftplugin/system_verilog.vim
syntax on
filetype on 
filetype indent on 
filetype plugin on
set nocompatible
set lines=40 columns=150
set nu

But it is not able to match the pairs inside vim automatically. However if I do the following command inside the vim, it is able to detect the pairs with %.

runtime ftplugin/system_verilog.vim

Can you please help me to fix it to be done automatically whenever I open gvim?

1

As far as I can tell from your question, you're attempting to use the matchit plugin in a Systemverilog file and it's not working how you'd expect.

If you edit your question to be more specific about exactly what you're doing and what you're expecting to happen I can be more specific in my advice. Still, the following part of your vimrc stands out:

The runtime lines in your vimrc aren't the recommended way of enabling plugins (and don't do what I'm guessing you think they do).

How to enable matchit

If you're running Vim 8, then you enable matchit by adding the following line to your vimrc:

packadd! matchit

If you're still on Vim 7, then instead of editing your vimrc, you install matchit by running the following commands from an existing Vim instance:

:!mkdir ~/.vim
:!mkdir ~/.vim/plugin
:!cp $VIMRUNTIME/macros/matchit.vim ~/.vim/plugin

See :help matchit for more details.

Systemverilog filetype

In order to use Vim's standard configuration for Systemverilog you just need to enable Vim's syntax and/or filetype plugins, and then ensure that the 'filetype' is set to systemverilog when editing a Systemverilog file.

You can do this manually by running the command :set ft=systemverilog from a Systemverilog file, but since you've turned on filetype detection, Vim will automatically set the 'filetype' to systemverilog and load its filetype/syntax/indent files when you open any file with an .sv or .svh extension.

See :help filetype for more details, and :help new-filetype if you need Vim to detect Systemverilog files that don't have an .sv or .svh extension.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.