How to fix the Vim cursor in Source editing mode when formatting is disabled

I have Vim keybindings enabled, and have disabled Markdown formatting when in source editing mode, using the CSS provided in Disabled Markdown:

/* remove formatting and set font to single size monospace */
.markdown-source-view:not(.is-live-preview) * {
  background: unset !important;
  color: unset !important;
  font-size: 1rem !important;
  font-weight: unset !important;
  font-family: monospace !important;
  }
/* in case themes uses ::after div formatting for borders and so on */
.markdown-source-view:not(.is-live-preview) *::after {
  border: unset !important;
  }

The problem is that this causes the Vim normal-mode cursor to become invisible when editing in Source mode (this might relate to this vim in a canvas document issue).

An easy fix is to remove the !important from the “background” property. However I feel that there should be a way exempt the cursor from the CCS override, rather than weakening it globally.

Using the developer tools (ctrl-shift-i), I see that the cursor seems to be displayed by <div class="cm-cursorLayer cm-vimCursorLayer" ...., so I tried adding another negation selector:

.markdown-source-view:not(.is-live-preview):not(.cm-vimCursorLayer) * {

No dice. I also tried excluding these other selectors selectors, but to no avail:

  • cm-cursorLayer
  • cm-fat-cursor
  • cm-cursor-primary
  • cm-active
  • cm-layer
  • cm-editor

At this point I suspect that I either fundamentally misunderstand how CSS works, or that this is a flawed approach and I should be looking at the cm-blink2 animation (or something similar).

Any tips or insights would be greatly appreciated. Thanks!

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