feat: set unique filetype on built-in modals (#3)

This commit is contained in:
Steven Arcangeli 2021-12-05 19:25:05 -08:00
parent 08c0cf3217
commit a3255df4a5
2 changed files with 2 additions and 0 deletions

View File

@ -148,6 +148,7 @@ setmetatable(M, {
vim.api.nvim_buf_set_option(bufnr, "buftype", "prompt")
vim.api.nvim_buf_set_option(bufnr, "swapfile", false)
vim.api.nvim_buf_set_option(bufnr, "bufhidden", "wipe")
vim.api.nvim_buf_set_option(bufnr, "filetype", "DressingInput")
local keyopts = { silent = true, noremap = true }
local close_rhs = "<cmd>lua require('dressing.input').confirm()<CR>"
vim.api.nvim_buf_set_keymap(bufnr, "n", "<Esc>", close_rhs, keyopts)

View File

@ -43,6 +43,7 @@ M.select = function(config, items, opts, on_choice)
vim.api.nvim_win_set_option(winnr, "winblend", config.winblend)
vim.api.nvim_win_set_option(winnr, "cursorline", true)
pcall(vim.api.nvim_win_set_option, winnr, "cursorlineopt", "both")
vim.api.nvim_buf_set_option(bufnr, "filetype", "DressingSelect")
-- Create the title window once the main window is placed.
-- Have to defer here or the title will be in the wrong location