-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
Conversation
lua/spectre/ui.lua
Outdated
height = win_height + 2, | ||
col = 4, | ||
row = 4, | ||
border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
border = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" } | |
border = "rounded" |
lua/spectre/ui.lua
Outdated
api.nvim_buf_set_lines(bufnr, 0, -1, true, content) | ||
|
||
local help_win = vim.api.nvim_open_win(bufnr, true, { | ||
title = title, |
There was a problem hiding this comment.
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
title = title, | |
title = " " .. title .. " ", |
lua/spectre/ui.lua
Outdated
col = 4, | ||
row = 4, |
There was a problem hiding this comment.
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:
col = 4, | |
row = 4, | |
col = 0, | |
row = 1, |
lua/spectre/ui.lua
Outdated
width = win_width + 3, | ||
height = win_height + 2, |
There was a problem hiding this comment.
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
width = win_width + 3, | |
height = win_height + 2, | |
width = win_width, | |
height = win_height, |
lua/spectre/ui.lua
Outdated
api.nvim_buf_set_lines(bufnr, 0, -1, true, content) | ||
|
||
local help_win = vim.api.nvim_open_win(bufnr, true, { | ||
title = title, |
There was a problem hiding this comment.
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
title = title, | |
style = "minimal", | |
title = title, |
lua/spectre/ui.lua
Outdated
}) | ||
api.nvim_win_set_option(help_win, 'winblend', 0) | ||
api.nvim_win_set_option(help_win, 'number', false) |
There was a problem hiding this comment.
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"
api.nvim_win_set_option(help_win, 'number', false) |
lua/spectre/ui.lua
Outdated
border = true, | ||
borderchars ={ "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, | ||
|
||
local check = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unused variable
local check = false |
lua/spectre/ui.lua
Outdated
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, { |
There was a problem hiding this comment.
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
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', |
There was a problem hiding this comment.
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...
)
'CursorMovedI', | |
'CursorMoved', | |
'CursorMovedI', | |
'BufHidden', | |
'BufLeave', | |
'InsertEnter', | |
'WinScrolled', | |
'BufDelete', |
There was a problem hiding this comment.
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.
There was a problem hiding this 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"
@Subjective what about now? |
@EpsilonKu LGTM! |
No description provided.