├── .gitattributes ├── .gitignore ├── Far3.bat ├── LICENSE ├── README.md ├── VERSION ├── bin └── README ├── clink.bat ├── doublecmd.bat ├── etc ├── ConEmu │ ├── Far3.xml │ ├── Prompt.xml │ └── QuakePanel.xml ├── ConsoleZ │ ├── Far3.xml │ └── Prompt.xml ├── Far3 │ ├── Default.farconfig │ ├── Far.exe.ini │ ├── FarColorer │ │ ├── schemes.hrc │ │ ├── schemes │ │ │ ├── gen │ │ │ │ ├── perl-brackets.ent.hrc │ │ │ │ └── sh-brackets.ent.hrc │ │ │ ├── perl-heredoc.ent.hrc │ │ │ ├── perl-keyword-pack.ent.hrc │ │ │ ├── perl-keywords.ent.hrc │ │ │ ├── perl-vars.ent.hrc │ │ │ ├── perl-vars.pkg.ent.hrc │ │ │ ├── perl-vars.pkg.hrc │ │ │ ├── perl.hrc │ │ │ ├── rare-ium │ │ │ │ └── ium.config.hrc │ │ │ ├── sh-keywords.ent.hrc │ │ │ └── sh.hrc │ │ ├── styles.xml │ │ └── styles │ │ │ ├── gentle-console.hrd │ │ │ └── gentle-rgb.hrd │ └── Profile │ │ ├── FarMenu.Ini │ │ └── Macros │ │ ├── modules │ │ └── macroEx.lua │ │ └── scripts │ │ ├── AutoStart.Shell.lua │ │ ├── Common.Translit.lua │ │ ├── Common.ViewUserScreen.lua │ │ ├── Dialog.ConcurrentHotkeys.lua │ │ ├── Editor.BlockIndent.lua │ │ ├── Editor.IncSearch.lua │ │ ├── Editor.Notepad.lua │ │ ├── Editor.ReloadFile.lua │ │ ├── Editor.SmartHomeEnd.lua │ │ ├── Editor.scite_like.lua │ │ ├── Plugin.Common.Calc.lua │ │ ├── Plugin.Common.S&R.lua │ │ ├── Plugin.ConEmu.TabList.lua │ │ ├── Plugin.Editor.AutoWrap.lua │ │ ├── Plugin.Editor.EditCase.lua │ │ ├── Plugin.Editor.FarColorer.lua │ │ ├── Plugin.Editor.Visualizer.lua │ │ ├── Plugin.Panel.VisualCompare.lua │ │ ├── Plugin.Shell.EMenu.lua │ │ ├── Shell.AutoCompletion.lua │ │ ├── Shell.CdUp.Light.lua │ │ ├── Shell.CdUp.lua │ │ ├── Shell.CmdLine.CursorMovement.lua │ │ ├── Shell.CtrlBackSlash.lua │ │ ├── Shell.DeepTarball.lua │ │ ├── Shell.EnterEmptyLine.lua │ │ ├── Shell.HiddenFiles.lua │ │ ├── Shell.History.lua │ │ ├── Shell.Rename.lua │ │ └── Viewer.PgDn.lua ├── PuTTY │ ├── README │ ├── config │ │ ├── create-putty-sessions.bat │ │ ├── sessions-list.txt │ │ └── sessions │ │ │ └── #default-settings.session │ └── putty.conf ├── README ├── candy-for-tea.bat ├── candy-for-tea.enabled ├── clink │ ├── .gitignore │ ├── clink_inputrc │ ├── clink_settings │ └── clink_start.cmd ├── distrib │ └── README ├── images │ ├── ConEmu.ico │ ├── Cygwin.ico │ ├── Far2.ico │ ├── Far3.bmp │ ├── Far3.ico │ ├── Prompt.bmp │ ├── Prompt.ico │ ├── git-for-windows.ico │ ├── git.ico │ └── msysgit.ico ├── mintty │ └── default.settings ├── misc │ ├── SumatraPDF │ │ ├── SumatraPDF-default.bat │ │ ├── SumatraPDF-default.txt │ │ └── SumatraPDF-register.bat │ └── __TIPS │ │ └── firefox-profile-notifications.txt ├── notepad │ ├── Notepad.ini │ └── Notepad3.ini ├── postinstall │ ├── calc-display-issue.txt │ ├── cygwin-update.txt │ ├── fstab │ ├── home-link.bat │ ├── home-link.cyglink │ ├── home-link.winlink │ ├── keyboard-layout-rus-eng.reg │ ├── notepad-replace-win10.bat │ ├── notepad-replace-win11.bat │ ├── notepad-txtfile.bat │ └── synaptics-middle-click.reg ├── shell │ ├── cygwin.bat │ ├── detect_winpty.bat │ ├── msys32.bat │ └── msys64.bat └── xsrv │ └── xsrv-multiwindow.xlaunch ├── home ├── .XWinrc ├── .bash │ ├── aliases │ ├── environ │ ├── functions-cd │ ├── functions-datetime │ ├── functions-jump │ ├── functions-misc │ ├── functions-pipe │ ├── functions-proxy │ ├── functions-strings │ ├── settings-git │ └── settings-prompt ├── .bash_profile ├── .bashrc ├── .git-completion.bash ├── .git-prompt.sh ├── .gitconfig ├── .inputrc ├── .minttyrc ├── .perl5 │ └── 000-make-runners └── .profile ├── javaenv.bat ├── libexec ├── README └── identify.bat ├── opt └── README ├── shell.bat ├── shellenv.bat ├── shellenv.cfg-EXAMPLE └── shellinfo.bat /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=lf 2 | 3 | *.bat text eol=crlf 4 | *.cmd text eol=crlf 5 | 6 | *.txt text 7 | *.xml text 8 | *.properties text 9 | *.pl text 10 | *.sh text 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | shellenv.cfg 2 | 3 | bin/* 4 | !bin/README* 5 | 6 | etc/candy-for-tea.enabled 7 | etc/*.log 8 | etc/ConEmu/ 9 | etc/distrib/ 10 | etc/misc/ 11 | !etc/**/README* 12 | 13 | etc/clink/.history 14 | 15 | etc/Far3/Profile/Plugins/* 16 | etc/Far3/Profile/PluginsData/* 17 | etc/Far3/Profile/*.db* 18 | etc/Far3/ProfileLocal 19 | 20 | GUI/ 21 | 22 | home/* 23 | !home/.bash_profile 24 | !home/.bashrc 25 | !home/.git-completion.bash 26 | !home/.git-prompt.sh 27 | !home/.gitconfig 28 | !home/.inputrc 29 | !home/.profile 30 | 31 | libexec/* 32 | !libexec/README* 33 | !libexec/identify.bat 34 | 35 | opt/* 36 | !opt/README* 37 | 38 | var/ 39 | 40 | vendors/ 41 | -------------------------------------------------------------------------------- /Far3.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | setlocal 4 | 5 | set "FAR_NAME=Far3" 6 | 7 | if exist "%~dp0libexec\identify.bat" call "%~dp0libexec\identify.bat" app Far3 8 | 9 | if defined FAR_NAME if exist "%~dp0libexec\%FAR_NAME%\Far.exe" goto :continue 10 | 11 | call :error "Can't identify Far3 by name %FAR_NAME%" 12 | goto :EOF 13 | 14 | :: ======================================================================== 15 | 16 | :continue 17 | set "FAR_HOME=%~dp0libexec\%FAR_NAME%" 18 | 19 | :: Path to the common directory for all FAR-related stuffs 20 | set "FAR_CONF=%~dp0etc\Far3" 21 | 22 | :: FAR startup options 23 | set "FAR_OPTS=%FAR_HOME%\Plugins;%FAR_CONF%\Profile\Plugins" 24 | if defined ConEmuDir if exist "%ConEmuDir%" set "FAR_OPTS=%FAR_OPTS%;%ConEmuDir%\Plugins\ConEmu" 25 | set "FAR_OPTS=/w /p"%FAR_OPTS%"" 26 | 27 | if exist "%~dp0shellenv.bat" call "%~dp0shellenv.bat" 28 | 29 | if exist "%~dp0shellinfo.bat" call "%~dp0shellinfo.bat" conemu far home path 30 | 31 | :: ======================================================================== 32 | 33 | if not exist "%FAR_HOME%\Far.exe.ini" ( 34 | echo: 35 | echo:*** "%FAR_HOME%\Far.exe.ini" not found 36 | if exist "%FAR_CONF%\Far.exe.ini" ( 37 | echo:*** Copying from "%FAR_CONF%\Far.exe.ini" 38 | copy /b "%FAR_CONF%\Far.exe.ini" "%FAR_HOME%\Far.exe.ini" 39 | ) else ( 40 | echo:*** Creating 41 | call :far.exe.ini_create >"%FAR_HOME%\Far.exe.ini" 42 | ) 43 | if errorlevel 1 ( 44 | call :error "Cannot create %FAR_CONF%\Far.exe.ini" 45 | goto :EOF 46 | ) 47 | ) 48 | 49 | :: ======================================================================== 50 | 51 | echo:Starting %FAR_NAME% 52 | echo:[ %DATE% %TIME% ] 53 | 54 | "%FAR_HOME%\Far.exe" %FAR_OPTS% %* 55 | 56 | echo:Terminating... 57 | goto :EOF 58 | 59 | :: ======================================================================== 60 | 61 | :error 62 | >&2 ( 63 | echo:CRITICAL ERROR: %~1 64 | pause 65 | ) 66 | goto :EOF 67 | 68 | :: ======================================================================== 69 | 70 | :far.exe.ini_create 71 | echo: 72 | echo:[General] 73 | echo: 74 | echo:UseSystemProfiles=0 75 | echo: 76 | echo:UserProfileDir=%%FARHOME%%\..\..\etc\Far3\Profile 77 | echo:UserLocalProfileDir=%%FARHOME%%\..\..\etc\Far3\Profile 78 | echo: 79 | echo:TemplateProfile=%%FARHOME%%\..\..\etc\Far3\Default.farconfig 80 | echo: 81 | echo:GlobalUserMenuDir=%%FARHOME%%\..\..\etc\Far3 82 | echo: 83 | echo:DefaultLanguage=Russian 84 | echo: 85 | echo:ReadOnlyConfig=0 86 | goto :EOF 87 | 88 | :: ======================================================================== 89 | 90 | :: EOF 91 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 ildar-shaimordanov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Tea set 2 | 3 | this development arisen from the own set of the constantly updated scripts and tools collected for comfortable work under Windows. Some good ideas were invented by me, others were borrowed from different places. After installing on PC it puts 7-Zip, ConEmu, ConsoleZ, Clink, Far3, unix ports, Notepad3 and allows to deploy others. 4 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 0.4.9 Beta 2 | -------------------------------------------------------------------------------- /bin/README: -------------------------------------------------------------------------------- 1 | Common place for tools 2 | -------------------------------------------------------------------------------- /clink.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set "CLINK_NAME=clink" 4 | 5 | if exist "%~dp0libexec\identify.bat" call "%~dp0libexec\identify.bat" app clink 6 | 7 | if exist "%~dp0shellenv.bat" call "%~dp0shellenv.bat" 8 | set "HOME=%~dp0home" 9 | 10 | if not defined CLINK_NAME goto :EOF 11 | if not exist "%~dp0libexec\%CLINK_NAME%\clink.bat" goto :EOF 12 | 13 | :: ======================================================================== 14 | 15 | :: Inject clink 16 | call "%~dp0libexec\%CLINK_NAME%\clink.bat" inject --quiet --profile "%~dp0etc\clink" 17 | 18 | :: ======================================================================== 19 | 20 | :: EOF 21 | -------------------------------------------------------------------------------- /doublecmd.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | start "Starting..." /b "%~dp0libexec\doublecmd\doublecmd.exe" --no-splash --config-dir="%~dp0etc\misc\doublecmd" 4 | -------------------------------------------------------------------------------- /etc/Far3/Far.exe.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ildar-shaimordanov/tea-set/4decb128dac4606e91edd2355aa167f588082958/etc/Far3/Far.exe.ini -------------------------------------------------------------------------------- /etc/Far3/FarColorer/schemes.hrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | /\.(config)$/i 8 | 9 | 10 | 14 | 15 | 27 | 28 | 34 | 35 | 41 | 42 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /etc/Far3/FarColorer/schemes/gen/sh-brackets.ent.hrc: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 16 | 17 | 18 | 19 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /etc/Far3/FarColorer/schemes/perl-heredoc.ent.hrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 50 | 51 | 55 | 59 | 63 | 64 | -------------------------------------------------------------------------------- /etc/Far3/FarColorer/schemes/perl-vars.ent.hrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | На выходе юзаются две схемы: 5 | Vars - для всего. 6 | VarsEx - для строк. 7 | Остальное - internal. 8 | 9 | SubProt - отдельная песня: прототип ф-ций 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 43 | 44 | 45 | 46 | 50 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | -------------------------------------------------------------------------------- /etc/Far3/FarColorer/schemes/perl-vars.pkg.ent.hrc: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 18 | 21 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /etc/Far3/FarColorer/schemes/perl-vars.pkg.hrc: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | ]> 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | &perl-vars-pkg; 19 | 20 | 21 | 22 | 23 | 24 | &perl-vars-pkg; 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /etc/Far3/FarColorer/schemes/rare-ium/ium.config.hrc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ildar-shaimordanov/tea-set/4decb128dac4606e91edd2355aa167f588082958/etc/Far3/FarColorer/schemes/rare-ium/ium.config.hrc -------------------------------------------------------------------------------- /etc/Far3/FarColorer/schemes/sh-keywords.ent.hrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | -------------------------------------------------------------------------------- /etc/Far3/FarColorer/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 14 | 15 | 16 | 30 | -------------------------------------------------------------------------------- /etc/Far3/FarColorer/styles/gentle-console.hrd: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /etc/Far3/FarColorer/styles/gentle-rgb.hrd: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | -------------------------------------------------------------------------------- /etc/Far3/Profile/FarMenu.Ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ildar-shaimordanov/tea-set/4decb128dac4606e91edd2355aa167f588082958/etc/Far3/Profile/FarMenu.Ini -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/modules/macroEx.lua: -------------------------------------------------------------------------------- 1 | local break_sequence_on_mod_release = true 2 | 3 | --http://forum.farmanager.com/viewtopic.php?f=15&t=8764 4 | 5 | local RAlt, LAlt = 0x1,0x2 6 | local RCtrl,LCtrl = 0x4,0x8 7 | --[[ 8 | local Shift = 0x10 9 | local NumLock,ScrollLock,CapsLock = 0x20,0x40,0x80 10 | local ENHANCED_KEY = 0x100 11 | --]] 12 | local Mods = { 13 | RAlt =RAlt, LAlt =LAlt, Alt =bor(RAlt, LAlt), 14 | RCtrl=RCtrl, LCtrl=LCtrl, Ctrl=bor(RCtrl,LCtrl), 15 | } 16 | 17 | local function isReleased(Mod) return band(Mouse.LastCtrlState,Mod)==0 end -- State after last mf.waitkey!! 18 | local function guessMod(mod,AKey) 19 | mod = mod or AKey:match"Ctrl" or AKey:match"Alt" or error"unable to guess modifier key" 20 | return assert(Mods[mod],"wrong modifier specified") 21 | end 22 | 23 | local function exec(f,...) 24 | if type(f)=="function" then 25 | return f(...) 26 | else 27 | Keys(f) 28 | end 29 | end 30 | 31 | local F,C = far.Flags,far.Colors 32 | local Color2 = far.AdvControl(F.ACTL_GETCOLOR,C.COL_MENUHIGHLIGHT) 33 | local Color1 = far.AdvControl(F.ACTL_GETCOLOR,C.COL_MENUTITLE) 34 | local function setStatus(text,Color) 35 | if text and type(text)=="string" then 36 | far.Text(1,0,Color," "..text.." ") 37 | far.Text() 38 | end 39 | end 40 | 41 | local getMod = regex.new"^((?:[LR]?Ctrl)?(?:[LR]?Alt)?(?:Shift)?).+$" 42 | 43 | local Delay = 300 44 | local SeqDelay = 1000 45 | return function(Macro) 46 | return function(t) 47 | local action, condition, hold, doubletap, sequence, delay, mod = 48 | t.action,t.condition,t.hold,t.doubletap,t.sequence,t.delay,t.mod 49 | if not (hold or doubletap or sequence) then return Macro(t) end 50 | local busy 51 | local function KeysEx(key) 52 | if key and key~="" then 53 | busy = true 54 | if eval(key,2)==-2 then Keys(key) end 55 | busy = false 56 | end 57 | end 58 | t.priority=t.priority or 60; 59 | t.condition=function(...) 60 | return not busy and (not condition or condition(...)) 61 | end; 62 | t.action=function(...) 63 | local AKey = akey(1) 64 | local mod = guessMod(mod,AKey) 65 | if sequence then setStatus(sequence.status,Color1) end 66 | local key = "" 67 | local timeout 68 | -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 69 | local start = Far.UpTime 70 | delay = not (hold or doubletap) and SeqDelay or delay or Delay 71 | while not (timeout or key~="" or isReleased(mod)) do 72 | key = mf.waitkey(10) 73 | timeout = Far.UpTime-start>delay 74 | end 75 | if hold and timeout then 76 | return exec(hold,"hold") 77 | elseif doubletap and key==AKey then 78 | return exec(doubletap,"doubletap") 79 | end 80 | -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 81 | local h 82 | if sequence then 83 | setStatus(sequence.status,Color2) 84 | local getKey = regex.new("^"..getMod:match(AKey).."(.+)$") 85 | local seq = sequence 86 | while not (isReleased(mod) and break_sequence_on_mod_release) do 87 | if timeout then 88 | if seq.help and not h then 89 | h = far.SaveScreen() 90 | far.Message(seq.help,seq.status,"","l") 91 | end 92 | end 93 | if key~="" then 94 | local key2 = getKey:match(key) or key:len()==1 and key:upper() or key 95 | local action = seq[key2] 96 | if action then 97 | if h then far.RestoreScreen(h); h = nil end 98 | if type(action)=="table" then 99 | seq = action 100 | setStatus(seq.status,Color2) 101 | timeout = true --todo?? 102 | else 103 | return exec(action,key2) 104 | end 105 | else 106 | break 107 | end 108 | end 109 | key = mf.waitkey(10) 110 | timeout = timeout or Far.UpTime-start>delay 111 | end 112 | end 113 | -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 114 | if h then far.RestoreScreen(h) end 115 | if timeout then elseif action then exec(action,...) else KeysEx(AKey) end 116 | KeysEx(key) 117 | end 118 | return Macro(t) 119 | end 120 | end -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/AutoStart.Shell.lua: -------------------------------------------------------------------------------- 1 | Macro { 2 | description = "Display date/time of Far invocation"; 3 | area = "Shell"; 4 | key = ""; 5 | flags = "RunAfterFARStart"; 6 | action = function() 7 | -- http://forum.farmanager.com/viewtopic.php?p=138007#p138007 8 | -- Скрыть "вводимую" команду при старте FAR 9 | -- Hide an "entered" command at starting of FAR 10 | panel.GetUserScreen() 11 | win.system("echo:Started Far3") 12 | win.system("echo:[ %DATE% %TIME% ]") 13 | panel.SetUserScreen() 14 | -- workaround to avoid unexpected keystroke printing 15 | -- https://forum.farmanager.com/viewtopic.php?p=168784#p168784 16 | win.Sleep(3000) 17 | end; 18 | } 19 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Common.Translit.lua: -------------------------------------------------------------------------------- 1 | 2 | Macro { 3 | area = "Common"; 4 | key = "CtrlShiftApps"; 5 | flags = ""; 6 | description = "Common: Transliterate Rus<->Lat"; 7 | action = function() 8 | Keys('xlat') 9 | end; 10 | } 11 | 12 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Common.ViewUserScreen.lua: -------------------------------------------------------------------------------- 1 | local Info = Info or package.loaded.regscript or function(...) return ... end --luacheck: ignore 113/Info 2 | local nfo = Info { _filename or ..., 3 | name = "Ctrl+O ultimate"; 4 | description = "View UserScreen from any area"; 5 | version = "0.3"; --http://semver.org/lang/ru/ 6 | author = "jd"; 7 | url = "https://forum.farmanager.com/viewtopic.php?f=15&t=10983"; 8 | id = "0698713F-35CF-4B47-98E4-C281E700C7DF"; 9 | minfarversion = {3,0,0,5067,0}; --desktop 10 | helpstr = [[ 11 | Хотя в редакторе/вьювере "из коробки" заявлена возможность по Ctrl+O посмотреть 12 | пользовательский экран, реализована она неполноценно, например невозможно использовать 13 | граббер, не работают макросы http://bugs.farmanager.com/view.php?id=3523 14 | 15 | Предлагаемый набор макросов даёт возможность полноценного просмотра пользовательского экрана 16 | из любой области. 17 | По желанию отдельные области можно исключить, перечислив их в параметре "exclude". 18 | 19 | Если активное окно немодально, то по нажатию Ctrl+O происходит переключение в окно Desktop. 20 | Если модально, то для просмотра используются функции GetUserScreen/SetUserScreen. 21 | Обратно можно вернуться нажав Ctrl+O, Esc или Ctrl+Tab. 22 | ]]; 23 | help = function(nfo) far.Message(nfo.helpstr,nfo.name,nil,"l") end; 24 | options = { 25 | exclude = "Grabber ShellAutoCompletion DialogAutoCompletion"; 26 | }; 27 | --disabled = true; 28 | } 29 | if not nfo or nfo.disabled then return end 30 | local O = nfo.options 31 | 32 | local Exclude = {} 33 | if O.exclude and type(O.exclude=="string") then 34 | for area in O.exclude:gmatch"%S+" do Exclude[area] = true end 35 | end 36 | 37 | local F = far.Flags 38 | local actl, GetWindowInfo, SetCurrentWindow 39 | = far.AdvControl,F.ACTL_GETWINDOWINFO,F.ACTL_SETCURRENTWINDOW 40 | 41 | local function isModal(wi) 42 | return band(wi.Flags,F.WIF_MODAL)~=0 43 | end 44 | 45 | -- 0003523: Полноценный просмотр пользовательского экрана в редакторе/вьювере 46 | -- http://bugs.farmanager.com/view.php?id=3523 47 | 48 | Macro { description="CtrlO: view UserScreen from any area"; 49 | area="Common"; key="CtrlO"; priority=40; 50 | id="51E14530-08AA-4134-9488-4AD5EF8B6EDE"; 51 | condition=function() 52 | return not Exclude[Area.Current] 53 | and actl(GetWindowInfo).Type~=F.WTYPE_PANELS 54 | end; 55 | action=function() 56 | local wi = actl(GetWindowInfo) 57 | if isModal(wi) then 58 | panel.GetUserScreen(nil,1) 59 | else 60 | for i=1,wi.Pos-1 do 61 | if actl(GetWindowInfo,i).Type==F.WTYPE_DESKTOP then 62 | actl(SetCurrentWindow,i) 63 | return 64 | end 65 | end 66 | end 67 | end; 68 | } 69 | 70 | -- 0003496: Desktop: реализовать выход по Esc/Ctrl-O 71 | -- http://bugs.farmanager.com/view.php?id=3496 72 | 73 | Macro { description="CtrlO/Esc - quit Desktop"; 74 | area="Desktop"; key="Esc CtrlTab CtrlO"; priority=45; 75 | id="6AB9F806-45E5-46E2-8146-8136CC2F275D"; 76 | action=function() 77 | local wi = actl(GetWindowInfo) 78 | if isModal(wi) then 79 | panel.SetUserScreen(nil,1) 80 | else 81 | actl(SetCurrentWindow,wi.Pos-1) 82 | end 83 | end; 84 | } 85 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Dialog.ConcurrentHotkeys.lua: -------------------------------------------------------------------------------- 1 | --http://forum.farmanager.com/viewtopic.php?f=15&t=9197 2 | -- requires FAR 3 build 4215 (http://bugs.farmanager.com/view.php?id=2878) 3 | --http://bugs.farmanager.com/view.php?id=2877 4 | --http://bugs.farmanager.com/view.php?id=2879 5 | --http://bugs.farmanager.com/view.php?id=2881 6 | 7 | local F = far.Flags 8 | local checkHK,getHK = Object.CheckHotkey,Object.GetHotkey 9 | local RAlt,LAlt,RCtrl,LCtrl,Shift = 0x1,0x2,0x4,0x8,0x10 10 | local Ctrl,Alt = bor(RCtrl,LCtrl),bor(RAlt,LAlt) 11 | 12 | local function P2p(hDlg, ID) --"visible" Pos -> "total" pos 13 | local P,p,ii = {},{},0 14 | for i,item in ipairs(far.GetDlgItem(hDlg, ID)[6]) do --[6] Selected/ListItems: integer/table 15 | if band(item.Flags,F.LIF_HIDDEN)==0 then 16 | ii = ii+1 17 | P[i],p[ii] = ii,i 18 | end 19 | end 20 | return p,P 21 | end 22 | 23 | Event { group="DialogEvent"; description="Ctrl- to run hotkey"; 24 | uid="5EB2CC1A-D563-4362-ACC2-20BE350EDDA4"; 25 | condition=function(Event,param) 26 | local ID,Input = param.Param1,param.Param2 27 | return param.Msg==F.DN_CONTROLINPUT and Event==F.DE_DLGPROCINIT 28 | and Input.EventType==F.KEY_EVENT and Input.UnicodeChar~="\0" 29 | and far.GetDlgItem(param.hDlg, ID)[1]==F.DI_LISTBOX 30 | end; 31 | action=function(Event,param) 32 | local hDlg,ID,Input = param.hDlg,param.Param1,param.Param2 33 | local Mods = Input.ControlKeyState 34 | if band(Mods,Ctrl)~=0 and band(Mods,Alt)==0 35 | and checkHK(Input.UnicodeChar)~=0 then 36 | local hk,char = getHK():lower(),Input.UnicodeChar:lower() 37 | if hk~=char and hk~=far.XLat(char) then 38 | local Pos = checkHK(char) 39 | if Pos==0 then return end 40 | hDlg:send(F.DM_LISTSETCURPOS,ID,{SelectPos=P2p(hDlg,ID)[Pos]}) 41 | end 42 | return param.hDlg:send"DM_CLOSE" 43 | end 44 | end; 45 | } 46 | 47 | local InitPos 48 | Event { group="DialogEvent"; description="Alt- to pos to menu item (cycle through same hotkeys)"; 49 | uid="D91B58E5-4C32-4384-B205-D7895A4EC037"; 50 | condition=function(Event,param) return Event==F.DE_DLGPROCINIT end; 51 | action=function(Event,param) 52 | local hDlg,ID = param.hDlg,param.Param1 53 | if param.Msg==F.DN_CONTROLINPUT and param.Param2.EventType==F.KEY_EVENT then 54 | if far.GetDlgItem(hDlg, ID)[1]==F.DI_LISTBOX then 55 | InitPos = hDlg:send(F.DM_LISTINFO,ID).SelectPos 56 | end 57 | elseif param.Msg==F.DN_LISTHOTKEY then 58 | local hk,ItemIndex = getHK(),param.Param2 59 | local p,P = P2p(hDlg, ID) 60 | if checkHK(hk,P[ItemIndex]+1)==0 and band(Mouse.LastCtrlState,Alt)==0 then return end 61 | local Pos = checkHK(hk,P[InitPos]+1) 62 | if Pos==0 then Pos = checkHK(hk) end 63 | mf.postmacro(far.SendDlgMessage,hDlg,F.DM_LISTSETCURPOS,ID,{SelectPos=p[Pos]}) 64 | return 0 65 | end 66 | end; 67 | } 68 | 69 | Event { group="DialogEvent"; description="Concurrent hotkeys menu filter"; 70 | uid="33E83694-4F10-44A0-8CAD-C7DE90F5621C"; 71 | condition=function(Event,param) 72 | return param.Msg==F.DN_LISTHOTKEY and Event==F.DE_DLGPROCINIT 73 | and band(Mouse.LastCtrlState,Alt)==0 74 | and 60 75 | end; 76 | action=function(Event,param) 77 | local hDlg,ID,ItemIndex = param.hDlg,param.Param1,param.Param2 78 | if hDlg:send(F.DM_LISTINFO,ID).ItemsNumber~=Object.ItemCount then return end --macro api item indexes does not count hidden items 79 | --local P = select(2,P2p(hDlg, ID)); ItemIndex = P[ItemIndex] 80 | local hk = getHK() --ItemIndex 81 | if checkHK(hk,ItemIndex+1)~=0 then 82 | hDlg:send(F.DM_SHOWDIALOG,0) 83 | local list = far.GetDlgItem(hDlg, ID)[6] --[6] Selected/ListItems: integer/table 84 | local item 85 | for i=#list,1,-1 do 86 | if getHK(i)~=hk then 87 | item = list[i] 88 | hDlg:send(F.DM_LISTUPDATE, ID,{Index=i,Text=item.Text,Flags=bor(item.Flags,F.LIF_HIDDEN)}) 89 | end 90 | end 91 | hDlg:send(F.DM_SHOWDIALOG,1) 92 | Menu.Filter(4) --подправить высоту списка под количество элементов 93 | if Object.ItemCount==1 then return param.hDlg:send"DM_CLOSE" end 94 | return item and 0 or nil 95 | end 96 | end; 97 | } 98 | 99 | local hDlg,ID 100 | Macro { description="Reset filters"; 101 | area="Dialog Menu UserMenu Disks"; key="Esc F10"; 102 | uid="3DE219F0-7B83-453B-A1FA-E780640F7093"; 103 | condition=function() 104 | hDlg = far.AdvControl"ACTL_GETWINDOWINFO".Id 105 | ID = Area.Dialog and Dlg.CurPos or 1 106 | if Area.Dialog and Dlg.ItemType~=F.DI_LISTBOX then return end 107 | return hDlg:send(F.DM_LISTINFO,ID).ItemsNumber~=Object.ItemCount 108 | end; 109 | action=function() 110 | if Menu.Filter(0)==1 then Menu.Filter(0,0); return end 111 | hDlg:send(F.DM_SHOWDIALOG,0) 112 | for i,item in ipairs(far.GetDlgItem(hDlg,ID)[6]) do--[6] Selected/ListItems: integer/table 113 | if band(item.Flags,F.LIF_HIDDEN)~=0 then 114 | hDlg:send(F.DM_LISTUPDATE,ID,{Index=i,Text=item.Text,Flags=band(item.Flags,bnot(F.LIF_HIDDEN))}) 115 | end 116 | end 117 | hDlg:send(F.DM_SHOWDIALOG,1) 118 | Menu.Filter(4) --подправить высоту списка под количество элементов 119 | end; 120 | } 121 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Editor.BlockIndent.lua: -------------------------------------------------------------------------------- 1 | 2 | -- http://forum.farmanager.com/viewtopic.php?f=15&t=7703 3 | -- http://evil-programmers.googlecode.com/svn/trunk/BlockIndent/BlockIndent.lua 4 | 5 | --[[ 6 | Block Indent for Far Manager 7 | Version: 2.1 8 | Copyright (C) 2001 Alex Yaroslavsky 9 | 10 | This program is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation; either version 2 of the License, or 13 | (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | 24 | Features: 25 | - Right or Left Indentation of the selected block (or the current line) by 26 | a tab or a space. 27 | - Each line in the block is indented relatively to its own position with no 28 | respect to other lines in the block. 29 | - Tab indentation as in Borland Turbo IDE, text is indented to the nearest 30 | tab position and not just by tab size. 31 | - Works correctly with any editor settings (expand tabs or not, inserts real 32 | tabs). 33 | --]] 34 | 35 | local Indent = function (IndentByTabSize, Forward) 36 | local F = far.Flags 37 | local ei = editor.GetInfo(nil); 38 | local IndentSize = IndentByTabSize and ei.TabSize or 1 39 | local IndentStr = IndentByTabSize and "\t" or " " 40 | 41 | local line = ei.CurLine; 42 | local loop = false 43 | if ei.BlockType ~= F.BTYPE_NONE then 44 | local s = editor.GetString() 45 | if s.SelStart ~= 0 then 46 | loop = true; 47 | line = ei.BlockStartLine; 48 | end 49 | end 50 | 51 | editor.UndoRedo(nil, F.EUR_BEGIN) 52 | 53 | repeat 54 | editor.SetPosition(nil, line, 1, 0, 0, 1, ei.Overtype) 55 | -- patch 2.7 at http://forum.farmanager.com/viewtopic.php?p=125167#p125167 56 | -- local s = editor.GetString(nil, 0, 0) 57 | local s = editor.GetString(nil, line, 0) 58 | if not s or (loop and ((s.SelStart == 0) or (s.SelEnd ~= -1 and s.SelStart > s.SelEnd))) then 59 | break 60 | end 61 | local j = s.StringText:find("[^ \t]") 62 | if j and (j>1 or Forward) then 63 | local TabPos = editor.RealToTab(nil, nil, j) - 1 64 | local x = math.floor(TabPos/IndentSize) 65 | if ((TabPos%IndentSize) == 0) and not Forward then 66 | x = x - 1 67 | end 68 | x = Forward and x + 1 or x 69 | -- patch 2.7 at http://forum.farmanager.com/viewtopic.php?p=125167#p125167 70 | -- editor.SetString(nil, nil, s.StringText:sub(j), s.StringEOL) 71 | -- for i=1,x,1 do editor.InsertText(nil,IndentStr) end 72 | editor.SetString(nil, nil, IndentStr:rep(x)..s.StringText:sub(j), s.StringEOL) 73 | end 74 | line = line + 1 75 | -- http://forum.farmanager.com/viewtopic.php?p=125170#p125170 76 | loop = ei.TotalLines >= line 77 | until not loop 78 | 79 | editor.SetPosition(nil, ei.CurLine, ei.CurPos, 0, ei.TopScreenLine, ei.LeftPos, ei.Overtype) 80 | editor.UndoRedo(nil, F.EUR_END) 81 | end 82 | 83 | -- patch for Far 3.0 build 4444 84 | -- comment or remove unsupported flags = "DisableOutput" 85 | -- http://forum.farmanager.com/viewtopic.php?p=133237#p133237 86 | 87 | Macro { 88 | area = "Editor"; 89 | key = "ShiftTab"; 90 | --flags = "DisableOutput"; 91 | description = "Editor: Indent right by tab size"; 92 | action = function() 93 | Indent(true, true) 94 | end; 95 | } 96 | 97 | Macro { 98 | area = "Editor"; 99 | key = "ShiftBS"; 100 | --flags = "DisableOutput"; 101 | description = "Editor: Indent left by tab size"; 102 | action = function() 103 | Indent(true, false) 104 | end; 105 | } 106 | 107 | NoMacro { 108 | area = "Editor"; 109 | key = ""; 110 | --flags = "DisableOutput"; 111 | description = "Editor: Indent right by space"; 112 | action = function() 113 | Indent(false, true) 114 | end; 115 | } 116 | 117 | NoMacro { 118 | area = "Editor"; 119 | key = ""; 120 | --flags = "DisableOutput"; 121 | description = "Editor: Indent left by space"; 122 | action = function() 123 | Indent(false, false) 124 | end; 125 | } 126 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Editor.IncSearch.lua: -------------------------------------------------------------------------------- 1 | --http://forum.farmanager.com/viewtopic.php?f=15&t=8802 2 | --v2 3 | local useEdtFind = true --false 4 | local options = "WholeWords:0 RegExp:0 CaseSensitive:0 HighLight:1" 5 | local ExtraQuick --= true 6 | local useBM = false 7 | 8 | local F = far.Flags 9 | local SearchMode, str 10 | local last, appendable = "" 11 | local OriginalPos,OriginalSel 12 | 13 | local srhInit,srhFin,srhStart,srhFwd,srhBwd 14 | local function SetSelection(sel) 15 | editor.Select(nil,sel and { 16 | BlockType=F.BTYPE_STREAM, 17 | BlockStartPos=sel.StartPos, 18 | BlockWidth=sel.EndPos-sel.StartPos+1, 19 | BlockStartLine=sel.StartLine, 20 | BlockHeight=sel.EndLine-sel.StartLine+1, 21 | }) 22 | end 23 | 24 | local function MessagePopup(msg,title,flags,delay) 25 | local s = far.SaveScreen() 26 | far.Message(msg,title or "","",flags) 27 | win.Sleep(delay or 500); far.RestoreScreen(s) 28 | far.Text() 29 | end 30 | 31 | local function EdtFind(arg) 32 | return Plugin.SyncCall("E4ABD267-C2F9-4158-818F-B0E040A2AB9F",arg) 33 | end 34 | 35 | local function search(f,str,options,dir) 36 | local pos = editor.GetString().SelStart 37 | editor.SetPosition(nil,0,pos) 38 | if str=="" then 39 | editor.SetPosition(nil,0,pos) 40 | editor.Select(nil, F.BTYPE_NONE) 41 | EdtFind"Highlight:0" 42 | far.Text() 43 | return 44 | end 45 | local sel = editor.GetSelection() 46 | Keys(dir) 47 | local found = f(str,options) 48 | if not found then 49 | mf.beep() 50 | win.Sleep(200) 51 | editor.SetPosition(nil,0,pos) 52 | SetSelection(sel) --restore selection 53 | elseif false then 54 | ------------------------------- 55 | local si = editor.GetString() 56 | local word = si.StringText:match("%w+",si.SelEnd) 57 | local ei = editor.GetInfo() 58 | local LeftPos = si.SelEnd+word:len()-ei.WindowSizeX 59 | if LeftPos>ei.LeftPos then 60 | ei.LeftPos = LeftPos 61 | editor.SetPosition(nil,ei) 62 | end 63 | end 64 | editor.Redraw() 65 | far.Text() 66 | appendable = found 67 | end 68 | 69 | if useEdtFind and EdtFind() then 70 | srhInit = function() EdtFind"Highlight:0" end 71 | srhFin = function() end 72 | srhStart = function(str,extra) 73 | return EdtFind((extra or '')..options..' Error:0 Loop:0 Find:"'..str..'"') 74 | end 75 | srhFwd = function(str) return srhStart(str) end 76 | srhBwd = function(str) return srhStart(str,"Reverse:1 ") end 77 | srhToggleOption = function(opt) 78 | options = options:gsub(("(%s:)(%%d)"):format(opt),function(opt,value) 79 | local new = opt..(1-value) 80 | MessagePopup(new,"IncSearch.lua",nil,300) 81 | return new 82 | end,1) 83 | search(srhStart,str) 84 | end 85 | else ------------------------- 86 | local SearchSelFound,getValue = 17,-1 87 | local SelFoundInitState 88 | srhInit = function() 89 | SelFoundInitState = Editor.Set(SearchSelFound,getValue) --save init state of [x] Select found 90 | Editor.Set(SearchSelFound,1) 91 | end 92 | srhFin = function() 93 | Editor.Set(SearchSelFound,SelFoundInitState) --restore init state of [x] Select found 94 | if SelFoundInitState==0 then editor.Select(nil,{BlockStartPos=0}) end 95 | end 96 | srhStart = function(str,options) 97 | Far.DisableHistory(-1) 98 | Keys"F7 CtrlY"; print(str); if options then options() end; Keys"Enter" 99 | if not Area.Editor then far.Text(); Keys"Esc" else return true end 100 | end 101 | local function searchNext(key) 102 | Keys(key) 103 | if not Area.Editor then far.Text(); Keys"Esc" else return true end 104 | end 105 | srhFwd = function() return searchNext"ShiftF7" end 106 | srhBwd = function() return searchNext"AltF7" end 107 | local optpos = { 108 | ["CaseSensitive"] = 5; 109 | ["WholeWords"] = 6; 110 | ["RegExp"] = 7; 111 | } 112 | srhToggleOption = function(opt) 113 | if not optpos[opt] then return end 114 | local value 115 | search(srhStart,str,function() 116 | Dlg.SetFocus(optpos[opt]) 117 | Keys"Space" 118 | value = Dlg.GetValue() 119 | end) 120 | MessagePopup(opt..":"..value,"IncSearch.lua",nil,300) 121 | end 122 | end 123 | 124 | local xform = { 125 | Tab =" "; 126 | Space =" "; 127 | Divide ="/"; 128 | Multiply="*"; 129 | Subtract="-"; 130 | Add ="+"; 131 | Decimal ="."; 132 | -- 133 | RCtrl ="Shift"; --skip 134 | -- ="BS"; --backspace/restore 135 | -- ="CtrlBS"; --clear/restore 136 | CtrlV ="ShiftIns"; --insert 137 | -- ="Esc"; --quit and restore pos 138 | RAlt ="Alt"; --quit 139 | -- CtrlI ="Alt"; --quit 140 | F3 ="ShiftF7"; --next 141 | Enter ="ShiftF7"; 142 | ShiftF3 ="AltF7"; --prev 143 | ShiftEnter ="AltF7"; 144 | } 145 | 146 | local function setStatus(str) 147 | editor.SetTitle(nil,str and " ↓"..str:gsub(" ","∙") or nil) 148 | end 149 | 150 | local function enterSearchMode() 151 | srhInit() 152 | if useBM then BM.Add() end 153 | OriginalPos,OriginalSel = editor.GetInfo(),editor.GetSelection() 154 | str = ""; SearchMode = true; appendable = true 155 | local s1 = editor.GetString(nil,0,0) 156 | if s1.SelStart>0 then 157 | local sel = OriginalSel 158 | if sel.StartLine==sel.EndLine then 159 | str = s1.StringText:sub(s1.SelStart,s1.SelEnd) 160 | editor.SetPosition (nil,0,s1.SelStart) 161 | search(srhStart,str) 162 | else 163 | editor.Select(nil,{BlockStartPos=0}) 164 | end 165 | end 166 | setStatus(str) 167 | end 168 | 169 | local function quitSearchMode(restorePos) 170 | SearchMode = false 171 | if str~="" then last = str end 172 | setStatus() 173 | srhFin() 174 | if restorePos then 175 | editor.SetPosition(nil,OriginalPos) 176 | SetSelection(OriginalSel) 177 | end 178 | end 179 | ---------------------------------------------- 180 | 181 | local function append(text) 182 | str = appendable and str..text or str 183 | setStatus(str) 184 | search(srhStart,str,nil,ExtraQuick and appendable and text~="" and "Right") 185 | end 186 | 187 | local actions = { 188 | --skip 189 | Shift=function() Keys"Shift" end; 190 | --backspace/restore 191 | BS=function() 192 | str = str:len()>0 and str:sub(1,-2) or last 193 | appendable = true 194 | return "" --return value in order to append it to search string 195 | end; 196 | --clear/restore 197 | CtrlBS=function() 198 | str = str:len()>0 and "" or last 199 | appendable = true 200 | return "" 201 | end; 202 | --insert 203 | ShiftIns=function() 204 | return far.PasteFromClipboard():match"[^\r\n]+" 205 | end; 206 | --quit and restore pos 207 | Esc=function() quitSearchMode(not useBM) end; 208 | --quit 209 | Alt=function() quitSearchMode() end; 210 | --next 211 | ShiftF7=function() 212 | if str~="" then 213 | search(srhFwd,str,nil,"Right") 214 | end 215 | end; 216 | --prev 217 | AltF7=function() 218 | if str~="" then 219 | search(srhBwd,str,nil,"Left") 220 | end 221 | end; 222 | AltC=function() srhToggleOption"CaseSensitive" end; 223 | AltW=function() srhToggleOption"WholeWords" end; 224 | AltG=function() srhToggleOption"RegExp" end; 225 | AltH=function() srhToggleOption"HighLight" end; 226 | AltQ=function() 227 | ExtraQuick = not ExtraQuick 228 | local txt = "ExtraQuick:"..(ExtraQuick and 1 or 0) 229 | MessagePopup(txt,"IncSearch.lua",nil,300) 230 | end; 231 | } 232 | 233 | Macro { 234 | area="Editor"; key="RAlt"; description="incremental search mode"; 235 | uid="9CDB70B8-2774-491C-9F7C-46B4B0BC14CE"; 236 | action=function() 237 | enterSearchMode() 238 | repeat 239 | local key = mf.waitkey() 240 | key = xform[key] or key 241 | if actions[key] then 242 | local text = actions[key](key) 243 | if text then append(text) end 244 | elseif key:len()>1 then 245 | quitSearchMode() 246 | if eval(key,2)==-2 then Keys(key) end 247 | else 248 | append(key) 249 | end 250 | until not SearchMode 251 | end; 252 | } -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Editor.Notepad.lua: -------------------------------------------------------------------------------- 1 | 2 | -- Modification of the original script taken from: 3 | -- https://code.google.com/p/farmanager/source/browse/trunk/addons/Macros/Edit.Notepad.lua 4 | 5 | --[[ 6 | Macro { 7 | area = "Editor"; 8 | key = "CtrlN"; 9 | flags = ""; 10 | description = "Editor: Open New File"; 11 | action = function() 12 | Keys("ShiftF4 Del Enter") 13 | end 14 | } 15 | 16 | Macro { 17 | area = "Editor"; 18 | key = "CtrlO"; 19 | flags = ""; 20 | description = "Editor: Open..."; 21 | action = function() 22 | Keys("ShiftF4") 23 | end 24 | } 25 | ]] 26 | 27 | Macro { 28 | area = "Editor"; 29 | key = "CtrlS"; 30 | flags = ""; 31 | description = "Editor: Save a File"; 32 | action = function() 33 | Keys("F2") 34 | end 35 | } 36 | 37 | Macro { 38 | area = "Editor"; 39 | key = "CtrlW"; 40 | flags = ""; 41 | description = "Editor: Save a File and Exit"; 42 | action = function() 43 | Keys("ShiftF10") 44 | end 45 | } 46 | 47 | --[[ 48 | Macro { 49 | area = "Editor"; 50 | key = "CtrlG"; 51 | flags = ""; 52 | description = "Editor: Go To..."; 53 | action = function() 54 | Keys("AltF8") 55 | end 56 | } 57 | ]] 58 | 59 | --[[ 60 | Macro { 61 | area = "Editor"; 62 | key = "CtrlF"; 63 | flags = ""; 64 | description = "Editor: Find..."; 65 | action = function() 66 | Keys("F7") 67 | end 68 | } 69 | 70 | Macro { 71 | area = "Editor"; 72 | key = "F3"; 73 | flags = ""; 74 | description = "Editor: Find Next"; 75 | action = function() 76 | Keys("ShiftF7") 77 | end 78 | } 79 | ]] 80 | 81 | --[[ 82 | Macro { 83 | area = "Editor"; 84 | key = "CtrlH"; 85 | flags = ""; 86 | description = "Editor: Replace..."; 87 | action = function() 88 | Keys("CtrlF7") 89 | end 90 | } 91 | ]] 92 | 93 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Editor.ReloadFile.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Editor: Reload a file 4 | http://forum.farmanager.com/viewtopic.php?f=57&t=10599 5 | 6 | This macro allows to reload a file from the disk. 7 | Any changes made in the editor may be lost. 8 | 9 | ]] 10 | 11 | --------------------------------------------------------------------------- 12 | 13 | local EDITOR_MODIFIED = 0x00000008 14 | 15 | local MSG_WARNING = 0x00000001 16 | local MSG_OKCANCEL = 0x00020000 17 | 18 | --------------------------------------------------------------------------- 19 | 20 | local msg_title = "Warning" 21 | local msg_text = "FIle modified, everything will be lost" 22 | 23 | --------------------------------------------------------------------------- 24 | 25 | Macro { 26 | area = "Editor"; 27 | key = "CtrlR"; 28 | flags = ""; 29 | description = "Editor: Reload a file"; 30 | action = function() 31 | local state = bit.band(Editor.State, EDITOR_MODIFIED) 32 | if state ~= 0 then 33 | local answer = msgbox(msg_title, msg_text, MSG_WARNING + MSG_OKCANCEL) 34 | if answer ~= 1 then return end 35 | end 36 | 37 | local history = Far.DisableHistory() 38 | Far.DisableHistory(-1) 39 | 40 | -- Avoid saving the file 41 | Keys("F6 " .. ( state ~= 0 and "Right Enter" or "" ) .. " F6") 42 | 43 | Far.DisableHistory(history) 44 | end; 45 | } 46 | 47 | --------------------------------------------------------------------------- 48 | 49 | -- EOF 50 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Editor.SmartHomeEnd.lua: -------------------------------------------------------------------------------- 1 | 2 | -- http://forum.farmanager.com/viewtopic.php?f=15&t=8421 3 | -- https://github.com/Firebie/FarScripts/blob/master/Editor/Editor.SmartHomeEnd.lua 4 | 5 | -- version 1.4 6 | 7 | local function EditorSelect(editorId, blockType, startLine, startPos, linesCount, posCount) 8 | editor.Select( 9 | editorId, 10 | blockType, 11 | startLine, 12 | startPos, 13 | linesCount, 14 | posCount) 15 | end 16 | 17 | local function EditorClearSelection(editorId) 18 | editor.Select(editorId, 0) 19 | end 20 | 21 | local function SelectBlock(info, sel, curPos, blockType, persistentBlocks) 22 | 23 | local curLine = info.CurLine 24 | 25 | if sel and not persistentBlocks then 26 | 27 | -- we either had cursor at the block begin or at the block end 28 | if curLine == sel.StartLine and info.CurPos == sel.StartPos then 29 | 30 | -- so, cursor was the block begin, 31 | -- so, we lock block end 32 | if curLine == sel.EndLine and curPos == sel.EndPos then 33 | EditorClearSelection(info.EditorId) 34 | elseif curLine < sel.EndLine or (curLine == sel.EndLine and (curPos - 1) < sel.EndPos) then 35 | -- mark from curPos to block end 36 | EditorSelect(info.EditorId, blockType, curLine, curPos, sel.EndPos - curPos + 1, sel.EndLine - curLine + 1) 37 | else 38 | -- mark from block end to curPos 39 | EditorSelect(info.EditorId, blockType, sel.EndLine, sel.EndPos + 1, curPos - sel.EndPos - 1, curLine - sel.EndLine + 1) 40 | end 41 | else 42 | -- so, cursor was the block end 43 | -- so, we lock block begin 44 | if curLine == sel.StartLine and curPos == sel.StartPos then 45 | EditorClearSelection(info.EditorId) 46 | elseif curLine < sel.StartLine or (curLine == sel.StartLine and curPos < sel.StartPos) then 47 | -- mark from curPos to block begin 48 | EditorSelect(info.EditorId, blockType, curLine, curPos, sel.StartPos - curPos, sel.StartLine - curLine + 1) 49 | else 50 | -- mark from block begin to curPos 51 | EditorSelect(info.EditorId, blockType, sel.StartLine, sel.StartPos, curPos - sel.StartPos, curLine - sel.StartLine + 1) 52 | end 53 | end 54 | else 55 | -- no selection block 56 | 57 | if curPos == info.CurPos then 58 | EditorClearSelection(info.EditorId) 59 | elseif curPos < info.CurPos then 60 | EditorSelect(info.EditorId, blockType, curLine, curPos, info.CurPos - curPos, 1) 61 | else 62 | EditorSelect(info.EditorId, blockType, curLine, info.CurPos, curPos - info.CurPos, 1) 63 | end 64 | end 65 | 66 | end; 67 | 68 | local function SmartHome(select, blockType) 69 | 70 | blockType = blockType or far.Flags.BTYPE_STREAM 71 | 72 | local info = editor.GetInfo() 73 | local sel = editor.GetSelection() 74 | local persistentBlocks = band(info.Options, far.Flags.EOPT_PERSISTENTBLOCKS) ~= 0; 75 | 76 | if info then 77 | local str = editor.GetString(-1, info.CurLine) 78 | local s = str.StringText 79 | local len = s:len() 80 | local pos = 1 81 | 82 | for i = 1, len do 83 | local c = s:sub(i, i) 84 | if not c:match("%s") then 85 | 86 | pos = i 87 | if pos == info.CurPos then 88 | pos = 1 89 | end 90 | 91 | break 92 | end 93 | end 94 | 95 | editor.SetPosition(info.EditorId, info.CurLine, pos) 96 | if (select) then 97 | SelectBlock(info, sel, pos, blockType, persistentBlocks) 98 | elseif band(info.Options, far.Flags.EOPT_PERSISTENTBLOCKS) == 0 then 99 | editor.Select(info.EditorId, 0) 100 | end 101 | 102 | end 103 | end 104 | 105 | local function SmartEnd(select, blockType) 106 | 107 | blockType = blockType or far.Flags.BTYPE_STREAM 108 | 109 | local info = editor.GetInfo() 110 | local sel = editor.GetSelection() 111 | local persistentBlocks = band(info.Options, far.Flags.EOPT_PERSISTENTBLOCKS) ~= 0; 112 | 113 | if info then 114 | local str = editor.GetString(-1, info.CurLine) 115 | local s = str.StringText 116 | local len = s:len() 117 | local pos = len + 1 118 | 119 | for i = len, 1, -1 do 120 | local c = s:sub(i, i) 121 | if not c:match("%s") then 122 | 123 | pos = i + 1 124 | if pos == info.CurPos then 125 | pos = len + 1 126 | end 127 | 128 | break 129 | end 130 | end 131 | 132 | editor.SetPosition(info.EditorId, info.CurLine, pos) 133 | 134 | if (select) then 135 | SelectBlock(info, sel, pos, blockType, persistentBlocks) 136 | elseif band(info.Options, far.Flags.EOPT_PERSISTENTBLOCKS) == 0 then 137 | editor.Select(info.EditorId, 0) 138 | end 139 | 140 | end 141 | end 142 | 143 | 144 | Macro { 145 | area = "Editor"; 146 | key = "Home Num7"; 147 | flags = ""; 148 | description = "Editor: Smart Move: Home"; 149 | action = function() 150 | SmartHome(false) 151 | end; 152 | } 153 | 154 | Macro { 155 | area = "Editor"; 156 | key = "End Num1"; 157 | flags = ""; 158 | description = "Editor: Smart Move: End"; 159 | action = function() 160 | SmartEnd(false) 161 | end; 162 | } 163 | 164 | Macro { 165 | area = "Editor"; 166 | key = "ShiftHome ShiftNum7"; 167 | flags = ""; 168 | description = "Editor: Smart Select: ShiftHome"; 169 | action = function() 170 | SmartHome(true) 171 | end; 172 | } 173 | 174 | Macro { 175 | area = "Editor"; 176 | key = "ShiftEnd ShiftNum1"; 177 | flags = ""; 178 | description = "Editor: Smart Select: ShiftEnd"; 179 | action = function() 180 | SmartEnd(true) 181 | end; 182 | } 183 | 184 | --[[ 185 | 186 | Macro { 187 | area = "Editor"; 188 | key = "AltShiftHome AltShiftNum7"; 189 | flags = ""; 190 | description = "Editor: Smart AltShiftHome"; 191 | action = function() 192 | SmartHome(true, far.Flags.BTYPE_COLUMN) 193 | end; 194 | } 195 | 196 | ]] 197 | 198 | --[[ 199 | 200 | Macro { 201 | area = "Editor"; 202 | key = "AltShiftEnd AltShiftNum1"; 203 | flags = ""; 204 | description = "Editor: Smart AltShiftEnd"; 205 | action = function() 206 | SmartEnd(true, far.Flags.BTYPE_COLUMN) 207 | end; 208 | } 209 | 210 | ]] 211 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Editor.scite_like.lua: -------------------------------------------------------------------------------- 1 | -- Started 2014-12-01 by Shmuel Zeigerman 2 | -- http://forum.farmanager.com/viewtopic.php?f=15&t=9191 3 | -- http://forum.farmanager.com/viewtopic.php?p=126100#p126100 4 | 5 | -- Imitate the feature of typing/erasing on multiple lines at once (like the SciTE editor does). 6 | -- * Select a vertical block 0 or 1 character wide. 7 | -- * Position the cursor on any line covered with the block. 8 | -- * Type or delete (Del, BS) the text. 9 | 10 | -- OPTIONS ----------------------------------------------------------------------------------------- 11 | 12 | -- Replace the block with entered character; delete the block contents on pressing Del or BS. 13 | -- This option works for vertical blocks with width >= 2. 14 | local OptReplaceBlock = true 15 | 16 | -- Use Alt codes e.g. Alt+64 --> @. (This feature is still experimental). 17 | local OptUseAltCodes = false 18 | 19 | -- Reset selection on cursor key moves (only with non-persistent blocks) 20 | local OptCursorMoveResetsBlock = true 21 | 22 | -- END OF OPTIONS ---------------------------------------------------------------------------------- 23 | 24 | local F = far.Flags 25 | local band = (bit or bit64).band 26 | local CharMap = {Space=" ", ShiftSpace=" ", Tab="\t", BackSlash="\\", 27 | Add="+", Subtract="-", Multiply="*", Divide="/", Decimal="."} 28 | local KeyMap = {Num2="Down", Num4="Left", Num6="Right", Num8="Up", NumDel="Del", ShiftIns="CtrlV", ShiftNum0="CtrlV"} 29 | 30 | Event { 31 | group="EditorInput"; 32 | action=function(Rec) 33 | if Rec.EventType ~= F.KEY_EVENT then return false end 34 | 35 | local EI = editor.GetInfo() 36 | if not (EI and EI.BlockType==F.BTYPE_COLUMN and band(EI.CurState,F.ECSTATE_LOCKED)==0) then return false end 37 | 38 | local uc = Rec.UnicodeChar 39 | local altchar = OptUseAltCodes and not Rec.KeyDown and Rec.VirtualKeyCode==18 and uc~="" and uc~="\0" and uc 40 | local key = not altchar and far.InputRecordToName(Rec) 41 | key = KeyMap[key] or key 42 | 43 | if OptCursorMoveResetsBlock and band(EI.Options,F.EOPT_PERSISTENTBLOCKS)==0 then 44 | if key=="Left" or key=="Right" or key=="Up" or Key=="Down" then return false end 45 | end 46 | 47 | if not (altchar or key=="CtrlV" or (Rec.KeyDown and band(Rec.ControlKeyState,0x0F)==0)) then return false end 48 | local cur = editor.GetString() 49 | local BlockWidth = cur and cur.SelStart>0 and cur.SelEnd-cur.SelStart+1 50 | if not (BlockWidth and (OptReplaceBlock or BlockWidth<=1)) then return false end 51 | 52 | local char = altchar or key and (CharMap[key] or key:match("^.$")) 53 | local text = char 54 | if key=="CtrlV" then 55 | local clip = far.PasteFromClipboard() 56 | text = clip and clip:match("^([^\r\n]*)\r?\n?$") 57 | if not text then return false end 58 | end 59 | local textlen = text and text:len() or 0 60 | 61 | local delblock = OptReplaceBlock and BlockWidth>1 62 | if delblock and not (text or key=="Del" or key=="BS") then return false end 63 | 64 | if not (text or key=="Del" or key=="BS" or key=="Left" or key=="Right" or key=="Up" or key=="Down") then return false end 65 | 66 | if (key=="BS" or key=="Left") and EI.CurPos==1 then return true end 67 | 68 | if key=="Up" then 69 | if EI.CurLine==1 then return true end 70 | if EI.CurLine==EI.BlockStartLine then return false end 71 | elseif key=="Down" then 72 | if EI.CurLine==EI.TotalLines then return true end 73 | local line = editor.GetString(nil,EI.CurLine+1) 74 | if not line or line.SelStart <= 0 then return false end 75 | end 76 | 77 | local lnum = EI.BlockStartLine 78 | local clean = true 79 | local BlockStartRealPos, BlockStartTabPos 80 | while true do 81 | local line = editor.GetString(nil,lnum) 82 | if not line or line.SelStart <= 0 then break end 83 | BlockStartRealPos = BlockStartRealPos or line.SelStart 84 | BlockStartTabPos = BlockStartTabPos or editor.RealToTab(nil,lnum,BlockStartRealPos) 85 | local pos = editor.TabToReal(nil,lnum,EI.CurTabPos) 86 | local s, len, newS = line.StringText, line.StringLength, nil 87 | if delblock then 88 | if key == "Del" or key == "BS" then 89 | if line.SelStart <= len then newS = s:sub(1,line.SelStart-1)..s:sub(line.SelEnd+1) end 90 | elseif text then 91 | if line.SelStart > len+1 then newS = s..(" "):rep(line.SelStart-len-1)..text 92 | else newS = s:sub(1,line.SelStart-1)..text..s:sub(line.SelEnd+1) 93 | end 94 | end 95 | else 96 | if key == "Del" then 97 | if pos <= len then newS = s:sub(1,pos-1)..s:sub(pos+1) end 98 | elseif key == "BS" then 99 | if pos <= len+1 then newS = s:sub(1,pos-2)..s:sub(pos) end 100 | elseif text then 101 | if pos > len+1 then newS = s..(" "):rep(pos-len-1)..text 102 | else newS = s:sub(1,pos-1)..text..s:sub(pos+(EI.Overtype~=0 and textlen or 0)) 103 | end 104 | end 105 | end 106 | if newS then 107 | if clean then editor.UndoRedo(nil,F.EUR_BEGIN); clean=false; end 108 | editor.SetString(nil, lnum, newS) 109 | end 110 | lnum = lnum + 1 111 | end 112 | if not clean then editor.UndoRedo(nil,F.EUR_END) end 113 | 114 | local textlen = text and text:len() or 0 115 | local realX, tabX, newY 116 | if delblock then 117 | realX = BlockStartRealPos + textlen 118 | tabX = BlockStartTabPos + textlen 119 | newY = EI.CurLine 120 | else 121 | realX = math.max(1, EI.CurPos + ((key=="Right") and 1 or (key=="BS" or key=="Left") and -1 or textlen)) 122 | tabX = editor.RealToTab(nil, EI.CurLine, realX) 123 | newY = math.max(1, EI.CurLine + (key=="Up" and -1 or key=="Down" and 1 or 0)) 124 | end 125 | editor.SetPosition(nil, newY, realX) 126 | editor.Select(nil, "BTYPE_COLUMN", EI.BlockStartLine, tabX, 1, lnum-EI.BlockStartLine) 127 | editor.Redraw() 128 | return true 129 | end; 130 | } 131 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Plugin.Common.Calc.lua: -------------------------------------------------------------------------------- 1 | 2 | local guid = '894EAABB-C57F-4549-95FC-4AC6F3102A36'; 3 | 4 | Macro { 5 | area = "Shell Viewer Editor"; 6 | key = "Alt="; 7 | flags = ""; 8 | description = "Common: Calulator"; 9 | action = function() 10 | Plugin.Call(guid, 1); 11 | -- Keys("F11 = Enter"); 12 | end 13 | } 14 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Plugin.Common.S&R.lua: -------------------------------------------------------------------------------- 1 | 2 | --[[ 3 | Macro { 4 | area = "Shell Viewer Editor"; 5 | key = "CtrlF"; 6 | flags = ""; 7 | description = "Common: CTRL+F to Find by S & R"; 8 | action = function() 9 | if Area.Shell then Keys('F11 & 2') end 10 | if Area.Viewer then Keys('F11 & 1') end 11 | if Area.Editor then Keys('F11 & 1') end 12 | end 13 | } 14 | 15 | Macro { 16 | area = "Shell Editor"; 17 | key = "CtrlH"; 18 | flags = ""; 19 | description = "Common: CTRL+H to Replace by S & R"; 20 | action = function() 21 | if Area.Shell then Keys('F11 & 3') end 22 | if Area.Editor then Keys("F11 & 2") end 23 | end 24 | } 25 | 26 | Macro { 27 | area = "Viewer Editor"; 28 | key = "F3"; 29 | flags = ""; 30 | description = "Common: F3 to continue Find/Replace by S & R"; 31 | action = function() 32 | if Area.Viewer then Keys('F11 & 2') end 33 | if Area.Editor then Keys('F11 & 3') end 34 | end 35 | } 36 | ]] 37 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Plugin.ConEmu.TabList.lua: -------------------------------------------------------------------------------- 1 |  2 | -- Place this file into your %FARPROFILE%\Macros\scripts 3 | 4 | 5 | -- Show all windows list from all consoles 6 | 7 | local ConEmu = "4b675d80-1d4a-4ea9-8436-fdc23f2fc14b" 8 | 9 | Macro 10 | { 11 | area="Shell QView Info Tree Search Dialog Editor Viewer"; 12 | key="F12"; 13 | flags="NoSendKeysToPlugins"; 14 | description="ConEmu: Show all windows list from all consoles"; 15 | action = function() 16 | local k = Plugin.Menu(ConEmu) and "T" or "F12" 17 | Keys(k) 18 | -- if Plugin.Menu(ConEmu) then 19 | -- Keys("T") 20 | -- end 21 | end 22 | } 23 | 24 | Macro 25 | { 26 | area="Shell QView Info Tree Search Dialog Editor Viewer"; 27 | key="CtrlShiftF12"; 28 | flags="NoSendKeysToPlugins"; 29 | description="ConEmu: Standard Far windows list"; 30 | action = function() 31 | Keys("F12") 32 | end 33 | } 34 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Plugin.Editor.AutoWrap.lua: -------------------------------------------------------------------------------- 1 | 2 | local guid = 'DEEC52C3-AC76-4AD3-A6EF-CAFC33BD4C05'; 3 | 4 | Macro { 5 | area = "Editor"; 6 | key = "AltBackSlash"; 7 | flags = ""; 8 | description = "Editor: Toggle AutoWrap"; 9 | action = function() 10 | Plugin.Call(guid); 11 | -- Keys("F11 BackSlash"); 12 | end 13 | } 14 | 15 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Plugin.Editor.EditCase.lua: -------------------------------------------------------------------------------- 1 | 2 | -- http://forum.farmanager.com/viewtopic.php?p=125855#p125855 3 | 4 | local shortcuts = { 5 | ["CtrlAltL"] = "Lower", 6 | ["CtrlAltT"] = "Title", 7 | ["CtrlAltU"] = "Upper", 8 | ["CtrlAltG"] = "Toggle", 9 | ["CtrlAltC"] = "Cyclic", 10 | } 11 | 12 | local desc = "Editor: Change Case"; 13 | 14 | local guid = "0E92FC81-4888-4297-A85D-31C79E0E0CEE"; 15 | 16 | Macro { 17 | description = desc .. ": Menu"; 18 | area = "Editor"; 19 | key = "F4"; 20 | action = function() 21 | Plugin.Call(guid); 22 | end 23 | } 24 | 25 | for key, cmd in pairs(shortcuts) do 26 | Macro { 27 | description = desc .. ": " .. cmd; 28 | area = "Editor"; 29 | key = key; 30 | action = function() 31 | Plugin.Call(guid, cmd); 32 | end 33 | } 34 | end 35 | 36 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Plugin.Editor.FarColorer.lua: -------------------------------------------------------------------------------- 1 | 2 | --local guid = 'D2F36B62-A470-418D-83A3-ED7A3710E5B5'; 3 | --local guid_main_menu = "45453CAC-499D-4B37-82B8-0A77F7BD087C"; 4 | local ColorerGUID = "D2F36B62-A470-418D-83A3-ED7A3710E5B5"; 5 | 6 | Macro { 7 | area = "Editor"; 8 | key = "AltL"; 9 | flags = ""; 10 | description = "Editor: List of types"; 11 | condition = function() 12 | return Plugin.Exist(ColorerGUID) 13 | end; 14 | action = function() 15 | Plugin.Call(ColorerGUID, "Types", "Menu") 16 | -- Plugin.Call(guid, 1); 17 | -- -- universal workaround for Far3 > 4242 and between 4499 and 4545 18 | -- -- Issue somewhere in FarColorer 1.2.1.8, 1.2.2 or 1.2.4 19 | -- if Menu.Id == guid_main_menu then Keys("Enter"); end; 20 | -- -- Keys("F11 c 1"); 21 | end 22 | } 23 | 24 | Macro { 25 | area = "Editor"; 26 | key = "Alt["; 27 | flags = ""; 28 | description = "Editor: Find pair brackets"; 29 | condition = function() 30 | return Plugin.Exist(ColorerGUID) 31 | end; 32 | action = function() 33 | Plugin.Call(ColorerGUID, "Brackets", "Match") 34 | -- Plugin.Call(guid, 2); 35 | -- -- Keys("F11 c 2") 36 | end 37 | } 38 | 39 | Macro { 40 | area = "Editor"; 41 | key = "Alt]"; 42 | flags = ""; 43 | description = "Editor: Select a block with brackets"; 44 | condition = function() 45 | return Plugin.Exist(ColorerGUID) 46 | end; 47 | action = function() 48 | Plugin.Call(ColorerGUID, "Brackets", "SelectAll") 49 | -- Plugin.Call(guid, 3); 50 | -- -- Keys("F11 c 3") 51 | end 52 | } 53 | 54 | Macro { 55 | area = "Editor"; 56 | key = "AltP"; 57 | flags = ""; 58 | description = "Editor: Select a block within brackets"; 59 | condition = function() 60 | return Plugin.Exist(ColorerGUID) 61 | end; 62 | action = function() 63 | Plugin.Call(ColorerGUID, "Brackets", "SelectIn") 64 | -- Plugin.Call(guid, 4); 65 | -- -- Keys("F11 c 4") 66 | end 67 | } 68 | 69 | Macro { 70 | area = "Editor"; 71 | key = "Alt;"; 72 | flags = ""; 73 | description = "Editor: List of functions"; 74 | condition = function() 75 | return Plugin.Exist(ColorerGUID) 76 | end; 77 | action = function() 78 | Plugin.Call(ColorerGUID, "Functions", "Show") 79 | -- Plugin.Call(guid, 5); 80 | -- -- Keys("F11 c 5") 81 | end 82 | } 83 | 84 | Macro { 85 | area = "Editor"; 86 | key = "Alt'"; 87 | flags = ""; 88 | description = "Editor: List of errors"; 89 | condition = function() 90 | return Plugin.Exist(ColorerGUID) 91 | end; 92 | action = function() 93 | Plugin.Call(ColorerGUID, "Errors", "Show") 94 | -- Plugin.Call(guid, 6); 95 | -- -- Keys("F11 c 6") 96 | end 97 | } 98 | 99 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Plugin.Editor.Visualizer.lua: -------------------------------------------------------------------------------- 1 | 2 | Macro { 3 | area = "Editor"; 4 | key = "CtrlShift8"; 5 | flags = ""; 6 | description = "Editor: Show/Hide EOL"; 7 | action = function() 8 | Keys("F11  Space Enter") 9 | end 10 | } 11 | 12 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Plugin.Panel.VisualCompare.lua: -------------------------------------------------------------------------------- 1 | -- https://forum.farmanager.com/viewtopic.php?p=165567#p165567 2 | ----------------------------------------------------------------------------------------- 3 | -- Panel.VisualCompare, v1.5, (c) 2014, LanKing. 4 | -- 5 | -- 2021/03/17 6 | -- Обновление от siberia-man: дальнейшее развитие скрипта: 7 | -- Возможность указать свой любимый "сравниватель" 8 | -- Вывел основную логику обработки в отдельную функцию 9 | -- Горячие клавиши вынесены наверх скрипта для "простоты конфигурирования" 10 | -- Косметические изменения в коде 11 | -- 12 | -- 2015/01/26 13 | -- Подправлено fml2: добавлена возможность сравнивать с помощью BeyondCompare 14 | -- 15 | -- 2014/12/20 16 | -- Сравнение файлов с помощью плагина Visual Compare с поддержкой Branch панелей 17 | 18 | -- Плагин является продвинутой версией плагина от AleXH, переписанного LanKing 19 | -- Пофикшены некоторые баги, добавлены дополнительные условия и дополнения по интерфейсу 20 | -- В разработке также использовались наработки SimSU (локализация) 21 | 22 | 23 | -- Варианты работы: 24 | -- 1. На активной панели выделено 2 файла или 2 директории - сравнить их 25 | -- 2. На обоих панелях выделено по 1 файлу - сравнить их 26 | -- 3. Иные случаи: Курсор на обеих панелях на файлах: Если пути не одинаковые, сравнить их; 27 | -- 4. Если в предидущем пункте пути одинаковые -- запустить меню плагина; 28 | 29 | -- Также если попытаться сравнить файл и папку, что невозможно: будет выведено сообщение 30 | -- об ошибке с предложением стандартного диалога Visual Compare 31 | 32 | ----------------------------------------------------------------------------------------- 33 | 34 | -- External application parameters 35 | --local ExtComp = "BCompare" 36 | --local ExtCompOpts = "" 37 | 38 | --local ExtComp = "ExamDiff" 39 | --local ExtCompOpts = "/t" 40 | 41 | local ExtComp = "winmerge" 42 | local ExtCompOpts = "" 43 | 44 | --------------------------------------------------------------------------- 45 | 46 | -- Hotkeys to launch VisualCompare and external tool 47 | 48 | local hotkeys = { 49 | VisComp = "Ctrl/"; 50 | ExtComp = "CtrlShift/"; 51 | } 52 | 53 | --------------------------------------------------------------------------- 54 | 55 | ---- Локализация 56 | _G.far.lang = far.lang or win.GetEnv("farlang") 57 | 58 | -- Встроенные языки / Buildin laguages 59 | local function Messages() 60 | if far.lang == "Russian" then 61 | return { 62 | Description = "Сравнение 2 выделенных файлов/каталогов (VisualCompare)"; 63 | DescriptionAlt = "Сравнение 2 выделенных файлов/каталогов ("..ExtComp..")"; 64 | MsgSameFiles = "Visual Compare: Обнаружены одинаковые объекты."; 65 | MsgStandartDlg = 'Запустить стандартный диалог сравнения?'; 66 | MsgDifferent = "Visual Compare: Невозможно сравнить файл и папку"; 67 | } 68 | else 69 | return{ 70 | Description = "Compare files/dirs with VisualCompare"; 71 | DescriptionAlt = "Compare files/dirs with "..ExtComp..""; 72 | MsgSameFiles = "Visual Compare: Objects are equal."; 73 | MsgStandartDlg = 'Start standart compare dialog?'; 74 | MsgDifferent = "Visual Compare: Can't compare file and folder"; 75 | } 76 | end; 77 | end; 78 | 79 | local M = Messages(); 80 | 81 | --------------------------------------------------------------------------- 82 | 83 | local VisComp = "AF4DAB38-C00A-4653-900E-7A8230308010" 84 | 85 | --------------------------------------------------------------------------- 86 | 87 | local function getNamesToCompare() 88 | -- Can't compare file and folder message 89 | local function badattr(f1, f2) 90 | if msgbox(M.MsgDifferent, "\n"..f1.."\n"..f2.."\n\n"..M.MsgStandartDlg.."\n\n", 0x00040000) == 1 then Plugin.Menu(VisComp) end; 91 | return false; 92 | end; 93 | 94 | local AP, PP, AC, PC, fn, attrChecked = APanel.Path0, PPanel.Path0, APanel.Current, PPanel.Current ,"", false 95 | 96 | -- 2 files on active panel 97 | if APanel.SelCount == 2 then 98 | PP, AC, PC = AP, panel.GetSelectedPanelItem(nil, 1, 1), panel.GetSelectedPanelItem(nil, 1, 2) 99 | 100 | if mf.index(AC.FileAttributes, 'd') ~= mf.index(PC.FileAttributes, 'd') then return badattr(AC.FileName, PC.FileName, true); end; 101 | AC, PC, attrChecked = AC.FileName, PC.FileName, true 102 | 103 | -- selected one file on active and one on passive 104 | elseif APanel.SelCount == 1 and PPanel.SelCount == 1 then 105 | AC, PC = panel.GetSelectedPanelItem(nil, 1, 1), panel.GetSelectedPanelItem(nil, 0, 1) 106 | 107 | if mf.index(AC.FileAttributes, 'd') ~= mf.index(PC.FileAttributes, 'd') then return badattr(AC.FileName, PC.FileName, true); end; 108 | AC, PC, attrChecked = AC.FileName, PC.FileName, true 109 | end 110 | 111 | if AC:match("^[A-Z]:") then AP = AC elseif AP == "" then AP = "\\" elseif AC ~= ".." then AP = AP.."\\"..AC end 112 | if PC:match("^[A-Z]:") then PP = PC elseif PP == "" then PP = "\\" elseif PC ~= ".." then PP = PP.."\\"..PC end -- тут может быть условие для .. 113 | 114 | if (not attrChecked and not APanel.Folder == PPanel.Folder) then return badattr(AP, PP); end; 115 | 116 | if AP == PP then 117 | if msgbox(M.MsgSameFiles, "\n"..AP.."\n\n"..M.MsgStandartDlg.."\n\n", 0x00040000) == 1 then Plugin.Menu(VisComp) end; 118 | else 119 | if (APanel.SelCount ~= 2 and not APanel.Left) then fn = PP..'" "'..AP else fn = AP..'" "'..PP end 120 | return '"'..fn..'"'; 121 | end 122 | end; 123 | 124 | --------------------------------------------------------------------------- 125 | 126 | local function callCompare(mode) 127 | local fn = getNamesToCompare() 128 | if fn == false then return false; end; 129 | 130 | if mode == 0 then 131 | Plugin.Command(VisComp, fn) 132 | else 133 | win.system(ExtComp..' '..ExtCompOpts..' '..fn) 134 | end 135 | end 136 | 137 | --------------------------------------------------------------------------- 138 | 139 | Macro { 140 | description = M.Description; 141 | area = "Shell Tree"; 142 | key = hotkeys.VisComp; 143 | action = function() 144 | callCompare(0) 145 | end 146 | } 147 | 148 | Macro { 149 | description = M.DescriptionAlt; 150 | area = "Shell Tree"; 151 | key = hotkeys.ExtComp; 152 | action = function() 153 | callCompare(1) 154 | end 155 | } 156 | 157 | --------------------------------------------------------------------------- 158 | 159 | -- EOF 160 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Plugin.Shell.EMenu.lua: -------------------------------------------------------------------------------- 1 | 2 | Macro { 3 | area = "Shell"; 4 | key = "Apps"; 5 | flags = ""; 6 | description = "Shell: Windows Context Menu"; 7 | action = function() 8 | Keys("F11 o") 9 | end 10 | } 11 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Shell.AutoCompletion.lua: -------------------------------------------------------------------------------- 1 | 2 | -- http://forum.farmanager.com/viewtopic.php?f=60&t=8013 3 | 4 | --[[ 5 | Macro { description="Shell: Don't steal important keys!"; 6 | area="ShellAutoCompletion DialogAutoCompletion"; key="Up Down Home End Num7 Num1"; 7 | action=function() Keys("Esc AKey") end; 8 | } 9 | 10 | Macro { description="Shell: Use Ctrl- to navigate in list"; 11 | area="ShellAutoCompletion DialogAutoCompletion"; key="/^[LR]Ctrl(Up|Down|Home|Num7)$/"; 12 | action=function() Keys(akey(1):match("Ctrl(.+)")) end; 13 | } 14 | 15 | Macro { description="Shell: CtrlEnd acts like in panels/dialog"; 16 | area="ShellAutoCompletion DialogAutoCompletion"; key="/^[LR]Ctrl(End|Num1)$/"; 17 | action=function() Keys("Down") end; 18 | } 19 | 20 | Macro { description="Shell: Esc to close list and discard all changes"; --you can use F10 or CtrlTab to close and keep text 21 | area="ShellAutoCompletion DialogAutoCompletion"; key="Esc"; 22 | action=function() 23 | if Menu.Filter(2)~=0 then Menu.Filter(0,0) end --turn filter off 24 | Keys("Home Esc") 25 | end; 26 | } 27 | ]] 28 | 29 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Shell.CdUp.Light.lua: -------------------------------------------------------------------------------- 1 | 2 | -- https://forum.farmanager.com/viewtopic.php?p=149194#p149194 3 | 4 | --------------------------------------------------------------------------- 5 | 6 | local FARPANEL_BRODER_WIDTH_LEFT = 1 7 | local FARPANEL_BRODER_WIDTH_RIGHT = 1 8 | 9 | local FARMENU_BORDER_WIDTH_LEFT = 5 10 | local FARMENU_BORDER_WIDTH_RIGHT = 6 11 | 12 | --------------------------------------------------------------------------- 13 | 14 | local OMIT = "..." 15 | local oLen = string.len(OMIT) 16 | 17 | function string.shrink(s, width) 18 | local sLen = string.len(s) 19 | return sLen <= width and s or OMIT .. string.sub(s, sLen - width + oLen + 1) 20 | end 21 | 22 | --------------------------------------------------------------------------- 23 | 24 | local function FillTable(t, path, width) 25 | local pLen = string.len(path) 26 | local pos = 0 27 | 28 | repeat 29 | pos = string.find(path, "\\", pos + 1, true) 30 | 31 | local s = string.sub(path, 1, pos and pos or pLen) 32 | if s == "" then s = "\\" end 33 | 34 | local sLen = string.len(s) 35 | table.insert(t, { 36 | path = s; 37 | text = string.shrink(s, width); 38 | }) 39 | until not pos or pos >= pLen 40 | end 41 | 42 | --------------------------------------------------------------------------- 43 | 44 | local function ShowMenu() 45 | local items = {} 46 | 47 | -- max width for the menu items 48 | local width = APanel.Width - FARMENU_BORDER_WIDTH_LEFT - FARMENU_BORDER_WIDTH_RIGHT 49 | 50 | FillTable(items, APanel.Path0, width) 51 | 52 | if APanel.Plugin then 53 | table.insert(items, { separator = true }) 54 | FillTable(items, APanel.Path, width) 55 | end 56 | 57 | local item = far.Menu({ 58 | Title = "Go to..."; 59 | SelectIndex = #items; 60 | -- Fit the menu into the width of the active panel taking into account the border widths 61 | X = ( APanel.Left and 0 or PPanel.Width ) + FARPANEL_BRODER_WIDTH_LEFT + FARPANEL_BRODER_WIDTH_RIGHT; 62 | }, items) 63 | 64 | if item then Panel.SetPath(0, item.path) end 65 | end 66 | 67 | --------------------------------------------------------------------------- 68 | 69 | if Macro == nil then 70 | ShowMenu() 71 | return 72 | end 73 | 74 | Macro { 75 | description = "Shell: Cd Up (Light)"; 76 | area = "Shell"; 77 | key = "AltPgUp"; 78 | --condition = function() return APanel.Visible end; 79 | action = ShowMenu; 80 | } 81 | 82 | --------------------------------------------------------------------------- 83 | 84 | -- EOF 85 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Shell.CdUp.lua: -------------------------------------------------------------------------------- 1 | 2 | -- http://forum.farmanager.com/viewtopic.php?f=60&t=6542 3 | 4 | local function FillTable(t, path) 5 | while true do 6 | path = path:match("(.*)\\[^\\]+$") 7 | if path==nil then break end 8 | t[#t+1] = {path=path.."\\"} 9 | end 10 | end 11 | 12 | local function ShowMenu() 13 | local items = {} 14 | if APanel.Plugin then 15 | FillTable(items, APanel.Path) 16 | if items[1] then items[#items+1] = { separator=true } end 17 | items[#items+1] = { path=APanel.Path0 } 18 | end 19 | FillTable(items, APanel.Path0) 20 | if items[1] then 21 | for k,v in ipairs(items) do 22 | if v.path then 23 | local extra = v.path:len() - Far.Width + 8 24 | v.text = extra<=0 and v.path or "..."..v.path:sub(extra+4) 25 | end 26 | end 27 | local item = far.Menu({Title="Go to ..."}, items) 28 | if item then Panel.SetPath(0, item.path) end 29 | end 30 | end 31 | 32 | Macro { 33 | area = "Shell"; 34 | key = "CtrlBS"; 35 | description = "Shell: Menu with list of parent directories (CD up)"; 36 | condition = function() 37 | return CmdLine.Empty and APanel.Visible 38 | end; 39 | action = ShowMenu; 40 | } 41 | 42 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Shell.CmdLine.CursorMovement.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | This macro is simplified and improved version of the macro 4 | Shell_CmdLine.lua having the same functionality and borrowed here: 5 | https://forum.farmanager.com/viewtopic.php?p=93265#p93265 6 | 7 | ]] 8 | 9 | local function CursorMoveHome(SelectText) 10 | local SelStart, SelEnd = 0, 0 11 | 12 | if SelectText then 13 | SelStart, SelEnd = panel.GetCmdLineSelection() 14 | local Pos = panel.GetCmdLinePos() 15 | 16 | if Pos == SelEnd + 1 then 17 | SelEnd = SelStart - 1 18 | elseif Pos ~= SelStart then 19 | SelEnd = Pos - 1 20 | end 21 | 22 | SelStart = 1 23 | 24 | -- Pos = Pos == SelStart and SelEnd + 1 or Pos == SelEnd + 1 and SelStart or Pos 25 | end 26 | 27 | panel.SetCmdLineSelection(nil, SelStart, SelEnd) 28 | panel.SetCmdLinePos(nil, 1) 29 | end 30 | 31 | local function CursorMoveEnd(SelectText) 32 | local SelStart, SelEnd = 0, 0 33 | local Len = panel.GetCmdLine():len() 34 | 35 | if SelectText then 36 | SelStart, SelEnd = panel.GetCmdLineSelection() 37 | local Pos = panel.GetCmdLinePos() 38 | 39 | if Pos == SelStart then 40 | SelStart = SelEnd + 1 41 | elseif Pos ~= SelEnd + 1 then 42 | SelStart = Pos 43 | end 44 | 45 | SelEnd = Len 46 | 47 | -- Pos = Pos == SelStart and SelEnd + 1 or Pos == SelEnd + 1 and SelStart or Pos 48 | end 49 | 50 | panel.SetCmdLineSelection(nil, SelStart, SelEnd) 51 | panel.SetCmdLinePos(nil, Len + 1) 52 | end 53 | 54 | Macro { 55 | area = "Shell Info QView Tree"; 56 | key = "Home Num7"; 57 | description = "CmdLine.CursorMovement.Home"; 58 | flags = "NotEmptyCommandLine"; 59 | action = function() CursorMoveHome() end; 60 | } 61 | 62 | Macro { 63 | area = "Shell Info QView Tree"; 64 | key = "ShiftHome ShiftNum7"; 65 | description = "CmdLine.CursorMovement.ShiftHome"; 66 | flags = "NotEmptyCommandLine"; 67 | action = function() CursorMoveHome(1) end; 68 | } 69 | 70 | Macro { 71 | area = "Shell Info QView Tree"; 72 | key = "End Num1"; 73 | description = "CmdLine.CursorMovement.End"; 74 | flags = "NotEmptyCommandLine"; 75 | action = function() CursorMoveEnd() end; 76 | } 77 | 78 | Macro { 79 | area = "Shell Info QView Tree"; 80 | key = "ShiftEnd ShiftNum1"; 81 | description = "CmdLine.CursorMovement.ShiftEnd"; 82 | flags = "NotEmptyCommandLine"; 83 | action = function() CursorMoveEnd(1) end; 84 | } 85 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Shell.CtrlBackSlash.lua: -------------------------------------------------------------------------------- 1 | -- https://forum.farmanager.com/viewtopic.php?p=154581#p154581 2 | 3 | Macro { 4 | area = "Shell"; 5 | key = "CtrlBackSlash"; 6 | description = "Shell: Cd \\ and highlght the upper level dir of the previous location"; 7 | action = function() 8 | local path = APanel.Path 9 | local root, dir 10 | if APanel.Plugin then -- plugin panel 11 | path = APanel.Current:find("\\") and APanel.Current or path 12 | root, dir = path:match("([^\\]*\\)([^\\]*)") 13 | elseif APanel.Path:find("^\\\\") then -- network share 14 | root, dir = path:match("^(\\\\[^\\]*\\%w%$\\)([^\\]*)") 15 | else -- local directory 16 | root, dir = path:match("([^\\]*\\)([^\\]*)") 17 | end 18 | if root then 19 | Panel.SetPath(0, root, dir) 20 | else 21 | Keys("CtrlBackSlash") -- default Far action 22 | end 23 | end; 24 | } 25 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Shell.DeepTarball.lua: -------------------------------------------------------------------------------- 1 | -- https://forum.farmanager.com/viewtopic.php?f=15&t=11109 2 | 3 | -- Enable or disable the macros 4 | local enabled = false 5 | 6 | --------------------------------------------------------------------------- 7 | 8 | -- *.tar 9 | local tar_ext = { 10 | "%.tar", 11 | } 12 | 13 | -- *.tgz or *.gz 14 | -- *.tbz or *.bz 15 | -- *.tbz2 or *.bz2 16 | -- *.txz or *.xz 17 | local zip_ext = { 18 | "%.t?gz", 19 | "%.t?bz2?", 20 | "%.t?xz", 21 | } 22 | 23 | -- *.tgz or *.tar.gz 24 | -- *.tbz or *.tar.bz 25 | -- *.tbz2 or *.tar.bz2 26 | -- *.txz or *.tar.xz 27 | local tarball_ext = { 28 | "%.tgz", "%.tar%.gz", 29 | "%.tbz2?", "%.tar%.bz2?", 30 | "%.txz", "%.tar%.xz", 31 | } 32 | 33 | local function is_file(f, ext) 34 | f = f:lower() 35 | for i = 1, #ext do 36 | if f:match("("..ext[i]..")$") then return true end 37 | end 38 | return false 39 | end 40 | 41 | local function is_tar(f) 42 | return is_file(f, tar_ext) 43 | end 44 | 45 | local function is_zip(f) 46 | return is_file(f, zip_ext) 47 | end 48 | 49 | local function is_tarball(f) 50 | return is_file(f, tarball_ext) 51 | end 52 | 53 | --------------------------------------------------------------------------- 54 | 55 | Macro { 56 | area = "Shell"; 57 | key = "Enter CtrlPgDn"; 58 | description = "Deep Tarball: Enter the archive"; 59 | condition = function() 60 | return enabled and is_tarball(APanel.Current) 61 | end; 62 | action = function() 63 | Keys("AKey Down AKey") 64 | end; 65 | } 66 | 67 | Macro { 68 | area = "Shell"; 69 | key = "Enter CtrlPgUp"; 70 | description = "Deep Tarball: Exit the archive"; 71 | condition = function() 72 | return enabled and ( APanel.Current == ".." or is_tar(APanel.HostFile) ) 73 | end; 74 | action = function() 75 | Keys("AKey") 76 | if APanel.Plugin and is_zip(APanel.HostFile) then Keys("Up AKey") end 77 | end; 78 | } 79 | 80 | --------------------------------------------------------------------------- 81 | 82 | -- EOF 83 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Shell.EnterEmptyLine.lua: -------------------------------------------------------------------------------- 1 | -- http://forum.farmanager.com/viewtopic.php?p=127121#p127121 2 | 3 | -- This script scrolls the console (where program output goes) 4 | -- when the user presses Enter while the panels are hidden and 5 | -- the command line is empty. 6 | 7 | -- Whether the command prompt should be displayed in the inserted lines 8 | local leave_prompt = false 9 | 10 | Macro { 11 | description="Line feed via Enter in Userscreen"; 12 | area="Shell Tree Info QView"; 13 | key="Enter"; 14 | uid="3A6A0C4A-BBC8-4751-922D-09B59084DC5A"; 15 | condition=function() 16 | return not APanel.Visible and CmdLine.Empty 17 | end; 18 | action=function() 19 | local toggleKeyBar = Far.GetConfig"Screen.KeyBar" and "CtrlB" 20 | Keys(toggleKeyBar) 21 | if not leave_prompt then panel.GetUserScreen() end 22 | io.write("\n") 23 | panel.SetUserScreen() 24 | Keys(toggleKeyBar) 25 | end; 26 | } 27 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Shell.HiddenFiles.lua: -------------------------------------------------------------------------------- 1 | 2 | Macro { 3 | area = "Shell"; 4 | key = "CtrlShiftH"; 5 | flags = ""; 6 | description = "Shell: Show/hide hidden files"; 7 | action = function() 8 | Keys("CtrlH") 9 | end 10 | } 11 | 12 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Shell.History.lua: -------------------------------------------------------------------------------- 1 | 2 | Macro { 3 | area = "Shell Tree"; 4 | key = "CtrlUp"; 5 | flags = ""; 6 | -- flags = "EmptyCommandLine"; 7 | description = "Shell: Command History"; 8 | action = function() 9 | Keys("AltF8") 10 | end 11 | } 12 | 13 | Macro { 14 | area = "Shell Tree"; 15 | key = "CtrlDown"; 16 | flags = ""; 17 | -- flags = "EmptyCommandLine"; 18 | description = "Shell: Command History"; 19 | action = function() 20 | Keys("AltF8") 21 | end 22 | } 23 | 24 | 25 | Macro { 26 | area = "Shell Tree"; 27 | key = "CtrlLeft"; 28 | flags = "EmptyCommandLine"; 29 | description = "Shell: View & Edit History"; 30 | action = function() 31 | Keys("AltF11") 32 | end 33 | } 34 | 35 | 36 | Macro { 37 | area = "Shell Tree"; 38 | key = "CtrlRight"; 39 | flags = "EmptyCommandLine"; 40 | description = "Shell: Folder History"; 41 | action = function() 42 | Keys("AltF12") 43 | end 44 | } 45 | 46 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Shell.Rename.lua: -------------------------------------------------------------------------------- 1 | 2 | local NoFolders = true; 3 | 4 | Macro { 5 | area = "Shell"; 6 | -- key = "ShiftF6"; 7 | key = "/ShiftF[56]/"; 8 | flags = ""; 9 | description = "Shell: Highlight the filename of the file to be renamed"; 10 | action = function() 11 | if APanel.Current == ".." then 12 | return; 13 | end; 14 | 15 | Keys("AKey Home ShiftEnd"); 16 | 17 | if APanel.Folder and NoFolders then 18 | return; 19 | end; 20 | 21 | local text = Dlg.GetValue(); 22 | if regex.match(text, ".+\\..+") then 23 | Keys("CtrlShiftLeft ShiftLeft"); 24 | end; 25 | end; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /etc/Far3/Profile/Macros/scripts/Viewer.PgDn.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ildar-shaimordanov/tea-set/4decb128dac4606e91edd2355aa167f588082958/etc/Far3/Profile/Macros/scripts/Viewer.PgDn.lua -------------------------------------------------------------------------------- /etc/PuTTY/README: -------------------------------------------------------------------------------- 1 | Default settings for the portable version of PuTTY by Jacub Kotrla: 2 | https://jakub.kotrla.net/putty/ 3 | 4 | Copy the content of this directory into the place on your computer where 5 | you have deployed PuTTY. 6 | 7 | The "#default-settings.session" file contains all PuTTY settings with some 8 | changes I found in my practice useful and convenient (see them below). You 9 | can modify this file as you want. The better way is to run PuTTY, load the 10 | session, change parameters and save again. Further these settings are 11 | spreaded on other sessions by executing the "create-putty-sessions.bat" 12 | script. 13 | 14 | The script reads the "putty.conf" configuration file to retreive the 15 | directory configured to store PuTTY sessions and the extension for 16 | sessions filenames. The list of hosts or sessions is read from the 17 | "sessions-list.txt" file. 18 | 19 | Both files "create-putty-sessions.bat" and "sessions-list.txt" MUST be 20 | placed in the same directory, next each other. 21 | 22 | # FILES 23 | 24 | The content of this directory: 25 | 26 | putty.conf 27 | The main PuTTY configuration file 28 | README 29 | This file 30 | config/create-putty-sessions.bat 31 | The script to create PuTTY sessions files 32 | config/sessions-list.txt 33 | The sessions list file 34 | config/sessions/#default-settings.session 35 | The default settings for other PuTTY sessions 36 | 37 | # SETTINGS 38 | 39 | The "#default-settings.session" file provides the following changed 40 | parameters: 41 | 42 | Window 43 | Lines of scrollback 44 | 2000000 45 | 46 | Window/Behaviour 47 | System menu appears on ALT Space 48 | on 49 | 50 | Connection 51 | Seconds between keepalives (0 to turn off) 52 | 10 53 | 54 | Connection/SSH/X11 55 | Enable X11 forwarding 56 | on 57 | -------------------------------------------------------------------------------- /etc/PuTTY/config/create-putty-sessions.bat: -------------------------------------------------------------------------------- 1 | 0 9 | 10 | $packages = @( 11 | 12 | @{ 13 | "name" = "7-zip"; 14 | "home" = "http://7-zip.org/"; 15 | "url" = "http://downloads.sourceforge.net/sevenzip/7za920.zip"; 16 | "dir" = "..\opt\7za"; 17 | "postinstall" = { 18 | $dir = $args[0]; 19 | $script:7zip_exe = "$dir\7za.exe"; 20 | }; 21 | } 22 | 23 | @{ 24 | "name" = "ConEmu"; 25 | "home" = "https://github.com/Maximus5/ConEmu/"; 26 | # "url" = "https://github.com/Maximus5/ConEmu/releases/download/v16.03.13/ConEmuPack.160313.7z"; 27 | "url" = "https://github.com/Maximus5/ConEmu/releases/download/v20.11.23a/ConEmuPack.201123a.7z"; 28 | "dir" = "ConEmu"; 29 | } 30 | 31 | @{ 32 | "Skip" = $True; 33 | "name" = "ConsoleZ"; 34 | "home" = "https://github.com/cbucher/console"; 35 | # "url" = "https://github.com/cbucher/console/releases/download/1.16.0/ConsoleZ.x86.1.16.0.16038.zip"; 36 | # "url" = "https://github.com/cbucher/console/releases/download/1.16.0/ConsoleZ.x64.1.16.0.16038.zip"; 37 | # "url" = "https://github.com/cbucher/console/releases/download/1.18.0/ConsoleZ.x64.1.18.0.17048.zip"; 38 | # "url" = "https://github.com/cbucher/console/releases/download/1.18.0/ConsoleZ.x86.1.18.0.17048.zip"; 39 | "dir" = "ConsoleZ"; 40 | } 41 | 42 | @{ 43 | "name" = "Clink"; 44 | "home" = "http://mridgers.github.io/clink"; 45 | "url" = "https://github.com/mridgers/clink/releases/download/0.4.8/clink_0.4.8.zip"; 46 | "dir" = "clink"; 47 | "onlyFiles" = $True; 48 | "postinstall" = { 49 | $dir = $args[0]; 50 | ls $dir | 51 | ? { $_.Attributes -eq "Directory" } | 52 | % { rmdir -Force -Path "$dir\$_"; }; 53 | }; 54 | } 55 | 56 | @{ 57 | "name" = "Far3"; 58 | "home" = "http://www.farmanager.com/"; 59 | "url" = "https://farmanager.com/files/Far30b5445.x64.20190807.7z" 60 | "dir" = "Far3"; 61 | } 62 | 63 | @{ 64 | "skip" = $True; 65 | "name" = "Notepad3"; 66 | "home" = "https://www.rizonesoft.com/downloads/notepad3/"; 67 | "url" = "https://github.com/rizonesoft/Notepad3/releases/download/RELEASE_4.18.512.992/Notepad3_4.18.512.992.zip"; 68 | "dir" = "..\GUI\notepad"; 69 | "postinstall" = { 70 | $dir = $args[0]; 71 | $ini = "$dir\Notepad3.ini"; 72 | mv -Force -Path "$ini" -Destination "$ini.orig"; 73 | & { 74 | "[Notepad3]"; 75 | "Notepad3.ini=..\..\etc\notepad\Notepad.ini"; 76 | } | Out-File "$ini"; 77 | }; 78 | } 79 | 80 | @{ 81 | "name" = "UnxUtils"; 82 | "home" = "http://unxutils.sourceforge.met/"; 83 | "url" = "http://downloads.sourceforge.net/project/unxutils/unxutils/current/UnxUtils.zip"; 84 | "dir" = "unxutils"; 85 | "postinstall" = { 86 | $dir = $args[0]; 87 | $src = "$dir\usr\local\wbin\*"; 88 | $dst = "$dir\bin"; 89 | mv -Force -Path $src -Destination $dst; 90 | }; 91 | } 92 | 93 | @{ 94 | "name" = "UnxUtils Updates"; 95 | "home" = "http://unxutils.sourceforge.met/"; 96 | "url" = "http://unxutils.sourceforge.net/UnxUpdates.zip"; 97 | "dir" = "unxutils\bin"; 98 | } 99 | 100 | @{ 101 | "name" = "Busybox"; 102 | "home" = "https://frippery.org/busybox/"; 103 | # "url" = "https://frippery.org/files/busybox/busybox.exe"; 104 | "url" = "https://frippery.org/files/busybox/busybox64.exe"; 105 | "dir" = "..\opt\busybox"; 106 | } 107 | ); 108 | 109 | # ========================================================================= 110 | 111 | $libexecDir = [System.IO.Path]::GetFullPath("$pwd\..\libexec"); 112 | $distribDir = "$pwd\distrib"; 113 | 114 | $7zip_exe = ""; 115 | 116 | # ========================================================================= 117 | 118 | function download-archive( [string]$url, [string]$targetDir ) { 119 | $filename = "$targetDir\" + [System.IO.Path]::GetFileName($url); 120 | if ( ! ( Test-Path $filename ) ) { 121 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; 122 | $webclient = New-Object System.Net.WebClient; 123 | $webclient.DownloadFile($url, $filename); 124 | } 125 | return $filename; 126 | } 127 | 128 | function extract-zip-v5( [string]$filename, [string]$targetDir ) { 129 | return Expand-Archive -Path $filename -DestinationPath $targetDir 130 | } 131 | 132 | function extract-zip( [string]$filename, [string]$targetDir ) { 133 | if ( $PSVersionTable.PSVersion.Major -gt 5 ) { 134 | return extract-zip-v5 $filename $targetDir 135 | } 136 | 137 | $shell = New-Object -com shell.application; 138 | $zip = $shell.NameSpace($filename); 139 | foreach ( $item in $zip.items() ) { 140 | $shell.Namespace($targetDir).CopyHere($item, 16); 141 | } 142 | } 143 | 144 | function extract-7z( [string]$filename, [string]$targetDir, [bool]$onlyFiles ) { 145 | $mode = if ( $onlyFiles ) { "e" } else { "x" }; 146 | & "$script:7zip_exe" $mode "$filename" -y "-o$targetDir"; 147 | } 148 | 149 | function extract-archive( [string]$filename, [string]$targetDir, [bool]$onlyFiles ) { 150 | if ( $script:7zip_exe ) { 151 | extract-7z $filename $targetDir $onlyFiles; 152 | } else { 153 | extract-zip $filename $targetDir; 154 | } 155 | } 156 | 157 | function install-package( $package ) { 158 | $dstDir = $script:libexecDir + "\" + $package.dir; 159 | 160 | "================================================================="; 161 | "Package : $($package.name)"; 162 | "Destination : $dstDir"; 163 | 164 | if ( $package.skip ) { 165 | "Skipped"; 166 | return; 167 | } 168 | 169 | New-Item -Force -ItemType Directory -Path $dstDir >$null; 170 | $filename = download-archive $package.url $script:distribDir; 171 | extract-archive $filename $dstDir ( !! $package.onlyFiles ); 172 | 173 | if ( ! $package.postinstall ) { 174 | return; 175 | } 176 | 177 | "`nInvoke command:"; 178 | $package.postinstall; 179 | Invoke-Command -ScriptBlock $package.postinstall -ArgumentList $dstDir; 180 | } 181 | 182 | # ========================================================================= 183 | 184 | $enabled = "$pwd\candy-for-tea.enabled"; 185 | $logfile = "$pwd\candy-for-tea.log"; 186 | 187 | if ( ! ( Test-Path "$enabled" ) ) { 188 | [System.Reflection.Assembly]::LoadWithPartialName( "System.Windows.Forms" ) >$Null; 189 | [System.Windows.Forms.MessageBox]::Show( "To enable execution create the file:`n$enabled.", "Disabled", 0, "Stop" ) >$Null; 190 | exit; 191 | } 192 | 193 | $packages | % { install-package $_; } | Out-File $logfile; 194 | 195 | if ( Test-Path $enabled ) { 196 | Remove-Item -Force -Path "$enabled"; 197 | } 198 | 199 | # ========================================================================= 200 | 201 | # EOF 202 | -------------------------------------------------------------------------------- /etc/candy-for-tea.enabled: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ildar-shaimordanov/tea-set/4decb128dac4606e91edd2355aa167f588082958/etc/candy-for-tea.enabled -------------------------------------------------------------------------------- /etc/clink/.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | *.dmp 3 | clink_history* 4 | -------------------------------------------------------------------------------- /etc/clink/clink_inputrc: -------------------------------------------------------------------------------- 1 | # When this file is named "default_inputrc" and is in the binaries 2 | # directory or profile directory, it provides enhanced default settings. 3 | 4 | # Override the built-in Readline defaults with ones that provide a more 5 | # enhanced Clink experience. 6 | 7 | set colored-completion-prefix on 8 | set colored-stats on 9 | set mark-symlinked-directories on 10 | set completion-auto-query-items on 11 | set history-point-at-end-of-anchored-search on 12 | set search-ignore-case on 13 | 14 | -------------------------------------------------------------------------------- /etc/clink/clink_settings: -------------------------------------------------------------------------------- 1 | # name: Strips CR and LF chars on paste 2 | # type: enum 3 | # options: delete,space,ampersand,crlf 4 | clink.paste_crlf = space 5 | 6 | # name: Auto-answer terminate prompt 7 | # type: enum 8 | # options: off,answer_yes,answer_no 9 | cmd.auto_answer = off 10 | 11 | # name: Pressing Ctrl-D exits session 12 | # type: boolean 13 | cmd.ctrld_exits = True 14 | 15 | # name: Argument color 16 | # type: color 17 | color.arg = bold 18 | 19 | # name: Argument info color 20 | # type: color 21 | color.arginfo = yellow 22 | 23 | # name: Shell command completions 24 | # type: color 25 | color.cmd = bold 26 | 27 | # name: Color for comment row 28 | # type: color 29 | color.comment_row = bright white on cyan 30 | 31 | # name: Description completion color 32 | # type: color 33 | color.description = bright cyan 34 | 35 | # name: Doskey completions 36 | # type: color 37 | color.doskey = bold cyan 38 | 39 | # name: Filtered completion color 40 | # type: color 41 | color.filtered = bold 42 | 43 | # name: Flag color 44 | # type: color 45 | color.flag = default 46 | 47 | # name: For user-interaction prompts 48 | # type: color 49 | color.interact = bold 50 | 51 | # name: Message area color 52 | # type: color 53 | color.message = default 54 | 55 | # name: Prompt color 56 | # type: color 57 | color.prompt = bright red 58 | 59 | # name: Color for suggestion text 60 | # type: color 61 | color.suggestion = bright black 62 | 63 | # name: Unexpected argument color 64 | # type: color 65 | color.unexpected = default 66 | 67 | # name: Controls how duplicate entries are handled 68 | # type: enum 69 | # options: add,ignore,erase_prev 70 | history.dupe_mode = erase_prev 71 | 72 | # name: Sets how command history expansion is applied 73 | # type: enum 74 | # options: off,on,not_squoted,not_dquoted,not_quoted 75 | history.expand_mode = not_quoted 76 | 77 | # name: Skip adding lines prefixed with whitespace 78 | # type: boolean 79 | history.ignore_space = False 80 | 81 | # name: The number of history lines to save 82 | # type: integer 83 | history.max_lines = 10000 84 | 85 | # name: Save history between sessions 86 | # type: boolean 87 | history.save = True 88 | 89 | # name: Share history between instances 90 | # type: boolean 91 | history.shared = False 92 | 93 | # name: Controls VT emulation 94 | # type: enum 95 | # options: native,emulate,auto 96 | terminal.emulation = auto 97 | 98 | # name: Esc sends a literal escape character 99 | # type: boolean 100 | terminal.raw_esc = False 101 | 102 | # name: Support Windows' Ctrl-Alt substitute for AltGr 103 | # type: boolean 104 | terminal.use_altgr_substitute = True 105 | 106 | 107 | 108 | exec.cwd = 1 109 | 110 | exec.dirs = 1 111 | 112 | exec.enable = 1 113 | 114 | exec.path = 1 115 | 116 | exec.space_prefix = 1 117 | 118 | -------------------------------------------------------------------------------- /etc/clink/clink_start.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :: Customize the prompt 4 | :: - the current disk and path in light green 5 | :: - new line 6 | :: - the ">" character 7 | :: - the " " character 8 | prompt $E[92m$P$E[m$_$G$S 9 | -------------------------------------------------------------------------------- /etc/distrib/README: -------------------------------------------------------------------------------- 1 | This directory for storing packages downloaded by zentea. 2 | 3 | -------------------------------------------------------------------------------- /etc/images/ConEmu.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ildar-shaimordanov/tea-set/4decb128dac4606e91edd2355aa167f588082958/etc/images/ConEmu.ico -------------------------------------------------------------------------------- /etc/images/Cygwin.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ildar-shaimordanov/tea-set/4decb128dac4606e91edd2355aa167f588082958/etc/images/Cygwin.ico -------------------------------------------------------------------------------- /etc/images/Far2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ildar-shaimordanov/tea-set/4decb128dac4606e91edd2355aa167f588082958/etc/images/Far2.ico -------------------------------------------------------------------------------- /etc/images/Far3.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ildar-shaimordanov/tea-set/4decb128dac4606e91edd2355aa167f588082958/etc/images/Far3.bmp -------------------------------------------------------------------------------- /etc/images/Far3.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ildar-shaimordanov/tea-set/4decb128dac4606e91edd2355aa167f588082958/etc/images/Far3.ico -------------------------------------------------------------------------------- /etc/images/Prompt.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ildar-shaimordanov/tea-set/4decb128dac4606e91edd2355aa167f588082958/etc/images/Prompt.bmp -------------------------------------------------------------------------------- /etc/images/Prompt.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ildar-shaimordanov/tea-set/4decb128dac4606e91edd2355aa167f588082958/etc/images/Prompt.ico -------------------------------------------------------------------------------- /etc/images/git-for-windows.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ildar-shaimordanov/tea-set/4decb128dac4606e91edd2355aa167f588082958/etc/images/git-for-windows.ico -------------------------------------------------------------------------------- /etc/images/git.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ildar-shaimordanov/tea-set/4decb128dac4606e91edd2355aa167f588082958/etc/images/git.ico -------------------------------------------------------------------------------- /etc/images/msysgit.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ildar-shaimordanov/tea-set/4decb128dac4606e91edd2355aa167f588082958/etc/images/msysgit.ico -------------------------------------------------------------------------------- /etc/mintty/default.settings: -------------------------------------------------------------------------------- 1 | BoldAsFont=no 2 | Rows=50 3 | ScrollbackLines=100000 4 | Transparency=low 5 | OpaqueWhenFocused=no 6 | ClicksPlaceCursor=no 7 | RightClickAction=paste 8 | FontHeight=10 9 | BellType=0 10 | -------------------------------------------------------------------------------- /etc/misc/SumatraPDF/SumatraPDF-default.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | if not exist "SumatraPDF.exe" ( 4 | echo:SumatraPDF not found here. 5 | echo:Re-run this script under the folder where SumatraPDF is located. 6 | goto :EOF 7 | ) 8 | 9 | if not exist "%~dp0SumatraPDF-settings.txt" ( 10 | copy /b "%~dp0SumatraPDF-settings-default.txt" "%~dp0SumatraPDF-settings.txt" 11 | ) 12 | 13 | if not exist "%~dp0sumatrapdfcache" ( 14 | md "%~dp0sumatrapdfcache" 15 | ) 16 | 17 | mklink "SumatraPDF-settings.txt" "..\..\etc\misc\SumatraPDF\SumatraPDF-settings.txt" 18 | mklink /d "sumatrapdfcache" "..\..\etc\misc\SumatraPDF\sumatrapdfcache" 19 | -------------------------------------------------------------------------------- /etc/misc/SumatraPDF/SumatraPDF-default.txt: -------------------------------------------------------------------------------- 1 | # For documentation, see http://www.sumatrapdfreader.org/settings3.2.html 2 | 3 | MainWindowBackground = #80fff200 4 | EscToExit = false 5 | ReuseInstance = false 6 | UseSysColors = false 7 | RestoreSession = true 8 | 9 | FixedPageUI [ 10 | TextColor = #000000 11 | BackgroundColor = #ffffff 12 | SelectionColor = #f5fc0c 13 | WindowMargin = 2 4 2 4 14 | PageSpacing = 4 4 15 | ] 16 | EbookUI [ 17 | FontName = Georgia 18 | FontSize = 12.5 19 | TextColor = #5f4b32 20 | BackgroundColor = #fbf0d9 21 | UseFixedPageUI = false 22 | ] 23 | ComicBookUI [ 24 | WindowMargin = 0 0 0 0 25 | PageSpacing = 4 4 26 | CbxMangaMode = false 27 | ] 28 | ChmUI [ 29 | UseFixedPageUI = false 30 | ] 31 | ExternalViewers [ 32 | ] 33 | ShowMenubar = true 34 | ReloadModifiedDocuments = true 35 | FullPathInTitle = false 36 | ZoomLevels = 8.33 12.5 18 25 33.33 50 66.67 75 100 125 150 200 300 400 600 800 1000 1200 1600 2000 2400 3200 4800 6400 37 | ZoomIncrement = 0 38 | 39 | PrinterDefaults [ 40 | PrintScale = shrink 41 | ] 42 | ForwardSearch [ 43 | HighlightOffset = 0 44 | HighlightWidth = 15 45 | HighlightColor = #6581ff 46 | HighlightPermanent = false 47 | ] 48 | CustomScreenDPI = 0 49 | 50 | RememberStatePerDocument = true 51 | UiLanguage = en 52 | ShowToolbar = true 53 | ShowFavorites = false 54 | AssociateSilently = false 55 | CheckForUpdates = false 56 | RememberOpenedFiles = true 57 | EnableTeXEnhancements = false 58 | DefaultDisplayMode = automatic 59 | DefaultZoom = fit width 60 | WindowState = 2 61 | WindowPos = 424 0 673 872 62 | ShowToc = true 63 | SidebarDx = 166 64 | TocDy = 0 65 | ShowStartPage = true 66 | UseTabs = true 67 | 68 | FileStates [ 69 | ] 70 | SessionData [ 71 | ] 72 | TimeOfLastUpdateCheck = 0 0 73 | OpenCountWeek = 404 74 | 75 | # Settings after this line have not been recognized by the current version 76 | -------------------------------------------------------------------------------- /etc/misc/SumatraPDF/SumatraPDF-register.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | if not exist "SumatraPDF.exe" ( 4 | echo:SumatraPDF not found here. 5 | echo:Re-run this script under the folder where SumatraPDF is located. 6 | goto :EOF 7 | ) 8 | 9 | SumatraPDF.exe -register-for-pdf 10 | -------------------------------------------------------------------------------- /etc/misc/__TIPS/firefox-profile-notifications.txt: -------------------------------------------------------------------------------- 1 | # how do I stop firefox from notifying me about updates? 2 | 3 | https://superuser.com/a/1392487 4 | 5 | ## open 6 | 7 | about:config 8 | 9 | ## find 10 | 11 | app.update.url 12 | app.update.url.details 13 | app.update.url.manual 14 | 15 | ## modify each prepending "xxx-" 16 | 17 | --- 18 | 19 | # How do I remove the request for push notifications globally? 20 | 21 | https://www.reddit.com/r/firefox/comments/5augv2/how_do_i_remove_the_request_for_push/ 22 | 23 | ## open 24 | 25 | about:config 26 | 27 | ## find 28 | 29 | dom.webnotifications.enabled 30 | dom.webnotifications.serviceworker.enabled 31 | dom.push.connection.enabled 32 | dom.push.enabled 33 | 34 | ## modify setting them to false 35 | 36 | --- 37 | 38 | # No More Notifications (If You Want) 39 | 40 | https://blog.mozilla.org/firefox/no-notifications/ 41 | 42 | ## open 43 | 44 | about:preferences#privacy 45 | 46 | ## find 47 | 48 | Permissions 49 | Location and/or Notifications 50 | 51 | ## click the proper buttons 52 | 53 | Settings... 54 | 55 | ## check in the box 56 | 57 | Block new requests asking to access your location 58 | Block new requests asking to allow notifications 59 | 60 | -------------------------------------------------------------------------------- /etc/notepad/Notepad.ini: -------------------------------------------------------------------------------- 1 | [Notepad3] 2 | ;Notepad3.ini=%USERPROFILE%\Notepad3.ini 3 | ;Notepad3.ini=%APPDATA%\Rizonesoft\Notepad3\Notepad3.ini 4 | [Settings] 5 | SettingsVersion=5 6 | TabWidth=8 7 | IndentWidth=8 8 | MarkLongLines=true 9 | LongLinesLimit=75 10 | SaveRecentFiles=false 11 | MarkOccurrencesMatchWholeWords=false 12 | SaveSettings=false 13 | AutoCloseTags=true 14 | [Settings2] 15 | ;IMEInteraction=0 16 | ;AutoReloadTimeout=2000 17 | ;DateTimeFormat= (-> $Date: $) 18 | ;TimeStampRegEx= (-> \$Date:[^\$]+\$) 19 | ;DefaultDirectory= 20 | ;DefaultExtension=txt 21 | ;DefaultWindowPosition= 22 | ;DenyVirtualSpaceAccess=0 23 | ;filebrowser.exe=minipath.exe 24 | ;grepWin.exe=grepWinNP3.exe 25 | ;FileCheckInverval=2000 26 | ;FileDlgFilters= 27 | ;FileLoadWarningMB=64 28 | ;MarkOccurrencesMaxCount=2000 29 | ;MultiFileArg=0 30 | ;NoCGIGuess=0 31 | ;NoCopyLineOnEmptySelection=0 32 | ;NoCutLineOnEmptySelection=0 33 | ;NoFadeHidden=0 34 | ;NoFileVariables=0 35 | ;NoHTMLGuess=0 36 | ;PortableMyDocs=1 37 | ;OpacityLevel=75 38 | ;FindReplaceOpacityLevel=50 39 | ;RelativeFileMRU=1 40 | ;ReuseWindow=0 41 | ;SciFontQuality=3 42 | ;SimpleIndentGuides=0 43 | ;SingleFileInstance=1 44 | ;ShellAppUserModelID=Rizonesoft.Notepad3 45 | ;ShellUseSystemMRU=1 46 | StickyWindowPosition=1 47 | PreferredLanguageLocaleName=en-US 48 | ;UseOldStyleBraceMatching=0 49 | ;WebTemplate1=https://google.com/search?q=%s 50 | ;WebTemplate2=https://en.wikipedia.org/w/index.php?search=%s 51 | ;ExtendedWhiteSpaceChars= 52 | ;AutoCompleteWordCharSet= 53 | ;AutoCompleteFillUpChars= 54 | ;LineCommentPostfixStrg= 55 | ;UpdateDelayMarkAllOccurrences=50 56 | ;CurrentLineHorizontalSlop=40 57 | ;CurrentLineVerticalSlop=5 58 | ;UndoTransactionTimeout=0 59 | ;AdministrationTool.exe= 60 | ;DevDebugMode=0 61 | ;AnalyzeReliableConfidenceLevel=92 62 | ;LocaleAnsiCodePageAnalysisBonus=33 63 | ;LexerSQLNumberSignAsComment=1 64 | ;ExitOnESCSkipLevel=2 65 | ;ZoomTooltipTimeout=3200 66 | [Statusbar Settings] 67 | ;VisibleSections=0 1 12 14 2 4 5 6 7 8 9 10 11 68 | ;SectionPrefixes=Ln ,Col ,Sel ,Sb ,SLn ,Occ ,,,,,,,Ch ,Repl ,Eval , 69 | ;SectionPostfixes=,,,,,,,,,,,,,,, 70 | ;SectionWidthSpecs=30 20 20 20 20 20 0 0 0 0 0 0 20 20 20 71 | ;ZeroBasedColumnIndex=0 72 | ;ZeroBasedCharacterCount=0 73 | [Toolbar Images] 74 | ;BitmapDefault=<[:|relative_]\path_to>\Toolbar.bmp 75 | ;BitmapHot=<[:|relative_]\path_to>\ToolbarHot.bmp 76 | ;BitmapDisabled=<[:|relative_]\path_to>\ToolbarDisabled.bmp 77 | [Toolbar Labels] 78 | ;01=New 79 | ;02=Open 80 | ;03=Browse 81 | ;04=Save 82 | ;05=Undo 83 | ;06=Redo 84 | ;07=Cut 85 | ;08=Copy 86 | ;09=Paste 87 | ;10=Find 88 | ;11=Replace 89 | ;12=Word Wrap 90 | ;13=Zoom In 91 | ;14=Zoom Out 92 | ;15=Scheme 93 | ;16=Customize Schemes 94 | ;17=Exit 95 | ;18=Save As 96 | ;19=Save Copy 97 | ;20=Delete 98 | ;21=Print 99 | ;22=Favorites 100 | ;23=Add to Favorites 101 | ;24=Toggle Folds 102 | ;25=Execute Document 103 | ;26=Focused View 104 | ;27=Monitoring Log 105 | ;28=History 106 | ;29=Always On Top 107 | [Custom Colors] 108 | [Styles] 109 | [Common Base] 110 | Default Style=font:Courier New; size:10; charset:204 111 | [2nd Common Base] 112 | [Text Files] 113 | [ANSI Art] 114 | [Apache Config Files] 115 | [Assembly Script] 116 | [AutoHotkey_L Script] 117 | [AutoIt3 Script] 118 | [AviSynth Script] 119 | [Awk Script] 120 | [Batch Files] 121 | [C# Source Code] 122 | [C/C++ Source Code] 123 | [Cmake Script] 124 | [Coffeescript] 125 | [Configuration Files] 126 | [CSS Style Sheets] 127 | [CSV Prism] 128 | [D Source Code] 129 | [Diff Files] 130 | [Go Source Code] 131 | [Inno Setup Script] 132 | [Java Source Code] 133 | [JavaScript] 134 | [JSON] 135 | [LaTeX Files] 136 | [Lua Script] 137 | [Makefiles] 138 | [Markdown] 139 | [MATLAB] 140 | [Nim Source Code] 141 | [NSIS Script] 142 | [Pascal Source Code] 143 | [Perl Script] 144 | [PowerShell Script] 145 | [Python Script] 146 | [Registry Files] 147 | [Resource Script] 148 | [R-S-SPlus Statistics Code] 149 | [Ruby Script] 150 | [Rust Source Code] 151 | [Shell Script] 152 | [SQL Query] 153 | [Tcl Script] 154 | [TOML Config] 155 | [VBScript] 156 | [VHDL] 157 | [Visual Basic] 158 | [Web Source Code] 159 | [XML Document] 160 | [YAML] 161 | [Window] 162 | 1600x900 HighDpiToolBar=0 163 | 1600x900 PosX=760 164 | 1600x900 PosY=35 165 | 1600x900 SizeX=760 166 | 1600x900 SizeY=845 167 | 1600x900 Maximized=false 168 | 1600x900 Zoom=100 169 | 1920x1080 HighDpiToolBar=0 170 | [Suppressed Messages] 171 | MsgFileUnknownExt=6 172 | [Recent Files] 173 | [Recent Find] 174 | [Recent Replace] 175 | -------------------------------------------------------------------------------- /etc/notepad/Notepad3.ini: -------------------------------------------------------------------------------- 1 | [Notepad3] 2 | Notepad3.ini=..\..\etc\notepad\Notepad.ini 3 | -------------------------------------------------------------------------------- /etc/postinstall/calc-display-issue.txt: -------------------------------------------------------------------------------- 1 | REGEDIT4 2 | 3 | [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes] 4 | "MS Shell Dlg"="Microsoft Sans Serif" 5 | "MS Shell Dlg 2"="Tahoma" 6 | "MS Shell Dlg,204"="Microsoft Sans Serif,204" 7 | 8 | ; Found at 9 | ; https://social.technet.microsoft.com/Forums/ru-RU/f2add0a5-fd64-4820-b33c-76e430744c58/windows-7-?forum=windows7ru 10 | 11 | ; if "Microsoft" words were changed to "MS" 12 | ; 1. revert "MS" to "Microsoft" 13 | ; 2. and log-off/log-on 14 | 15 | ; another solution 16 | ; 1. control panel 17 | ; 2. Apperance and Personalization 18 | ; 3. Dislpay 19 | ; 4. Set to "Medium - 125%" 20 | ; 5. Log-off/log-on 21 | ; 6. Repeat 1-3 22 | ; 7. Set to "Smaller - 100% (default)" 23 | ; 8. Repeat 5 24 | -------------------------------------------------------------------------------- /etc/postinstall/cygwin-update.txt: -------------------------------------------------------------------------------- 1 | 2 | 1. Install Cygwin 3 | 4 | 2. Run Cygwin first time and perform post-install activity 5 | 6 | --------------------------------------------------------------------------- 7 | 8 | The simplest way (not portable) 9 | 10 | 3. Modify /etc/passwd 11 | 12 | cd "NEW-HOME-DIR" 13 | sed -i "/$USERNAME/ s|^\(.*\):.*:\(.*\)|\1:$(pwd):\2|" /etc/passwd 14 | 15 | 4. Close the current Cygwin session 16 | 17 | --------------------------------------------------------------------------- 18 | 19 | The more complicated but portable way 20 | 21 | 3. Remove the current home dir 22 | 23 | cd ~/.. 24 | rm -rf "$HOME" 25 | 26 | 4. Create soft link to NEW-HOME-DIR 27 | 28 | ln -s "NEW-HOME-DIR" $USERNAME 29 | 30 | 5. Close the current Cygwin session 31 | 32 | --------------------------------------------------------------------------- 33 | 34 | Another and portable way 35 | 36 | 3. backup CYGWIN-DIR/etc/profile to here 37 | 38 | 4. open CYGWIN-DIR/etc/profile and add at the most beginning of the file 39 | the following lines 40 | 41 | # Set new home dir 42 | HOME="$( ../bin/cygpath -w / | ../bin/sed 's/libexec.*/home/' | ../bin/cygpath -uf - )" 43 | 44 | 45 | 5. Save the changes to the file 46 | 47 | --------------------------------------------------------------------------- 48 | 49 | Yet another way (git can't recognize /home/USERNAME as part of a repo) 50 | 51 | http://cygwin.com/cygwin-ug-net/using.html#mount-table 52 | 53 | 3. open CYGWIN-DIR/etc/fstab 54 | 55 | 4. add the following lines 56 | 57 | # This is for mapping new userhome 58 | TEA_HOME-DIR/home /home/USERNAME ntfs binary,noacl,posix=0,user 0 0 59 | 60 | 5. Close the current Cygwin session 61 | 62 | -------------------------------------------------------------------------------- /etc/postinstall/fstab: -------------------------------------------------------------------------------- 1 | # /etc/fstab 2 | # 3 | # This file is read once by the first process in a Cygwin process tree. 4 | # To pick up changes, restart all Cygwin processes. For a description 5 | # see https://cygwin.com/cygwin-ug-net/using.html#mount-table 6 | 7 | # This is default mapping to paths like "/cygdrive/..." 8 | none /cygdrive cygdrive binary,noacl,posix=0,user 0 0 9 | 10 | # This is for mapping to paths like "/mnt/..." 11 | #none /mnt cygdrive binary,noacl,posix=0,user 0 0 12 | 13 | # This is for mapping to paths like "/..." 14 | #none / cygdrive binary,noacl,posix=0,user 0 0 15 | 16 | # This is for mapping to new userhome like "TEA_HOME/home" 17 | TEA_HOME/home /home/USERNAME ntfs binary,noacl,posix=0,user 0 0 18 | -------------------------------------------------------------------------------- /etc/postinstall/home-link.bat: -------------------------------------------------------------------------------- 1 | :: Setup a TEA-SET home as Cygwin/MSYS2/MinGW user home 2 | :: 3 | :: Usage: home-link TYPE 4 | :: 5 | :: Available types: 6 | :: 7 | :: junction creates a directory junction. 8 | :: symlinkd creates a directory symbolic link. Elevated privileges 9 | :: could be required to complete this command. 10 | :: winlink creates symlinks as Windows shortcuts with a special header 11 | :: and the R/O attribute set. 12 | :: cyglink creates symlinks in the old-fashioned Cygwin style 13 | :: (a special file with the System attribute set). 14 | :: 15 | :: The script assumes the following directory tree structure and HAVE TO BE 16 | :: executed from within one of %TEA_SET%\libexec\*\home: 17 | :: %TEA_SET%\home 18 | :: %TEA_SET%\libexec\cygwin\home 19 | :: %TEA_SET%\libexec\msys32\home 20 | :: %TEA_SET%\libexec\msys64\home 21 | :: ... and so on 22 | @echo off 23 | 24 | if "%~1" == "" ( 25 | findstr /b "::" "%~f0" 26 | goto :EOF 27 | ) 28 | 29 | for %%n in ( 30 | junction 31 | symlinkd 32 | winlink 33 | cyglink 34 | ) do if /i "%~1" == "%%~n" ( 35 | call :create-%%~n 36 | if errorlevel 1 echo:Execution failed>&2 37 | goto :EOF 38 | ) 39 | 40 | echo:Bad option: %~1>&2 41 | goto :EOF 42 | 43 | rem ======================================================================= 44 | 45 | :create-junction 46 | mklink /j "%USERNAME%" "..\..\..\home" 47 | goto :EOF 48 | 49 | :create-symlinkd 50 | mklink /d "%USERNAME%" "..\..\..\home" 51 | goto :EOF 52 | 53 | rem ======================================================================= 54 | 55 | :create-winlink 56 | copy /b "%~dpn0.winlink" "%USERNAME%.lnk" || exit /b %ERRORLEVEL% 57 | attrib +R "%USERNAME%.lnk" 58 | goto :EOF 59 | 60 | :create-cyglink 61 | copy /b "%~dpn0.cyglink" "%USERNAME%" || exit /b %ERRORLEVEL% 62 | attrib +S "%USERNAME%" 63 | goto :EOF 64 | 65 | rem ======================================================================= 66 | 67 | :show_usage 68 | findstr /b "::" "%~f0" 69 | goto :EOF 70 | 71 | rem ======================================================================= 72 | 73 | rem EOF 74 | -------------------------------------------------------------------------------- /etc/postinstall/home-link.cyglink: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ildar-shaimordanov/tea-set/4decb128dac4606e91edd2355aa167f588082958/etc/postinstall/home-link.cyglink -------------------------------------------------------------------------------- /etc/postinstall/home-link.winlink: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ildar-shaimordanov/tea-set/4decb128dac4606e91edd2355aa167f588082958/etc/postinstall/home-link.winlink -------------------------------------------------------------------------------- /etc/postinstall/keyboard-layout-rus-eng.reg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ildar-shaimordanov/tea-set/4decb128dac4606e91edd2355aa167f588082958/etc/postinstall/keyboard-layout-rus-eng.reg -------------------------------------------------------------------------------- /etc/postinstall/notepad-replace-win10.bat: -------------------------------------------------------------------------------- 1 | :: http://www.flos-freeware.ch/doc/notepad2-Replacement.html 2 | :: https://github.com/rizonesoft/Notepad3/issues/3742 3 | 4 | @echo off 5 | 6 | setlocal 7 | 8 | set "np_registry=HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" 9 | 10 | for %%n in ( install uninstall show ) do if /i "%~1" == "%%~n" goto :np_%%~n 11 | 12 | echo:Usage: %~n0 install ^| uninstall ^| show>&2 13 | 14 | endlocal 15 | goto :EOF 16 | 17 | 18 | :np_setup 19 | set "np_fullpath=" 20 | for %%f in ( 21 | "%~dp0..\..\opt\notepad3\Notepad3.exe" 22 | "%~dp0..\..\opt\notepad\Notepad3.exe" 23 | "%~dp0..\..\GUI\notepad3\Notepad3.exe" 24 | "%~dp0..\..\GUI\notepad\Notepad3.exe" 25 | "%~dp0..\..\libexec\notepad3\Notepad3.exe" 26 | "%~dp0..\..\libexec\notepad\Notepad3.exe" 27 | ) do if exist "%%~ff" ( 28 | set "np_fullpath=%%~ff" 29 | goto :EOF 30 | ) 31 | echo:Notepad replacement not found>&2 32 | exit /b 1 33 | 34 | 35 | :np_install 36 | call :np_setup || goto :EOF 37 | 38 | reg add "%np_registry%" /v "Debugger" /t REG_SZ /d "\"%np_fullpath%\" /z" /f 39 | goto :EOF 40 | 41 | 42 | :np_uninstall 43 | reg delete "%np_registry%" /v "Debugger" /f 44 | goto :EOF 45 | 46 | 47 | :np_show 48 | reg query "%np_registry%" /s 49 | goto :EOF 50 | 51 | -------------------------------------------------------------------------------- /etc/postinstall/notepad-replace-win11.bat: -------------------------------------------------------------------------------- 1 | :: http://www.flos-freeware.ch/doc/notepad2-Replacement.html 2 | :: https://github.com/rizonesoft/Notepad3/issues/3742 3 | 4 | @echo off 5 | 6 | setlocal 7 | 8 | set "np_registry=HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" 9 | 10 | for %%n in ( install uninstall show ) do if /i "%~1" == "%%~n" goto :np_%%~n 11 | 12 | echo:Usage: %~n0 install ^| uninstall ^| show>&2 13 | 14 | endlocal 15 | goto :EOF 16 | 17 | 18 | :np_setup 19 | set "np_fullpath=" 20 | for %%f in ( 21 | "%~dp0..\..\opt\notepad3\Notepad3.exe" 22 | "%~dp0..\..\opt\notepad\Notepad3.exe" 23 | "%~dp0..\..\GUI\notepad3\Notepad3.exe" 24 | "%~dp0..\..\GUI\notepad\Notepad3.exe" 25 | "%~dp0..\..\libexec\notepad3\Notepad3.exe" 26 | "%~dp0..\..\libexec\notepad\Notepad3.exe" 27 | ) do if exist "%%~ff" ( 28 | set "np_fullpath=%%~ff" 29 | goto :EOF 30 | ) 31 | echo:Notepad replacement not found>&2 32 | exit /b 1 33 | 34 | 35 | :np_install 36 | call :np_setup || goto :EOF 37 | 38 | reg add "%np_registry%" /v "Debugger" /t REG_SZ /d "\"%np_fullpath%\" /z" /f 39 | reg add "%np_registry%" /v "UseFilter" /t REG_DWORD /d 0x0 /f 40 | goto :EOF 41 | 42 | 43 | :np_uninstall 44 | reg delete "%np_registry%" /v "Debugger" /f 45 | reg add "%np_registry%" /v "UseFilter" /t REG_DWORD /d 0x1 /f 46 | goto :EOF 47 | 48 | 49 | :np_show 50 | reg query "%np_registry%" /s 51 | goto :EOF 52 | 53 | -------------------------------------------------------------------------------- /etc/postinstall/notepad-txtfile.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | setlocal 4 | 5 | for %%f in ( "%~dp0..\..\GUI\notepad\Notepad3.exe" ) do set "np_path=%%~ff" 6 | 7 | set "np_root=HKEY_CURRENT_USER\Software\Classes" 8 | :: set "np_root=HKEY_CLASSES_ROOT" 9 | 10 | set "np_txtid=%np_root%\.txt\OpenWithProgids" 11 | 12 | set "np_appid=000000Notepad3" 13 | 14 | for %%p in ( install uninstall show ) do if /i "%~1" == "%%~p" goto :np_%%~p 15 | 16 | echo:Usage: %~n0 install^|uninstall^|show 17 | goto :EOF 18 | 19 | :np_install 20 | :: reg add "%np_txtid%" /v "%np_appid%" /t "REG_SZ" /d " " /f 21 | reg add "%np_txtid%" /v "%np_appid%" /t "REG_NONE" /d "" /f 22 | reg add "%np_root%\%np_appid%\shell\new\command" /ve /t REG_SZ /d "\"%np_path%\" /q \"%%1\"" /f 23 | reg add "%np_root%\%np_appid%\shell\open\command" /ve /t REG_SZ /d "\"%np_path%\" \"%%1\"" /f 24 | goto :EOF 25 | 26 | :np_uninstall 27 | reg delete "%np_txtid%" /v "%np_appid%" /f 28 | reg delete "%np_root%\%np_appid%" /f 29 | goto :EOF 30 | 31 | :np_show 32 | reg query "%np_txtid%" /s 33 | reg query "%np_root%\%np_appid%" /s 34 | goto :EOF 35 | -------------------------------------------------------------------------------- /etc/postinstall/synaptics-middle-click.reg: -------------------------------------------------------------------------------- 1 | REGEDIT4 2 | 3 | [HKEY_CURRENT_USER\Software\Synaptics\SynTP\Defaults] 4 | "HasBothButtonFeature"=dword:00000001 5 | 6 | -------------------------------------------------------------------------------- /etc/shell/cygwin.bat: -------------------------------------------------------------------------------- 1 | set "CHERE_INVOKING=1" 2 | 3 | call "%~dp0detect_winpty.bat" cygwin 64 4 | -------------------------------------------------------------------------------- /etc/shell/detect_winpty.bat: -------------------------------------------------------------------------------- 1 | ::: Usage: detect_winpty ENV BIT 2 | ::: 3 | ::: ENV - cygwin or msys 4 | ::: BIT - 32 or 64 5 | 6 | @echo off 7 | 8 | if "%~1" == "" ( 9 | findstr "^:::" "%~f0" 10 | goto :EOF 11 | ) 12 | 13 | for /f "tokens=* delims=" %%n in ( ' 14 | dir /ad /o-n /b "%~dp0..\..\libexec\winpty*%~1*%~2" 15 | ' ) do for %%d in ( "%~dp0..\..\libexec\%%~n" ) do if exist "%%~d\bin\winpty.exe" ( 16 | set "PATH=%PATH%;%%~d\bin" 17 | goto :EOF 18 | ) 19 | -------------------------------------------------------------------------------- /etc/shell/msys32.bat: -------------------------------------------------------------------------------- 1 | set "CHERE_INVOKING=1" 2 | set "MSYS2_PATH_TYPE=inherit" 3 | 4 | call "%~dp0detect_winpty.bat" msys2 32 5 | -------------------------------------------------------------------------------- /etc/shell/msys64.bat: -------------------------------------------------------------------------------- 1 | set "CHERE_INVOKING=1" 2 | set "MSYS2_PATH_TYPE=inherit" 3 | 4 | call "%~dp0detect_winpty.bat" msys2 64 5 | -------------------------------------------------------------------------------- /etc/xsrv/xsrv-multiwindow.xlaunch: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /home/.XWinrc: -------------------------------------------------------------------------------- 1 | # XWin Server Resource File - EXAMPLE 2 | # Earle F. Philhower, III 3 | 4 | # Place in ~/.XWinrc or in /etc/X11/system.XWinrc 5 | 6 | # Keywords are case insensitive, comments legal pretty much anywhere 7 | # you can have an end-of-line 8 | 9 | # Comments begin with "#" or "//" and go to the end-of-line 10 | 11 | # Menus are defined as... 12 | # MENU { 13 | # EXEC 14 | # ^^ This command will have any "%display%" 15 | # string replaced with the proper display 16 | # variable (i.e. 127.0.0.1:.0) 17 | # (This should only rarely be needed as 18 | # the DISPLAY environment variable is also 19 | # set correctly) 20 | # or MENU 21 | # or ALWAYSONTOP 22 | # ^^ Sets the window to display above all others 23 | # or RELOAD 24 | # ^^ Causes ~/.XWinrc or the system.XWinrc file 25 | # to be reloaded and icons and menus regenerated 26 | # or SEPARATOR 27 | # ... 28 | # } 29 | 30 | # Set the taskmar menu with 31 | # ROOTMENU 32 | 33 | # If you want a menu to be applied to all popup window's system menu 34 | # DEFAULTSYSMENU 35 | 36 | # To choose a specific menu for a specific WM_CLASS or WM_NAME use ... 37 | # SYSMENU { 38 | # 39 | # ... 40 | # } 41 | 42 | # When specifying an ICONFILE in the following commands several different 43 | # formats are allowed: 44 | # 1. Name of a regular Windows .ico format file 45 | # (ex: "cygwin.ico", "apple.ico") 46 | # 2. Name and index into a Windows .DLL 47 | # (ex: "c:\windows\system32\shell32.dll,4" gives the default folder icon 48 | # "c:\windows\system32\shell32.dll,5" gives the floppy drive icon) 49 | # 3. Index into XWin.EXE internal ICON resource 50 | # (ex: ",101" is the 1st icon inside XWin.exe) 51 | 52 | # To define where ICO files live (** Windows path**) 53 | # ICONDIRECTORY 54 | # NOTE: If you specify an absolute path in Windows or Cygwin format to an ICON below 55 | # (i.e. "c:\icons\xxx.ico" or "/usr/share/icons/xxx.ico") 56 | # this ICONDIRECTORY will not be prepended 57 | 58 | # To change the taskbar icon use... 59 | # TRAYICON 60 | 61 | # To define a replacement for the standard X icon for apps w/o specified icons 62 | # DEFAULTICON 63 | 64 | # To define substitute icons on a per-window basis use... 65 | # ICONS { 66 | # 67 | # ... 68 | # } 69 | # In the case where multiple matches occur, the first listed in the ICONS 70 | # section will be chosen. 71 | 72 | # To disable exit confirmation dialog add the line containing SilentExit 73 | 74 | # DEBUG prints out the string to the XWin.log file 75 | 76 | // Below are just some silly menus to demonstrate writing your 77 | // own configuration file. 78 | 79 | // Make some menus... 80 | # menu apps { 81 | # xterm exec "xterm" 82 | # "Emacs" exec "emacs" 83 | # notepad exec notepad 84 | # xload exec "xload -display %display%" # Comment 85 | # } 86 | 87 | menu root { 88 | // "Applications" menu apps 89 | // Comments fit here, too... 90 | // SEPARATOR 91 | 92 | # FAQ EXEC "cygstart http://x.cygwin.com/docs/faq/cygwin-x-faq.html" 93 | # "User's Guide" EXEC "cygstart http://x.cygwin.com/docs/ug/cygwin-x-ug.html" 94 | # SEPARATOR 95 | 96 | "Cygwin" EXEC "C:/PROGS/shell.bat cygwin" 97 | SEPARATOR 98 | 99 | "View logfile" EXEC "xterm -title $XWINLOGFILE -e less +F $XWINLOGFILE" 100 | SEPARATOR 101 | 102 | "Reload .XWinrc" RELOAD 103 | SEPARATOR 104 | } 105 | 106 | RootMenu root 107 | 108 | # menu aot { 109 | # Separator 110 | # "Always on Top" alwaysontop 111 | # } 112 | # 113 | # menu xtermspecial { 114 | # "Emacs" exec "emacs" 115 | # "Always on Top" alwaysontop 116 | # SepArAtor 117 | # } 118 | # 119 | # DefaultSysMenu aot atend 120 | # 121 | # SysMenu { 122 | # "xterm" xtermspecial atstart 123 | # } 124 | 125 | # IconDirectory "c:\winnt\" 126 | 127 | # DefaultIcon "reinstall.ico" 128 | 129 | # Icons { 130 | # "xterm" "uninstall.ico" 131 | # } 132 | 133 | SilentExit 134 | 135 | DEBUG "Done parsing the configuration file..." 136 | 137 | -------------------------------------------------------------------------------- /home/.bash/aliases: -------------------------------------------------------------------------------- 1 | # shellcheck shell=bash 2 | 3 | # ========================================================================= 4 | 5 | # Aliases 6 | # 7 | # Some people use a different file for aliases 8 | # if [ -f "${HOME}/.bash_aliases" ]; then 9 | # source "${HOME}/.bash_aliases" 10 | # fi 11 | # 12 | # Some example alias instructions 13 | # If these are enabled they will be used instead of any instructions 14 | # they may mask. For example, alias rm='rm -i' will mask the rm 15 | # application. To override the alias instruction use a \ before, ie 16 | # \rm will call the real rm not the alias. 17 | # 18 | # Interactive operation... 19 | # alias rm='rm -i' 20 | # alias cp='cp -i' 21 | # alias mv='mv -i' 22 | # 23 | # Default to human readable figures 24 | # alias df='df -h' 25 | # alias du='du -h' 26 | # 27 | # Misc :) 28 | # alias less='less -r' # raw control characters 29 | # alias whence='type -a' # where, of a sort 30 | 31 | # Some versions do not support colorizing 32 | if grep --help 2>/dev/null | grep -q color 33 | then 34 | alias grep='grep --color=auto' # show differences in colour 35 | alias egrep='egrep --color=auto' # show differences in colour 36 | alias fgrep='fgrep --color=auto' # show differences in colour 37 | fi 38 | 39 | # alias agrep='grep -a' 40 | 41 | # Some shortcuts for different directory listings 42 | # alias ls='ls -hF --color=tty' # classify files in colour 43 | alias ls='ls --color=tty' 44 | # alias dir='ls --color=auto --format=vertical' 45 | # alias vdir='ls --color=auto --format=long' 46 | alias ll='ls -l' # long list 47 | alias la='ls -A' # all but . and .. 48 | alias l='ls -CF' # 49 | 50 | # ========================================================================= 51 | 52 | # The following section provides 4 different implementations to display 53 | # file contents in ascii and hexadecimal. In fact, it's quite redundant 54 | # because the most of these tools are available in Linux and Cygwin-like 55 | # environments. 56 | if command -v od >/dev/null 2>&1 57 | then 58 | # http://www.pixelbeat.org/settings/.bashrc 59 | alias hd='od -Ax -tx1z -v' 60 | elif command -v hexdump >/dev/null 2>&1 61 | then 62 | alias hd='hexdump -C' 63 | elif command -v xxd >/dev/null 2>&1 64 | then 65 | alias hd='xxd -g1' 66 | elif command -v awk >/dev/null 2>&1 67 | then 68 | # Based on the answer to the question "Slurp-mode in awk?" 69 | # https://unix.stackexchange.com/a/304458/440611 70 | # awk implementing xxd -g1 71 | alias hd=xxd_awk 72 | xxd_awk() { 73 | awk -v RS="\0" -v RT="\0" -v FS="\0" ' 74 | { 75 | input = input $0 RT 76 | } 77 | END { 78 | for (i = 0; i < 256; i++) { 79 | c = sprintf("%c", i) 80 | ord[c] = i 81 | } 82 | 83 | while ( s = substr(input, m + 1, 16) ) { 84 | d = "" 85 | for (i = 1; i <= length(s); i++) { 86 | c = substr(s, i, 1) 87 | d = d sprintf(" %02x", ord[c]) 88 | } 89 | gsub(/[^[:print:]]/, ".", s) 90 | printf "%08x:%-48s %s\n", m, d, s 91 | m += 16 92 | } 93 | }' 94 | } 95 | elif command -v perl >/dev/null 2>&1 96 | then 97 | # perl implementing xxd -g1 98 | alias hd=xxd_perl 99 | xxd_perl() { 100 | perl -0777 -e ' 101 | for ( <> =~ /.{1,16}/gs ) { 102 | @d = unpack("H32") =~ /../g; 103 | s/[^[:print:]]/./g; 104 | printf "%08x: %-48s %s\n", $o, "@d", $_; 105 | $o += 16; 106 | } 107 | ' 108 | } 109 | fi 110 | 111 | # ========================================================================= 112 | 113 | # Detect colorized diff and its colorizing wrappers 114 | 115 | # Let's check and use diff itself or git diff 116 | if diff --help 2>/dev/null | grep -q color 117 | then 118 | # diff 3.4+ allows coloring 119 | alias diff='diff --color=auto' 120 | elif command -v git >/dev/null 2>&1 121 | then 122 | # git is available 123 | alias diff='git diff --no-index' 124 | fi 125 | 126 | # If one of these scripts exists, overwrite the alias for better colorizing 127 | if command -v ~/bin/colordiff.posix >/dev/null 2>&1 128 | then 129 | # Let's check and use POSIX-compliant shell script 130 | alias diff=~/bin/colordiff.posix 131 | elif command -v ~/bin/colordiff.bash >/dev/null 2>&1 132 | then 133 | # Let's check and use full-featured Bash script 134 | alias diff=~/bin/colordiff.bash 135 | elif command -v colordiff >/dev/null 2>&1 136 | then 137 | # Let's check and use well-known script from www.colordiff.org 138 | alias diff=colordiff 139 | fi 140 | 141 | # ========================================================================= 142 | 143 | # Windows only (Cygwin or MSys) 144 | case "$( uname | tr '[:upper:]' '[:lower:]' )" in 145 | cygwin* | msys* | mingw* ) 146 | alias ps='ps -W' 147 | ;; 148 | esac 149 | 150 | # ========================================================================= 151 | 152 | # Ant related aliases 153 | 154 | # Few ways to customize Ant: 155 | # 1. Create alias ant with the particular command line options. 156 | # 2. Export ANT_ARGS environment variable with the command line options. 157 | # 3. Create ${HOME}/.ant.properties with prefedined properties. 158 | # This file allows to override some properties without editing 159 | # Build.xml and without typing -D on each invocation. 160 | # This way, build.xml should be able to read properties from this file. 161 | # 4. Any combination of all the stuff above. 162 | # alias ant='ant -find build.xml -emacs -Dium.install.dir=/opt/SIU' 163 | 164 | # ========================================================================= 165 | 166 | # Git aliases 167 | if command -v git >/dev/null 2>&1 168 | then 169 | # http://gitimmersion.com/lab_11.html 170 | alias gs='git status' 171 | # alias ga='git add' 172 | alias gb='git branch' 173 | # http://stackoverflow.com/a/11585743/3627676 174 | # alias gbn='git name-rev --name-only HEAD' 175 | # alias gc='git commit' 176 | alias gd='git diff' 177 | alias go='git checkout' 178 | alias gl='git log' 179 | alias gll='git log --name-status' 180 | alias gli='LESS="-RS" git log --color --graph --oneline' 181 | alias gla='LESS="-RS" git log --color --graph --oneline --decorate --all' 182 | # alias gk='gitk --all&' 183 | # alias gx='gitx --all' 184 | # alias got='git' 185 | # alias get='git' 186 | 187 | alias ggu='git config --local remote.origin.url' 188 | alias ggn='git config --local remote.origin.url | sed "s|.*/||;s|\.[^.]*$||"' 189 | alias ggr='git rev-parse --show-toplevel' 190 | alias ggg='git rev-parse --git-dir' 191 | alias ggb='git rev-parse --abbrev-ref HEAD' 192 | 193 | # Do cd to the git root dir (if it's possible 194 | alias cdggr='cd "$( ggr )"' 195 | 196 | if command -v git-bunch >/dev/null 2>&1 197 | then 198 | # cd to home dir for personal gits 199 | alias cdgp='cd "$( git-bunch priv )" && ls' 200 | 201 | # cd to home dir for gits used at work 202 | alias cdgw='cd "$( git-bunch work )" && ls' 203 | fi 204 | fi 205 | 206 | # ========================================================================= 207 | 208 | # EOF 209 | -------------------------------------------------------------------------------- /home/.bash/environ: -------------------------------------------------------------------------------- 1 | # shellcheck shell=bash 2 | 3 | # ========================================================================= 4 | 5 | # Set the locale 6 | export LANG=en_US.UTF-8 7 | 8 | # Enable ANSI codes in less output 9 | export LESS='-R' 10 | 11 | # ========================================================================= 12 | 13 | # Few ways to customize Ant: 14 | # 1. Create alias ant with the particular command line options. 15 | # 2. Export ANT_ARGS environment variable with the command line options. 16 | # 3. Create ${HOME}/.ant.properties with prefedined properties. 17 | # This file allows to override some properties without editing 18 | # Build.xml and without typing -D on each invocation. 19 | # This way, build.xml should be able to read properties from this file. 20 | # 4. Any combination of all the stuff above. 21 | 22 | ANT_ARGS="-find build.xml" 23 | ANT_ARGS="${ANT_ARGS} -emacs" 24 | ANT_ARGS="${ANT_ARGS} -Dium.install.dir=/opt/SIU" 25 | ANT_ARGS="${ANT_ARGS} -Dusing.git=" 26 | #ANT_ARGS="${ANT_ARGS} -logger org.apache.tools.ant.listener.AnsiColorLogger" 27 | 28 | export ANT_ARGS 29 | 30 | # ========================================================================= 31 | 32 | # EOF 33 | -------------------------------------------------------------------------------- /home/.bash/functions-cd: -------------------------------------------------------------------------------- 1 | # shellcheck shell=bash 2 | 3 | # ========================================================================= 4 | 5 | # http://www.commandlinefu.com/commands/view/11246/bashksh-function-given-a-file-cd-to-the-directory-it-lives 6 | # dirname DIR/FILE + cd DIR 7 | cdf() { 8 | # shellcheck disable=SC2164 9 | cd "$( [ -f "$1" ] && dirname "$1" || echo "$1" )" 10 | } 11 | 12 | # ========================================================================= 13 | 14 | # http://www.commandlinefu.com/commands/view/12669/create-a-directory-and-change-into-it-at-the-same-time 15 | # mkdir DIR + cd DIR 16 | mkcd() { 17 | # shellcheck disable=SC2164 18 | mkdir -p "$1" && cd "$1" 19 | } 20 | 21 | # ========================================================================= 22 | 23 | # cd [-LP] old new 24 | # 25 | # https://linux.die.net/man/1/ksh 26 | # The string new is substituted for old in the current directory, and 27 | # the shell attempts to change to the new directory. 28 | # 29 | # https://linux.die.net/man/1/zshbuiltins 30 | # ... substitutes the string new for the string old in the name of the 31 | # current directory, and tries to change to this new directory. 32 | # 33 | # http://code.metager.de/source/xref/gnu/bash/examples/functions/ksh-cd 34 | # Early by this link I've seen the bash function by Chester Ramey 35 | # implementing a such functionality. At the present, that link is 36 | # unavailable. Also it's old implementation and it doesn't support 37 | # additional options introduced in the latest bash 4.4.x releases. And 38 | # as a result, I reinvented it on my own. 39 | # 40 | # http://www.commandlinefu.com/commands/view/13604/change-directory-for-current-path-in-bash 41 | # Lightweight version with the almost same functionality 42 | cd() { 43 | local CDOPTS 44 | local opt 45 | 46 | OPTIND=1 47 | 48 | while getopts "LPe@" opt 49 | do 50 | case "$opt" in 51 | L | P | e | @ ) 52 | CDOPTS="$CDOPTS -$opt" 53 | ;; 54 | * ) 55 | return $? 56 | ;; 57 | esac 58 | done 59 | 60 | shift $(( OPTIND - 1 )) 61 | 62 | case $# in 63 | 0 | 1 ) 64 | # shellcheck disable=SC2086,SC2164 65 | builtin cd $CDOPTS "$@" 66 | ;; 67 | 2 ) 68 | case "$PWD" in 69 | *$1* ) 70 | # correct: do nothing 71 | ;; 72 | * ) 73 | echo "${0##*/}: cd: bad substitution" >&2 74 | return 2 75 | ;; 76 | esac 77 | 78 | # shellcheck disable=SC2086,SC2164 79 | builtin cd $CDOPTS "${PWD//$1/$2}" 80 | ;; 81 | * ) 82 | echo "${0##*/}: cd: too many arguments" >&2 83 | return 2 84 | ;; 85 | esac 86 | } 87 | 88 | # ========================================================================= 89 | 90 | # EOF 91 | -------------------------------------------------------------------------------- /home/.bash/functions-datetime: -------------------------------------------------------------------------------- 1 | # shellcheck shell=bash 2 | 3 | # ========================================================================= 4 | 5 | now() { 6 | date "+%F %T" ${@:+ -d "$@"} 7 | } 8 | 9 | today() { 10 | date "+%F" ${@:+ -d "$@"} 11 | } 12 | 13 | tomorrow() { 14 | today "+1 day $*" 15 | } 16 | 17 | yesterday() { 18 | today "-1 day $*" 19 | } 20 | 21 | # ========================================================================= 22 | 23 | # EOF 24 | -------------------------------------------------------------------------------- /home/.bash/functions-jump: -------------------------------------------------------------------------------- 1 | # shellcheck shell=bash 2 | 3 | # ========================================================================= 4 | 5 | # Jump around anywhere 6 | # It's developed simple as much as possible: 7 | # - Keep the list of directories and aliases in the "~/.jconf" TSV-file 8 | # - Allow to jump to the directories fastly by aliases 9 | # - Listing of directories by its aliases 10 | # - Display listing of available directories and aliases 11 | # 12 | # Other projects implementing the same functionalities: 13 | # https://github.com/rupa/z 14 | # https://github.com/mfaerevaag/wd 15 | j() { 16 | if [ $# -eq 0 ] 17 | then 18 | cat - <&2 59 | return 255 60 | fi 61 | 62 | printf '%s\t%s\n' "$OPTARG" "${PWD#$prefix}" >>"$CONF" 63 | return $? 64 | ;; 65 | d ) 66 | # No file, nothing to delete -- no error 67 | [ -f "$CONF" ] || return 0 68 | 69 | sed -i "/^$OPTARG\t/d" "$CONF" 70 | return $? 71 | ;; 72 | A ) 73 | # No file, nothing to display -- error 74 | [ -f "$CONF" ] || { 75 | echo "File not exist: ~/.jconf" >&2 76 | return 255 77 | } 78 | 79 | sort "$CONF" 80 | return $? 81 | ;; 82 | : ) 83 | echo "Alias required" >&2 84 | return 255 85 | ;; 86 | \? ) 87 | echo "Bad option: $OPTARG" 88 | return 255 89 | ;; 90 | esac 91 | done 92 | 93 | shift $(( OPTIND - 1 )) 94 | 95 | if [ -z "$1" ] 96 | then 97 | echo "Alias not specified" >&2 98 | return $? 99 | fi 100 | 101 | local -a jdir 102 | mapfile -t jdir < <( sed -n "s/^$1\t*//p" "$CONF" ) 103 | 104 | case "${#jdir[@]}" in 105 | 0 ) 106 | echo "Alias not found: $1" >&2 107 | return 255 108 | ;; 109 | 1 ) 110 | # FIXME!!! Sometimes it fails -- for example: 111 | # 1. run under Msys2 112 | # cd /tmp ; j -a zzz 113 | # 2. run under Cygwin 114 | # j zzz 115 | # It happens because Msys2 creates "zzz {TAB} tmp" 116 | # And further Cygwin tries to "cd /cygdrive/tmp" 117 | [ "${jdir[0]:0:1}" = "/" ] && prefix="" 118 | # cd or ls 119 | $jcmd "$prefix${jdir[0]}/$2" 120 | ;; 121 | * ) 122 | echo "More than one alias found: $1" >&2 123 | return 255 124 | ;; 125 | esac 126 | } 127 | 128 | # ========================================================================= 129 | 130 | # EOF 131 | -------------------------------------------------------------------------------- /home/.bash/functions-misc: -------------------------------------------------------------------------------- 1 | # shellcheck shell=bash 2 | 3 | # ========================================================================= 4 | 5 | symlink() { 6 | [ $# -eq 2 ] || { 7 | echo "Make symbolic links in the Cygwin 1.7.xx style" 8 | echo "Usage: symlink TARGET LINK_NAME" 9 | return 1 10 | } 11 | printf '!%s\0' "$1" > "$2" || return $? 12 | chattr +s "$2" 13 | } 14 | 15 | # ========================================================================= 16 | 17 | # Manage with windows clipboard 18 | # Check for clp from https://github.com/ildar-shaimordanov/my-scripts 19 | 20 | command -v clp >/dev/null || clp() { 21 | if [ "$1" = "-h" ] || [ "$1" = "--help" ] 22 | then 23 | cat </dev/clipboard 42 | else 43 | # clp | ... 44 | # or simply output the clipboard 45 | case "$1" in 46 | -u ) dos2unix ;; 47 | -d ) unix2dos ;; 48 | * ) cat - ;; 49 | esac /dev/null 2>&1 67 | then 68 | # Assume winpty* instances lie next to Cygwin/Msys separately 69 | # under their own directories as follows: 70 | # -- CYGROOT/../winpty*cygwin* for Cygwin 71 | # -- MSYSROOT/../winpty*msys2* for Msys 72 | 73 | WINPTY="$( 74 | n="$( uname -s -m | tr '[:upper:]' '[:lower:]' )" 75 | 76 | case "$n" in 77 | cygwin* ) 78 | d="$( cygpath -m / )" 79 | e=cygwin 80 | ;; 81 | msys* | mingw* | windows* ) 82 | d="$( cd / ; pwd -W )" 83 | e=msys2 84 | ;; 85 | esac 86 | 87 | case "$n" in 88 | *x86_64 ) 89 | b=64 90 | ;; 91 | * ) 92 | b=32 93 | ;; 94 | esac 95 | 96 | # shellcheck disable=SC2012 97 | WINPTY="$( 98 | ls -rd "$d"/../winpty*$e*$b 2>/dev/null \ 99 | | head -1 100 | )" 101 | 102 | [ -n "$WINPTY" ] || exit 103 | 104 | case "$n" in 105 | cygwin* ) 106 | cygpath "$WINPTY" 107 | ;; 108 | msys* | mingw* | windows* ) 109 | cd "$WINPTY" && pwd 110 | ;; 111 | esac 112 | )" 113 | 114 | if [ -n "$WINPTY" ] && [ -x "$WINPTY/bin/winpty" ] 115 | then 116 | PATH="$PATH:$WINPTY/bin" 117 | fi 118 | 119 | unset WINPTY 120 | fi 121 | 122 | # ========================================================================= 123 | 124 | # Native Windows application invoker (works in most cases) 125 | 126 | alias e='call notepad' 127 | 128 | call() { 129 | # shellcheck disable=SC2046 130 | eval "$1" $( [ $# -gt 1 ] && shift && cygpath -m -- "$@" | sed 's/^\|$/"/g' ) 131 | } 132 | 133 | # ========================================================================= 134 | 135 | # pwd -W for cygwin 136 | uname | grep -iq cygwin && pwd() { 137 | case "$1" in 138 | -W ) 139 | cygpath -m "$PWD" 140 | ;; 141 | * ) 142 | builtin pwd "$@" 143 | ;; 144 | esac 145 | } 146 | 147 | # ========================================================================= 148 | 149 | # join lines 150 | 151 | j2() { 152 | sed "N;s/\n/$1/" 153 | } 154 | 155 | j3() { 156 | sed "N;N;s/\n/$1/g" 157 | } 158 | 159 | jn() { 160 | sed ":a;N;s/\n/$1/;ta" 161 | } 162 | 163 | # ========================================================================= 164 | 165 | ip2hex() { 166 | local ip 167 | IFS="." read -ra ip <<<"$1" 168 | printf "0x0001%02x%02x%02x%02x" "${ip[@]}" 169 | } 170 | 171 | hex2ip() { 172 | printf "%d.%d.%d.%d" "0x${1:6:2}" "0x${1:8:2}" "0x${1:10:2}" "0x${1:12:2}" 173 | } 174 | 175 | # ========================================================================= 176 | 177 | image2pdf() { 178 | convert -adjoin -format pdf "$@" 179 | } 180 | 181 | img2pdf() { 182 | jpegtopnm "${1:--}" | pnmtops -noturn | ps2pdf - "${2:--}" 183 | } 184 | 185 | cover2folder() { 186 | local resize="300x300>" 187 | local gravity="" 188 | local crop="" 189 | 190 | case "$1" in 191 | -l | -r ) 192 | resize="600x300>" 193 | crop="50%x100%" 194 | 195 | case "$1" in 196 | -l ) gravity="west" ;; 197 | -r ) gravity="east" ;; 198 | esac 199 | 200 | shift 201 | ;; 202 | -u | -d ) 203 | resize="300x600>" 204 | crop="100%x50%" 205 | 206 | case "$1" in 207 | -u ) gravity="north" ;; 208 | -d ) gravity="south" ;; 209 | esac 210 | 211 | shift 212 | ;; 213 | esac 214 | 215 | convert "${1:-cover-front.jpg}" \ 216 | -resize "$resize" \ 217 | ${gravity:+-gravity "$gravity"} \ 218 | ${crop:+-crop "$crop"} \ 219 | "folder.jpg" 220 | } 221 | 222 | # ========================================================================= 223 | 224 | # POSIX shell calculator 225 | # https://www.commandlinefu.com/commands/view/24415/shell-pocket-calculator-pure-sh 226 | 227 | calc() { 228 | printf "%.8g\n" "$( printf "%s\n" "$*" | bc -l )" 229 | } 230 | 231 | # ========================================================================= 232 | 233 | # EOF 234 | -------------------------------------------------------------------------------- /home/.bash/functions-pipe: -------------------------------------------------------------------------------- 1 | # shellcheck shell=bash 2 | 3 | # ========================================================================= 4 | 5 | # Perl version of sponge 6 | # http://backreference.org/2011/01/29/in-place-editing-of-files/ 7 | # http://joeyh.name/code/moreutils/ 8 | command -v sponge >/dev/null 2>&1 || sponge() { 9 | if [ $# -ne 1 ] || [ -z "$1" ] 10 | then 11 | cat <$file") or die "sponge: cannot open $file: $!\n"; 31 | print OUT @lines; 32 | close(OUT); 33 | }' -s -- -file="$1" 34 | # perl -e '@lines = <>; open(OUT, ">$file") or die "sponge: cannot open $file: $!\n"; print OUT @lines; close(OUT);' -s -- -file="$1" 35 | } 36 | 37 | # ========================================================================= 38 | 39 | # TODO!!! 40 | # 1. Extend with END-OF-PARA 41 | # 2. Rewrite entirely on Perl 42 | command -v paragrep >/dev/null 2>&1 || paragrep() { 43 | if [ $# -lt 2 ] || [ -z "$1" ] 44 | then 45 | cat < 10 | 11 | PS1="${PS1}\[\e[35m\]" # color: purple 12 | PS1="${PS1}${MSYSTEM:-$OSTYPE} " # $MSYSTEM/$OSTYPE 13 | 14 | PS1="${PS1}\[\e[33m\]" # color: dark yellow 15 | PS1="${PS1}\w" # current dir 16 | 17 | PS1="${PS1}\[\e[0m\]" # color: reset to default 18 | 19 | if declare -F __git_ps1 >/dev/null 20 | then 21 | # shellcheck disable=SC2034 22 | GIT_PS1_SHOWCOLORHINTS=1 23 | PS1="${PS1}\` __git_ps1 \`" # git status 24 | fi 25 | 26 | PS1="${PS1}\n" # new line 27 | PS1="${PS1}\\\$ " # $ 28 | 29 | # ========================================================================= 30 | 31 | # EOF 32 | -------------------------------------------------------------------------------- /home/.bash_profile: -------------------------------------------------------------------------------- 1 | #! ~/.bash_profile 2 | 3 | #- # Workaround to avoid the existing issue of sourcing from /etc/profile 4 | #- # https://github.com/msysgit/msysgit/pull/231 5 | #- case "$OSTYPE" in 6 | #- msys*) 7 | #- [ "${BASH_SOURCE[1]}" == "/etc/profile" ] && return 8 | #- ;; 9 | #- esac 10 | #- ## echo "${BASH_SOURCE[@]}" 11 | 12 | # ========================================================================= 13 | 14 | # To the extent possible under law, the author(s) have dedicated all 15 | # copyright and related and neighboring rights to this software to the 16 | # public domain worldwide. This software is distributed without any warranty. 17 | # You should have received a copy of the CC0 Public Domain Dedication along 18 | # with this software. 19 | # If not, see . 20 | 21 | # base-files version 4.1-1 22 | 23 | # ~/.bash_profile: executed by bash(1) for login shells. 24 | 25 | # The latest version as installed by the Cygwin Setup program can 26 | # always be found at /etc/defaults/etc/skel/.bash_profile 27 | 28 | # Modifying /etc/skel/.bash_profile directly will prevent 29 | # setup from updating it. 30 | 31 | # The copy in your home directory (~/.bash_profile) is yours, please 32 | # feel free to customise it to create a shell 33 | # environment to your liking. If you feel a change 34 | # would be benifitial to all, please feel free to send 35 | # a patch to the cygwin mailing list. 36 | 37 | # User dependent .bash_profile file 38 | 39 | # ========================================================================= 40 | 41 | # Workaround for setting HOME to $TEA_HOME/home 42 | OLD_HOME="$HOME" 43 | HOME="$( dirname "$BASH_SOURCE" | cygpath -mf - | xargs realpath | cygpath -uf - )" 44 | 45 | [ "$OLD_HOME" == "$PWD" ] && cd "$HOME" 46 | unset OLD_HOME 47 | 48 | PATH="$PATH:$HOME/bin" 49 | 50 | # ========================================================================= 51 | 52 | # source the users bashrc if it exists 53 | if [ -f "${HOME}/.bashrc" ] ; then 54 | source "${HOME}/.bashrc" 55 | fi 56 | 57 | # Set PATH so it includes user's private bin if it exists 58 | # if [ -d "${HOME}/bin" ] ; then 59 | # PATH="${HOME}/bin:${PATH}" 60 | # fi 61 | 62 | # Set MANPATH so it includes users' private man if it exists 63 | # if [ -d "${HOME}/man" ]; then 64 | # MANPATH="${HOME}/man:${MANPATH}" 65 | # fi 66 | 67 | # Set INFOPATH so it includes users' private info if it exists 68 | # if [ -d "${HOME}/info" ]; then 69 | # INFOPATH="${HOME}/info:${INFOPATH}" 70 | # fi 71 | 72 | # ========================================================================= 73 | 74 | # EOF 75 | -------------------------------------------------------------------------------- /home/.bashrc: -------------------------------------------------------------------------------- 1 | #! ~/.bashrc 2 | 3 | # ========================================================================= 4 | 5 | # To the extent possible under law, the author(s) have dedicated all 6 | # copyright and related and neighboring rights to this software to the 7 | # public domain worldwide. This software is distributed without any warranty. 8 | # You should have received a copy of the CC0 Public Domain Dedication along 9 | # with this software. 10 | # If not, see . 11 | 12 | # base-files version 4.1-1 13 | 14 | # ~/.bashrc: executed by bash(1) for interactive shells. 15 | 16 | # The latest version as installed by the Cygwin Setup program can 17 | # always be found at /etc/defaults/etc/skel/.bashrc 18 | 19 | # Modifying /etc/skel/.bashrc directly will prevent 20 | # setup from updating it. 21 | 22 | # The copy in your home directory (~/.bashrc) is yours, please 23 | # feel free to customise it to create a shell 24 | # environment to your liking. If you feel a change 25 | # would be benifitial to all, please feel free to send 26 | # a patch to the cygwin mailing list. 27 | 28 | # User dependent .bashrc file 29 | 30 | # If not running interactively, don't do anything 31 | [[ "$-" != *i* ]] && return 32 | 33 | # Shell Options 34 | # 35 | # See man bash for more options... 36 | # 37 | # Don't wait for job termination notification 38 | # set -o notify 39 | # 40 | # Don't use ^D to exit 41 | # set -o ignoreeof 42 | # 43 | # Use case-insensitive filename globbing 44 | # shopt -s nocaseglob 45 | # 46 | # Make bash append rather than overwrite the history on disk 47 | # shopt -s histappend 48 | # 49 | # When changing directory small typos can be ignored by bash 50 | # for example, cd /vr/lgo/apaache would find /var/log/apache 51 | # shopt -s cdspell 52 | # 53 | # Strip the ".exe" extension when use the bash autocompletion feature 54 | shopt -s completion_strip_exe 55 | 56 | # Completion options 57 | # 58 | # These completion tuning parameters change the default behavior of bash_completion: 59 | # 60 | # Define to access remotely checked-out files over passwordless ssh for CVS 61 | # COMP_CVS_REMOTE=1 62 | # 63 | # Define to avoid stripping description in --option=description of './configure --help' 64 | # COMP_CONFIGURE_HINTS=1 65 | # 66 | # Define to avoid flattening internal contents of tar files 67 | # COMP_TAR_INTERNAL_PATHS=1 68 | # 69 | # Uncomment to turn on programmable completion enhancements. 70 | # Any completions you add in ~/.bash_completion are sourced last. 71 | # [[ -f /etc/bash_completion ]] && . /etc/bash_completion 72 | 73 | # History Options 74 | # 75 | # Don't put duplicate lines in the history. 76 | export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups 77 | # 78 | # Ignore some controlling instructions 79 | # HISTIGNORE is a colon-delimited list of patterns which should be excluded. 80 | # The '&' is a special pattern which suppresses duplicate entries. 81 | export HISTIGNORE=$'[ \t]*:&:[fb]g:exit' 82 | # 83 | # Increase the history size and the history file size 84 | export HISTSIZE=2000 85 | export HISTFILESIZE=20000 86 | # 87 | # Whenever displaying the prompt, write the previous line to disk 88 | # export PROMPT_COMMAND="history -a" 89 | 90 | # Umask 91 | # 92 | # /etc/profile sets 022, removing write perms to group + others. 93 | # Set a more restrictive umask: i.e. no exec perms for others: 94 | # umask 027 95 | # Paranoid: neither group nor others have any perms: 96 | # umask 077 97 | 98 | # The CYGWIN environment variable 99 | # 100 | # https://www.cygwin.com/cygwin-ug-net/using-cygwinenv.html 101 | # https://www.cygwin.com/cygwin-ug-net/using.html#pathnames-symlinks 102 | # 103 | # winsymlinks:{lnk,native,nativestrict} 104 | # 105 | # if set to just winsymlinks or winsymlinks:lnk, Cygwin creates symlinks 106 | # as Windows shortcuts with a special header and the R/O attribute set. 107 | # 108 | # If set to winsymlinks:native or winsymlinks:nativestrict, Cygwin 109 | # creates symlinks as native Windows symlinks on filesystems and OS 110 | # versions supporting them. 111 | # 112 | # The difference between winsymlinks:native and winsymlinks:nativestrict 113 | # is this: If the filesystem supports native symlinks and Cygwin fails 114 | # to create a native symlink for some reason, it will fall back to 115 | # creating Cygwin default symlinks with winsymlinks:native, while with 116 | # winsymlinks:nativestrict the symlink(2) system call will immediately 117 | # fail. 118 | 119 | export CYGWIN="winsymlinks" 120 | 121 | # ========================================================================= 122 | 123 | # Clean the variable reserved for custom MOTD before using it. See the 124 | # details below to understand the concept of the feature. 125 | unset BASH_PROFILE_MOTD 126 | 127 | if [ -d "${HOME}/.bash" ] 128 | then 129 | # Environment, functions, some setings and aliases: in this order 130 | for f in \ 131 | "${HOME}/.bash"/environ \ 132 | "${HOME}/.bash"/functions-* \ 133 | "${HOME}/.bash"/settings-* \ 134 | "${HOME}/.bash"/aliases \ 135 | 136 | do 137 | [ -f "$f" ] \ 138 | && . "$f" 139 | done 140 | fi 141 | 142 | # Either "~/.bashrc" or any of "~/.bash/*" can define its own message 143 | # of the day (MOTD). Each MOTD should be correct shell code that 144 | # will be executed after sourcing all "~/.bash/*" and "~/.bashrc" 145 | # files. They should be added (either prepended or appended) to the 146 | # "$BASH_PROFILE_MOTD" variable. The easiest way to declare MOTD is 147 | # as follows: 148 | # 149 | # BASH_PROFILE_MOTD="$BASH_PROFILE_MOTD 150 | # : some code here if needed 151 | # cat <. 7 | 8 | # base-files version 4.1-1 9 | 10 | # ~/.inputrc: readline initialization file. 11 | 12 | # The latest version as installed by the Cygwin Setup program can 13 | # always be found at /etc/defaults/etc/skel/.inputrc 14 | 15 | # Modifying /etc/skel/.inputrc directly will prevent 16 | # setup from updating it. 17 | 18 | # The copy in your home directory (~/.inputrc) is yours, please 19 | # feel free to customise it to create a shell 20 | # environment to your liking. If you feel a change 21 | # would be benifitial to all, please feel free to send 22 | # a patch to the cygwin mailing list. 23 | 24 | # the following line is actually 25 | # equivalent to "\C-?": delete-char 26 | "\e[3~": delete-char 27 | 28 | # VT 29 | "\e[1~": beginning-of-line 30 | "\e[4~": end-of-line 31 | 32 | # kvt 33 | "\e[H": beginning-of-line 34 | "\e[F": end-of-line 35 | 36 | # rxvt and konsole (i.e. the KDE-app...) 37 | "\e[7~": beginning-of-line 38 | "\e[8~": end-of-line 39 | 40 | # VT220 41 | "\eOH": beginning-of-line 42 | "\eOF": end-of-line 43 | 44 | # Allow 8-bit input/output 45 | #set meta-flag on 46 | #set convert-meta off 47 | #set input-meta on 48 | #set output-meta on 49 | #$if Bash 50 | # Don't ring bell on completion 51 | #set bell-style none 52 | 53 | # or, don't beep at me - show me 54 | #set bell-style visible 55 | 56 | # Filename completion/expansion 57 | #set completion-ignore-case on 58 | #set show-all-if-ambiguous on 59 | 60 | # Expand homedir name 61 | #set expand-tilde on 62 | 63 | # Append "/" to all dirnames 64 | #set mark-directories on 65 | #set mark-symlinked-directories on 66 | 67 | # Match all files 68 | #set match-hidden-files on 69 | 70 | # 'Magic Space' 71 | # Insert a space character then performs 72 | # a history expansion in the line 73 | #Space: magic-space 74 | #$endif 75 | -------------------------------------------------------------------------------- /home/.minttyrc: -------------------------------------------------------------------------------- 1 | BoldAsFont=no 2 | Rows=50 3 | ScrollbackLines=100000 4 | Transparency=low 5 | OpaqueWhenFocused=no 6 | ClicksPlaceCursor=no 7 | RightClickAction=paste 8 | FontHeight=10 9 | BellType=0 10 | -------------------------------------------------------------------------------- /home/.perl5/000-make-runners: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # ========================================================================= 4 | 5 | shell_runner() { 6 | cat - <<-SCRIPT 7 | #!/usr/bin/env bash 8 | PERL5LIB="\$( dirname "\$0" )/../home/.perl5/lib" 9 | perl -I "\$PERL5LIB" -x -S "\$PERL5LIB/../bin/\$( basename "\$0" )$1" "\$@" 10 | SCRIPT 11 | } 12 | 13 | batch_runner() { 14 | cat - <<-SCRIPT | unix2dos 15 | @echo off 16 | set PERL5LIB="%~dp0..\home\.perl5\lib" 17 | perl -I "%PERL5LIB%" -x -S "%PERL5LIB%\..\bin\%~n0$1" %* 18 | SCRIPT 19 | } 20 | 21 | # ========================================================================= 22 | 23 | DESTDIR="${1:-$HOME/bin}" 24 | 25 | [ -d "$DESTDIR" ] || { 26 | echo "Not a directory: $DESTDIR" 27 | exit 1 28 | } 29 | 30 | cat - < "$DESTDIR/$g" 52 | batch_runner "$x" > "$DESTDIR/$g.bat" 53 | done 54 | 55 | # ========================================================================= 56 | 57 | # EOF 58 | -------------------------------------------------------------------------------- /home/.profile: -------------------------------------------------------------------------------- 1 | # To the extent possible under law, the author(s) have dedicated all 2 | # copyright and related and neighboring rights to this software to the 3 | # public domain worldwide. This software is distributed without any warranty. 4 | # You should have received a copy of the CC0 Public Domain Dedication along 5 | # with this software. 6 | # If not, see . 7 | 8 | # base-files version 4.1-1 9 | 10 | # ~/.profile: executed by the command interpreter for login shells. 11 | 12 | # The latest version as installed by the Cygwin Setup program can 13 | # always be found at /etc/defaults/etc/skel/.profile 14 | 15 | # Modifying /etc/skel/.profile directly will prevent 16 | # setup from updating it. 17 | 18 | # The copy in your home directory (~/.profile) is yours, please 19 | # feel free to customise it to create a shell 20 | # environment to your liking. If you feel a change 21 | # would be benificial to all, please feel free to send 22 | # a patch to the cygwin mailing list. 23 | 24 | # User dependent .profile file 25 | 26 | # Set user-defined locale 27 | which locale >/dev/null 2>&1 && export LANG="$(locale -uU)" 28 | 29 | # This file is not read by bash(1) if ~/.bash_profile or ~/.bash_login 30 | # exists. 31 | # 32 | # if running bash 33 | if [ -n "${BASH_VERSION}" ]; then 34 | if [ -f "${HOME}/.bashrc" ]; then 35 | source "${HOME}/.bashrc" 36 | fi 37 | fi 38 | -------------------------------------------------------------------------------- /javaenv.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | call :shellenv.lookup.jdk 4 | call :shellenv.lookup.jre 5 | 6 | if defined JRE_HOME set "JAVA_HOME=%JRE_HOME%" 7 | if defined JDK_HOME set "JAVA_HOME=%JDK_HOME%" 8 | 9 | goto :EOF 10 | 11 | :: ======================================================================== 12 | 13 | :: These routines look for the latest version of JDK or JRE installed on 14 | :: the PC and set the environment variable (JDK_HOME or JRE_HOME, 15 | :: respectively) to the appropriate path. Initially they look for paths in 16 | :: Windows Registry. If nothing is found there, they try to find all Java 17 | :: directories under %ProgramFiles% and %ProgramFiles(x86)% and set to the 18 | :: latest one. 19 | :: 20 | :: %~1 - variable name (JDK_HOME or JRE_HOME) 21 | :: %~2 - engine name (jdk or jre) 22 | :: %~3 - registry name ("Java Development Kit" or "Java Runtime Environment") 23 | 24 | :shellenv.lookup.jdk 25 | call :shellenv.lookup.java JDK_HOME jdk "Java Development Kit" 26 | goto :EOF 27 | 28 | :: ======================================================================== 29 | 30 | :shellenv.lookup.jre 31 | call :shellenv.lookup.java JRE_HOME jre "Java Runtime Environment" 32 | goto :EOF 33 | 34 | :: ======================================================================== 35 | 36 | :shellenv.lookup.java 37 | set "%~1=" 38 | 39 | for %%q in ( 40 | "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\%~3" 41 | "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\%~3" 42 | ) do for /f "tokens=1,2,*" %%a in ( ' 43 | reg query "%%~q" /v "JavaHome" /s 2^>nul ^| find "JavaHome" 44 | ' ) do if exist "%%~c" ( 45 | set "%~1=%%~c" 46 | ) 47 | 48 | for /f %%d in ( ' 49 | dir /b "%ProgramFiles%\Java" "%ProgramFiles(x86)%\Java" 2^>nul ^| findstr /i "%~2" ^| sort 50 | ' ) do if exist "%ProgramFiles%\Java\%%d" ( 51 | set "%~1=%ProgramFiles%\Java\%%d" 52 | ) else ( 53 | set "%~1=%ProgramFiles(x86)%\Java\%%d" 54 | ) 55 | goto :EOF 56 | 57 | :: ======================================================================== 58 | 59 | :: EOF 60 | -------------------------------------------------------------------------------- /libexec/README: -------------------------------------------------------------------------------- 1 | Family home for: 2 | 3 | * clink 4 | * ConEmu 5 | * Far3 6 | * unxutils 7 | 8 | * cygwin 9 | * gnuwin32 10 | * gow-git 11 | * msysgit 12 | * win-bash 13 | 14 | * mintty (for msysgit) 15 | -------------------------------------------------------------------------------- /libexec/identify.bat: -------------------------------------------------------------------------------- 1 | 2 | if /i "%~1 %~2" == "app clink" ( 3 | rem set "CLINK_NAME=clink_0.4.8" 4 | ) 5 | 6 | if /i "%~1 %~2" == "app Far3" ( 7 | rem set "FAR_NAME=Far30b4774.x86.20160902" 8 | rem set "FAR_NAME=Far30b4900.x86.20170221" 9 | ) 10 | 11 | if /i "%~1 %~2" == "app Unix" ( 12 | rem set "UNIX_NAME=cygwin" 13 | rem set "UNIX_NAME=gnuwin32" 14 | set "UNIX_NAME=gow" 15 | rem set "UNIX_NAME=PortableGit-2.11.1-32-bit" 16 | rem set "UNIX_NAME=PortableGit-2.11.1-64-bit" 17 | rem set "UNIX_NAME=unxutils" 18 | rem set "UNIX_NAME=win-bash" 19 | ) 20 | 21 | :: ======================================================================== 22 | 23 | if /i "%~1 %~2" == "shell Git" ( 24 | rem set "SHELL_NAME=PortableGit-2.11.1-32-bit" 25 | rem set "SHELL_NAME=PortableGit-2.11.1-64-bit" 26 | set "SHELL_NAME=PortableGit-2.42.0.2-64-bit" 27 | ) 28 | 29 | if /i "%~1 %~2" == "shell ConEmu" ( 30 | rem set "SHELL_NAME=ConEmuPack.160308" 31 | rem set "SHELL_NAME=ConEmuPack.160313" 32 | ) 33 | 34 | if /i "%~1 %~2" == "shell ConsoleZ" ( 35 | rem set "SHELL_NAME=ConsoleZ.x64.1.16.0.16038" 36 | rem set "SHELL_NAME=ConsoleZ.x86.1.16.0.16038" 37 | rem set "SHELL_NAME=ConsoleZ.x64.1.18.0.17048" 38 | rem set "SHELL_NAME=ConsoleZ.x86.1.18.0.17048" 39 | ) 40 | 41 | :: ======================================================================== 42 | 43 | :: EOF 44 | -------------------------------------------------------------------------------- /opt/README: -------------------------------------------------------------------------------- 1 | Variety of tools and packages 2 | 3 | These tools are not added automatically to "%PATH%". To enable the tool, 4 | declare the path to the tool in "shellenv.cfg". 5 | 6 | If you want to maintain different versions of one tool you can follow 7 | the procedure as below: 8 | 9 | 1. store each version of the tool in a separate directory 10 | 11 | 2.1. create a junction link using the command 12 | 13 | mklink /j NAME NAME-VERSION 14 | 15 | 2.2. create a directory symbolic link using the command 16 | 17 | mklink /d NAME NAME-VERSION 18 | -------------------------------------------------------------------------------- /shell.bat: -------------------------------------------------------------------------------- 1 | 0&2 echo:Shell name required 6 | goto :shell.failed 7 | ) 8 | 9 | setlocal 10 | 11 | :: Proceed to the specified folder 12 | if not "%~2" == "" pushd "%~2" || ( 13 | >&2 echo:Unable cd "%~2" 14 | goto :shell.failed 15 | ) 16 | 17 | :: Set the home dir 18 | set "HOME=%~dp0home" 19 | 20 | :: Set the environment specific for this shell/terminal 21 | if exist "%~dp0etc\%~n0\%~1.bat" call "%~dp0etc\%~n0\%~1.bat" 22 | 23 | :: ======================================================================== 24 | 25 | set "SHELL_NAME=%~1" 26 | set "SHELL_ARGS=" 27 | 28 | if exist "%~dp0libexec\identify.bat" call "%~dp0libexec\identify.bat" shell "%~1" 29 | 30 | :: ======================================================================== 31 | 32 | :: Check if there is git-bash 33 | if defined SHELL_NAME if exist "%~dp0libexec\%SHELL_NAME%\git-bash.exe" ( 34 | call :shell.git-bash.prepare "%~1" 35 | call :shell.start "%~1" "git-bash.exe" 36 | goto :EOF 37 | ) 38 | 39 | :: ======================================================================== 40 | 41 | :: Check if there is mintty 42 | if defined SHELL_NAME for %%s in ( 43 | bin 44 | usr\bin 45 | usr\local\bin 46 | ) do if exist "%~dp0libexec\%SHELL_NAME%\%%s\mintty.exe" ( 47 | call :shell.mintty.prepare "%~1" %%s 48 | call :shell.start "%~1" "%%s\mintty.exe" 49 | goto :EOF 50 | ) 51 | 52 | :: ======================================================================== 53 | 54 | :: Check if ConEmu is available 55 | set "SHELL_NAME=ConEmu" 56 | set "SHELL_ARGS=" 57 | 58 | if exist "%~dp0libexec\identify.bat" call "%~dp0libexec\identify.bat" shell ConEmu 59 | 60 | if defined SHELL_NAME if exist "%~dp0libexec\%SHELL_NAME%\ConEmu.exe" ( 61 | call :shell.conemu.prepare "%~1" && ( 62 | call :shell.start "%~1" "ConEmu.exe" 63 | goto :EOF 64 | ) 65 | ) 66 | 67 | :: ======================================================================== 68 | 69 | :: Check if ConsoleZ is available 70 | set "SHELL_NAME=ConsoleZ" 71 | set "SHELL_ARGS=" 72 | 73 | if exist "%~dp0libexec\identify.bat" call "%~dp0libexec\identify.bat" shell ConsoleZ 74 | 75 | if defined SHELL_NAME if exist "%~dp0libexec\%SHELL_NAME%\Console.exe" ( 76 | call :shell.consolez.prepare "%~1" && ( 77 | call :shell.start "%~1" "Console.exe" 78 | goto :EOF 79 | ) 80 | ) 81 | 82 | :: ======================================================================== 83 | 84 | :: Try bare bash, ksh or sh 85 | set "SHELL_NAME=%~1" 86 | set "SHELL_ARGS=-l -i" 87 | 88 | for %%s in ( 89 | bash 90 | ksh 91 | sh 92 | ) do if exist "%~dp0libexec\%SHELL_NAME%\bin\%%~s.exe" ( 93 | call :shell.start "%~1" "bin\%%~s.exe" 94 | goto :EOF 95 | ) 96 | 97 | :: ======================================================================== 98 | 99 | >&2 echo:Cannot find the specified shell "%~1". 100 | 101 | :: ======================================================================== 102 | 103 | :shell.failed 104 | >&2 pause 105 | exit /b 1 106 | 107 | :: ======================================================================== 108 | 109 | :shell.start 110 | start "Starting %~1 (%SHELL_NAME%)" "%~dp0libexec\%SHELL_NAME%\%~2" %SHELL_ARGS% 111 | goto :EOF 112 | 113 | :: ======================================================================== 114 | 115 | :shell.git-bash.prepare 116 | goto :EOF 117 | 118 | :: ======================================================================== 119 | 120 | :shell.bare.prepare 121 | set "SHELL_ARGS=--login -i" 122 | goto :EOF 123 | 124 | :: ======================================================================== 125 | 126 | :shell.mintty.prepare 127 | if not exist "%HOME%\.minttyrc" if exist "%~dp0etc\mintty\default.settings" ( 128 | copy /b "%~dp0etc\mintty\default.settings" "%HOME%\.minttyrc" 129 | ) 130 | 131 | set "SHELL_ARGS=-c "%HOME%\.minttyrc"" 132 | 133 | if exist "%~dp0etc\images\%~1.ico" ( 134 | set "SHELL_ARGS=%SHELL_ARGS% -i "%~dp0etc\images\%~1.ico"" 135 | ) 136 | 137 | set "SHELL_ARGS=%SHELL_ARGS% /%~2/bash --login -i" 138 | goto :EOF 139 | 140 | :: ======================================================================== 141 | 142 | :shell.consolez.prepare 143 | if not exist "%~dp0etc\ConsoleZ\%~1.xml" exit /b 1 144 | set "SHELL_ARGS=-c "%~dp0etc\ConsoleZ\%~1.xml" -t "%~1"" 145 | goto :EOF 146 | 147 | :: ======================================================================== 148 | 149 | :shell.conemu.prepare 150 | call :shell.conemu.prepare.args FILE "%~1" && goto :EOF 151 | call :shell.conemu.prepare.args CONF "%~1" && goto :EOF 152 | call :shell.conemu.prepare.args TASK "%~1" && goto :EOF 153 | goto :EOF 154 | 155 | :shell.conemu.prepare.args 156 | if "%~1" == "FILE" ( 157 | set "SHELL_ARGS=%~dp0etc\ConEmu\%~2.xml" 158 | ) else ( 159 | set "SHELL_ARGS=%~dp0etc\ConEmu\ConEmu.xml" 160 | ) 161 | 162 | if not exist "%SHELL_ARGS%" ( 163 | endlocal 164 | exit /b 1 165 | ) 166 | 167 | cscript //nologo //e:javascript "%~f0" "%SHELL_ARGS%" %* || ( 168 | endlocal 169 | exit /b 1 170 | ) 171 | 172 | set "SHELL_ARGS=/LoadCfgFile "%SHELL_ARGS%"" 173 | if exist "%~dp0etc\images\%~2.ico" ( 174 | set "SHELL_ARGS=%SHELL_ARGS% /Icon "%~dp0etc\images\%~2.ico"" 175 | ) else if exist "%~dp0etc\images\ConEmu.ico" ( 176 | set "SHELL_ARGS=%SHELL_ARGS% /Icon "%~dp0etc\images\ConEmu.ico"" 177 | ) 178 | 179 | if "%~1" == "CONF" ( 180 | set "SHELL_ARGS=%SHELL_ARGS% /Config "%~2"" 181 | ) else if "%~1" == "TASK" ( 182 | set "SHELL_ARGS=%SHELL_ARGS% /Cmd "{%~2}"" 183 | ) 184 | 185 | goto :EOF 186 | 187 | :: ======================================================================== 188 | 189 | */0; 190 | 191 | var alert = alert || function(msg) 192 | { 193 | WScript.Echo(msg); 194 | }; 195 | 196 | var exit = exit || function(exitCode) 197 | { 198 | WScript.Quit(exitCode); 199 | }; 200 | 201 | if ( WScript.Arguments.length != 3 ) { 202 | alert('Usage: ' + WScript.ScriptName + ' filename options'); 203 | exit(1); 204 | } 205 | 206 | var filename = WScript.Arguments.item(0); 207 | 208 | var ctrl = WScript.Arguments.item(1); 209 | var name = WScript.Arguments.item(2); 210 | 211 | var xpathstr = '/key[@name="Software"]/key[@name="ConEmu"]' 212 | + '/key[lower-case(@name)=lower-case("' + ( ctrl == 'CONF' ? name : '.Vanilla' ) + '")]' 213 | + '/key[@name="Tasks"]/key'; 214 | 215 | if ( ctrl == 'TASK' ) { 216 | xpathstr += '/value[@name="Name"][lower-case(@data)=lower-case("{' + name + '}")]'; 217 | } 218 | 219 | // Comparison in XPath is case sensitive. Using of "lower-case" XPath 220 | // function could be good solution to escape differencies between "abc", 221 | // "ABC" and so on. Unfortunately, "lower-case" is a part of XPath 2.0 and 222 | // is not supportable by MS JScript. To resolve this issue we introduce 223 | // the partial workaround replacement with the function "translate", 224 | // available in XPath 1.0. 225 | // See for details: http://stackoverflow.com/a/1625859/3627676 226 | xpathstr = xpathstr.replace( 227 | /lower-case\(([^()]+)\)/g, 228 | 'translate($1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")' 229 | ); 230 | 231 | var e; 232 | try { 233 | var xmldoc = new ActiveXObject('Microsoft.XMLDOM'); 234 | xmldoc.setProperty('SelectionLanguage', 'XPath'); 235 | xmldoc.load(filename); 236 | 237 | var xml = xmldoc.selectNodes(xpathstr); 238 | } catch(e) { 239 | // If a file or XML are bad, exit with error immediately 240 | exit(1); 241 | } 242 | 243 | exit( xml.length != 0 ? 0 : 1 ); 244 | -------------------------------------------------------------------------------- /shellenv.bat: -------------------------------------------------------------------------------- 1 | :: This file is a helper script to simplify setting up of the %PATH% and 2 | :: other useful environment variables. 3 | 4 | @echo off 5 | 6 | :: Tea-Set 7 | for /f "tokens=*" %%p in ( "%~dp0." ) do set "TEA_HOME=%%~fp" 8 | 9 | :: Java 10 | call :ifexist "%~dp0javaenv.bat" 11 | 12 | call :shellenv.config 13 | 14 | call :shellenv.conemu 15 | 16 | goto :EOF 17 | 18 | :: ======================================================================== 19 | 20 | :ifexist 21 | if exist "%~1" call %* 22 | goto :EOF 23 | 24 | :: ======================================================================== 25 | 26 | :shellenv.config 27 | if not exist "%~dpn0.cfg" goto :EOF 28 | 29 | setlocal enabledelayedexpansion 30 | 31 | :: This is TAB separated file 32 | for /f "usebackq eol=; tokens=1,2,3,4 delims= " %%1 in ( "%~dpn0.cfg" ) do ( 33 | if /i "%%~1" == "ROOT" ( 34 | for /f "tokens=*" %%p in ( 'echo:%%~2' ) do set "auto_root=%%~fp" 35 | ) else if /i "%%~1" == "HOME" ( 36 | call :shellenv.set.home "%%~2" "%%~3" 37 | ) else if /i "%%~1" == "DIRS" ( 38 | call :shellenv.set.dirs "!auto_root!\%%~2" "%%~3" "%%~4" 39 | ) else if /i "%%~1" == "DIR" ( 40 | call :shellenv.set.dir "!auto_root!\%%~2" "%%~3" 41 | ) 42 | ) 43 | 44 | endlocal & set "PATH=%PATH%" 45 | goto :EOF 46 | 47 | :: ======================================================================== 48 | 49 | :: homedir [prepend] 50 | :shellenv.set.home 51 | call :shellenv.set.dirs "%~1" "bin;sbin;usr\bin" "%~2" 52 | goto :EOF 53 | 54 | :: ======================================================================== 55 | 56 | :: rootdir\dir subdirs [prepend] 57 | :shellenv.set.dirs 58 | if "%~1" == "" goto :EOF 59 | if "%~2" == "" goto :EOF 60 | 61 | setlocal enabledelayedexpansion 62 | 63 | set "auto_subdirs=%~2" 64 | set "auto_path=" 65 | for %%s in ( "%auto_subdirs:;=" "%" ) do for %%p in ( "%~1\%%~s" ) do ( 66 | call :shellenv.check.dir "%%~fp" && set "auto_path=!auto_path!;%%~fp" 67 | ) 68 | 69 | if defined auto_path set "auto_path=!auto_path:~1!" 70 | 71 | call :shellenv.concat "%~3" 72 | 73 | endlocal & set "PATH=%PATH%" 74 | goto :EOF 75 | 76 | :: ======================================================================== 77 | 78 | :: rootdir\dir [prepend] 79 | :shellenv.set.dir 80 | if "%~1" == "" goto :EOF 81 | 82 | setlocal 83 | 84 | set "auto_path=" 85 | for %%p in ( 86 | "%~1\bin" 87 | "%~1\usr\bin" 88 | "%~1\cmd" 89 | "%~1" 90 | ) do if not defined auto_path ( 91 | call :shellenv.check.dir "%%~fp" && set "auto_path=%%~fp" 92 | ) 93 | 94 | if not defined auto_path goto :EOF 95 | 96 | call :shellenv.concat "%~2" 97 | 98 | endlocal & set "PATH=%PATH%" 99 | goto :EOF 100 | 101 | :: ======================================================================== 102 | 103 | :: dir 104 | :shellenv.check.dir 105 | :: Skip if path not exists 106 | if not exist "%~1" exit /b 1 107 | 108 | :: Skip if the path is specified in %PATH% 109 | for %%p in ( "%PATH:;=" "%" ) do if /i "%~1" == "%%~p" exit /b 1 110 | 111 | :: Skip if no executables in the path 112 | dir /b /a-d "%~1\*.exe" "%~1\*.bat" "%~1\*.cmd" >nul 2>nul 113 | goto :EOF 114 | 115 | :: ======================================================================== 116 | 117 | :: [prepend] 118 | :shellenv.concat 119 | if not defined auto_path goto :EOF 120 | 121 | if /i "%~1" == "prepend" ( 122 | set "PATH=%auto_path%;%PATH%" 123 | ) else ( 124 | set "PATH=%PATH%;%auto_path%" 125 | ) 126 | goto :EOF 127 | 128 | :: ======================================================================== 129 | 130 | :shellenv.conemu 131 | :: If possible, move the cursor to the bottom of the screen 132 | if /i "%ConEmuANSI%" == "ON" ( 133 | echo: 134 | ) else ( 135 | reg query "HKCU\Console" /v VirtualTerminalLevel 2>nul | findstr "0x1" && echo: 136 | ) 137 | 138 | :: Make ConEmu's environment variables available for child processes 139 | :: if defined ConEmuBaseDir ( 140 | :: call :ifexist "%ConEmuBaseDir%\IsConEmu.cmd" >nul 141 | if %ERRORLEVEL% == 0 call :ifexist "%ConEmuBaseDir%\ConEmuC.exe" /export 142 | :: ) 143 | 144 | :: Colorize the command line prompt 145 | :: if defined ConEmuBaseDir ( 146 | :: call :ifexist "%ConEmuBaseDir%\ColorPrompt.cmd" 147 | :: ) 148 | goto :EOF 149 | 150 | :: ======================================================================== 151 | 152 | :: EOF 153 | -------------------------------------------------------------------------------- /shellenv.cfg-EXAMPLE: -------------------------------------------------------------------------------- 1 | ; This is a TAB separated value file. It configures a set of directories 2 | ; supposed to be put in PATH. It provides few simple rules describing 3 | ; which directories and how should be put in PATH. 4 | ; 5 | ; ROOT rootdir 6 | ; It defines a root directory for looking for other directories laying 7 | ; under it. 8 | ; 9 | ; DIRS dir subdirs [prepend] 10 | ; It defines a directory rootdir\dir. The second parameter is a list of 11 | ; subdirectories delimited with ";". All declared subdirectories will 12 | ; be specified in PATH. 13 | ; 14 | ; DIR dir [prepend] 15 | ; It defines a directory rootdir\dir that may contain any subdirectories 16 | ; of the list: "bin", "usr\bin", or "cmd". The first found subdirectory 17 | ; or the directory itself will be specified in PATH. 18 | ; 19 | ; HOME homedir [prepend] 20 | ; It defines an application's home directory. It acts as couple of two 21 | ; rules (assuming that homedir=root\dir): 22 | ; ROOT root 23 | ; DIRS dir "bin;sbin;usr\bin" [prepend] 24 | ; 25 | ; The optional parameter "prepend" affects on how new directories will be 26 | ; concatenated with PATH: prepended as NEW;PATH or appended as PATH;NEW. 27 | ; 28 | ; ========================================================================= 29 | 30 | ; TEA_HOME variable is already set by shellenv.bat. 31 | ; The following rules add TEA_HOME and TEA_HOME\bin to PATH 32 | 33 | ROOT %TEA_HOME% 34 | DIRS . "bin;." 35 | 36 | ; ========================================================================= 37 | 38 | ; Let's try to add Java 39 | 40 | HOME %JAVA_HOME% 41 | 42 | ; ========================================================================= 43 | 44 | ; Let's try to add Virtual Box for its headless usage 45 | 46 | HOME "%ProgramFiles%\Oracle\VirtualBox" 47 | 48 | ; ========================================================================= 49 | 50 | ; Let's begin with these ones 51 | 52 | ROOT %TEA_HOME%\opt 53 | 54 | DIR 7za 55 | DIR busybox 56 | 57 | ; Add here everything you want from TEA_HOME\opt 58 | 59 | ; ========================================================================= 60 | 61 | ; Add here everything you want from TEA_HOME\libexec 62 | 63 | ; ========================================================================= 64 | 65 | ; Add here everything you want from another places 66 | 67 | ; ========================================================================= 68 | 69 | ; EOF 70 | -------------------------------------------------------------------------------- /shellinfo.bat: -------------------------------------------------------------------------------- 1 | :: ======================================================================== 2 | :: 3 | :: This file is a helper script to show some specific environment 4 | :: variables such as %PATH% and families %FAR*%, %ConEmu*% and %*HOME%. 5 | :: 6 | :: ======================================================================== 7 | 8 | @echo off 9 | 10 | if /i "%~1" == "list" goto :shellinfo_list 11 | 12 | if "%~1" == "" ( 13 | echo:Show the actual environment ^(variables and/or aliases^) 14 | echo: 15 | echo:Usage: 16 | echo:%~n0 PATTERN ... 17 | echo: 18 | echo:Available patterns: 19 | call :shellinfo_list 20 | 21 | goto :EOF 22 | ) 23 | 24 | :shellinfo_loop_1 25 | if "%~1" == "" goto :EOF 26 | 27 | for /f %%m in ( '"%~f0" list' ) do if /i "%~1" == "%%m" call :shellinfo.%%m & echo: 28 | shift /1 29 | 30 | goto :shellinfo_loop_1 31 | 32 | :: ======================================================================== 33 | 34 | :shellinfo_list 35 | for /f "tokens=2 delims=." %%p in ( 'findstr /i /b ":shellinfo\." "%~f0"' ) do echo:%%~p 36 | goto :EOF 37 | 38 | :: ======================================================================== 39 | 40 | :shellinfo.set 41 | set 42 | goto :EOF 43 | 44 | :shellinfo.path 45 | for %%a in ( "%PATH:;=" "%" ) do echo:%%~a 46 | goto :EOF 47 | 48 | :shellinfo.doskey 49 | :shellinfo.alias 50 | doskey /macros 51 | goto :EOF 52 | 53 | :shellinfo.home 54 | set | findstr /i /b "[^=]*HOME=" 55 | goto :EOF 56 | 57 | :shellinfo.conemu 58 | set | findstr /i /b "ConEmu" 59 | goto :EOF 60 | 61 | :shellinfo.far 62 | set | findstr /i /b "FAR" 63 | goto :EOF 64 | 65 | :: ======================================================================== 66 | 67 | :: EOF 68 | --------------------------------------------------------------------------------