update window height and width preset

neovim_0_5
ray-x 3 years ago
parent 95b45a6cf6
commit c5fe79d6df

@ -181,13 +181,16 @@ Nondefault configuration example:
```lua
require.'navigator'.setup({
debug = false, -- log output not implemented
debug = false, -- log output
code_action_icon = " ",
width = 0.75, -- number of cols for the floating window
height = 0.3, -- preview window size, 0.3 by default
width = 0.75, -- max width ratio (number of cols for the floating window) / (window width)
height = 0.3, -- max list window height, 0.3 by default
preview_height = 0.35, -- max height of preview windows
border = {"╭", "─", "╮", "│", "╯", "─", "╰", "│"}, -- border style, can be one of 'none', 'single', 'double',
-- 'shadow', or a list of chars which defines the border
on_attach = nil,
on_attach = function(client, bufnr)
-- your hook
end,
-- put a on_attach of your own here, e.g
-- function(client, bufnr)
-- -- the on_attach will be called at end of navigator on_attach
@ -205,7 +208,7 @@ require.'navigator'.setup({
diagnostic_head = '🐛',
diagnostic_head_severity_1 = "🈲",
-- refer to lua/navigator.lua for more icons setups
}
},
lsp = {
format_on_save = true, -- set to false to disasble lsp code format on save (if you are using prettier/efm/formater etc)
tsserver = {

@ -3,7 +3,7 @@ _NgConfigValues = {
debug = false, -- log output not implemented
width = 0.6, -- valeu of cols TODO allow float e.g. 0.6
preview_height = 0.35,
height = nil,
height = 0.35,
default_mapping = true,
on_attach = nil,
-- function(client, bufnr)
@ -46,9 +46,9 @@ _NgConfigValues = {
associated = "🤝",
namespace = "🚀",
type = "",
field = "🏈",
field = "🏈"
},
treesitter_defult = "🌲",
treesitter_defult = "🌲"
}
}

@ -50,7 +50,7 @@ function M._preview_location(opts) -- location, width, pos_x, pos_y
syntax = syntax,
width = opts.width,
height = display_range['end'].line - display_range.start.line + 1,
preview_height = opts.preview_height,
preview_height = opts.height or opts.preview_height,
pos_x = opts.offset_x,
pos_y = opts.offset_y,
range = opts.range,
@ -113,13 +113,16 @@ function M.new_list_view(opts)
local wwidth = api.nvim_get_option("columns")
local loc = "top_center"
local width = math.floor(wwidth * 0.75)
local mwidth = _NgConfigValues.width
local width = math.floor(wwidth * mwidth)
if config.width ~= nil and config.width > 0.3 and config.width < 0.99 then
width = math.floor(wwidth * config.width)
end
width = math.min(opts.width or 120, width)
opts.width = width
local wheight = config.height or math.floor(api.nvim_get_option("lines") * 0.8)
width = math.min(120, width)
local wheight = math.floor(1 + api.nvim_get_option("lines")
* (_NgConfigValues.height + _NgConfigValues.preview_height))
local pheight = math.floor(api.nvim_get_option("lines") * _NgConfigValues.preview_height)
local prompt = opts.prompt or false
if opts.rawdata then
data = items
@ -137,8 +140,7 @@ function M.new_list_view(opts)
prompt = true
end
local lheight = math.min(#data, math.floor(wheight / 2))
local pheight = math.min(wheight - lheight, math.floor(wheight / 2))
local lheight = math.min(#data, math.floor(wheight * _NgConfigValues.height))
local r, _ = top_center(lheight, width)

@ -96,7 +96,7 @@ local function set_mapping(user_opts)
local range_fmt = false
local doc_fmt = false
local ccls = false
log(vim.lsp.buf_get_clients(0))
-- log(vim.lsp.buf_get_clients(0))
for _, value in pairs(vim.lsp.buf_get_clients(0)) do
if value == nil or value.resolved_capabilities == nil then
return
@ -108,7 +108,7 @@ local function set_mapping(user_opts)
range_fmt = true
end
log("override ccls", value.config)
-- log("override ccls", value.config)
if value.config.name == "ccls" then
ccls = true

@ -39,7 +39,8 @@ local function ref_hdlr(err, api, locations, num, bufnr)
local ft = vim.api.nvim_buf_get_option(bufnr, "ft")
local wwidth = vim.api.nvim_get_option("columns")
width = math.min(width + 30, 120, math.floor(wwidth * 0.8))
local mwidth = _NgConfigValues.width
width = math.min(width + 30, 120, math.floor(wwidth * mwidth))
gui.new_list_view({
items = items,
ft = ft,

Loading…
Cancel
Save