hrsh7th / nvim-cmp

A completion plugin for neovim coded in Lua.
MIT License
7.75k stars 385 forks source link

Customize docs location #771

Open zbirenbaum opened 2 years ago

zbirenbaum commented 2 years ago

Something that I have really wanted for a while, but found out is easy to implement now with the new views changes, is the ability to customize the docs location to place it into the top right corner.

I managed to get mostly what I was looking for (although the line draw to fill max width messed things up when I tried to enforce a specific size cap with line wraps, but that should be fairly easily fixed...) after about 10 minutes of playing around in docs_view.lua

  self.window:set_style({
    relative = 'editor',
    style = 'minimal',
    width = width,
    height = height,
    row = vim.opt.tabline:get() == "" and 0 or 1,
    col = vim.api.nvim_win_get_width(0)-width-1,
    border = documentation.border,
    zindex = documentation.zindex or 50,
  })

It would be pretty easy to add in the ability to override these with something like documentation.row or row, etc... If anyone else thinks this would be a good idea I'd be happy to PR it in the next few days.

DeadlySquad13 commented 2 years ago

Seems like a cool idea! Hope to get more customisation for windows in general!

denstiny commented 2 years ago

I like

OrlandoMatteo commented 1 year ago

I really like this since my doc window is always too small

jonfriesen commented 1 year ago

This is a really cool idea. +1 to making this happen 🚀

dfendr commented 1 year ago

5thing on this one, would be great to have :-)

wvffle commented 1 month ago

That would help in cases when the documentation window is too narrow like in #1374

image