Skip to content

Commit 9ec585e

Browse files
committed
Introduce new way to trigger live reloading for developers of Treewalker
This introduces the TREEWALKER_NVIM_ENV env var, which, if set to "development", will trigger the plugin to live reload. It does introduce an environment variable check before every invocation of Treewalker, but I don't think that should make a practical difference.
1 parent d954928 commit 9ec585e

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

plugin/init.lua

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
-- local function tw()
2-
-- -- Use this function for development. Makes the plugin auto-reload so you
3-
-- -- don't need to restart nvim to get the changes.
4-
-- local util = require "treewalker.util"
5-
-- return util.R('treewalker')
6-
-- end
7-
81
local function tw()
9-
return require('treewalker')
2+
if os.getenv("TREEWALKER_NVIM_ENV") == "development" then
3+
-- For development. Makes the plugin auto-reload so you
4+
-- don't need to restart nvim to get the changes live.
5+
-- F*** it, we're doing it live!
6+
local util = require "treewalker.util"
7+
return util.R('treewalker')
8+
else
9+
return require('treewalker')
10+
end
1011
end
1112

1213
local subcommands = {

0 commit comments

Comments
 (0)