Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions lua/codesettings/commands/view.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local M = {}
---Show given string in a centered floating window, with q and esc bound to close
---@param str string|string[]
function M.show(str)
local buf = vim.api.nvim_create_buf(false, false)
local buf = vim.api.nvim_create_buf(false, true)
local vpad = 6
local hpad = 20

Expand All @@ -29,14 +29,13 @@ function M.show(str)
opts.row = (vim.o.lines - opts.height) / 2
opts.col = (vim.o.columns - opts.width) / 2

local win = vim.api.nvim_open_win(buf, true, opts)

local buf_scope = { buf = buf }
vim.api.nvim_set_option_value('filetype', 'markdown', buf_scope)
vim.api.nvim_set_option_value('buftype', 'nofile', buf_scope)
vim.api.nvim_set_option_value('filetype', 'codesettings-output', buf_scope)
vim.api.nvim_set_option_value('bufhidden', 'wipe', buf_scope)
vim.api.nvim_set_option_value('modifiable', false, buf_scope)

local win = vim.api.nvim_open_win(buf, true, opts)

local win_scope = { win = win }
vim.api.nvim_set_option_value('conceallevel', 3, win_scope)
vim.api.nvim_set_option_value('spell', false, win_scope)
Expand Down
2 changes: 2 additions & 0 deletions lua/codesettings/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ end
---Setup the plugin with the given options.
---@param opts CodesettingsConfigOverrides? optional config overrides for the global plugin configuration
function M.setup(opts)
vim.treesitter.language.register('markdown', 'codesettings-output')

opts = opts or {}
require('codesettings.config').setup(opts)
end
Expand Down