I would like to recenter current line after jumping by using helm-semantic-or-imenu or helm-org-in-buffer-headings, i.e., just like helm-swoop. Is it possible?
I don't use helm
, but I do this for isearch
. Figure out which function actually jumps to a line (maybe the called function, e.g. helm-semantic-or-imenu
, maybe some internal helper function as is the case for isearch
), then add the following advice to it.
(defun recenter-no-redraw (&optional arg)
"Like `recenter', but no redrawing."
(interactive "P")
(let ((recenter-redisplay nil))
(recenter arg)))
(advice-add 'isearch-search
:after
(lambda (&rest args)
"Recenter"
(when isearch-success
(recenter-no-redraw))))
I can't remember why I defined a non-redrawing version of recenter
(I've had it like that for years). It should work with plain recenter
also.