<commit_before>@echo off
setlocal EnableExtensions

set BATDIR=%~dp0
if not exist "%USERPROFILE%" (
    echo [Error] Environment variable %%USERPROFILE%% is not set.
    goto :EOF
)

REM Check access priviledge
if exist "%TEMP%\makelinks.tmp" del "%TEMP%\makelinks.tmp"
(mklink /h "%TEMP%\makelinks.tmp" "%~0" 2>&1) > NUL
if not %ERRORLEVEL% == 0 (
    echo Failed to create a hard link
    goto :EOF
)
del ".\makelinks.tmp" 2> NUL

REM Git configurations
git config --global include.path "%BATDIR%git\config"
call :COPY "%BATDIR%git/ignore" "%USERPROFILE%\.gitignore"

REM VIM configurations
call :MKDIR "%USERPROFILE%\_vim\autoload"
call :MKLINK "%USERPROFILE%\_vim\vimrc"                 "%BATDIR%vimfiles\vimrc"
call :MKLINK "%USERPROFILE%\_vim\autoload\plug.vim"     "%BATDIR%vimfiles\autoload\plug.vim"
call :MKDIR "%USERPROFILE%\.vim\autoload"
call :MKLINK "%USERPROFILE%\.vim\vimrc"                 "%BATDIR%vimfiles\vimrc"
call :MKLINK "%USERPROFILE%\.vim\autoload\plug.vim"     "%BATDIR%vimfiles\autoload\plug.vim"
call :MKDIR "%USERPROFILE%\vimfiles\autoload"
call :MKLINK "%USERPROFILE%\vimfiles\vimrc"             "%BATDIR%vimfiles\vimrc"
call :MKLINK "%USERPROFILE%\vimfiles\autoload\plug.vim" "%BATDIR%vimfiles\autoload\plug.vim"

REM Neovim configurations
call :MKDIR "%USERPROFILE%\.config\nvim\autoload"
call :MKDIR "%USERPROFILE%\.config\nvim\lua\plugins"
call :MKLINK "%USERPROFILE%\.config\nvim\init.lua"                  "%BATDIR%nvim\init.lua"
call :MKLINK "%USERPROFILE%\.config\vimfiles\autoload\plug.vim"     "%BATDIR%nvim\autoload\plug.vim"
call :MKLINK "%USERPROFILE%\.config\nvim\lua\plugins\cmp.lua"       "%BATDIR%nvim\lua\plugins\cmp.lua"
call :MKLINK "%USERPROFILE%\.config\nvim\lua\plugins\lualine.lua"   "%BATDIR%nvim\lua\plugins\lualine.lua"
call :MKLINK "%USERPROFILE%\.config\nvim\lua\plugins\null-ls.lua"   "%BATDIR%nvim\lua\plugins\null-ls.lua"
call :MKLINK "%USERPROFILE%\.config\nvim\lua\plugins\nvim-lsp-installer.lua" "%BATDIR%nvim\lua\plugins\nvim-lsp-installer.lua"
call :MKLINK "%USERPROFILE%\.config\nvim\lua\plugins\nvim-tree.lua" "%BATDIR%nvim\lua\plugins\nvim-tree.lua"
call :MKLINK "%USERPROFILE%\.config\nvim\lua\plugins\telescope.lua" "%BATDIR%nvim\lua\plugins\telescope.lua"
goto :EOF


REM ---------------------------------------------------------------------------
:COPY
    set SRC=%~f1
    set DEST=%~f2
    if not exist "%DEST%" (
        echo copy "%SRC%" "%DEST%"
        copy "%SRC%" "%DEST%" > NUL
    )
    exit /b 0

:MKLINK
    set DEST=%~f1
    set SRC=%~f2
    if exist "%DEST%" del /q "%DEST%"
    echo mklink /h "%DEST%" "%SRC%"
    mklink /h "%DEST%" "%SRC%" > NUL
    exit /b 0

:MKDIR
    if not exist "%~f1" (
        echo mkdir "%~f1"
        mkdir "%~f1"
    )
    exit /b 0<commit_msg>Revert "setup: Use hard link on Windows"<commit_after>@echo off
setlocal EnableExtensions

set BATDIR=%~dp0
if not exist "%USERPROFILE%" (
    echo [Error] Environment variable %%USERPROFILE%% is not set.
    goto :EOF
)

REM Check access priviledge
if exist "%TEMP%\makelinks.tmp" del "%TEMP%\makelinks.tmp"
(mklink "%TEMP%\makelinks.tmp" "%~0" 2>&1) > NUL
if not %ERRORLEVEL% == 0 (
    echo Failed to create a symbolic link
    goto :EOF
)
del ".\makelinks.tmp" 2> NUL

REM Git configurations
git config --global include.path "%BATDIR%git\config"
call :COPY "%BATDIR%git/ignore" "%USERPROFILE%\.gitignore"

REM VIM configurations
call :MKDIR "%USERPROFILE%\_vim\autoload"
call :MKLINK "%USERPROFILE%\_vim\vimrc"                 "%BATDIR%vimfiles\vimrc"
call :MKLINK "%USERPROFILE%\_vim\autoload\plug.vim"     "%BATDIR%vimfiles\autoload\plug.vim"
call :MKDIR "%USERPROFILE%\.vim\autoload"
call :MKLINK "%USERPROFILE%\.vim\vimrc"                 "%BATDIR%vimfiles\vimrc"
call :MKLINK "%USERPROFILE%\.vim\autoload\plug.vim"     "%BATDIR%vimfiles\autoload\plug.vim"
call :MKDIR "%USERPROFILE%\vimfiles\autoload"
call :MKLINK "%USERPROFILE%\vimfiles\vimrc"             "%BATDIR%vimfiles\vimrc"
call :MKLINK "%USERPROFILE%\vimfiles\autoload\plug.vim" "%BATDIR%vimfiles\autoload\plug.vim"

REM Neovim configurations
call :MKDIR "%USERPROFILE%\.config\nvim\autoload"
call :MKDIR "%USERPROFILE%\.config\nvim\lua\plugins"
call :MKLINK "%USERPROFILE%\.config\nvim\init.lua"                  "%BATDIR%nvim\init.lua"
call :MKLINK "%USERPROFILE%\.config\vimfiles\autoload\plug.vim"     "%BATDIR%nvim\autoload\plug.vim"
call :MKLINK "%USERPROFILE%\.config\nvim\lua\plugins\cmp.lua"       "%BATDIR%nvim\lua\plugins\cmp.lua"
call :MKLINK "%USERPROFILE%\.config\nvim\lua\plugins\lualine.lua"   "%BATDIR%nvim\lua\plugins\lualine.lua"
call :MKLINK "%USERPROFILE%\.config\nvim\lua\plugins\null-ls.lua"   "%BATDIR%nvim\lua\plugins\null-ls.lua"
call :MKLINK "%USERPROFILE%\.config\nvim\lua\plugins\nvim-lsp-installer.lua" "%BATDIR%nvim\lua\plugins\nvim-lsp-installer.lua"
call :MKLINK "%USERPROFILE%\.config\nvim\lua\plugins\nvim-tree.lua" "%BATDIR%nvim\lua\plugins\nvim-tree.lua"
call :MKLINK "%USERPROFILE%\.config\nvim\lua\plugins\telescope.lua" "%BATDIR%nvim\lua\plugins\telescope.lua"
goto :EOF


REM ---------------------------------------------------------------------------
:COPY
    set SRC=%~f1
    set DEST=%~f2
    if not exist "%DEST%" (
        echo copy "%SRC%" "%DEST%"
        copy "%SRC%" "%DEST%" > NUL
    )
    exit /b 0

:MKLINK
    set DEST=%~f1
    set SRC=%~f2
    if exist "%DEST%" del /q "%DEST%"
    echo mklink "%DEST%" "%SRC%"
    mklink "%DEST%" "%SRC%" > NUL
    exit /b 0

:MKDIR
    if not exist "%~f1" (
        echo mkdir "%~f1"
        mkdir "%~f1"
    )
    exit /b 0
{'fraction_non_alphanumeric': 0.1910598413842826, 'fraction_numerical': 0.005767844268204758, 'mean_word_length': 3.291569992266048, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1809938', 'n_tokens_mistral': 2293, 'n_tokens_neox': 2107, 'n_words': 404}