mirror of
https://github.com/cmderdev/cmder.git
synced 2025-06-14 21:57:52 +08:00
Reorganize how clink settings are loaded
4bfdf04d59
moved all clink config files
to vendor/ and therefore the files in config/ were not used and .history
was also moved to vendor/.
The new arrangement uses `--script` to load our own clink.lua file which in
turn as the first thing loads the original clink.lua file. The user defined
files are again in config/. As clink regenerates these files, if they are not
present, this also means that we don't need to include the settings file
in the git repo and therefore don't overwrite it on updates.
This commit is contained in:
17
vendor/cmder.lua → vendor/clink.lua
vendored
17
vendor/cmder.lua → vendor/clink.lua
vendored
@ -1,3 +1,11 @@
|
||||
-- At first, load the original clink.lua file
|
||||
-- this is needed as we set the script path to this dir and therefore the original
|
||||
-- clink.lua is not loaded.
|
||||
local clink_lua_file = clink.get_env('CMDER_ROOT')..'\\vendor\\clink\\clink.lua'
|
||||
dofile(clink_lua_file)
|
||||
|
||||
-- now add our own things...
|
||||
|
||||
function lambda_prompt_filter()
|
||||
clink.prompt.value = string.gsub(clink.prompt.value, "{lamb}", "λ")
|
||||
end
|
||||
@ -190,12 +198,3 @@ for _,lua_module in ipairs(clink.find_files(completions_dir..'*.lua')) do
|
||||
end
|
||||
end
|
||||
|
||||
-- now do the same for all lua files in config which do not start with '_'
|
||||
local user_config_dir = clink.get_env('CMDER_ROOT')..'\\config\\'
|
||||
for _,lua_module in ipairs(clink.find_files(user_config_dir..'*.lua')) do
|
||||
-- Skip files that starts with _. This could be useful if some files should be ignored
|
||||
if not string.match(lua_module, '^_.*') then
|
||||
local filename = user_config_dir..lua_module
|
||||
dofile(filename)
|
||||
end
|
||||
end
|
8
vendor/init.bat
vendored
8
vendor/init.bat
vendored
@ -23,8 +23,14 @@
|
||||
set architecture=64
|
||||
)
|
||||
|
||||
:: Tell the user about the clink config files...
|
||||
@if not exist "%CMDER_ROOT%\config\settings" (
|
||||
echo Generating clink initial settings in %CMDER_ROOT%\config\settings
|
||||
echo Additional *.lua files in %CMDER_ROOT%\config are loaded on startup.
|
||||
)
|
||||
|
||||
:: Run clink
|
||||
@"%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\vendor"
|
||||
@"%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor"
|
||||
|
||||
:: Prepare for git-for-windows
|
||||
|
||||
|
Reference in New Issue
Block a user