Skip to content

Commit

Permalink
feat(summary): delay setting file type (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
HiPhish authored Aug 13, 2022
1 parent 42ba517 commit d018868
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
17 changes: 17 additions & 0 deletions ftplugin/neotest-summary.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
if get(b:, 'did_ftplugin', v:false)
finish
endif
let b:did_ftplugin = v:true

let s:save_cpo = &cpo
set cpo&vim

setlocal winfixwidth
setlocal nonumber
setlocal norelativenumber
setlocal nospell

let b:undo_ftplugin = 'setlocal wfh< nu< rnu< spell<'

let &cpo = s:save_cpo
unlet s:save_cpo
17 changes: 2 additions & 15 deletions lua/neotest/consumers/summary/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@ local function create_buf()
end

summary_buf = async.api.nvim_create_buf(false, true)
local options = {
modifiable = false,
filetype = "neotest-summary",
}
for name, value in pairs(options) do
async.api.nvim_buf_set_option(summary_buf, name, value)
end
async.api.nvim_buf_set_option(summary_buf, 'modifiable', false)
async.api.nvim_buf_set_name(summary_buf, buf_name)
return summary_buf
end
Expand All @@ -35,16 +29,9 @@ local function open_window(buf)
local cur_win = async.api.nvim_get_current_win()
vim.cmd([[botright vsplit | vertical resize 50]])
local win = async.api.nvim_get_current_win()
local options = {
relativenumber = false,
number = false,
winfixwidth = true,
}
for name, value in pairs(options) do
async.api.nvim_win_set_option(win, name, value)
end
async.api.nvim_win_set_buf(win, buf)
async.api.nvim_set_current_win(cur_win)
async.api.nvim_buf_set_option(summary_buf, 'filetype', 'neotest-summary')
end

local components = {}
Expand Down

0 comments on commit d018868

Please sign in to comment.