Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

feat!(position): optimize max_len align & add fixed_col align #45

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

utkarshgupta137
Copy link

@utkarshgupta137 utkarshgupta137 commented Apr 23, 2023

I've changed the max_len_align/padding to a new key position so that the user can choose one of 3 options instead of having 2 bools. It should also simplify adding more alignment modes in the future (such as "right" from rust-tools.nvim).
I've also changed the code to use the virt_text_win_col, so that we don't have to calculate the padding for each line.

@utkarshgupta137 utkarshgupta137 changed the title feat!(position): add start_of_line aligning feat!(position): optimize max_len align & add fixed_col align Apr 23, 2023
@utkarshgupta137
Copy link
Author

@lvimuser Have you had a chance to look at this? I've been using this for over a month now. There is only minor 1 issue with this which is that if I enter text after my selected column, then the virtual text will hide the text that I've entered. Is there a setting I'm not seeing which will allow the virt_text to be hidden behind actual text instead? Fiddling with priority didn't help.

@lvimuser
Copy link
Owner

I haven't, no. You may look into the left_gravity option or perhaps avoid virt_text_win_col.

@manish-baghel
Copy link

manish-baghel commented Jun 27, 2023

@utkarshgupta137
virt_text_pos might be a better alternative to virt_text_win_col.

Having said that, you can avoid the issue by getting the current line length and setting the virt_text_win_col to

-- inside the loop
-- probably not the best way to get line length
line_len = string.len(vim.api.nvim.get_cur_line())
virt_text_win_col = math.max(opts.position.padding, line_len + 1)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants