remove conf.lua file

This commit is contained in:
kyazdani42 2020-02-19 18:47:02 +01:00
parent e29c9fb4ee
commit 5ab65e98b3
4 changed files with 12 additions and 38 deletions

View File

@ -1,23 +0,0 @@
local BUF_NAME = 'LuaTree'
local function get_cwd() return vim.loop.cwd() end
local ROOT_PATH = get_cwd() .. '/'
local function get_buf_name()
return BUF_NAME
end
local function get_root_path()
return ROOT_PATH
end
local function set_root_path(path)
ROOT_PATH = path
end
return {
get_buf_name = get_buf_name;
get_root_path = get_root_path;
set_root_path = set_root_path;
get_cwd = get_cwd;
}

View File

@ -1,8 +1,14 @@
local api = vim.api
local function syslist(v) return api.nvim_call_function('systemlist', { v }) end
local get_root_path = require 'lib/conf'.get_root_path
local get_git_attr = require 'lib/git'.get_git_attr
local function get_cwd() return vim.loop.cwd() end
local ROOT_PATH = get_cwd() .. '/'
local function set_root_path(path)
ROOT_PATH = path
end
local Tree = {}
local function is_dir(path)
@ -78,7 +84,6 @@ local function create_nodes(path, relpath, depth, dirs)
end
local function init_tree()
local ROOT_PATH = get_root_path()
Tree = create_nodes(ROOT_PATH, '', 0, list_dirs())
if ROOT_PATH ~= '/' then
table.insert(Tree, 1, {
@ -152,4 +157,6 @@ return {
open_dir = open_dir;
check_dir_access = check_dir_access;
is_dir = is_dir;
set_root_path = set_root_path;
get_cwd = get_cwd;
}

View File

@ -1,3 +1,4 @@
local BUF_NAME = 'LuaTree'
local api = vim.api
local libformat = require 'lib/format'
@ -7,14 +8,9 @@ local highlight = libformat.highlight_buffer
local stateutils = require 'lib/state'
local get_tree = stateutils.get_tree
local confutils = require 'lib/conf'
local get_buf_name = confutils.get_buf_name
local get_root_path = confutils.get_root_path
local scratch_buf = nil
local function get_buf()
local BUF_NAME = get_buf_name()
local regex = '.*'..BUF_NAME..'$';
for _, win in pairs(api.nvim_list_wins()) do
@ -28,7 +24,6 @@ local function get_buf()
end
local function get_win()
local BUF_NAME = get_buf_name()
local regex = '.*'..BUF_NAME..'$';
for _, win in pairs(api.nvim_list_wins()) do
@ -129,8 +124,6 @@ local function scratch_wrapper(edit_type, ...)
end
local function open()
local BUF_NAME = get_buf_name()
local ROOT_PATH = get_root_path()
local win_width = 30
local options = {
bufhidden = 'wipe';
@ -148,7 +141,6 @@ local function open()
api.nvim_command('topleft '..win_width..'vnew')
api.nvim_win_set_buf(0, buf)
buf_setup()
api.nvim_command('echo "'..ROOT_PATH..'"')
end
local function close()

View File

@ -12,6 +12,8 @@ local open_dir = stateutils.open_dir
local check_dir_access = stateutils.check_dir_access
local refresh_tree = stateutils.refresh_tree
local is_dir = stateutils.is_dir
local set_root_path = stateutils.set_root_path
local get_cwd = stateutils.get_cwd
local winutils = require 'lib/winutils'
local update_view = winutils.update_view
@ -20,10 +22,6 @@ local close = winutils.close
local open = winutils.open
local set_mappings = winutils.set_mappings
local conf = require 'lib/conf'
local set_root_path = conf.set_root_path
local get_cwd = conf.get_cwd
local git = require 'lib/git'
local refresh_git = git.refresh_git
local force_refresh_git = git.force_refresh_git