-
Notifications
You must be signed in to change notification settings - Fork 49
feature: only "unconceal" at the cursorline #204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
So there's 2 kinds of concealing happening. The one you're describing that works is via treesitter highlights, where The second is all of the custom decorations added by this plugin which uses The setting you're looking for that controls this behavior is You can set this to a list of specific modes, the default value is: require('render-markdown').setup({
render_modes = { 'n', 'c' },
}) So to add insert mode to the modes we render marks for you would do: require('render-markdown').setup({
render_modes = { 'n', 'c', 'i' },
}) Or if you want rendering to happen in all modes you can simply set it to true: require('render-markdown').setup({
render_modes = true,
}) |
For your bonus one, the implementation as is removes everything on the cursor line, the goal is to see the actual text. There is an exception for spacing elements to avoid overly jumpy behavior, but in general the goal was to let you interact with what's actually there. I can try out an implementation that would make what stays and what goes on the cursor line more configurable, LMK if there are any other elements, in addition to link icons, that should not be hidden away. |
Great! Thanks
Awesome! A similar thing happens with the icon and language in code blocks as well as in callouts ; I believe these elements should not be hidden away. |
|
## Details Request: #204 Previously the decoration elements that are hidden on the cursor line was not something the user had direct control over. The default behavior was to never hide virtual lines, spacing, signs or code backgrounds. All other decorations on the line would always be hidden if the user kept anti conceal enabled. For the time being virtual lines and spacing remain permanently enabled. However signs, code backgrounds and most other elements that by default would be hidden are entirely within the users control. This is all managed through the new `anti_conceal.ignore` property. This table is a mapping from element name to a boolean. A value of `true` for an element means it will not be concealed when the cursor enters the line. A value of `false` behaves the same as no value being set and will be hidden. A table is used rather than a list so that when users modify values the defaults remain the same as they were unless explicitely changed. Signs and code backgrounds set their values to `true` to remain ignored by default as before, however now users have the ability to change this behavior if they would like to hide signs and backgrounds. Additionally most other decorations that remain concealable by default like before can now be ignored if the user sets their value to true. A complete list of possible values is provided in the default configuration in the README.
I've made most decorations configurable in terms of what gets concealed on cursor column and what does not here: fb6b3d1. This is managed through the require('render-markdown').setup({
anti_conceal = {
ignore = {
link = true,
code_language = true,
callout = true,
quote = true,
},
},
}) Feel free to play around and mix and match these as you like. The complete list of decorations you can control is:
Hopefully the things they control is intuitive enough. |
This is great! Thanks for the quick implementation. One minor nuisance: it possible to hide those element in normal mode but not in insert mode (or more generally respect the conceal settings)?. Looking at the following gif now you can see for instance than in the code block the Since we are at it, and you've been incredibly generous and patient, I'm aware of neovim/neovim#9496 but I was wondering whether something could be made from your side to avoid this thing (with links mostly) where the conceal "extends" an extra virtual line when a window is split (as in the image below): |
## Details Request: #204 Updates the recently added `anti_conceal.ignore` settings to allow values to be a string list of modes in addition to just booleans. This behaves similarly to the top level `render_modes` setting but at a much more granular, component level. It is also a little confusing parsing all the negatives happening, anti conceal & ignore, what does this mean. When a list of modes is specified these are the modes where the decorations will stick around, i.e. not be hidden when your cursor enters the line. This is similar to neovim's concealcursor behavior.
Yeah this was my thinking when I asked:
I updated the values in You can now specify a list of modes where decorations will remain when the cursor enters. So rather than specifying to hide them in insert mode, you would specify continue showing them in say normal mode with: require('render-markdown').setup({
anti_conceal = {
ignore = {
code_language = { 'n' },
},
},
}) You can read this as the anti conceal behavior will ignore the code language in normal mode.
I wish :( This is an issue I've gotten a few times and is also something I would love to get working but there does not seem to be a way around it: #82, there's some links from this issue that go into more details about it, been an open issue for nearly a decade and realistically I don't think it will be fixed, kinda one of those things. Lately I've taken to disabling line wrapping in If you have a concrete suggestion or something to try out I'm more than willing to take a look, but this would be an issue without my plugin if you just set the |
Thanks! Works perfectly.
I suspected that too. Thanks anyway (feel free to close this issue, and once again thanks for the superb responses) |
Is your feature request related to a problem? Please describe.
Consider the folllowing minimal
init.lua
file:Now, as in the GIF, open nvim and edit the following
bar.md
file:You will see that if you press
i
in order to get into insert mode every text in every heading is "unconceal`.On the other hand if I disable the plugin and just use some treesitter queries (as per https://github.com/petobens/dotfiles/blob/master/nvim/queries/markdown/highlights.scm) the ability to unconceal only at the cursor seems to work just fine (i.e only the
Heading 3
line is unconcealed whereasHeading 1
andHeading 2
remain properly concealed).Describe the solution you'd like
See above
Describe alternatives you've considered
See above
Additional information
No response
The text was updated successfully, but these errors were encountered: