add some options for the user and info in the readme

This commit is contained in:
kiyan42
2020-02-20 21:16:13 +01:00
parent 1d61d6b123
commit f5af7aa95d
3 changed files with 53 additions and 7 deletions

View File

@@ -34,11 +34,24 @@ end
local BUF_OPTIONS = {
'nonumber', 'norelativenumber', 'winfixwidth', 'winfixheight',
'winhighlight=EndOfBuffer:LuaTreeEndOfBuffer', 'noswapfile'
'winhighlight=EndOfBuffer:LuaTreeEndOfBuffer', 'noswapfile',
'splitbelow'
}
local WIN_WIDTH = 30
local SIDE = 'topleft'
if api.nvim_call_function('exists', { 'g:lua_tree_width' }) == 1 then
WIN_WIDTH = api.nvim_get_var('lua_tree_width')
end
if api.nvim_call_function('exists', { 'g:lua_tree_side' }) == 1 then
if api.nvim_get_var('lua_tree_side') == 'right' then
SIDE = 'rightbelow'
end
end
local function open()
local win_width = 30
local options = {
bufhidden = 'delete';
buftype = 'nowrite';
@@ -52,7 +65,7 @@ local function open()
api.nvim_buf_set_option(buf, opt, val)
end
api.nvim_command('topleft '..win_width..'vnew')
api.nvim_command(SIDE.. ' '..WIN_WIDTH..'vnew')
api.nvim_win_set_buf(0, buf)
for _, opt in pairs(BUF_OPTIONS) do
api.nvim_command('setlocal '..opt)