Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to set up my favorite editor in ModelSim. The default behavior is that ModelSim uses its own internal editor, which I don't like.

I've Googled and I've searched the ModelSim User Manual. I figured out that:

  • If you set the EDITOR environment variable, the TCL edit command will use your editor.
  • You can configure the project to execute a custom command when you double-click a file (I've set this custom command to edit %f which opens the file with my editor.

Still, when I double-click a compile error, the default (built-in) editor is opened. This is not what I want.

Is there a global setting so that the internal editor is not used, but my own editor is?

share|improve this question
    
Windows or Linux? – Brian Carlton Sep 8 '11 at 17:20
    
@Brian I did this on Linux. – Philippe Sep 9 '11 at 7:21
2  
Have you asked Mentor? – Martin Thompson May 28 '12 at 14:22
1  
@AndrewKohlsmith: Lots of people use ModelSim for VHDL and Verilog work. – Brian Carlton Oct 16 '12 at 21:35
1  
@AndrewKohlsmith: "It has nothing to do with electronics or engineering." - That would be true if ModelSim were accounting software or something that is actually unrelated to electronics or engineering. – Chris Laplante Dec 15 '12 at 17:28

Put this in a tcl file somewhere:

proc external_editor {filename linenumber} {
 exec "youreditor" $linenumber $filename &   # edit as required
}
set PrefSource(altEditor) external_editor
share|improve this answer
    
Didn't work. Do you have any documentation on this? – Philippe Jun 18 '12 at 11:58
    
@Philippe - What did you try? What was the error message? – Trygve Laugstøl Oct 22 '12 at 0:39
    
I tried executing the Tcl command that Anon gave. No error messages, but no different default editor. It would be great so see some documentation on this "PrefSource" thing that Anon uses. – Philippe Oct 22 '12 at 6:58

For those using the external_editor tcl script and get in trouble trying to restore functionality to ModelSim:

Open up regedit, go to:

Computer\HKEY_CURRENT_USER\Software\Model Technology Incorporated\ModelSim

There you will find the PrefSource key. Delete the altEditor value, and that will fix your ModelSim issues.

share|improve this answer

Anon's answer got me where I was going, but I thought I'd add a specific example. I use Arch linux and GVim.

This line only needs to be ran once. I ran it directly in Modelsim's terminal.

set PrefSource(altEditor) external_editor

This is the actual function I used

proc external_editor {filename linenumber} {
    exec gvim +$linenumber $filename &
}

However, the external_editor proc still needs to be added to Modelsim. As a one off, you can actually just drop the function into the terminal, but I created a modelsim.tcl file within my home directory.

In that I linked to the external_editor.tcl file elsewhere.

source /opt/altera/15.1/modelsim_ase/tcl/custom_scripts/external_editor.tcl

I suspect there is any number of ways to permanently load the external editor proc, but this is what I did.

As a side note, I would have placed this as a comment under Anon's answer, but I don't have enough reputation as I just created my account.

share|improve this answer

Change the default editor for .v or .vhd files in Windows. Choose "Open As..." and the check the checkbox to make the selected app default.

share|improve this answer
2  
How is this going to make Modelsim use another editor? – Philippe Sep 13 '15 at 7:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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