created 2003 · complexity basic · author rajesh · version 5.7
For all verilog users dealing with netlists, this an easier way to find out in which module you are really working in.add this map to your vimrc. Press
` to find out which module you are actually residing in.
map ` ma?module<CR>Wyiw'a:echo "module -->" @0<CR>
This map works only when you are within the module. Placing it on module/endmodule does not make any sense.
An improved version of this if you are using a searching for a particular net/wire and then u want to know in which module you are really in. Add this to your vimrc
map ` ma?module<CR>Wyiw'a/<Up><Up><CR>:echo "module -->" @0<CR>
If you are not searching for any particular net the above map will do.
It's not working for me. Vim seems to be kind of hanging then i press C-C to break it. BTW but if some signals are having <module> in the signal names? Won't work i think!
This will not work if you have module with names line module_AND...
Also wont work if module is in commnets or something, I guess better solution would be to exclusively search for module I think the following will avoid both of the problems.
:map <F6> ma?^\s*\<module\><CR>Wyiw'a:echo "module -->" @0<CR>
Here's a version which doesn't pollute your search history:
map ` :let old = @/<CR>ma?module<CR>Wyiw'a:call histdel('search',-1)<CR>:let @/ = old<CR>:echo "module -->" @0<CR>
I added a space after module to help when module is part of a name. Now I'd like to expand it or add another mapping to traverse up hierarchy.