Skip to content

feature: #168

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

Closed
Kyren223 opened this issue Sep 17, 2024 · 8 comments
Closed

feature: #168

Kyren223 opened this issue Sep 17, 2024 · 8 comments
Labels
enhancement New feature or request

Comments

@Kyren223
Copy link

Is your feature request related to a problem? Please describe.

There is no way to configure how things are concealed

Describe the solution you'd like

Configuration options for the following functionality:

  • Whether to show/hide the thing under the cursor in normal mode
  • Whether to show/hide the entire file (except cursor or line) in insert mode

The desired goal for me is when going to a mode that isn't normal (insert/visual) I don't want the entire file to get back to normal just because I edit a TODO, so being able to decide to only show the raw text when the cursor is on the thing and not the entire file (like the current normal mode behavior), or even specifying a range like "show only 5 lines around the cursor (2 up, 2 down, 1 current).

Another thing that'd be cool, is in visual mode, only show raw text that is actively selected (or some amount of lines around selections) rather than the entire file.

Describe alternatives you've considered

N/A

Additional information

No response

@Kyren223 Kyren223 added the enhancement New feature or request label Sep 17, 2024
@MeanderingProgrammer
Copy link
Owner

The modes this plugin renders content in is configurable through the render_modes option. There's an example of that in the wiki here: https://github.com/MeanderingProgrammer/render-markdown.nvim/wiki#render-modes.

If you want it to render in insert and visual mode for instance, so they look the same as normal mode by default, you would do:

require('render-markdown').setup({
    render_modes = { 'n', 'v', 'i', 'c' },
})

You can expand the list of modes as much as you like to include all the modes you want to be rendered.

I also recently pushed a change which allows render_modes to be a boolean: 7493db6. So now if you want to have the buffer be rendered in all modes you can simply do:

require('render-markdown').setup({
    render_modes = true,
})

@MeanderingProgrammer
Copy link
Owner

Does the above take care of the feature request or were there specific other things you had in mind?

@Kyren223
Copy link
Author

Oh thanks I missed it.
For normal and insert mode it works fine but not for visual.
For normal/insert using the cursor is fine, but this isn't good for visual mode, it'd be better if it is based on what's visually selected instead.

MeanderingProgrammer added a commit that referenced this issue Sep 17, 2024
## Details

Request: #168

Rather than removing marks on current row only, for visual mode
specifically use the range of the selected text.

This allows users to see what's actually being selected rather that
still being overlayed by marks.

All other modes continue to behave the same as before.

Moves the logic for caclulating the hidden range out of `extmark` module
and into `ui` since that now seems like a better fit.
@MeanderingProgrammer
Copy link
Owner

Sure, should work after: 5ff191f

@Kyren223
Copy link
Author

Updated to that commit, seems to still be broken (I think that's because it uses inlay hints?)
image

@MeanderingProgrammer
Copy link
Owner

It does not use inlay hints, everything is an extmark.

How did you create this selection?

  • Did you put your cursor on the Some Header line then run something like 10j? This one should work.
  • Did you do some kind of vi motion?
  • Something else?

There are different types of visual modes and I may not have handled all of them.

@MeanderingProgrammer
Copy link
Owner

I've updated the logic to handle all the visual modes here: 354baf4.

Can you update and try again, should work regardless of what you do to select.

@Kyren223
Copy link
Author

Yes it works, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants