Alternately, here’s a replacement for the colorvimmode
function that changes Obsidian’s cursor color based on what Vim mode is set to.
function colorvimmode(mode) {
const vimStatusPromptMap = {
'normal': 'green',
'insert': 'orange',
'visual': 'yellow',
'visual block': 'lightyellow',
'replace': 'red',
}
const color = vimStatusPromptMap[mode];
if (color) {
document.body.style.setProperty('--cursorcolor', color);
} else {
document.body.style.setProperty('--cursorcolor', color);
}
}
You also need this CSS snippet.
body {
--cursorcolor: var(--text-accent);
}
.cm-line {
caret-color: var(--cursorcolor) !important;
}
.cm-cursor {
border-left-color: var(--cursorcolor) !important;
}
.cm-fat-cursor {
background-color: var(--cursorcolor) !important;
}