You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
2.1 KiB
71 lines
2.1 KiB
2 years ago
|
-- vim.ui.input({ prompt = 'Enter value for shiftwidth: ' }, function(input)
|
||
|
-- vim.o.shiftwidth = tonumber(input)
|
||
|
-- end)
|
||
|
-- vim.ui.select({ 'tabs', 'spaces' }, {
|
||
|
-- prompt = 'Select tabs or spaces:',
|
||
|
-- format_item = function(item)
|
||
|
-- return "I'd like to choose " .. item
|
||
|
-- end,
|
||
|
-- }, function(choice)
|
||
|
-- if choice == 'spaces' then
|
||
|
-- vim.o.expandtab = true
|
||
|
-- else
|
||
|
-- vim.o.expandtab = false
|
||
|
-- end
|
||
|
-- end)
|
||
|
-- function NavigationFloatingWin()
|
||
|
-- -- get the editor's max width and height
|
||
|
-- local width = vim.api.nvim_get_option("columns")
|
||
|
-- local height = vim.api.nvim_get_option("lines")
|
||
|
--
|
||
|
-- -- create a new, scratch buffer, for fzf
|
||
|
-- local buf = vim.api.nvim_create_buf(false, true)
|
||
|
-- vim.api.nvim_buf_set_option(buf, 'buftype', 'nofile')
|
||
|
--
|
||
|
-- -- if the editor is big enough
|
||
|
-- if (width > 150 or height > 35) then
|
||
|
-- -- fzf's window height is 3/4 of the max height, but not more than 30
|
||
|
-- local win_height = math.min(math.ceil(height * 3 / 4), 30)
|
||
|
-- local win_width
|
||
|
--
|
||
|
-- -- if the width is small
|
||
|
-- if (width < 150) then
|
||
|
-- -- just subtract 8 from the editor's width
|
||
|
-- win_width = math.ceil(width - 8)
|
||
|
-- else
|
||
|
-- -- use 90% of the editor's width
|
||
|
-- win_width = math.ceil(width * 0.9)
|
||
|
-- end
|
||
|
--
|
||
|
-- -- settings for the fzf window
|
||
|
-- local opts = {
|
||
|
-- relative = "editor",
|
||
|
-- width = win_width,
|
||
|
-- height = win_height,
|
||
|
-- row = math.ceil((height - win_height) / 2),
|
||
|
-- col = math.ceil((width - win_width) / 2)
|
||
|
-- }
|
||
|
--
|
||
|
-- -- create a new floating window, centered in the editor
|
||
|
-- local win = vim.api.nvim_open_win(buf, true, opts)
|
||
|
-- end
|
||
|
-- end
|
||
|
-- NavigationFloatingWin()
|
||
|
local buf = vim.api.nvim_create_buf(false, true)
|
||
|
vim.api.nvim_buf_set_lines(buf, 0, -1, true, {"test", "text"})
|
||
|
local opts = {
|
||
|
relative = 'editor',
|
||
|
-- relative = 'cursor',
|
||
|
width = 10,
|
||
|
height = 2,
|
||
|
col = 60,
|
||
|
row = 10,
|
||
|
anchor = 'NW',
|
||
|
style = 'minimal'
|
||
|
}
|
||
|
local win = vim.api.nvim_open_win(buf, 0, opts)
|
||
|
-- optional: change highlight, otherwise Pmenu is used
|
||
|
vim.api.nvim_win_set_option(win, 'winhl', 'Normal:MyHighlight')
|
||
|
|
||
|
|