generated from nvimdev/nvim-plugin-template
-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
init.lua
45 lines (41 loc) · 1.09 KB
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
local utils = require('hurl.utils')
--- Default configuration for hurl.nvim
local default_config = {
debug = false,
mode = 'split',
show_notification = false,
auto_close = true,
-- Default split options
split_position = 'right',
split_size = '50%',
-- Default popup options
popup_size = {
width = 80,
height = 40,
},
env_file = { 'vars.env' },
formatters = {
json = { 'jq' },
html = {
'prettier',
'--parser',
'html',
},
},
}
--- Global configuration for entire plugin, easy to access from anywhere
_HURL_GLOBAL_CONFIG = default_config
local M = {}
--- Setup hurl.nvim
---@param options (table | nil)
-- - debug: (boolean | nil) default: false.
-- - mode: ('popup' | 'split') default: popup.
function M.setup(options)
if options and options.env_file ~= nil and type(options.env_file) == 'string' then
utils.log_warn('env_file should be a table')
options.env_file = { options.env_file }
end
_HURL_GLOBAL_CONFIG = vim.tbl_extend('force', _HURL_GLOBAL_CONFIG, options or default_config)
require('hurl.main').setup()
end
return M