Skip to content
Cayetano Santos edited this page Jul 5, 2019 · 22 revisions

Table of Contents

Headings

Following the status of the vhdl-tools-use-outshine flag (off by default), when the mode is enabled, VHDL-tools will activate outshine-mode, setting locally vhdl-tools-outline-regexp as the regexp used to locate headings.

This enables using this kind of headings

-- * Header Level 1

  -- ** Header Level 2

  MyInstance : MyComponent
  port map ( ...

to delimit code blocks.

In order to outshine to deal correctly with indented headings, it is necessary to comment out line 989, and uncomment line 991 in outshine.el. This may be done instead with help of this piece of advice

(defadvice outshine-calc-outline-level (around titi activate)
  (flet ((outshine-calc-outline-regexp () outline-regexp))
    ad-do-it))

Then, call outshine-speed-command-help to get an overview over the available functionality and the keybindings.

Setting vhdl-tools-manage-folding (off by default) to true will allow auto folding upon jumping.

Finally, to browse all headings use imenu as shown in next section.

Custom Imenu

The following keybinds are made available to browse current buffer contents

C-x c i m   - standard imenu
C-x c i i   - instances
C-x c i c   - components
C-x c i p   - processes
C-x c i h   - headings (with a prefix argument use ido instead)
C-x c i a   - all items

Custom SmartScan

One may use the great smart scan library customising its behaviour like follows.

First, advice the two main provided defuns

(defun smartscan-symbol-go-forward-advice-after ()
  (let ((titi (intern (format "smartscan-next-%s"
                              (car (split-string
                                    (symbol-name major-mode) "-mode"))))))
    (when (fboundp titi)
      (funcall titi))))
(advice-add 'smartscan-symbol-go-forward :after #'smartscan-symbol-go-forward-advice-after)
(defun smartscan-symbol-go-backward-advice-after ()
  (let ((titi (intern (format "smartscan-prev-%s"
                              (car (split-string
                                    (symbol-name major-mode) "-mode"))))))
    (when (fboundp titi)
      (funcall titi))))
(advice-add 'smartscan-symbol-go-backward :after #'smartscan-symbol-go-backward-advice-after)

This approach gives a chance to customize its behaviour following the current major mode. Here for example, concerning vhdl-tools mode one might use

(defun smartscan-prev-vhdl-tools ()
  (when vhdl-tools-use-outshine
    (forward-char 1)
    (vhdl-tools--fold)
    (recenter-top-bottom vhdl-tools-recenter-nb-lines)))

(defun smartscan-next-vhdl-tools ()
  (when vhdl-tools-use-outshine
    (backward-char 1)
    (vhdl-tools--fold)
    (recenter-top-bottom vhdl-tools-recenter-nb-lines)))

to unfold headings when using outshine.

Jumping around

The following keybinds are available

C-c M-D - jumps to the definition of symbol at point

C-c M-w - store a link
C-c M-y - paste a link
C-c M-j - follows the link at point

C-c M-. - jumps into the instance at point and move point to current signal

C-c M-a - moves point to first appearance of symbol at point

C-c M-u - jumps to upper hierarchy level

Cursor will jump to the target if there is one, searching packages too. The ring mark is push after jumping, so to get back, press C-c C-p or M-, (default binds under ggtags ) if corresponding definition has been found. Works better for files with correct syntax: think vhdl-beautify-buffer before using VHDL-tools.

Misc

C-c M-b - beautify current block (module, etc.)
Clone this wiki locally