Improve consistency with Vim: session-level persistence for :hlsearch setting

Use case or problem

When searching with native Vim, the highlighting of search matches is determined by the state of the internal variable hlsearch. This variable (on by default) persists until vim is closed, unless modified directly.

However, Obsidian’s vim emulation behaves differently, in that changes to the hlsearch setting only stick around as long as the current search query. Once you search for something new, the variable seems to reset, requiring someone who doesn’t want highlights to run :nohl everytime they do a new search.

Proposed solution

Optimal: Match the behavior of native Vim by persisting changes to Vim “variables” like hlsearch.

Suboptimal: Add an Obsidian editor setting for whether to highlight searches

Current workaround


A costly workaround since we’re trading the persistence of the highlight setting for the persistence of the search query

Related feature requests

No related feature requests I know of. Previously there was a bug that requested support for the :nohl[search] command.

if this happens here, open a feature request to codemirror.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.