So, I'm trying to set up a sort of bookmark/marker kind of workflow, and I came to notice I'm used to put characters such as #
and such for different meaning inside my own notes, etc.
Now, I already know how to do the first part (inserting text at the start of a/the current line):
.s/^/#
And I also already know how to make a mapping of it. Problem is, I want to be able to also remove the placed marker if it's already there, and place one on the current line if it's not.
I'm unsure on how this should look like in vimscript. I don't mind using an existing plugin for this, but would prefer not to if possible.
Any feedback/answer appreciated.
#
withgetline('.') ~= '^#'
. If it does, remove it with:s/^#//
, otherwise insert one with:s/^/#
. Does this help?