Skip to content
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

Migrate from plenary to nvim_win_open #158

Merged
merged 2 commits into from
Aug 19, 2023
Merged

Conversation

EpsilonKu
Copy link
Member

No description provided.

height = win_height + 2,
col = 4,
row = 4,
border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
border = { "", "", "", "", "", "", "", "" }
border = "rounded"

api.nvim_buf_set_lines(bufnr, 0, -1, true, content)

local help_win = vim.api.nvim_open_win(bufnr, true, {
title = title,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imo it looks a lot better with padding

Suggested change
title = title,
title = " " .. title .. " ",

Comment on lines 162 to 163
col = 4,
row = 4,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This positioning is more consistent with lsp hover:

Suggested change
col = 4,
row = 4,
col = 0,
row = 1,

Comment on lines 160 to 161
width = win_width + 3,
height = win_height + 2,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opinionated, but I don't think there should be additional right/bottom padding

Suggested change
width = win_width + 3,
height = win_height + 2,
width = win_width,
height = win_height,

api.nvim_buf_set_lines(bufnr, 0, -1, true, content)

local help_win = vim.api.nvim_open_win(bufnr, true, {
title = title,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This disables line number and relative line number, among other options

Suggested change
title = title,
style = "minimal",
title = title,

})
api.nvim_win_set_option(help_win, 'winblend', 0)
api.nvim_win_set_option(help_win, 'number', false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unecessary when setting style = "minimal"

Suggested change
api.nvim_win_set_option(help_win, 'number', false)

border = true,
borderchars ={ "─", "│", "─", "│", "╭", "╮", "╯", "╰" },

local check = false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused variable

Suggested change
local check = false

api.nvim_buf_set_option(bufnr, "bufhidden", "wipe")
api.nvim_buf_set_lines(bufnr, 0, -1, true, content)

local help_win = vim.api.nvim_open_win(bufnr, true, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should automatically enter the help window, imo it should be similar to lsp hover where the window is first displayed, then hitting the keymap again enters it

Suggested change
local help_win = vim.api.nvim_open_win(bufnr, true, {
local help_win = vim.api.nvim_open_win(bufnr, false, {

api.nvim_create_autocmd({
'CursorMoved',
'CursorMovedI',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be added back to close the window if we disable automatically entering the help window (vim.api.nvim_open_win(bufnr, false...)

Suggested change
'CursorMovedI',
'CursorMoved',
'CursorMovedI',
'BufHidden',
'BufLeave',
'InsertEnter',
'WinScrolled',
'BufDelete',

Copy link
Member Author

@EpsilonKu EpsilonKu Aug 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't work if it focus on window. I will add it back so it won't focus on it.

Copy link
Contributor

@Subjective Subjective left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also we should probably rename "Mapping" to "Mappings"

@EpsilonKu
Copy link
Member Author

@Subjective what about now?

@Subjective
Copy link
Contributor

@EpsilonKu LGTM!

@EpsilonKu EpsilonKu merged commit eb17a85 into nvim-pack:master Aug 19, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants