-
-
Notifications
You must be signed in to change notification settings - Fork 803
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
feat: layout relative to current cursor position #496
Comments
To make new layouts, check out https://github.com/nvim-telescope/telescope.nvim/blob/master/lua/telescope/pickers/layout_strategies.lua for how it is currently being done. To make the layout relative to the cursor position should be possible since we can access the current cursor state inside the strategy. I will let others comment on getting the cursor position. |
Thank you for answering @rockerBOO. I've ended up playing around with it a little bit more. I was able to get something that gets the current cursor position by using a combination of I'll be able to proceed with what I have right now since it works for all of the cases I have tested for myself. Once I'm happy with it, I'll create a PR ^_^ |
Why?
When using things like LSP related pickers, I don't usually want them to take all of the space on my screen, especially things like the
lsp_code_actions
picker would be a lot better to use if it was smaller and relative to my cursor's position.How would I see it implemented?
I actually already started trying to implement it. Here's the layout I had in mind:
With the top left being the cursor's position. The previewer would be optional, but I put it here because that's how the Visual Studio IDE displays it on code actions.
What knowledge I'm missing to make it work
As said above, I already have a branch that has the basic idea, my issue is with getting the current cursor position.
I've gone through the help and found a bunch of things like
nvim_win_get_position
,nvim_win_get_cursor
,getline
,wincol
,screencol
, etc.But nothing actually allows me to get the position of the cursor on screen without counting the folds, the fact that the buffer can be scrolled, splits, tabline, sign column, line number column, etc.
If someone knows what functions to get the position or knows what functions to use and calculate the cursor position, then I'd be able to do it myself.
Another thing that I would need to know is the size of the current neovim instance, so that if the coordinates are out of bound, I can position everything at the right place. I think these are given by the
lines
andcolumns
options from what I understand.The text was updated successfully, but these errors were encountered: