When I narrow an org mode header into a subtree(using command org-narrow-to-subtree) in vanilla Emacs, the line number counts from 1 in the subtree, but when I create a subtree in Doom Emacs, the line number counts from the original line number(e.g. if the header is on the 8000th line in the original file, the header in the subtree still starts from 8000, instead of 1). How can I make it count from 1 in the subtree?
Put this in an appropriate place in your emacs configuration (not sure what file that is for doom):
(custom-set-variables '(display-line-numbers-widen nil))
I think you could use
setq-default instead if you like, but I hear there are some subtleties that make
custom-set-variables a better choice for customize-able variables -- it's OK to use
custom-set-variables in your ordinary emacs config however you like -- just don't edit by hand the special customize call that is commented with
;; custom-set-variables was added by Custom. unless you know what you're doing.
Alternatively, you can use
M-x customize-variable <RET> display-line-numbers-widen <RET>.