├── .gitconfig ├── .gitignore ├── LICENSE ├── README.md ├── TODO.md ├── clavier_plus ├── Clavier.ini └── README.md ├── create_symlinks.bat ├── dev.md ├── fonts └── vazir │ ├── ttf │ ├── Vazirmatn-Black.ttf │ ├── Vazirmatn-Bold.ttf │ ├── Vazirmatn-ExtraBold.ttf │ ├── Vazirmatn-ExtraLight.ttf │ ├── Vazirmatn-Light.ttf │ ├── Vazirmatn-Medium.ttf │ ├── Vazirmatn-Regular.ttf │ ├── Vazirmatn-SemiBold.ttf │ └── Vazirmatn-Thin.ttf │ └── webfonts │ ├── Vazirmatn-Black.woff2 │ ├── Vazirmatn-Bold.woff2 │ ├── Vazirmatn-ExtraBold.woff2 │ ├── Vazirmatn-ExtraLight.woff2 │ ├── Vazirmatn-Light.woff2 │ ├── Vazirmatn-Medium.woff2 │ ├── Vazirmatn-Regular.woff2 │ ├── Vazirmatn-SemiBold.woff2 │ ├── Vazirmatn-Thin.woff2 │ └── Vazirmatn[wght].woff2 ├── mpv ├── README.md ├── input.conf ├── mpv.conf ├── script-modules │ ├── file-browser-addons │ │ ├── favourites.lua │ │ └── find.lua │ └── user-input-module.lua ├── script-opts │ ├── file-browser-keybinds.json │ ├── file_browser.conf │ ├── file_browser_favourites.txt │ └── osc.conf └── scripts │ ├── auto-keep-gui-open.lua │ ├── autoload.lua │ ├── bookmarker.lua │ ├── cycle-video-rotate.lua │ ├── file-browser.lua │ ├── modules.js │ ├── AssFormat.js │ ├── MicroUtils.js │ ├── Options.js │ ├── PathIndex.js │ ├── PathTools.js │ ├── PlaylistManager.js │ ├── PseudoRandom.js │ ├── RandomCycle.js │ ├── SelectionMenu.js │ └── Stack.js │ ├── multi-command-if.lua │ ├── playlistmanager.lua │ ├── quick-scale.lua │ ├── user-input.lua │ └── visualizer.lua ├── msys64 ├── bootstrap.txt └── home │ ├── .bash_profile │ ├── .bashrc │ ├── .config │ └── clifm │ │ ├── colors │ │ ├── default-256.clifm │ │ └── default.clifm │ │ ├── keybindings.clifm │ │ ├── plugins │ │ ├── BFG.cfg │ │ ├── bashh.sh │ │ └── clih.sh │ │ ├── profiles │ │ └── default │ │ │ ├── .last │ │ │ ├── actions.clifm │ │ │ ├── bookmarks.clifm │ │ │ ├── clifmrc │ │ │ ├── cmdlogs.clifm │ │ │ ├── mimelist.clifm │ │ │ ├── nets.clifm │ │ │ ├── preview.clifm │ │ │ ├── profile.clifm │ │ │ └── selbox.clifm │ │ ├── prompts.clifm │ │ └── readline.clifm │ ├── .gitconfig │ ├── .inputrc │ ├── .profile │ └── scripts │ └── bash │ ├── a.sh │ ├── books.sh │ ├── dirs.sh │ ├── do_mount.sh │ ├── do_unmount.sh │ ├── e.sh │ ├── files.sh │ ├── g.sh │ ├── open_files.sh │ └── y.sh ├── nvim ├── README.md ├── after │ └── ftplugin │ │ ├── help.vim │ │ ├── rust.lua │ │ ├── srt.vim │ │ └── vim.vim ├── init.lua └── lua │ └── user │ ├── comments.lua │ ├── plugin_manager.lua │ ├── plugins │ ├── m_gitsigns.lua │ ├── m_goto_preview.lua │ ├── m_lsp.lua │ ├── m_lsp_signature.lua │ └── m_whichkey.lua │ ├── settings.lua │ ├── ui │ ├── menu.lua │ ├── popup.lua │ └── telescope.lua │ ├── util │ ├── file.lua │ └── strings.lua │ └── wrapper │ ├── treesitter.lua │ └── vim.lua ├── scoop.md ├── services.md ├── tor.md └── wezterm ├── .wezterm.lua └── README.md /.gitconfig: -------------------------------------------------------------------------------- 1 | [core] 2 | pager = delta 3 | symlinks = true 4 | #editor = nvim 5 | #gitproxy = /home/linarcx/bin/git-proxy-wrapper 6 | 7 | [credential] 8 | helper = manager 9 | 10 | [user] 11 | name = linarcx 12 | email = linarcx@gmail.com 13 | 14 | [delta] 15 | navigate = true # use n and N to move between diff sections 16 | light = false # set to true if you're in a terminal w/ a light background color (e.g. the default macOS terminal) 17 | line-numbers = true 18 | features = decorations 19 | #features = collared-trogon 20 | #side-by-side = true 21 | 22 | [diff] 23 | tool = nvimdiff 24 | colorMoved = default 25 | 26 | [pager] 27 | branch = true 28 | diff = true 29 | 30 | [interactive] 31 | diffFilter = delta --color-only --features=interactive 32 | 33 | [merge] 34 | conflictstyle = diff3 35 | 36 | [alias] 37 | lg = log --color --graph --pretty 38 | 39 | [delta "decorations"] 40 | commit-decoration-style = blue ol 41 | commit-style = raw 42 | file-style = omit 43 | hunk-header-decoration-style = blue box 44 | hunk-header-file-style = red 45 | hunk-header-style = file 46 | #hunk-header-line-number-style = "#067a00" 47 | 48 | # log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -- 49 | #[http] 50 | # proxy = http://localhost:9080 51 | 52 | #[socks5] 53 | # proxy = socks5h://localhost:1080 54 | 55 | #[http "https://gitlab.com"] 56 | # proxy = https://localhost:8123 57 | 58 | #[http "https://github.com"] 59 | # proxy = https://localhost:8123 60 | 61 | #[http] 62 | # proxy = socks://127.0.0.1:1080 63 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | garbage/* 2 | debug.log 3 | gui-sock-2992 4 | mpv/cache/* 5 | mpv/watch_later/* 6 | msys64/home/.config/clifm/profiles/default/jump.clifm 7 | msys64/home/.config/clifm/profiles/default/dirhist.clifm 8 | msys64/home/.config/clifm/profiles/default/history.clifm 9 | msys64/home/.config/clifm/profiles/default/msglogs.clifm 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # philosophy 2 | I try to follow these ideas as much as i can: 3 | - using free/open source software. 4 | - using terminal-based applications. 5 | - using msys2 for development base and scoop for installing any other packages. 6 | - avoid using software from microsoft like vscode, terminal, etc.. use more free alternative or compile linux versions with msys2. 7 | 8 | ## for future 9 | - i don't want to rely on supply chain. building software directly the pc is the best/safest way.(so i will ditch scoop in future) 10 | - it's better to replace c/c++ software with rust. 11 | - In some cases it's better to use GUI applications.(like web-browsers) 12 | 13 | # prerequisites 14 | As i said, i use msys2 for development.(it has pacman and a wide varity of software) 15 | for installing any other software, i use scoop package manger. 16 | 17 | to see list of all software, please refer to: 18 | - msys64\bootstrap.txt 19 | - scoop.md 20 | 21 | ## other software that maybe usefull 22 | - scoop 23 | - wezterm [https://wezfurlong.org/wezterm/] - replacement of tmux 24 | - 7zip unar winrar zstd tar gsudo fzf 25 | - uget youtube-dl curl dog 26 | fd grep bat llvm neovim openssh scc ripgrep ugrep jq 27 | zeal doxygen dos2unix cppcheck cscope delta diffutils gdb 28 | drmemory 29 | 30 | ## Optional 31 | - broot 32 | - fzf-bash 33 | - fzf-bash-completion 34 | 35 | ## Packages that may not available 36 | - opencppcoverage 37 | - bzip3 38 | 39 | ### Wait for a release 40 | - gf 41 | - xxd 42 | 43 | ### Linux only 44 | - bvi 45 | - splint 46 | - exa 47 | - sc-im 48 | - atool 49 | - colordiff 50 | - colorgcc 51 | - ascii 52 | - enca 53 | - translate-shell 54 | - cpuid 55 | - net-tools 56 | - cgdb 57 | - tzutils 58 | - zathura 59 | 60 | # Windows Basics 61 | - User home directory or user profile(`%USERPROFILE%`) is located: `C:\Users\` 62 | - You can Switch to it by: `~` 63 | - Switch to the root of current drive: `/` or `cd /` 64 | - Switch to application directory: `cd %AppData%`. 65 | - In powershell: `cd $env:APPDATA` 66 | - To power-off the computer: `shutdown /p` 67 | - In powershell: `Stop-Computer` 68 | - To restart the computer: `shutdown /r` 69 | - In powershell: `Restart-Computer` 70 | - Default config folder (equivalent to `~/.config` in __*nix-based__ os) is located: `C:\Users\linarcx\AppData\Local` 71 | - You can switch to it by: `cd %LOCALAPPDATA%` 72 | - In powershell: `cd $env:LOCALAPPDATA` 73 | - To start an application at start-up, you should put it's shortcut here: 74 | 75 | `C:\Users\\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup` 76 | 77 | Instead of browsing with file explorer, you can hit: `Win+R` and type: `shell:startup` 78 | 79 | ## SymLinks, HardLinks, ShortCuts 80 | - Create symlinks: 81 | - `new-item -itemtype SymbolicLink -path -name -value ` 82 | 83 | For example: 84 | - `New-Item -ItemType SymbolicLink -Path "C:\Users\linarcx\AppData\Local\nvim" -Name "init.lnk" -Value "init.vim"` 85 | 86 | - Create HardLinks: 87 | - `New-Item -itemtype HardLink -path $env:LOCALAPPDATA\nvim\ -name plugins.vim -value C:\winny\.config\.nvim\plugins.vim` 88 | 89 | Tip: To manage your dot-files, always use __SymbolicLink__. 90 | 91 | ## Other 92 | - Clears the command history: 93 | `Alt + F7` 94 | - Break out of the subprompt or terminate execution: 95 | `Ctrl + C` 96 | - Delete all the characters in the line after the cursor: 97 | `Ctrl + End` 98 | - Move left or right one word at a time: 99 | `Ctrl + Left Arrow || Ctrl + Right Arrow` 100 | - Pause/resume the display of output: 101 | `Ctrl + S` 102 | - Clear the current line: 103 | `Esc` 104 | - Moves the cursor one character to the right on the command line: 105 | `F1` 106 | 107 | At the end of the line, inserts one character from the text of your last command. 108 | - Creates a new command line by copying your last command line up to the character you type: 109 | `F2` 110 | - Completes the command line with the content from your last command line, starting from the current cursor position to the end of the line: 111 | `F3` 112 | - Deletes characters from your current command line, starting from the current cursor position up to the character you type: 113 | `F4` 114 | - Scans backward through your command history: 115 | `F5` 116 | - Similar to get-history. Displays a pop-up window with your command history and allows you to select a command: 117 | `F7` 118 | 119 | Use the arrow keys to scroll through the list. Press Enter to select a command to run, or press the Right arrow to place the text on the command line. 120 | - Uses text you’ve entered to scan backward through your command history for commands that match the text you’ve typed so far on the command line: 121 | `F8` 122 | - Runs a specific numbered command from your command history. Command numbers are listed when you press F7 or get-history: 123 | `F9` 124 | - Gets the first/last command in the command history: 125 | `Page Up / Page Down` 126 | - If QuickEdit is disabled, displays an editing shortcut menu with Mark, Copy, Paste, Select All, Scroll, and Find options: 127 | `Right-click` 128 | 129 | To copy the screen buffer to the Clipboard, right-click, choose Select, and then press Enter. 130 | - Press the Tab key or press Shift+Tab to access the tab expansion function, which include folder or filename autocompletion: 131 | `Tab / Shift+Tab` 132 | 133 | # Shortcuts 134 | - Close current window: 135 | `Alt + F4` 136 | - Open Settings app: 137 | `Windows key + I` 138 | - Open File Explorer: 139 | `Windows key + E` 140 | - Display and hide the desktop: 141 | `Windows key + D` 142 | - Minimize all windows: 143 | `Windows key + M` 144 | - Restore minimized windows on the desktop: 145 | `Windows key + Shift + M` 146 | - Lock device: 147 | `Windows key + L` 148 | - Open the Windows Ink Workspace: 149 | `Windows key + W` 150 | - Zoom in using the magnifier: 151 | `Windows key + Plus (+)` 152 | - Zoom out using the magnifier: 153 | `Windows key + Minus (-)` 154 | - Exit magnifier: 155 | `Windows key + Esc` 156 | - Quick Link menu: 157 | `Windows key + X` 158 | - Open default PowerShell: 159 | `Windows key + X + a` 160 | - Capture full screenshot in the "Screenshots" folder: 161 | `Windows key + PrtScn` 162 | - Capture part of the screen with Snip & Sketch: 163 | `Windows key + Shift + S` 164 | - Open emoji panel: 165 | `Windows key + Period (.) or semicolon (;)` 166 | - Snap app or window left: 167 | `Windows key + Left arrow key` 168 | - Snap app or window right: 169 | `Windows key + Right arrow key` 170 | - Open Clipboard bin: 171 | `Windows key + V` 172 | - Open Action center: 173 | `Windows key + A` 174 | - Open Task View: 175 | `Windows key + Tab` 176 | - Create a virtual desktop: 177 | `Windows key + Ctrl + D` 178 | - Close active virtual desktop: 179 | `Windows key + Ctrl + F4` 180 | - Switch to the virtual desktop on the right: 181 | `Windows key + Ctrl + Right arrow` 182 | - Switch to the virtual desktop on the left: 183 | `Windows key + Ctrl + Left arrow` 184 | - Open Task Manager: 185 | `Ctrl + Shift + Esc` 186 | - View open apps: 187 | `Ctrl + Alt + Tab` 188 | 189 | # Run commands 190 | - Open the Windows 10 drive: 191 | `\` 192 | - Open the Home folder of the current user: 193 | `.` 194 | - Open the Users folder: 195 | `..` 196 | 197 | # References 198 | - https://www.maketecheasier.com/20-run-commands-windows/ 199 | - https://www.windowscentral.com/best-windows-10-keyboard-shortcuts 200 | - https://github.com/git-for-windows/git/wiki/Symbolic-Links#allowing-non-administrators-to-create-symbolic-links 201 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | - [] Can't open files in LF. 2 | - [] Use torify 3 | - [] Bind Ctrl+a, BackSpace to Ctrl+k. 4 | - [] Manage tor via services(aliases) 5 | - [] Environtment variables not seen after setting.(You should poweroff computer to see it.) 6 | - [Done] configure ~/.gitconfig 7 | - [Done] Disable Ctrl+alt+arrow keys. 8 | - [Done] make lite-xl as default editor 9 | - [Done] set keybinding to close current window. 10 | - Alt + F4 is enough. 11 | - [Done] disable win key: 12 | Run gpedit.msc and go to: UserConfiguration > Administrative Templates > Windows Components > File Explorer 13 | And "Enable" this item: "Turn off windows Key hotkeys" 14 | - [Done] How to Export/Import env? 15 | Export: 16 | `SET >> allvariables.txt` 17 | 18 | Import: 19 | `C:\> for /F %A in (allvariables.txt) do SET %A` 20 | 21 | - [Done] disalbe F1: 22 | Copy this into a file and run it as administrator: 23 | ``` 24 | @echo off 25 | 26 | REM Run this file as Administrator 27 | 28 | taskkill /f /im HelpPane.exe 29 | takeown /f c:\windows\HelpPane.exe 30 | icacls c:\windows\HelpPane.exe /deny Everyone:(X) 31 | ``` 32 | - [Done] disable Ctrl+Alt+down and Ctrl+Alt+up: 33 | Right click on "Intel Hd Graphics" in system tray. Graphic opitons > HotKeys > Disable. 34 | 35 | - [Done] How remove pinned items from QuickAccess? 36 | Just click on QuickAcces button in file explorer to open it. And then right click on every item that you want to unpin. 37 | 38 | - [Done] How to Change Win + E Shortcut Target in Windows 10/11? 39 | https://www.winhelponline.com/blog/winkey-e-shortcut-target-change/ 40 | 41 | - [Done] Some pinned items like network locations won't delete from QuickAccess. How remove theme? 42 | Just put another quickaccess link in QuickAcces folder. Select both of them and unpin them. 43 | 44 | - [Done] Hide "All rights reserved" message in CMD: 45 | This is sort-of possible, but there may be consequences. cmd.exe looks at two registry values (type REG_SZ or REG_EXPAND_SZ) when starting up: 46 | 47 | `HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun` 48 | `HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun` 49 | Simply put cls in one of them and cmd.exe will automatically wipe the copyright notice, still leaving an empty line unfortunately. 50 | 51 | Whether this could interfere with running batch files somehow, I don’t know. You’ll have to try. Fortunately, the change is easily reversible. 52 | Source: https://superuser.com/questions/1723381/hide-all-rights-reserved-message-in-cmd-in-terminal 53 | - [?] Set keybinding to open regedit window. 54 | - [?] Alt-F4 not working to close windows.(use alt+q instead!) 55 | - [?] Set default apps and extensions like mimeapps in linux via powershell. 56 | - [Canceled] Sort choco package by latest install date 57 | -------------------------------------------------------------------------------- /clavier_plus/Clavier.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinArcX/winconf/2904d4e9904344473c06fc96577d576b326b162b/clavier_plus/Clavier.ini -------------------------------------------------------------------------------- /clavier_plus/README.md: -------------------------------------------------------------------------------- 1 | put Clavier.ini here: 2 | C:\Users\\scoop\apps\clavier-plus\current -------------------------------------------------------------------------------- /create_symlinks.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | 4 | mklink C:\tools\saeed\scoop\apps\llvm\current\bin C:\Users\saeed\scoop\apps\llvm\current\bin 5 | -------------------------------------------------------------------------------- /dev.md: -------------------------------------------------------------------------------- 1 | # Development 2 | - git 3 | - neovim 4 | - openssh 5 | - fd 6 | - grep 7 | - llvm 8 | - scc 9 | - ripgrep 10 | - ugrep 11 | - zeal 12 | - doxygen 13 | - cppcheck 14 | - cscope 15 | - delta 16 | - diffutils 17 | - gdb 18 | - dependencies 19 | - regdllview 20 | - drmemory 21 | - OpenCppCoverage 22 | - FlawFinder: https://dwheeler.com/flawfinder/ 23 | - VCG: https://github.com/nccgroup/VCG 24 | - ApiMonitor: http://www.rohitab.com/apimonitor 25 | - WinSpy: https://github.com/strobejb/winspy 26 | - EdoC++: https://edoc.sourceforge.net/index.html 27 | - procexp: https://learn.microsoft.com/en-us/sysinternals/downloads/process-explorer 28 | - procmon: https://learn.microsoft.com/en-us/sysinternals/downloads/procmon 29 | - windbg: https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/ 30 | - Other usefull tools included: https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/extra-tools 31 | - windows ADK: https://learn.microsoft.com/en-us/windows-hardware/get-started/adk-install 32 | - WDK(Windows Driver Kit): https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk 33 | - Build Tools for Visual Studio 2022(https://visualstudio.microsoft.com/downloads/) 34 | 35 | It will install these software on your machine: 36 | - Windows Software Development Kit 37 | - Microsoft Visual C++ 2015-2022 Redistributable 38 | - Microsoft Visual Studio Installer 39 | 40 | And through Developer Command prompt for Visual Studio 2022, you can access to: 41 | - cl.exe 42 | - dumpbin 43 | 44 | ## Important directories of Visual Studio Build Tools 45 | - packages directory: `C:\ProgramData\Microsoft\VisualStudio\Packages` 46 | - shared components, tools, sdk: `C:\Program Files (x86)\Microsoft Visual Studio\Shared` 47 | - build tools: `C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools` 48 | 49 | ## Generate ssh keys 50 | - generate a rsa key: 51 | `ssh-keygen -t rsa -b 2048 -C "email@example.com"` 52 | 53 | It'll create two files: __id_rsa__ and __id_rsa.pub__. 54 | Open __id_rsa.pub__ and copy it's content into your git account in ssh part. 55 | 56 | ## Resources 57 | https://github.com/flutter/flutter/issues/77638 58 | https://devtalk.blender.org/t/error-after-debug-vsdevcmd-bat-calling-ext/25990 59 | https://www.reddit.com/r/cpp_questions/comments/xydqmj/can_i_work_on_a_desktop_application_using_the/ 60 | https://copyprogramming.com/howto/compiling-a-win32-gui-app-without-a-console-using-mingw-and-eclipse 61 | https://stackoverflow.com/questions/41914013/how-can-i-make-a-win32-app-with-no-dependency-on-the-msvc-dll 62 | -------------------------------------------------------------------------------- /fonts/vazir/ttf/Vazirmatn-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinArcX/winconf/2904d4e9904344473c06fc96577d576b326b162b/fonts/vazir/ttf/Vazirmatn-Black.ttf -------------------------------------------------------------------------------- /fonts/vazir/ttf/Vazirmatn-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinArcX/winconf/2904d4e9904344473c06fc96577d576b326b162b/fonts/vazir/ttf/Vazirmatn-Bold.ttf -------------------------------------------------------------------------------- /fonts/vazir/ttf/Vazirmatn-ExtraBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinArcX/winconf/2904d4e9904344473c06fc96577d576b326b162b/fonts/vazir/ttf/Vazirmatn-ExtraBold.ttf -------------------------------------------------------------------------------- /fonts/vazir/ttf/Vazirmatn-ExtraLight.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinArcX/winconf/2904d4e9904344473c06fc96577d576b326b162b/fonts/vazir/ttf/Vazirmatn-ExtraLight.ttf -------------------------------------------------------------------------------- /fonts/vazir/ttf/Vazirmatn-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinArcX/winconf/2904d4e9904344473c06fc96577d576b326b162b/fonts/vazir/ttf/Vazirmatn-Light.ttf -------------------------------------------------------------------------------- /fonts/vazir/ttf/Vazirmatn-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinArcX/winconf/2904d4e9904344473c06fc96577d576b326b162b/fonts/vazir/ttf/Vazirmatn-Medium.ttf -------------------------------------------------------------------------------- /fonts/vazir/ttf/Vazirmatn-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinArcX/winconf/2904d4e9904344473c06fc96577d576b326b162b/fonts/vazir/ttf/Vazirmatn-Regular.ttf -------------------------------------------------------------------------------- /fonts/vazir/ttf/Vazirmatn-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinArcX/winconf/2904d4e9904344473c06fc96577d576b326b162b/fonts/vazir/ttf/Vazirmatn-SemiBold.ttf -------------------------------------------------------------------------------- /fonts/vazir/ttf/Vazirmatn-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinArcX/winconf/2904d4e9904344473c06fc96577d576b326b162b/fonts/vazir/ttf/Vazirmatn-Thin.ttf -------------------------------------------------------------------------------- /fonts/vazir/webfonts/Vazirmatn-Black.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinArcX/winconf/2904d4e9904344473c06fc96577d576b326b162b/fonts/vazir/webfonts/Vazirmatn-Black.woff2 -------------------------------------------------------------------------------- /fonts/vazir/webfonts/Vazirmatn-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinArcX/winconf/2904d4e9904344473c06fc96577d576b326b162b/fonts/vazir/webfonts/Vazirmatn-Bold.woff2 -------------------------------------------------------------------------------- /fonts/vazir/webfonts/Vazirmatn-ExtraBold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinArcX/winconf/2904d4e9904344473c06fc96577d576b326b162b/fonts/vazir/webfonts/Vazirmatn-ExtraBold.woff2 -------------------------------------------------------------------------------- /fonts/vazir/webfonts/Vazirmatn-ExtraLight.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinArcX/winconf/2904d4e9904344473c06fc96577d576b326b162b/fonts/vazir/webfonts/Vazirmatn-ExtraLight.woff2 -------------------------------------------------------------------------------- /fonts/vazir/webfonts/Vazirmatn-Light.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinArcX/winconf/2904d4e9904344473c06fc96577d576b326b162b/fonts/vazir/webfonts/Vazirmatn-Light.woff2 -------------------------------------------------------------------------------- /fonts/vazir/webfonts/Vazirmatn-Medium.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinArcX/winconf/2904d4e9904344473c06fc96577d576b326b162b/fonts/vazir/webfonts/Vazirmatn-Medium.woff2 -------------------------------------------------------------------------------- /fonts/vazir/webfonts/Vazirmatn-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinArcX/winconf/2904d4e9904344473c06fc96577d576b326b162b/fonts/vazir/webfonts/Vazirmatn-Regular.woff2 -------------------------------------------------------------------------------- /fonts/vazir/webfonts/Vazirmatn-SemiBold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinArcX/winconf/2904d4e9904344473c06fc96577d576b326b162b/fonts/vazir/webfonts/Vazirmatn-SemiBold.woff2 -------------------------------------------------------------------------------- /fonts/vazir/webfonts/Vazirmatn-Thin.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinArcX/winconf/2904d4e9904344473c06fc96577d576b326b162b/fonts/vazir/webfonts/Vazirmatn-Thin.woff2 -------------------------------------------------------------------------------- /fonts/vazir/webfonts/Vazirmatn[wght].woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinArcX/winconf/2904d4e9904344473c06fc96577d576b326b162b/fonts/vazir/webfonts/Vazirmatn[wght].woff2 -------------------------------------------------------------------------------- /mpv/README.md: -------------------------------------------------------------------------------- 1 | put all the content of mpv directory here: 2 | C:\Users\\AppData\Local -------------------------------------------------------------------------------- /mpv/mpv.conf: -------------------------------------------------------------------------------- 1 | #-----------=[ General ] =----------# 2 | keep-open # keep the player open when a file's end is reached 3 | hls-bitrate=max # use max quality for HLS streams 4 | ao='wasapi' 5 | vo='gpu' 6 | #hwdec='vaapi' 7 | sub-font="Vazir" #Roboto #Merriweather 8 | sub-font="Vazir" 9 | sub-scale = 1.3 10 | sub-scale-with-window='yes' 11 | geometry='50%:50%' 12 | autofit-larger='70%x70%' 13 | save-position-on-quit 14 | screenshot-directory = "~/Pictures/mpv" 15 | sub-pos = 97 16 | #secondary-sid='auto' 17 | #sub-codepage=utf8:cp1256 18 | 19 | #------------=[ Audio ]=------------# 20 | audio-device=alsa/default 21 | audio-channels=auto 22 | audio-file-auto=fuzzy # external audio doesn't has to match the file name exactly to autoload 23 | audio-pitch-correction=yes # automatically insert scaletempo when playing with higher speed 24 | volume-max=300 # maximum volume in %, everything above 100 results in amplification 25 | volume=100 # default volume, 100 = unchanged 26 | 27 | #------------=[ Video ]=------------# 28 | [high-quality] 29 | profile-desc=cond:is_desktop() and get('width', math.huge) < 3840 30 | scale=ewa_lanczossharp 31 | cscale=ewa_lanczossoft 32 | dscale=mitchell 33 | scale-antiring=0 34 | cscale-antiring=0 35 | dither-depth=auto 36 | correct-downscaling=yes 37 | sigmoid-upscaling=yes 38 | deband=yes 39 | hwdec=no -------------------------------------------------------------------------------- /mpv/script-modules/file-browser-addons/favourites.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | An addon for mpv-file-browser which adds a Favourites path that can be loaded from the ROOT 3 | ]]-- 4 | 5 | local mp = require "mp" 6 | local msg = require "mp.msg" 7 | local utils = require "mp.utils" 8 | local save_path = mp.command_native({"expand-path", "~~/script-opts/file_browser_favourites.txt"}) 9 | do 10 | local file = io.open(save_path, "a+") 11 | if not file then 12 | msg.error("cannot access file", ("%q"):format(save_path), "make sure that the directory exists") 13 | return {} 14 | end 15 | file:close() 16 | end 17 | 18 | local favourites = nil 19 | local favs = { 20 | version = "1.4.0", 21 | priority = 30, 22 | cursor = 1 23 | } 24 | 25 | local use_virtual_directory = true 26 | local full_paths = {} 27 | 28 | local function create_favourite_object(str) 29 | local item = { 30 | type = str:sub(-1) == "/" and "dir" or "file", 31 | path = str, 32 | redirect = not use_virtual_directory, 33 | name = str:match("([^/]+/?)$") 34 | } 35 | full_paths[str:match("([^/]+)/?$")] = str 36 | return item 37 | end 38 | 39 | function favs:setup() 40 | self:register_root_item('Favourites/') 41 | end 42 | 43 | local function update_favourites() 44 | favourites = {} 45 | 46 | local file = io.open(save_path, "r") 47 | if not file then return end 48 | 49 | for str in file:lines() do 50 | table.insert(favourites, create_favourite_object(str)) 51 | end 52 | file:close() 53 | end 54 | 55 | function favs:can_parse(directory) 56 | return directory:find("Favourites/") == 1 57 | end 58 | 59 | function favs:parse(directory) 60 | if not favourites then update_favourites() end 61 | if directory == "Favourites/" then 62 | local opts = { 63 | filtered = true, 64 | sorted = true 65 | } 66 | if self.cursor ~= 1 then opts.selected_index = self.cursor ; self.cursor = 1 end 67 | return favourites, opts 68 | end 69 | 70 | if use_virtual_directory then 71 | -- converts the relative favourite path into a full path 72 | local name = directory:match("Favourites/([^/]+)/?") 73 | 74 | local _, finish = directory:find("Favourites/([^/]+/?)") 75 | local full_path = (full_paths[name] or "")..directory:sub(finish+1) 76 | local list, opts = self:defer(full_path or "") 77 | 78 | if not list then return nil end 79 | opts.id = self:get_id() 80 | if opts.directory_label then 81 | opts.directory_label = opts.directory_label:gsub(full_paths[name], "Favourites/"..name..'/') 82 | if opts.directory_label:find("Favourites/") ~= 1 then opts.directory_label = nil end 83 | end 84 | 85 | for _, item in ipairs(list) do 86 | if not item.path then item.redirect = false end 87 | item.path = item.path or full_path..item.name 88 | end 89 | 90 | return list, opts 91 | end 92 | 93 | local path = full_paths[ directory:match("([^/]+/?)$") or "" ] 94 | 95 | local list, opts = self:defer(path) 96 | if not list then return nil end 97 | opts.directory = opts.directory or path 98 | return list, opts 99 | end 100 | 101 | local function get_favourite(path) 102 | for index, value in ipairs(favourites) do 103 | if value.path == path then return index, value end 104 | end 105 | end 106 | 107 | --update the browser with new contents of the file 108 | local function update_browser() 109 | if favs.get_directory():find("[fF]avourites/") then 110 | if favs.get_directory():find("[fF]avourites/$") then 111 | local cursor = favs.get_selected_index() 112 | favs.rescan() 113 | favs.set_selected_index(cursor) 114 | favs.redraw() 115 | else 116 | favs.clear_cache() 117 | end 118 | end 119 | end 120 | 121 | --write the contents of favourites to the file 122 | local function write_to_file() 123 | local file = io.open(save_path, "w+") 124 | if not file then return msg.error(file, "could not open favourites file") end 125 | for _, item in ipairs(favourites) do 126 | file:write(string.format("%s\n", item.path)) 127 | end 128 | file:close() 129 | end 130 | 131 | local function add_favourite(path) 132 | if get_favourite(path) then return end 133 | update_favourites() 134 | table.insert(favourites, create_favourite_object(path)) 135 | write_to_file() 136 | end 137 | 138 | local function remove_favourite(path) 139 | update_favourites() 140 | local index = get_favourite(path) 141 | if not index then return end 142 | table.remove(favourites, index) 143 | write_to_file() 144 | end 145 | 146 | local function move_favourite(path, direction) 147 | update_favourites() 148 | local index, item = get_favourite(path) 149 | if not index or not favourites[index + direction] then return end 150 | 151 | favourites[index] = favourites[index + direction] 152 | favourites[index + direction] = item 153 | write_to_file() 154 | end 155 | 156 | local function toggle_favourite(cmd, state, co) 157 | local path = favs.get_full_path(state.list[state.selected], state.directory) 158 | 159 | if state.directory:find("[fF]avourites/$") then remove_favourite(path) 160 | else add_favourite(path) end 161 | update_browser() 162 | end 163 | 164 | local function move_key(cmd, state, co) 165 | if not state.directory:find("[fF]avourites/") then return false end 166 | local path = favs.get_full_path(state.list[state.selected], state.directory) 167 | 168 | local cursor = favs.get_selected_index() 169 | if cmd.name == favs:get_id().."/move_up" then 170 | move_favourite(path, -1) 171 | favs.set_selected_index(cursor-1) 172 | else 173 | move_favourite(path, 1) 174 | favs.set_selected_index(cursor+1) 175 | end 176 | update_browser() 177 | end 178 | 179 | update_favourites() 180 | mp.register_script_message("favourites/add_favourite", add_favourite) 181 | mp.register_script_message("favourites/remove_favourite", remove_favourite) 182 | mp.register_script_message("favourites/move_up", function(path) move_favourite(path, -1) end) 183 | mp.register_script_message("favourites/move_down", function(path) move_favourite(path, 1) end) 184 | 185 | favs.keybinds = { 186 | { "F", "toggle_favourite", toggle_favourite, {}, }, 187 | { "Ctrl+UP", "move_up", move_key, {repeatable = true} }, 188 | { "Ctrl+DOWN", "move_down", move_key, {repeatable = true} }, 189 | } 190 | 191 | return favs -------------------------------------------------------------------------------- /mpv/script-modules/file-browser-addons/find.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | An addon for mpv-file-browser for searching the current directory 3 | Available at: https://github.com/CogentRedTester/mpv-file-browser/tree/master/addons 4 | 5 | Requires mpv-user-input: https://github.com/CogentRedTester/mpv-user-input 6 | 7 | Keybinds: 8 | Ctrl+f open search box 9 | Ctrl+F open advanced search box (supports Lua patterns) 10 | n cycle to next valid item 11 | ]]-- 12 | 13 | local msg = require "mp.msg" 14 | local fb = require "file-browser" 15 | local input = require "user-input-module" 16 | 17 | local find = { 18 | version = "1.3.0" 19 | } 20 | local latest_coroutine = nil 21 | local global_fb_state = getmetatable(fb.get_state()).__original 22 | 23 | local function compare(name, query) 24 | if name:find(query) then return true end 25 | if name:lower():find(query) then return true end 26 | if name:upper():find(query) then return true end 27 | 28 | return false 29 | end 30 | 31 | local function main(key, state, co) 32 | if not state.list then return false end 33 | 34 | local text 35 | if key.name == "find/find" then text = "Find: enter search string" 36 | else text = "Find: enter advanced search string" end 37 | 38 | local query, error = coroutine.yield( 39 | input.get_user_input( fb.coroutine.callback(), { text = text, id = "find", replace = true } ) 40 | ) 41 | 42 | if not query then return msg.debug(error) end 43 | 44 | -- allow the directory to be changed before this point 45 | local list = fb.get_list() 46 | local parse_id = global_fb_state.co 47 | 48 | if key.name == "find/find" then 49 | query = fb.pattern_escape(query) 50 | end 51 | 52 | local results = {} 53 | 54 | for index, item in ipairs(list) do 55 | if compare(item.label or item.name, query) then 56 | table.insert(results, index) 57 | end 58 | end 59 | 60 | if (#results < 1) then 61 | msg.warn("No matching items for '"..query.."'") 62 | return 63 | end 64 | 65 | --keep cycling through the search results if any are found 66 | --putting this into a separate coroutine removes any passthrough ambiguity 67 | --the final return statement should return to `step_find` not any other function 68 | fb.coroutine.run(function() 69 | latest_coroutine = coroutine.running() 70 | while (true) do 71 | for _, index in ipairs(results) do 72 | fb.set_selected_index(index) 73 | coroutine.yield(true) 74 | 75 | if parse_id ~= global_fb_state.co then 76 | latest_coroutine = nil 77 | return false 78 | end 79 | end 80 | end 81 | end) 82 | end 83 | 84 | local function step_find() 85 | if not latest_coroutine then return false end 86 | return fb.coroutine.resume_err(latest_coroutine) 87 | end 88 | 89 | find.keybinds = { 90 | {"Ctrl+f", "find", main, {}}, 91 | {"Ctrl+F", "find_advanced", main, {}}, 92 | {"n", "next", step_find, {}}, 93 | } 94 | 95 | return find -------------------------------------------------------------------------------- /mpv/script-modules/user-input-module.lua: -------------------------------------------------------------------------------- 1 | #-----------=[ General ] =----------# 2 | keep-open # keep the player open when a file's end is reached 3 | hls-bitrate=max # use max quality for HLS streams 4 | ao='alsa' 5 | vo='gpu' 6 | hwdec='vaapi' 7 | #sub-font="" Roboto #Merriweather 8 | sub-font="Vazir" 9 | sub-scale = 1.3 10 | sub-scale-with-window='yes' 11 | geometry='50%:50%' 12 | autofit-larger='70%x70%' 13 | save-position-on-quit 14 | screenshot-directory = "~/Pictures/mpv" 15 | sub-pos = 97 16 | #secondary-sid='auto' 17 | #sub-codepage=utf8:cp1256 18 | 19 | #------------=[ Audio ]=------------# 20 | audio-device=alsa/default 21 | audio-channels=auto 22 | audio-file-auto=fuzzy # external audio doesn't has to match the file name exactly to autoload 23 | audio-pitch-correction=yes # automatically insert scaletempo when playing with higher speed 24 | volume-max=300 # maximum volume in %, everything above 100 results in amplification 25 | volume=100 # default volume, 100 = unchanged 26 | 27 | #------------=[ Video ]=------------# 28 | [high-quality] 29 | profile-desc=cond:is_desktop() and get('width', math.huge) < 3840 30 | scale=ewa_lanczossharp 31 | cscale=ewa_lanczossoft 32 | dscale=mitchell 33 | scale-antiring=0 34 | cscale-antiring=0 35 | dither-depth=auto 36 | correct-downscaling=yes 37 | sigmoid-upscaling=yes 38 | deband=yes 39 | hwdec=no -------------------------------------------------------------------------------- /mpv/script-opts/file-browser-keybinds.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "key": "KP1", 4 | "command": [ 5 | "print-text", 6 | "file: %f" 7 | ], 8 | "multiselect": true 9 | }, 10 | { 11 | "key": "KP2", 12 | "command": [ 13 | "print-text", 14 | "name: %n" 15 | ], 16 | "multiselect": true 17 | }, 18 | { 19 | "key": "KP3", 20 | "command": [ 21 | "print-text", 22 | "open directory: %p" 23 | ] 24 | }, 25 | { 26 | "key": "KP4", 27 | "command": [ 28 | "print-text", 29 | "directory name: %d" 30 | ] 31 | }, 32 | { 33 | "key": "KP5", 34 | "command": [ 35 | "print-text", 36 | "escape the code: %%f" 37 | ], 38 | "multiselect": true 39 | }, 40 | { 41 | "key": "KP6", 42 | "command": [ "print-text", "full filepath via concatenation: %p%n" ], 43 | "multiselect": true 44 | }, 45 | { 46 | "key": "KP7", 47 | "command": [ "print-text", "quote/escape filepath: %F" ], 48 | "multiselect": true 49 | }, 50 | { 51 | "comment": "opens the currently selected items in a new mpv window", 52 | "key": "Ctrl+ENTER", 53 | "command": [ 54 | "run", 55 | "mpv", 56 | "%F" 57 | ], 58 | "multiselect": true, 59 | "multi-type": "concat" 60 | }, 61 | { 62 | "key": "Ctrl+c", 63 | "command": [ 64 | [ 65 | "run", 66 | "powershell", 67 | "-command", 68 | "Set-Clipboard", 69 | "%F" 70 | ], 71 | [ 72 | "print-text", 73 | "copied filepath to clipboard" 74 | ] 75 | ], 76 | "multiselect": true, 77 | "delay": 0.3 78 | }, 79 | { 80 | "comment": "Opens the current directory in windows explorer", 81 | "key": "Ctrl+o", 82 | "command": [ "script-binding", "browse-files" ], 83 | "multiselect": false 84 | }, 85 | { 86 | "key": "INS", 87 | "command": [ 88 | "run", 89 | "powershell", 90 | "-command", 91 | "Set-Content", 92 | "-LiteralPath", 93 | "( %P + '/.ordered-chapters.m3u' )", 94 | "-Value", 95 | "( %N )" 96 | ], 97 | "multiselect": true, 98 | "multi-type": "concat", 99 | "concat-string": "+ '\n' +" 100 | }, 101 | { 102 | "key": "WHEEL_UP", 103 | "command": [ "script-binding", "file_browser/dynamic/scroll_up" ] 104 | }, 105 | { 106 | "key": "WHEEL_DOWN", 107 | "command": [ "script-binding", "file_browser/dynamic/scroll_down" ] 108 | }, 109 | { 110 | "key": "UP", 111 | "command": [ "script-binding", "file_browser/dynamic/scroll_up" ] 112 | }, 113 | { 114 | "key": "k", 115 | "command": [ "script-binding", "file_browser/dynamic/scroll_up" ] 116 | }, 117 | { 118 | "key": "DOWN", 119 | "command": [ "script-binding", "file_browser/dynamic/scroll_down" ] 120 | }, 121 | { 122 | "key": "j", 123 | "command": [ "script-binding", "file_browser/dynamic/scroll_down" ] 124 | }, 125 | { 126 | "key": "TAB", 127 | "command": [ "script-binding", "file_browser/dynamic/scroll_down" ] 128 | }, 129 | { 130 | "key": "SHIFT+TAB", 131 | "command": [ "script-binding", "file_browser/dynamic/scroll_up" ] 132 | }, 133 | { 134 | "key": "LEFT", 135 | "command": [ "script-binding", "file_browser/dynamic/up_dir" ] 136 | }, 137 | { 138 | "key": "BS", 139 | "command": [ "script-binding", "file_browser/dynamic/up_dir" ] 140 | }, 141 | { 142 | "key": "h", 143 | "command": [ "script-binding", "file_browser/dynamic/up_dir" ] 144 | }, 145 | { 146 | "key": "RIGHT", 147 | "command": [ "script-binding", "file_browser/dynamic/down_dir" ] 148 | }, 149 | { 150 | "key": "l", 151 | "command": [ "script-binding", "file_browser/dynamic/down_dir" ] 152 | }, 153 | { 154 | "key": "MBTN_LEFT", 155 | "command": [ "script-binding", "file_browser/dynamic/down_dir" ] 156 | }, 157 | { 158 | "key": "MBTN_RIGHT", 159 | "command": [ "script-binding", "file_browser/dynamic/up_dir" ] 160 | }, 161 | { 162 | "key": "MBTN_MID", 163 | "command": [ "script-binding", "file_browser/dynamic/play" ] 164 | }, 165 | { 166 | "key": "1", 167 | "command": ["script-binding", "file_browser/dynamic/select_item"] 168 | }, 169 | ] -------------------------------------------------------------------------------- /mpv/script-opts/file_browser.conf: -------------------------------------------------------------------------------- 1 | ####################################################### 2 | # This is the default config file for mpv-file-browser 3 | # https://github.com/CogentRedTester/mpv-file-browser 4 | ####################################################### 5 | 6 | #root directories, separated by commas 7 | #on linux you will probably want to add `/`, 8 | #on windows this should be used to add different drive letters 9 | #Examples: 10 | #linux: root=~/,/ 11 | #windows: root=~/,C:/ 12 | root=~/Downloads,/mnt/D/video,/mnt/E/video 13 | 14 | #characters to separate root directories, each character works individually 15 | #this is in case one is using directories with strange names 16 | root_separators=,; 17 | 18 | #number of entries to show on the screen at once 19 | num_entries=20 20 | 21 | #wrap the cursor around the top and bottom of the list 22 | wrap=no 23 | 24 | #only show files compatible with mpv in the browser 25 | filter_files=yes 26 | 27 | #experimental feature that recurses directories concurrently when appending items to the playlist 28 | #this feature has the potential for massive performance improvements when using addons with asynchronous IO 29 | concurrent_recursion=no 30 | 31 | #maximum number of recursions that can run concurrently 32 | #if this number is too high it risks overflowing the mpv event queue, which will cause some directories to be dropped entirely 33 | max_concurrency=16 34 | 35 | #enable custom keybinds 36 | #the keybind json file must go in ~~/script-opts 37 | custom_keybinds=yes 38 | 39 | #file-browser only shows files that are compatible with mpv by default 40 | #adding a file extension to this list will add it to the extension whitelist 41 | #extensions are separated with the root separators, do not use any spaces 42 | extension_whitelist= 43 | 44 | #add file extensions to this list to disable default filetypes 45 | #note that this will also override audio/subtitle_extension options below 46 | extension_blacklist=zip,rar 47 | 48 | #files with these extensions will be added as additional audio tracks for the current file instead of appended to the playlist 49 | #items on this list are automatically added to the extension whitelist 50 | audio_extensions=mka,dts,dtshd,dts-hd,truehd,true-hd 51 | 52 | #files with these extensions will be added as additional subtitle tracks for the current file instead of appended to the playlist 53 | #items on this list are automatically added to the extension whitelist 54 | subtitle_extensions=etf,etf8,utf-8,idx,sub,srt,rt,ssa,ass,mks,vtt,sup,scc,smi,lrc,pgs 55 | 56 | #filter directories or files starting with a period like .config 57 | #for linux systems 58 | filter_dot_dirs=no 59 | filter_dot_files=no 60 | 61 | #substitude forward slashes for backslashes when appending a local file to the playlist 62 | #may be useful on windows systems 63 | substitute_backslash=no 64 | 65 | #this option reverses the behaviour of the alt+ENTER keybind 66 | #when disabled the keybind is required to enable autoload for the file 67 | #when enabled the keybind disables autoload for the file 68 | autoload=no 69 | 70 | #if autoload is triggered by selecting the currently playing file, then 71 | #the current file will have it's watch-later config saved before being closed and re-opened 72 | #essentially the current file will not be restarted 73 | autoload_save_current=yes 74 | 75 | #when opening the browser in idle mode prefer the current working directory over the root 76 | #note that the working directory is set as the 'current' directory regardless, so `home` will 77 | #move the browser there even if this option is set to false 78 | default_to_working_directory=no 79 | 80 | #enables addons 81 | addons=yes 82 | addon_directory=~~/script-modules/file-browser-addons 83 | 84 | #directory to load external modules - currently just user-input-module 85 | module_directory=~~/script-modules 86 | 87 | #turn the OSC idle screen off and on when opening and closing the browser 88 | toggle_idlescreen=no 89 | 90 | #################################### 91 | ######### style settings ########### 92 | #################################### 93 | 94 | #force file-browser to use a specific text alignment (default: top-left) 95 | #uses ass tag alignment numbers: https://aegi.vmoe.info/docs/3.0/ASS_Tags/#index23h3 96 | #set to 0 to use the default mpv osd-align options 97 | alignment=7 98 | 99 | #allows custom icons be set to fix incompatabilities with some fonts 100 | #the `\h` character is a hard space to add padding 101 | folder_icon=🖿 102 | cursor_icon=➤ 103 | indent_icon=\h\h\h 104 | 105 | #set the opacity of fonts in hexadecimal from 00 (opaque) to FF (transparent) 106 | font_opacity_selection_marker=99 107 | 108 | #print the header in bold font 109 | font_bold_header=yes 110 | 111 | #set custom font sizes 112 | font_size_header=35 113 | font_size_body=25 114 | font_size_wrappers=16 115 | 116 | #set custom font names, blank is the default 117 | #setting custom fonts for the folder/cursor can fix broken or missing icons 118 | font_name_header= 119 | font_name_body= 120 | font_name_wrappers= 121 | font_name_folder= 122 | font_name_cursor= 123 | 124 | #set custom font colours 125 | #colours are in hexadecimal format in Blue Green Red order 126 | #note that this is the opposite order to most RGB colour codes 127 | font_colour_header=00ccff 128 | font_colour_body=ffffff 129 | font_colour_wrappers=00ccff 130 | font_colour_cursor=00ccff 131 | 132 | #these are colours applied to list items in different states 133 | font_colour_selected=fce788 134 | font_colour_multiselect=fcad88 135 | font_colour_playing=33ff66 136 | font_colour_playing_multiselected=22b547 -------------------------------------------------------------------------------- /mpv/script-opts/file_browser_favourites.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinArcX/winconf/2904d4e9904344473c06fc96577d576b326b162b/mpv/script-opts/file_browser_favourites.txt -------------------------------------------------------------------------------- /mpv/script-opts/osc.conf: -------------------------------------------------------------------------------- 1 | #boxalph=10 2 | # layout= box 3 | seekbarstyle=bar 4 | 5 | # valign=0.9 6 | # layout=slimbox 7 | # seekbarstyle=slider 8 | # deadzonesize=1 9 | # hidetimeout=500 -------------------------------------------------------------------------------- /mpv/scripts/autoload.lua: -------------------------------------------------------------------------------- 1 | -- This script automatically loads playlist entries before and after the 2 | -- the currently played file. It does so by scanning the directory a file is 3 | -- located in when starting playback. It sorts the directory entries 4 | -- alphabetically, and adds entries before and after the current file to 5 | -- the internal playlist. (It stops if the it would add an already existing 6 | -- playlist entry at the same position - this makes it "stable".) 7 | -- Add at most 5000 * 2 files when starting a file (before + after). 8 | MAXENTRIES = 5000 9 | 10 | local options = require 'mp.options' 11 | 12 | o = { 13 | disabled = false 14 | } 15 | options.read_options(o) 16 | 17 | function Set (t) 18 | local set = {} 19 | for _, v in pairs(t) do set[v] = true end 20 | return set 21 | end 22 | 23 | EXTENSIONS = Set { 24 | 'mkv', 'avi', 'mp4', 'ogv', 'webm', 'rmvb', 'flv', 'wmv', 'mpeg', 'mpg', 'm4v', '3gp', 25 | 'mp3', 'wav', 'ogm', 'flac', 'm4a', 'wma', 'ogg', 'opus', 26 | } 27 | 28 | mputils = require 'mp.utils' 29 | 30 | function add_files_at(index, files) 31 | index = index - 1 32 | local oldcount = mp.get_property_number("playlist-count", 1) 33 | for i = 1, #files do 34 | mp.commandv("loadfile", files[i], "append") 35 | mp.commandv("playlist-move", oldcount + i - 1, index + i - 1) 36 | end 37 | end 38 | 39 | function get_extension(path) 40 | match = string.match(path, "%.([^%.]+)$" ) 41 | if match == nil then 42 | return "nomatch" 43 | else 44 | return match 45 | end 46 | end 47 | 48 | table.filter = function(t, iter) 49 | for i = #t, 1, -1 do 50 | if not iter(t[i]) then 51 | table.remove(t, i) 52 | end 53 | end 54 | end 55 | 56 | -- splitbynum and alnumcomp from alphanum.lua (C) Andre Bogus 57 | -- Released under the MIT License 58 | -- http://www.davekoelle.com/files/alphanum.lua 59 | 60 | -- split a string into a table of number and string values 61 | function splitbynum(s) 62 | local result = {} 63 | for x, y in (s or ""):gmatch("(%d*)(%D*)") do 64 | if x ~= "" then table.insert(result, tonumber(x)) end 65 | if y ~= "" then table.insert(result, y) end 66 | end 67 | return result 68 | end 69 | 70 | function clean_key(k) 71 | k = (' '..k..' '):gsub("%s+", " "):sub(2, -2):lower() 72 | return splitbynum(k) 73 | end 74 | 75 | -- compare two strings 76 | function alnumcomp(x, y) 77 | local xt, yt = clean_key(x), clean_key(y) 78 | for i = 1, math.min(#xt, #yt) do 79 | local xe, ye = xt[i], yt[i] 80 | if type(xe) == "string" then ye = tostring(ye) 81 | elseif type(ye) == "string" then xe = tostring(xe) end 82 | if xe ~= ye then return xe < ye end 83 | end 84 | return #xt < #yt 85 | end 86 | 87 | function find_and_add_entries() 88 | local path = mp.get_property("path", "") 89 | local dir, filename = mputils.split_path(path) 90 | if o.disabled or #dir == 0 then 91 | return 92 | end 93 | local pl_count = mp.get_property_number("playlist-count", 1) 94 | if (pl_count > 1 and autoload == nil) or 95 | (pl_count == 1 and EXTENSIONS[string.lower(get_extension(filename))] == nil) then 96 | return 97 | else 98 | autoload = true 99 | end 100 | 101 | local files = mputils.readdir(dir, "files") 102 | if files == nil then 103 | return 104 | end 105 | table.filter(files, function (v, k) 106 | if string.match(v, "^%.") then 107 | return false 108 | end 109 | local ext = get_extension(v) 110 | if ext == nil then 111 | return false 112 | end 113 | return EXTENSIONS[string.lower(ext)] 114 | end) 115 | table.sort(files, alnumcomp) 116 | 117 | if dir == "." then 118 | dir = "" 119 | end 120 | 121 | local pl = mp.get_property_native("playlist", {}) 122 | local pl_current = mp.get_property_number("playlist-pos", 0) + 1 123 | -- Find the current pl entry (dir+"/"+filename) in the sorted dir list 124 | local current 125 | for i = 1, #files do 126 | if files[i] == filename then 127 | current = i 128 | break 129 | end 130 | end 131 | if current == nil then 132 | return 133 | end 134 | 135 | local append = {[-1] = {}, [1] = {}} 136 | for direction = -1, 1, 2 do -- 2 iterations, with direction = -1 and +1 137 | for i = 1, MAXENTRIES do 138 | local file = files[current + i * direction] 139 | local pl_e = pl[pl_current + i * direction] 140 | if file == nil or file[1] == "." then 141 | break 142 | end 143 | 144 | local filepath = dir .. file 145 | if pl_e then 146 | -- If there's a playlist entry, and it's the same file, stop. 147 | if pl_e.filename == filepath then 148 | break 149 | end 150 | end 151 | 152 | if direction == -1 then 153 | if pl_current == 1 then -- never add additional entries in the middle 154 | mp.msg.info("Prepending " .. file) 155 | table.insert(append[-1], 1, filepath) 156 | end 157 | else 158 | mp.msg.info("Adding " .. file) 159 | table.insert(append[1], filepath) 160 | end 161 | end 162 | end 163 | 164 | add_files_at(pl_current + 1, append[1]) 165 | add_files_at(pl_current, append[-1]) 166 | end 167 | 168 | mp.register_event("start-file", find_and_add_entries) -------------------------------------------------------------------------------- /mpv/scripts/bookmarker.lua: -------------------------------------------------------------------------------- 1 | local utils = require 'mp.utils' 2 | 3 | local latest_loaded_bookmark = -1 4 | 5 | --// seconds to hh:mm:ss 6 | function displayTime(time) 7 | local hours = math.floor(time/3600) 8 | local minutes = math.floor((time % 3600)/60) 9 | local seconds = math.floor((time % 60)) 10 | return string.format("%02d:%02d:%02d",hours,minutes,seconds) 11 | end 12 | 13 | --// Extract filename/immediate-dir from url 14 | function GetFileName(url) 15 | return url:match("^.+/(.+)$") 16 | end 17 | function GetImmediateDirectoryName(url) 18 | return url:match("^.*/([^/]+)/[^/]+$") 19 | end 20 | function GetDirectory(url) 21 | return url:match("^(.*)/[^/]+$") 22 | end 23 | 24 | 25 | --// Save/Load string serializer function 26 | function exportstring( s ) 27 | return string.format("%q", s) 28 | end 29 | 30 | --// Save a table as json to a file 31 | function saveTable(t, path) 32 | -- a simple machanism to make it transactional 33 | local contents = utils.format_json(t) 34 | local file = io.open(path .. ".tmp", "wb") 35 | file:write( contents ) 36 | io.close( file ) 37 | os.remove(path) 38 | os.rename(path .. ".tmp", path) 39 | return true 40 | end 41 | 42 | --// Load a table from a json-file 43 | function loadTable(path) 44 | local contents = "" 45 | local myTable = {} 46 | local file = io.open( path, "r" ) 47 | if file then 48 | local contents = file:read( "*a" ) 49 | myTable = utils.parse_json(contents); 50 | io.close( file ) 51 | return myTable 52 | end 53 | return nil 54 | end 55 | 56 | function platform_independent(filepath) 57 | return filepath 58 | end 59 | 60 | --// check whether a file exists or not 61 | function file_exists(path) 62 | local f = io.open(path,"r") 63 | if f~=nil then 64 | io.close(f) 65 | return true 66 | else 67 | return false 68 | end 69 | end 70 | 71 | --// check if macos 72 | function is_macos() 73 | local homedir = os.getenv("HOME") 74 | if homedir ~= nil and string.sub(homedir,1,6) == "/Users" then 75 | return true 76 | else 77 | return false 78 | end 79 | end 80 | 81 | --// check if windows 82 | function is_windows() 83 | local windir = os.getenv("windir") 84 | if windir~=nil then 85 | return true 86 | else 87 | return false 88 | end 89 | end 90 | 91 | --// default file to save/load bookmarks to/from 92 | function getConfigFile() 93 | if is_windows() then 94 | return os.getenv("APPDATA"):gsub("\\", "/") .. "/mpv/bookmarks.json" 95 | else 96 | return os.getenv("HOME") .. "/.config/mpv/bookmarks.json" 97 | end 98 | end 99 | 100 | --// print current bookmark object 101 | function printBookmarkInfo(bookmark) 102 | if bookmark ~= nil then 103 | local fp = bookmark["filepath"] or "NO PATH HAS BEEN SET" 104 | local dirname = GetImmediateDirectoryName(fp) or "NO DIRECTORY HAS BEEN SET" 105 | local name = GetFileName(fp) or "NO FILENAME HAS BEEN SET" 106 | name = name:gsub("_", " ") 107 | local pos = bookmark["pos"] or "0" 108 | local toprint = "" 109 | local existance = (file_exists(fp) and "") or "[!!] " 110 | return existance .. dirname .. "\n" .. existance .. name .. "\n" .. displayTime(tonumber(pos)) 111 | else 112 | return "Undefined" 113 | end 114 | end 115 | 116 | function fetchBookmark(slot) 117 | local bookmarks = loadTable(getConfigFile()) 118 | if bookmarks == nil then 119 | mp.osd_message("Error loading bookmarks.json") 120 | return 121 | end 122 | local bookmark = bookmarks[slot] 123 | if bookmark == nil then 124 | return 125 | end 126 | bookmark["pos"] = math.max(bookmark["pos"] or 0, 0) 127 | bookmark["filepath"] = platform_independent(bookmark["filepath"]) 128 | return bookmark 129 | end 130 | 131 | --// save current file/pos to a bookmark object 132 | function currentPositionAsBookmark() 133 | local bookmark = {} 134 | bookmark["pos"] = mp.get_property_number("time-pos") 135 | bookmark["filepath"] = mp.get_property("path") 136 | bookmark["filename"] = mp.get_property("filename") 137 | return bookmark 138 | end 139 | 140 | --// play to a bookmark 141 | function bookmarkToCurrentPosition(bookmark, tryToLoadFile) 142 | if mp.get_property("path") == bookmark["filepath"] then -- if current media is the same as bookmark media 143 | mp.set_property_number("time-pos", bookmark["pos"]) 144 | return 145 | elseif tryToLoadFile == true then 146 | mp.commandv("loadfile", bookmark["filepath"], "replace") 147 | local seekerFunc = {} 148 | seekerFunc.fn = function() 149 | mp.unregister_event(seekerFunc.fn); 150 | bookmarkToCurrentPosition(bookmark, false) 151 | end 152 | mp.register_event("playback-restart", seekerFunc.fn) 153 | end 154 | end 155 | 156 | --// get latest bookmark if it relates to current file (if they point to files that are in the same directory) 157 | function find_current_bookmark_slot() 158 | if latest_loaded_bookmark ~= -1 then 159 | local bookmark = fetchBookmark(latest_loaded_bookmark) 160 | current_file = mp.get_property("path") 161 | if bookmark ~= nil and current_file ~= nil then 162 | if GetDirectory(platform_independent(bookmark["filepath"])) == GetDirectory(platform_independent(current_file)) then 163 | return latest_loaded_bookmark 164 | end 165 | end 166 | end 167 | return nil 168 | end 169 | 170 | --// handle "bookmark-set" function triggered by a key in "input.conf" 171 | function bookmark_save(slot) 172 | local bookmarks = loadTable(getConfigFile()) 173 | if bookmarks == nil then 174 | bookmarks = {} 175 | end 176 | bookmarks[slot] = currentPositionAsBookmark() 177 | local result = saveTable( bookmarks, getConfigFile()) 178 | if result ~= true then 179 | mp.osd_message("Error saving: " .. result) 180 | end 181 | latest_loaded_bookmark = slot 182 | mp.osd_message("Bookmark#" .. slot .. " saved.") 183 | end 184 | mp.register_script_message("bookmark-set", bookmark_save) 185 | 186 | --// handle "bookmark-update" function triggered by a key in "input.conf" | basically updates latest saved/loaded bookmark if current file is with in the same directory 187 | function last_bookmark_update() 188 | slot_to_be_saved = find_current_bookmark_slot() 189 | if slot_to_be_saved ~= nil then 190 | bookmark_save(slot_to_be_saved) 191 | end 192 | end 193 | mp.register_script_message("bookmark-update", last_bookmark_update) 194 | 195 | --// handle "bookmark-load" function triggered by a key in "input.conf" 196 | mp.register_script_message("bookmark-load", function(slot) 197 | local bookmark = fetchBookmark(slot) 198 | if bookmark == nil then 199 | mp.osd_message("Bookmark#" .. slot .. " is not set.") 200 | return 201 | end 202 | if file_exists(bookmark["filepath"]) == false then 203 | mp.osd_message("File " .. bookmark["filepath"] .. " not found!") 204 | return 205 | end 206 | bookmarkToCurrentPosition(bookmark, true) 207 | latest_loaded_bookmark = slot 208 | mp.osd_message("Bookmark#" .. slot .. " loaded\n" .. printBookmarkInfo(bookmark)) 209 | end) 210 | 211 | --// handle "bookmark-peek" function triggered by a key in "input.conf" 212 | function bookmark_peek(slot) 213 | local bookmark = fetchBookmark(slot) 214 | if bookmark == nil then 215 | mp.osd_message("Bookmark#" .. slot .. " is not set.") 216 | return 217 | end 218 | mp.osd_message("Bookmark#" .. slot .. " :\n" .. printBookmarkInfo(bookmark)) 219 | 220 | end 221 | mp.register_script_message("bookmark-peek", bookmark_peek) 222 | 223 | --// handle "bookmark-peek-current" function triggered by a key in "input.conf" | basically peeks at latest saved/loaded bookmark if current file is with in the same directory 224 | function current_bookmark_peek() 225 | slot_to_be_saved = find_current_bookmark_slot() 226 | if slot_to_be_saved ~= nil then 227 | bookmark_peek(slot_to_be_saved) 228 | end 229 | end 230 | mp.register_script_message("bookmark-peek-current", current_bookmark_peek) -------------------------------------------------------------------------------- /mpv/scripts/cycle-video-rotate.lua: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------- 2 | -- 3 | -- CYCLE-VIDEO-ROTATE.LUA 4 | -- Version: 1.0 5 | -- Author: SteveJobzniak 6 | -- URL: https://github.com/SteveJobzniak/mpv-tools 7 | -- 8 | -- Description: 9 | -- 10 | -- Allows you to perform video rotation which perfectly 11 | -- cycles through all 360 degrees without any glitches. 12 | -- 13 | -- ----------------------------------------------------------- 14 | 15 | function cycle_video_rotate(amt) 16 | -- Ensure that amount is a base 10 integer. 17 | amt = tonumber(amt, 10) 18 | if amt == nil then 19 | mp.osd_message("Rotate: Invalid rotation amount") 20 | return nil -- abort 21 | end 22 | 23 | -- Calculate what the next rotation value should be, 24 | -- and wrap value to correct range (0 (aka 360) to 359). 25 | local newrotate = mp.get_property_number("video-rotate") 26 | newrotate = ( newrotate + amt ) % 360 27 | 28 | -- Change rotation and tell the user. 29 | mp.set_property_number("video-rotate", newrotate) 30 | mp.osd_message("Rotate: " .. newrotate) 31 | end 32 | 33 | -- Bind this via input.conf. Example: 34 | -- Alt+LEFT script-message Cycle_Video_Rotate -90 35 | -- Alt+RIGHT script-message Cycle_Video_Rotate 90 36 | mp.register_script_message("Cycle_Video_Rotate", cycle_video_rotate) -------------------------------------------------------------------------------- /mpv/scripts/modules.js/AssFormat.js: -------------------------------------------------------------------------------- 1 | /* 2 | * ASSFORMAT.JS (MODULE) 3 | * 4 | * Version: 1.2.0 5 | * Author: SteveJobzniak 6 | * URL: https://github.com/SteveJobzniak/mpv-tools 7 | * License: Apache License, Version 2.0 8 | */ 9 | 10 | /* jshint -W097 */ 11 | /* global mp, module, require */ 12 | 13 | 'use strict'; 14 | 15 | var Utils = require('MicroUtils'); 16 | 17 | var Ass = {}; 18 | 19 | Ass._startSeq = mp.get_property_osd('osd-ass-cc/0'); 20 | 21 | Ass._stopSeq = mp.get_property_osd('osd-ass-cc/1'); 22 | 23 | Ass.startSeq = function(output) 24 | { 25 | return output === false ? '' : Ass._startSeq; 26 | }; 27 | 28 | Ass.stopSeq = function(output) 29 | { 30 | return output === false ? '' : Ass._stopSeq; 31 | }; 32 | 33 | Ass.esc = function(str, escape) 34 | { 35 | if (escape === false) // Conveniently disable escaping via the same call. 36 | return str; 37 | // Uses the same technique as mangle_ass() in mpv's osd_libass.c: 38 | // - Treat backslashes as literal by inserting a U+2060 WORD JOINER after 39 | // them so libass can't interpret the next char as an escape sequence. 40 | // - Replace `{` with `\{` to avoid opening an ASS override block. There is 41 | // no need to escape the `}` since it's printed literally when orphaned. 42 | // - See: https://github.com/libass/libass/issues/194#issuecomment-351902555 43 | return str.replace(/\\/g, '\\\u2060').replace(/\{/g, '\\{'); 44 | }; 45 | 46 | Ass.size = function(fontSize, output) 47 | { 48 | return output === false ? '' : '{\\fs'+fontSize+'}'; 49 | }; 50 | 51 | Ass.scale = function(scalePercent, output) 52 | { 53 | return output === false ? '' : '{\\fscx'+scalePercent+'\\fscy'+scalePercent+'}'; 54 | }; 55 | 56 | Ass.convertPercentToHex = function(percent, invertValue) 57 | { 58 | // Tip: Use with "invertValue" to convert input range 0.0 (invisible) - 1.0 59 | // (fully visible) to hex range '00' (fully visible) - 'FF' (invisible), for 60 | // use with the alpha() function in a logical manner for end-users. 61 | if (typeof percent !== 'number' || percent < 0 || percent > 1) 62 | throw 'Invalid percentage value (must be 0.0 - 1.0)'; 63 | return Utils.toHex( 64 | Math.floor( // Invert range (optionally), and make into a 0-255 value. 65 | 255 * (invertValue ? 1 - percent : percent) 66 | ), 67 | 2 // Fixed-size: 2 bytes (00-FF), as needed for hex in ASS subtitles. 68 | ); 69 | }; 70 | 71 | Ass.alpha = function(transparencyHex, output) 72 | { 73 | return output === false ? '' : '{\\alpha&H'+transparencyHex+'&}'; // 00-FF. 74 | }; 75 | 76 | Ass.color = function(rgbHex, output) 77 | { 78 | return output === false ? '' : '{\\1c&H'+rgbHex.substring(4, 6)+rgbHex.substring(2, 4)+rgbHex.substring(0, 2)+'&}'; 79 | }; 80 | 81 | Ass.white = function(output) 82 | { 83 | return Ass.color('FFFFFF', output); 84 | }; 85 | 86 | Ass.gray = function(output) 87 | { 88 | return Ass.color('909090', output); 89 | }; 90 | 91 | Ass.yellow = function(output) 92 | { 93 | return Ass.color('FFFF90', output); 94 | }; 95 | 96 | Ass.green = function(output) 97 | { 98 | return Ass.color('90FF90', output); 99 | }; 100 | 101 | module.exports = Ass; -------------------------------------------------------------------------------- /mpv/scripts/modules.js/MicroUtils.js: -------------------------------------------------------------------------------- 1 | /* 2 | * MICROUTILS.US (MODULE) 3 | * 4 | * Version: 1.3.0 5 | * Author: SteveJobzniak 6 | * URL: https://github.com/SteveJobzniak/mpv-tools 7 | * License: Apache License, Version 2.0 8 | */ 9 | 10 | /* jshint -W097 */ 11 | /* global mp, module, require */ 12 | 13 | 'use strict'; 14 | 15 | var Utils = {}; 16 | 17 | // NOTE: This is an implementation of a non-recursive quicksort, which doesn't 18 | // risk any stack overflows. This function is necessary because of a MuJS <= 19 | // 1.0.1 bug which causes a stack overflow when running its built-in sort() on 20 | // any large array. See: https://github.com/ccxvii/mujs/issues/55 21 | // Furthermore, this performs optimized case-insensitive sorting. 22 | Utils.quickSort = function(arr, options) 23 | { 24 | options = options || {}; 25 | 26 | var i, sortRef, 27 | caseInsensitive = !!options.caseInsensitive; 28 | 29 | if (caseInsensitive) { 30 | sortRef = arr.slice(0); 31 | for (i = sortRef.length - 1; i >= 0; --i) 32 | if (typeof sortRef[i] === 'string') 33 | sortRef[i] = sortRef[i].toLowerCase(); 34 | 35 | return Utils.quickSort_Run(arr, sortRef); 36 | } 37 | 38 | return Utils.quickSort_Run(arr); 39 | }; 40 | 41 | Utils.quickSort_Run = function(arr, sortRef) 42 | { 43 | if (arr.length <= 1) 44 | return arr; 45 | 46 | var hasSortRef = !!sortRef; 47 | if (!hasSortRef) 48 | sortRef = arr; // Use arr instead. Makes a direct reference (no copy). 49 | 50 | if (arr.length !== sortRef.length) 51 | throw 'Array and sort-reference length must be identical'; 52 | 53 | // Adapted from a great, public-domain C algorithm by Darel Rex Finley. 54 | // Original implementation: http://alienryderflex.com/quicksort/ 55 | // Ported by SteveJobzniak and extended to sort via a 2nd reference array, 56 | // to allow sorting the main array by _any_ criteria via the 2nd array. 57 | var refPiv, arrPiv, beg = [], end = [], stackMax = -1, stackPtr = 0, L, R; 58 | 59 | beg.push(0); end.push(sortRef.length); 60 | ++stackMax; // Tracks highest available stack index. 61 | while (stackPtr >= 0) { 62 | L = beg[stackPtr]; R = end[stackPtr] - 1; 63 | if (L < R) { 64 | if (hasSortRef) // If we have a SEPARATE sort-ref, mirror actions! 65 | arrPiv = arr[L]; 66 | refPiv = sortRef[L]; // Left-pivot is fastest, no MuJS math needed! 67 | 68 | while (L < R) { 69 | while (sortRef[R] >= refPiv && L < R) R--; 70 | if (L < R) { 71 | if (hasSortRef) 72 | arr[L] = arr[R]; 73 | sortRef[L++] = sortRef[R]; 74 | } 75 | while (sortRef[L] <= refPiv && L < R) L++; 76 | if (L < R) { 77 | if (hasSortRef) 78 | arr[R] = arr[L]; 79 | sortRef[R--] = sortRef[L]; 80 | } 81 | } 82 | 83 | if (hasSortRef) 84 | arr[L] = arrPiv; 85 | sortRef[L] = refPiv; 86 | 87 | if (stackPtr === stackMax) { 88 | beg.push(0); end.push(0); // Grow stacks to fit next elem. 89 | ++stackMax; 90 | } 91 | 92 | beg[stackPtr + 1] = L + 1; 93 | end[stackPtr + 1] = end[stackPtr]; 94 | end[stackPtr++] = L; 95 | } else { 96 | stackPtr--; 97 | // NOTE: No need to shrink stack here. Size-reqs GROW until sorted! 98 | // (Anyway, MuJS is slow at splice() and wastes time if we shrink.) 99 | } 100 | } 101 | 102 | return arr; 103 | }; 104 | 105 | Utils.isInt = function(value) 106 | { 107 | // Verify that the input is an integer (whole number). 108 | return (typeof value !== 'number' || isNaN(value)) ? 109 | false : 110 | (value | 0) === value; 111 | }; 112 | 113 | Utils._hexSymbols = [ 114 | '0', '1', '2', '3', '4', '5', '6', '7', 115 | '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' 116 | ]; 117 | 118 | Utils.toHex = function(num, outputLength) 119 | { 120 | // Generates a fixed-length output, and handles negative numbers properly. 121 | var result = ''; 122 | while (outputLength--) { 123 | result = Utils._hexSymbols[num & 0xF] + result; 124 | num >>= 4; 125 | } 126 | return result; 127 | }; 128 | 129 | Utils.shuffle = function(arr) 130 | { 131 | var m = arr.length, tmp, i; 132 | 133 | while (m) { // While items remain to shuffle... 134 | // Pick a remaining element... 135 | i = Math.floor(Math.random() * m--); 136 | 137 | // And swap it with the current element. 138 | tmp = arr[m]; 139 | arr[m] = arr[i]; 140 | arr[i] = tmp; 141 | } 142 | 143 | return arr; 144 | }; 145 | 146 | Utils.trim = function(str) 147 | { 148 | return str.replace(/(?:^\s+|\s+$)/g, ''); // Trim left and right whitespace. 149 | }; 150 | 151 | Utils.ltrim = function(str) 152 | { 153 | return str.replace(/^\s+/, ''); // Trim left whitespace. 154 | }; 155 | 156 | Utils.rtrim = function(str) 157 | { 158 | return str.replace(/\s+$/, ''); // Trim right whitespace. 159 | }; 160 | 161 | Utils.dump = function(value) 162 | { 163 | mp.msg.error(JSON.stringify(value)); 164 | }; 165 | 166 | Utils.benchmarkStart = function(textLabel) 167 | { 168 | Utils.benchmarkTimestamp = mp.get_time(); 169 | Utils.benchmarkTextLabel = textLabel; 170 | }; 171 | 172 | Utils.benchmarkEnd = function() 173 | { 174 | var now = mp.get_time(), 175 | start = Utils.benchmarkTimestamp ? Utils.benchmarkTimestamp : now, 176 | elapsed = now - start, 177 | label = typeof Utils.benchmarkTextLabel === 'string' ? Utils.benchmarkTextLabel : ''; 178 | mp.msg.info('Time Elapsed (Benchmark'+(label.length ? ': '+label : '')+'): '+elapsed+' seconds.'); 179 | }; 180 | 181 | module.exports = Utils; -------------------------------------------------------------------------------- /mpv/scripts/modules.js/Options.js: -------------------------------------------------------------------------------- 1 | /* 2 | * OPTIONS.JS (MODULE) 3 | * 4 | * Description: JavaScript implementation of mpv's Lua API's config file system, 5 | * via "mp.options.read_options()". See official Lua docs for help. 6 | * https://github.com/mpv-player/mpv/blob/master/DOCS/man/lua.rst#mpoptions-functions 7 | * Version: 2.1.0 8 | * Author: SteveJobzniak 9 | * URL: https://github.com/SteveJobzniak/mpv-tools 10 | * License: Apache License, Version 2.0 11 | */ 12 | 13 | /* jshint -W097 */ 14 | /* global mp, exports, require */ 15 | 16 | 'use strict'; 17 | 18 | var ScriptConfig = function(options, identifier) 19 | { 20 | if (!options) 21 | throw 'Options table parameter is missing.'; 22 | this.options = options; 23 | this.scriptName = typeof identifier === 'string' ? identifier : mp.get_script_name(); 24 | this.configFile = null; 25 | 26 | // Converts string "val" to same primitive type as "destTypeVal". 27 | var typeConv = function(destTypeVal, val) 28 | { 29 | switch (typeof destTypeVal) { 30 | case 'object': 31 | if (!Array.isArray(destTypeVal)) 32 | val = undefined; // Unknown "object" target variable. 33 | else if (typeof val !== 'string') 34 | val = String(val); // Target is array, so use string values. 35 | break; 36 | case 'string': 37 | if (typeof val !== 'string') 38 | val = String(val); 39 | break; 40 | case 'boolean': 41 | if (val === 'yes') 42 | val = true; 43 | else if (val === 'no') 44 | val = false; 45 | else { 46 | mp.msg.error('Error: Can\'t convert '+JSON.stringify(val)+' to boolean!'); 47 | val = undefined; 48 | } 49 | break; 50 | case 'number': 51 | var num = parseFloat(val); 52 | if (!isNaN(num)) 53 | val = num; 54 | else { 55 | mp.msg.error('Error: Can\'t convert '+JSON.stringify(val)+' to number!'); 56 | val = undefined; 57 | } 58 | break; 59 | default: 60 | val = undefined; 61 | } 62 | return val; 63 | }; 64 | 65 | // Find config file. 66 | if (this.scriptName && this.scriptName.length) { 67 | mp.msg.debug('Reading options for '+this.scriptName+'.'); 68 | this.configFile = mp.find_config_file('script-settings/'+this.scriptName+'.conf'); 69 | if (!this.configFile) // Try legacy settings location as fallback. 70 | this.configFile = mp.find_config_file('lua-settings/'+this.scriptName+'.conf'); 71 | } 72 | 73 | // Read and parse configuration if found. 74 | var i, len, pos, key, val, isArrayVal, convVal; 75 | if (this.configFile && this.configFile.length) { 76 | try { 77 | var line, configLines = mp.utils.read_file(this.configFile).split(/[\r\n]+/); 78 | for (i = 0, len = configLines.length; i < len; ++i) { 79 | line = configLines[i].replace(/^\s+/, ''); 80 | if (!line.length || line.charAt(0) === '#') 81 | continue; 82 | pos = line.indexOf('='); 83 | if (pos < 0) { 84 | mp.msg.warn('"'+this.configFile+'": Ignoring malformatted config line "'+line.replace(/\s+$/, '')+'".'); 85 | continue; 86 | } 87 | key = line.substring(0, pos); 88 | val = line.substring(pos + 1); 89 | isArrayVal = false; 90 | if ('[]' === line.substring(pos - 2, pos)) { 91 | key = key.substring(0, key.length - 2); 92 | isArrayVal = true; 93 | } 94 | if (this.options.hasOwnProperty(key)) { 95 | convVal = typeConv(this.options[key], val); 96 | if (typeof convVal !== 'undefined') { 97 | if (Array.isArray(this.options[key])) { 98 | if (isArrayVal) 99 | this.options[key].push(convVal); 100 | else 101 | mp.msg.error('"'+this.configFile+'": Ignoring non-array value for array-based option key "'+key+'".'); 102 | } 103 | else 104 | this.options[key] = convVal; 105 | } 106 | else 107 | mp.msg.error('"'+this.configFile+'": Unable to convert value "'+val+'" for key "'+key+'".'); 108 | } 109 | else 110 | mp.msg.warn('"'+this.configFile+'": Ignoring unknown key "'+key+'".'); 111 | } 112 | } catch (e) { 113 | mp.msg.error('Unable to read configuration file "'+this.configFile+'".'); 114 | } 115 | } 116 | else 117 | mp.msg.verbose('Unable to find configuration file for '+this.scriptName+'.'); 118 | 119 | // Parse command-line options. 120 | if (this.scriptName && this.scriptName.length) { 121 | var cmdOpts = mp.get_property_native('options/script-opts'), rawOpt, 122 | prefix = this.scriptName+'-', keyLen; 123 | len = prefix.length; 124 | for (rawOpt in cmdOpts) { 125 | if (!cmdOpts.hasOwnProperty(rawOpt)) 126 | continue; 127 | pos = rawOpt.indexOf(prefix); 128 | if (pos !== 0) 129 | continue; 130 | key = rawOpt.substring(len); 131 | keyLen = key.length; 132 | isArrayVal = false; 133 | if ('[]' === key.substring(keyLen - 2)) { 134 | key = key.substring(0, keyLen - 2); 135 | isArrayVal = true; 136 | } 137 | if (key.length && this.options.hasOwnProperty(key)) { 138 | val = cmdOpts[rawOpt]; 139 | convVal = typeConv(this.options[key], val); 140 | if (typeof convVal !== 'undefined') { 141 | if (Array.isArray(this.options[key])) { 142 | if (isArrayVal) 143 | this.options[key].push(convVal); 144 | else 145 | mp.msg.error('script-opts: Ignoring non-array value for array-based option key "'+key+'".'); 146 | } 147 | else 148 | this.options[key] = convVal; 149 | } 150 | else 151 | mp.msg.error('script-opts: Unable to convert value "'+val+'" for key "'+key+'".'); 152 | } 153 | else 154 | mp.msg.warn('script-opts: Ignoring unknown key "'+key+'".'); 155 | } 156 | } 157 | }; 158 | 159 | ScriptConfig.prototype.getValue = function(key) 160 | { 161 | if (!this.options.hasOwnProperty(key)) 162 | throw 'Invalid option "'+key+'"'; 163 | return this.options[key]; 164 | }; 165 | 166 | ScriptConfig.prototype.getMultiValue = function(key) 167 | { 168 | // Multi-value format: `{one}+{two}+{three}`. 169 | var i, len, 170 | val = this.getValue(key), // Throws. 171 | result = []; 172 | if (typeof val !== 'string') 173 | throw 'Invalid non-string value in multi-value option "'+key+'"'; 174 | len = val.length; 175 | if (len) { 176 | if (val.charAt(0) !== '{' || val.charAt(len - 1) !== '}') 177 | throw 'Missing surrounding "{}" brackets in multi-value option "'+key+'"'; 178 | val = val.substring(1, len - 1).split('}+{'); 179 | len = val.length; 180 | for (i = 0; i < len; ++i) { 181 | result.push(val[i]); 182 | } 183 | } 184 | return result; 185 | }; 186 | 187 | // Class `advanced_options()`: Offers extended features such as multi-values. 188 | exports.advanced_options = ScriptConfig; 189 | 190 | // Function `read_options()`: Behaves like Lua API (returns plain list of opts). 191 | exports.read_options = function(table, identifier) { 192 | // NOTE: "table" will be modified by reference, just as the Lua version. 193 | var config = new ScriptConfig(table, identifier); 194 | return config.options; // This is the same object as "table". 195 | }; -------------------------------------------------------------------------------- /mpv/scripts/modules.js/PathIndex.js: -------------------------------------------------------------------------------- 1 | /* 2 | * PATHINDEX.JS (MODULE) 3 | * Version: 1.0 4 | * Author: SteveJobzniak 5 | * URL: https://github.com/SteveJobzniak/mpv-tools 6 | * License: Apache License, Version 2.0 7 | */ 8 | 9 | /* jshint -W097 */ 10 | /* global mp, module, require */ 11 | 12 | 'use strict'; 13 | 14 | var Utils = require('MicroUtils'); 15 | 16 | var PathIndex = function(path, settings) 17 | { 18 | this.path = path; 19 | this.dirs = []; 20 | this.files = []; 21 | this.skipDotfiles = false; 22 | this.includeDirs = true; 23 | this.includeFiles = true; 24 | this.dirFilterRgx = null; 25 | this.fileFilterRgx = null; 26 | this.changeSettings(settings); 27 | this.update(); 28 | }; 29 | 30 | PathIndex.prototype.changeSettings = function(settings) 31 | { 32 | settings = settings || {}; 33 | if (typeof settings.skipDotfiles !== 'undefined') 34 | this.skipDotfiles = !!settings.skipDotfiles; 35 | if (typeof settings.includeDirs !== 'undefined') 36 | this.includeDirs = !!settings.includeDirs; 37 | if (typeof settings.includeFiles !== 'undefined') 38 | this.includeFiles = !!settings.includeFiles; 39 | if (typeof settings.dirFilterRgx !== 'undefined') 40 | this.dirFilterRgx = settings.dirFilterRgx; 41 | if (typeof settings.fileFilterRgx !== 'undefined') 42 | this.fileFilterRgx = settings.fileFilterRgx; 43 | }; 44 | 45 | PathIndex.prototype._readdir = function(path, type) 46 | { 47 | if (typeof path !== 'string') 48 | throw '_readdir: No path provided'; 49 | 50 | // NOTE: Items are listed in "filesystem order", which MAY not be sorted. 51 | var result = mp.utils.readdir(path, type); 52 | if (result === undefined) 53 | throw '_readdir: '+mp.last_error()+' ("'+path+'")'; 54 | 55 | // If filtering is enabled, we'll ONLY keep files MATCHING the filter! 56 | var filterRgx = type === 'dirs' ? this.dirFilterRgx : this.fileFilterRgx; 57 | if (filterRgx || this.skipDotfiles) { 58 | for (var i = result.length - 1; i >= 0; --i) { 59 | if ( 60 | (this.skipDotfiles && result[i].charAt(0) === '.') || 61 | (filterRgx && !filterRgx.exec(result[i])) 62 | ) { 63 | result.splice(i, 1); 64 | } 65 | } 66 | } 67 | 68 | // Sort all items in case-insensitive alphabetical order. 69 | Utils.quickSort(result, {caseInsensitive: true}); 70 | 71 | return result; 72 | }; 73 | 74 | PathIndex.prototype.update = function(newPath, newSettings) 75 | { 76 | // Change the path and/or settings if requested. 77 | if (typeof newPath === 'string') 78 | this.path = newPath; 79 | if (typeof newSettings !== 'undefined') 80 | this.changeSettings(newSettings); 81 | 82 | // Attempt to load the directory contents. 83 | try { 84 | // NOTE: Blocks whole JS engine until done! Throws if bad path! 85 | var dirs = this.includeDirs ? this._readdir(this.path, 'dirs') : [], 86 | files = this.includeFiles ? this._readdir(this.path, 'files') : []; 87 | 88 | this.dirs = dirs; 89 | this.files = files; 90 | } catch (e) { 91 | this.dirs = []; 92 | this.files = []; 93 | throw e; 94 | } 95 | }; 96 | 97 | module.exports = PathIndex; -------------------------------------------------------------------------------- /mpv/scripts/modules.js/PathTools.js: -------------------------------------------------------------------------------- 1 | /* 2 | * PATHTOOLS.JS (MODULE) 3 | * Version: 1.0 4 | * Author: SteveJobzniak 5 | * URL: https://github.com/SteveJobzniak/mpv-tools 6 | * License: Apache License, Version 2.0 7 | */ 8 | 9 | /* jshint -W097 */ 10 | /* global mp, module, require */ 11 | 12 | 'use strict'; 13 | 14 | var PathIndex = require('PathIndex'); 15 | 16 | var PathTools = {}; 17 | 18 | PathTools.getCwd = function(strictErrors) 19 | { 20 | var cwdPath = mp.utils.getcwd(); 21 | if (cwdPath) 22 | return cwdPath; 23 | if (strictErrors) 24 | throw mp.last_error(); 25 | return ''; 26 | }; 27 | 28 | PathTools._isUnix = null; 29 | PathTools._isMac = null; 30 | PathTools._pathSep = null; 31 | 32 | PathTools._detectOS = function() 33 | { 34 | var cwdPath = PathTools.getCwd(true); // Throws. 35 | 36 | // Detect Unix/Linux/macOS if the path starts with a forward slash. 37 | PathTools._isUnix = cwdPath.charAt(0) === '/'; 38 | PathTools._isMac = false; // Mac is also Unix, but we'll detect separately. 39 | PathTools._pathSep = PathTools._isUnix ? '/' : '\\'; 40 | 41 | // Differentiate macOS from other Unix-like systems. 42 | if (PathTools._isUnix) { 43 | var unameResult = mp.utils.subprocess({ 44 | args: ['uname', '-s'], // "Linux" or "Darwin" (Mac) or "BSD", etc. 45 | cancellable: false // Cannot be interrupted by user playback. 46 | }); 47 | if (typeof unameResult.stdout === 'string' && unameResult.stdout.match(/^\s*Darwin\s*$/)) 48 | PathTools._isMac = true; 49 | } 50 | }; 51 | 52 | PathTools.isUnix = function() 53 | { 54 | if (PathTools._isUnix === null) 55 | PathTools._detectOS(); 56 | return PathTools._isUnix; 57 | }; 58 | 59 | PathTools.isMac = function() 60 | { 61 | if (PathTools._isMac === null) 62 | PathTools._detectOS(); 63 | return PathTools._isMac; 64 | }; 65 | 66 | PathTools.pathSep = function() 67 | { 68 | if (PathTools._pathSep === null) 69 | PathTools._detectOS(); 70 | return PathTools._pathSep; 71 | }; 72 | 73 | PathTools.getPathInfo = function(path) 74 | { 75 | // Use the modern file_info() API if the user's mpv is built with it! 76 | if (mp.utils.file_info) { 77 | var fileInfo = mp.utils.file_info(path); 78 | return fileInfo ? (fileInfo.is_dir ? 'dir' : 'file') : 'missing'; 79 | } 80 | 81 | // Fallback: Check if it's a dir by attempting to list directories in it. 82 | // NOTE: Misdetects on permission issues, but best we can do for old mpv. 83 | try { 84 | var dirContents = new PathIndex(path, { // Throws. 85 | // Skips file query, and just asks for directories (filtered out). 86 | includeFiles: false, 87 | dirFilterRgx: /^$/ 88 | }); 89 | return 'dir'; 90 | } catch (e) {} 91 | 92 | // It's either an unreadable directory, or a file, or missing. We'll use 93 | // a trick (reading 1 byte) to check if it's a (readable) file. 94 | try { 95 | // NOTE: We must read at least 1 byte (0 doesn't work). And the docs 96 | // claim that the function "allows text content only". Seems to only 97 | // affect the write function, since reading binary actually works! 98 | // NOTE: This properly works on (and detects) 0-byte files too. 99 | var data = mp.utils.read_file(path, 1); // Throws. 100 | return 'file'; 101 | } catch (e) { 102 | return 'missing'; 103 | } 104 | }; 105 | 106 | PathTools.getParentPath = function(path) 107 | { 108 | if (PathTools._isUnix === null || PathTools._pathSep === null) 109 | PathTools._detectOS(); 110 | var pathParts = path.split(PathTools._pathSep), 111 | previousDir = null; 112 | if (pathParts.length > 1) // Refuse to remove last remaining (drive root). 113 | previousDir = pathParts.pop(); 114 | var newPath = pathParts.join(PathTools._pathSep); 115 | if (PathTools._isUnix && !newPath.length) // Preserve unix drive root. 116 | newPath = '/'; 117 | if (!newPath.length) // Safeguard against empty parent path result. 118 | newPath = path; 119 | return { 120 | path: path, // Original input. 121 | newPath: newPath, // May still be empty (or "/") if path was empty. 122 | previousDir: previousDir // May be null. 123 | }; 124 | }; 125 | 126 | PathTools.getSubPath = function(path, file) 127 | { 128 | if (PathTools._isUnix === null || PathTools._pathSep === null) 129 | PathTools._detectOS(); 130 | return (PathTools._isUnix && path === '/' ? '/' : path+PathTools._pathSep)+file; 131 | }; 132 | 133 | PathTools.getPathname = function(path) 134 | { 135 | if (PathTools._pathSep === null) 136 | PathTools._detectOS(); 137 | // If there is no path separator, we assume there is no path (empty string). 138 | var filenameSep = path.lastIndexOf(PathTools._pathSep); 139 | return filenameSep >= 0 ? path.substring(0, filenameSep) : ''; 140 | }; 141 | 142 | PathTools.getBasename = function(path) 143 | { 144 | if (PathTools._pathSep === null) 145 | PathTools._detectOS(); 146 | // If there is no path separator, we assume the whole path is a filename. 147 | var filenameSep = path.lastIndexOf(PathTools._pathSep); 148 | return filenameSep >= 0 ? path.substring(filenameSep + 1) : path; 149 | }; 150 | 151 | PathTools.getExtension = function(path, includeDotfiles, noLowerCase) { 152 | var filename = PathTools.getBasename(path); 153 | var match = includeDotfiles ? 154 | filename.match(/\.([^.]+)$/) : 155 | filename.match(/[^.]\.([^.]+)$/); 156 | return match ? (noLowerCase ? match[1] : match[1].toLowerCase()) : null; 157 | }; 158 | 159 | PathTools.isPathAbsolute = function(path) 160 | { 161 | if (PathTools._isUnix === null) 162 | PathTools._detectOS(); 163 | return ( 164 | // Unix paths always start from "/" (even network paths). 165 | (PathTools._isUnix && path.charAt(0) === '/') || 166 | // Windows paths are "C:" (disk) or "\\XYZ" (network). 167 | (!PathTools._isUnix && path.match(/^(?:[a-z]:|\\\\[a-z])/i)) 168 | ); 169 | }; 170 | 171 | PathTools.makePathAbsolute = function(path) 172 | { 173 | return PathTools.isPathAbsolute(path) ? path : 174 | PathTools.getSubPath(PathTools.getCwd(), path); 175 | }; 176 | 177 | PathTools.isWebURL = function(path) 178 | { 179 | return path && path.match(/^[^:]+:\/\//); 180 | }; 181 | 182 | module.exports = PathTools; -------------------------------------------------------------------------------- /mpv/scripts/modules.js/PlaylistManager.js: -------------------------------------------------------------------------------- 1 | /* 2 | * PLAYLISTMANAGER.JS (MODULE) 3 | * Version: 1.0 4 | * Author: SteveJobzniak 5 | * URL: https://github.com/SteveJobzniak/mpv-tools 6 | * License: Apache License, Version 2.0 7 | */ 8 | 9 | /* jshint -W097 */ 10 | /* global mp, module, require */ 11 | 12 | 'use strict'; 13 | 14 | var PathTools = require('PathTools'); 15 | 16 | var PlaylistManager = {}; 17 | 18 | PlaylistManager.getPlaylist = function(itemPos) 19 | { 20 | var playlist = mp.get_property_native('playlist'); 21 | if (playlist === undefined) 22 | return null; 23 | 24 | if (typeof itemPos !== 'undefined') { // Single item is desired. 25 | if (!playlist.length) 26 | return null; 27 | 28 | if (itemPos === -1) // Get last item. 29 | return playlist[playlist.length - 1]; 30 | else if (itemPos >= 0 && itemPos < playlist.length) // Specific item. 31 | return playlist[itemPos]; 32 | else // Invalid position. 33 | return null; 34 | } 35 | 36 | return playlist; // Array of all playlist items. 37 | }; 38 | 39 | PlaylistManager.getCurrentlyPlaying = function(makeAbsolute) 40 | { 41 | // Attempt to detect the currently playing file (or the first playlist 42 | // file in case the playlist hasn't been started yet). Will be empty if 43 | // no playlist exists (such as in mpv's "idle with forced GUI" mode). 44 | var playlist = PlaylistManager.getPlaylist(), 45 | playlistItem = playlist.length ? playlist[0] : null, 46 | fullPath = null; 47 | for (var i = 0; i < playlist.length; ++i) { 48 | if (playlist[i] && playlist[i].current) { 49 | playlistItem = playlist[i]; 50 | break; 51 | } 52 | } 53 | 54 | if (playlistItem) { 55 | fullPath = playlistItem.filename; 56 | if (makeAbsolute && !PathTools.isWebURL(fullPath)) 57 | // Append the relative path to mpv's working dir (which is 58 | // what relative playlist files must be resolved against). 59 | fullPath = PathTools.makePathAbsolute(fullPath); 60 | } 61 | 62 | return fullPath; 63 | }; 64 | 65 | PlaylistManager.getCurrentlyPlayingLocal = function(makeAbsolute) 66 | { 67 | var info = { 68 | // Grab the current playlist file (if any) and make its path absolute. 69 | fullPath: PlaylistManager.getCurrentlyPlaying(makeAbsolute), 70 | pathName: null, 71 | baseName: null 72 | }; 73 | 74 | // If nothing is queued or it's a web URL, erase it and return. 75 | if (!info.fullPath || PathTools.isWebURL(info.fullPath)) { 76 | info.fullPath = null; 77 | return info; 78 | } 79 | 80 | // NOTE: Pathname will be empty if this is a relative file that has no dirs. 81 | info.pathName = PathTools.getPathname(info.fullPath); 82 | info.baseName = PathTools.getBasename(info.fullPath); 83 | 84 | return info; 85 | }; 86 | 87 | module.exports = PlaylistManager; -------------------------------------------------------------------------------- /mpv/scripts/modules.js/PseudoRandom.js: -------------------------------------------------------------------------------- 1 | /* 2 | * PSEUDORANDOM.JS (MODULE) 3 | * 4 | * Version: 1.0.0 5 | * Author: SteveJobzniak 6 | * URL: https://github.com/SteveJobzniak/mpv-tools 7 | * License: Apache License, Version 2.0 8 | */ 9 | 10 | /* jshint -W097 */ 11 | /* global mp, module, require, setInterval, clearInterval, setTimeout, clearTimeout */ 12 | 13 | 'use strict'; 14 | 15 | var Utils = require('MicroUtils'); 16 | 17 | /** 18 | * Pseudo-random number generator. 19 | * 20 | * Always generates the same output sequence based on the given input seed. 21 | */ 22 | var PseudoRandom = function(initialSeed) 23 | { 24 | // Based on Park-Miller-Carta PRNG (http://www.firstpr.com.au/dsp/rand31/). 25 | this.setSeed(initialSeed); 26 | }; 27 | 28 | /** 29 | * Get the current seed. 30 | */ 31 | PseudoRandom.prototype.getSeed = function() 32 | { 33 | return this._seed; 34 | }; 35 | 36 | /** 37 | * Set the current seed. 38 | * 39 | * This is useful for returning the PRNG to an earlier state. 40 | */ 41 | PseudoRandom.prototype.setSeed = function(seed) 42 | { 43 | if (!Utils.isInt(seed) || seed === 0) 44 | throw 'The seed must be a positive integer'; 45 | 46 | seed = seed % 2147483647; 47 | if (seed <= 0) 48 | seed += 2147483646; 49 | this._seed = seed; 50 | }; 51 | 52 | /** 53 | * Returns a pseudo-random value between 1 and 2^32 - 2. 54 | */ 55 | PseudoRandom.prototype.nextSeed = function() 56 | { 57 | // Generate the next seed based on current seed. Result will always be an 58 | // integer and can never become 0 (since only a float could lead to that). 59 | this._seed = this._seed * 16807 % 2147483647; 60 | return this._seed; 61 | }; 62 | 63 | /** 64 | * Returns a pseudo-random floating point number in range [0, 1] (exclusive). 65 | */ 66 | PseudoRandom.prototype.next = function() 67 | { 68 | // We know that `_nextSeed()` will be 1 to 2147483646 (inclusive), so simply 69 | // subtract one to turn the result into a float from 0 to 1 (exclusive). 70 | return (this.nextSeed() - 1) / 2147483646; 71 | }; 72 | 73 | module.exports = PseudoRandom; -------------------------------------------------------------------------------- /mpv/scripts/modules.js/RandomCycle.js: -------------------------------------------------------------------------------- 1 | /* 2 | * RANDOMCYCLE.JS (MODULE) 3 | * 4 | * Version: 1.0.0 5 | * Author: SteveJobzniak 6 | * URL: https://github.com/SteveJobzniak/mpv-tools 7 | * License: Apache License, Version 2.0 8 | */ 9 | 10 | /* jshint -W097 */ 11 | /* global mp, module, require, setInterval, clearInterval, setTimeout, clearTimeout */ 12 | 13 | 'use strict'; 14 | 15 | var Utils = require('MicroUtils'); 16 | 17 | /** 18 | * Generates a randomly ordered set and lets you traverse it in any direction. 19 | * 20 | * When it comes to randomizing data, this class is vastly superior to a pure 21 | * "pick a random entry", since this guarantees that you'll never encounter the 22 | * same entry twice. It also guarantees that the user can traverse forwards as 23 | * much as they want, and suddenly decide that they want to go back a few steps 24 | * to land on an entry they just passed through. Since the order is linked, they 25 | * just have to travel a few steps backwards and they'll reach the entry again. 26 | * 27 | * For example, for a set size of 6, you'd have the data `[0,1,2,3,4,5]`. 28 | * Shuffled, it may look like `[4,5,3,0,1,2]`. If you traverse it forwards 29 | * and query it about what comes after "3", it would answer "0". If you ask 30 | * what comes before "3", it would answer "5". Whenever you reach an edge, 31 | * it wraps around and thereby gives you a perfect cycle/chain which always 32 | * leads back to where you started, and covers every value along the way. 33 | * 34 | * Expressed in "next" order: `3 -> 0 -> 1 -> 2 -> 4 -> 5 -> 3 -> 0 -> 1 -> 2`. 35 | * And in "previous" order: `4 -> 2 -> 1 -> 0 -> 3 -> 5 -> 4 -> 2 -> 1 -> 0`. 36 | */ 37 | var RandomCycle = function() 38 | { 39 | this._count = 0; 40 | this._shuffled = []; 41 | }; 42 | 43 | /** 44 | * Change the size of the set and shuffle the data. 45 | * 46 | * This must be done before you can query about any number, and it must be 47 | * called any time the set size changes. 48 | */ 49 | RandomCycle.prototype.setCount = function(count) 50 | { 51 | if (!Utils.isInt(count)) 52 | throw 'The count must be a positive integer'; 53 | this._count = count; 54 | this._shuffled = []; 55 | for (var i = 0; i < count; ++i) { 56 | this._shuffled.push(i); 57 | } 58 | Utils.shuffle(this._shuffled); 59 | }; 60 | 61 | /** 62 | * Shuffle the current dataset again. 63 | * 64 | * Can be used anytime you want to re-organize the cycle pattern into a 65 | * different order. 66 | */ 67 | RandomCycle.prototype.shuffleCycle = function() 68 | { 69 | Utils.shuffle(this._shuffled); 70 | }; 71 | 72 | /** 73 | * Get the next index after the given index. 74 | * 75 | * Throws if the given index is out of range of the dataset's count. 76 | */ 77 | RandomCycle.prototype.getNext = function(fromIdx) 78 | { 79 | var current = this._findIdx(fromIdx), // Throws. 80 | next = current + 1; 81 | if (next >= this._count) // Wrap. 82 | next = 0; 83 | 84 | return this._shuffled[next]; 85 | }; 86 | 87 | /** 88 | * Get the previous index before the given index. 89 | * 90 | * Throws if the given index is out of range of the dataset's count. 91 | */ 92 | RandomCycle.prototype.getPrevious = function(fromIdx) 93 | { 94 | var current = this._findIdx(fromIdx), // Throws. 95 | previous = current - 1; 96 | if (previous < 0) // Wrap. 97 | previous = this._count - 1; 98 | 99 | return this._shuffled[previous]; 100 | }; 101 | 102 | /** 103 | * (Internal) Locate an index value in the shuffled dataset. 104 | * 105 | * 106 | * Throws if the given index is out of range of the dataset's count. 107 | */ 108 | RandomCycle.prototype._findIdx = function(idx) 109 | { 110 | if (!Utils.isInt(idx) || idx < 0 || idx >= this._count) 111 | throw 'The index must be an integer within the current count-range'; 112 | var foundAt = this._shuffled.indexOf(idx); 113 | if (foundAt < 0) // Just a safeguard. 114 | throw 'Unable to find index in shuffled dataset'; 115 | 116 | return foundAt; 117 | }; 118 | 119 | module.exports = RandomCycle; -------------------------------------------------------------------------------- /mpv/scripts/modules.js/Stack.js: -------------------------------------------------------------------------------- 1 | /* 2 | * STACK.JS (MODULE) 3 | * 4 | * Version: 1.0.0 5 | * Author: SteveJobzniak 6 | * URL: https://github.com/SteveJobzniak/mpv-tools 7 | * License: Apache License, Version 2.0 8 | */ 9 | 10 | /* jshint -W097 */ 11 | /* global mp, module, require, setInterval, clearInterval, setTimeout, clearTimeout */ 12 | 13 | 'use strict'; 14 | 15 | var Utils = require('MicroUtils'); 16 | 17 | var Stack = function(maxSize) 18 | { 19 | if (!Utils.isInt(maxSize) || maxSize === 0) 20 | throw 'Max stack size must be either -1 (unlimited), or 1 or higher'; 21 | 22 | this.stack = []; 23 | this.position = -1; 24 | this.maxSize = maxSize; 25 | }; 26 | 27 | Stack.prototype.push = function(elem) 28 | { 29 | // Add to end of stack. 30 | this.stack.push(elem); 31 | if (this.maxSize !== -1) 32 | while (this.stack.length > this.maxSize) // Normally only triggers once. 33 | this.stack.shift(); // Remove 1st and reindex. 34 | this.position = this.stack.length - 1; 35 | }; 36 | 37 | Stack.prototype.pop = function() 38 | { 39 | // Pop from end of stack. 40 | if (this.position < 0) 41 | return undefined; // Stack is empty. 42 | var popped = this.stack.pop(); 43 | this.position = this.stack.length - 1; 44 | return popped; 45 | }; 46 | 47 | Stack.prototype.clearStack = function() 48 | { 49 | // NOTE: We use splice rather than `= []` to ensure old references retrieved 50 | // via `getStack()` will still point to the active stack after clearing it. 51 | this.stack.splice(0, this.stack.length); 52 | this.position = -1; 53 | }; 54 | 55 | Stack.prototype.getStack = function() 56 | { 57 | return this.stack; 58 | }; 59 | 60 | Stack.prototype.getLast = function() 61 | { 62 | return this.position >= 0 ? 63 | this.stack[this.position] : 64 | undefined; 65 | }; 66 | 67 | Stack.prototype.getCount = function() 68 | { 69 | return this.position + 1; 70 | }; 71 | 72 | Stack.prototype.isEmpty = function() 73 | { 74 | return this.position < 0; 75 | }; 76 | 77 | module.exports = Stack; -------------------------------------------------------------------------------- /mpv/scripts/quick-scale.lua: -------------------------------------------------------------------------------- 1 | -- ----------------------------------------------------------- 2 | -- 3 | -- QUICK-SCALE.LUA 4 | -- Version: 1.1 5 | -- Author: SteveJobzniak 6 | -- URL: https://github.com/SteveJobzniak/mpv-tools 7 | -- 8 | -- Description: 9 | -- 10 | -- Quickly scale the video player to a target size, 11 | -- with full control over target scale and max scale. 12 | -- Helps you effortlessly resize a video to fit on your 13 | -- desktop, or any other video dimensions you need! 14 | -- 15 | -- History: 16 | -- 17 | -- 1.0: Initial release. 18 | -- 1.1: Do nothing if mpv is in fullscreen mode. 19 | -- 20 | -- ----------------------------------------------------------- 21 | -- 22 | -- Parameters: 23 | -- targetwidth = How wide you want the target area to be. 24 | -- targetheight = How tall you want the target area to be. 25 | -- targetscale = If this is 1, we use your target width/height 26 | -- as-is, but if it's another value then we scale your provided 27 | -- target size by that amount. This parameter is great if you want 28 | -- a video to be a certain percentage of your desktop resolution. 29 | -- In that case, just set targetwidth/targetheight to your 30 | -- desktop resolution, and set this targetscale to the percentage 31 | -- of your desktop that you want to use for the video, such as 32 | -- "0.25" to resize the video to 25% of your desktop resolution. 33 | -- maxvideoscale = If this is a positive number (anything above 0), 34 | -- then the final video scale cannot exceed this number. 35 | -- This is useful if you for example set the target to 25% 36 | -- of your desktop resolution. If the video is smaller than that, 37 | -- then it would be scaled up (enlarged) to the size of the target. 38 | -- To control that behavior, simply set this parameter. 39 | -- Here are some examples: 40 | -- -1, 0, or any other non-positive number: We'll enlarge 41 | -- too-small videos and shrink too-large videos. Small videos 42 | -- will be enlarged as much as needed to match target size. 43 | -- 1: Video will only be allowed to enlarge to 100% of its natural size. 44 | -- This means that small videos won't become big and blurry. 45 | -- 1.5: Video will only be allowed to enlarge to 150% of its natural size. 46 | function quick_scale(targetwidth, targetheight, targetscale, maxvideoscale) 47 | -- Don't attempt to scale the fullscreen window. 48 | if (mp.get_property_bool("fullscreen", false)) then 49 | return nil -- abort 50 | end 51 | 52 | -- Check parameter existence. 53 | if (targetwidth == nil or targetheight == nil 54 | or targetscale == nil or maxvideoscale == nil) 55 | then 56 | mp.osd_message("Quick_Scale: Missing parameters") 57 | return nil -- abort 58 | end 59 | 60 | -- Ensure that the incoming strings are valid numbers. 61 | targetwidth = tonumber(targetwidth) 62 | targetheight = tonumber(targetheight) 63 | targetscale = tonumber(targetscale) 64 | maxvideoscale = tonumber(maxvideoscale) 65 | if (targetwidth == nil or targetheight == nil 66 | or targetscale == nil or maxvideoscale == nil) 67 | then 68 | mp.osd_message("Quick_Scale: Non-numeric parameters") 69 | return nil -- abort 70 | end 71 | 72 | -- If the target scale isn't 1 (100%), we'll re-calculate target size. 73 | if (targetscale ~= 1) then 74 | targetwidth = targetwidth * targetscale 75 | targetheight = targetheight * targetscale 76 | end 77 | 78 | -- Find smallest video scale that fits target size in both width and height. 79 | -- This only looks at video and doesn't take window borders into account! 80 | widthscale = targetwidth / mp.get_property("width") 81 | heightscale = targetheight / mp.get_property("height") 82 | local scale = (widthscale < heightscale and widthscale or heightscale) 83 | 84 | -- If we arrived at a target width/height that is larger than the video's 85 | -- natural "100%" scale, then we may want to limit it to a maximum amount. 86 | if (maxvideoscale > 0 and scale > maxvideoscale) then 87 | scale = maxvideoscale 88 | end 89 | 90 | -- Apply the new video scale. 91 | mp.set_property_number("window-scale", scale) 92 | end 93 | 94 | -- Bind this via input.conf. Examples: 95 | -- To fit a video to 100% of a 1680x1050 desktop size, with unlimited video enlarging: 96 | -- Alt+9 script-message Quick_Scale "1680" "1050" "1" "-1" 97 | -- To fit a video to 80% of a 1680x1050 desktop size, but disallowing the 98 | -- video from becoming larger than 150% of its natural size: 99 | -- Alt+9 script-message Quick_Scale "1680" "1050" "0.8" "1.5" 100 | -- To fit a video to a 200x200 box, with unlimited video enlarging: 101 | -- Alt+9 script-message Quick_Scale "200" "200" "1" "-1" 102 | mp.register_script_message("Quick_Scale", quick_scale) -------------------------------------------------------------------------------- /msys64/bootstrap.txt: -------------------------------------------------------------------------------- 1 | # packages 2 | 3 | ## fonts 4 | pacman -S mingw-w64-ucrt-x86_64-ttf-cascadia-code-nerd 5 | mingw-w64-ucrt-x86_64-ttf-cascadia-mono-nerd 6 | 7 | ## utility 8 | pacman -S tree procps-ng rsync unzip zip 9 | mingw-w64-ucrt-x86_64-bat mingw-w64-ucrt-x86_64-bottom 10 | mingw-w64-ucrt-x86_64-ripgrep mingw-w64-ucrt-x86_64-scc 11 | mingw-w64-ucrt-x86_64-delta mingw-w64-ucrt-x86_64-fd 12 | mingw-w64-ucrt-x86_64-fzf mingw-w64-ucrt-x86_64-czkawka-cli 13 | mingw-w64-ucrt-x86_64-yt-dlp mingw-w64-ucrt-x86_64-qbittorrent 14 | mingw-w64-ucrt-x86_64-qemu mingw-w64-ucrt-x86_64-qalculate-gtk 15 | mingw-w64-ucrt-x86_64-jq 16 | 17 | ## development 18 | pacman -S base-devel gcc gdb git cscope clang llvm man-db man-pages-posix msys2-runtime 19 | mingw-w64-ucrt-x86_64-cppcheck mingw-w64-ucrt-x86_64-neovim 20 | 21 | ## audio/video 22 | pacman -S mingw-w64-ucrt-x86_64-mediainfo mingw-w64-ucrt-x86_64-mpg123 23 | mingw-w64-ucrt-x86_64-mpv mingw-w64-ucrt-x86_64-ffmpeg 24 | 25 | ## pdf/docs 26 | pacman -S mingw-w64-ucrt-x86_64-okular 27 | 28 | # clifm 29 | ## dependencies 30 | pacman -S libreadline-devel gettext-devel 31 | 32 | ## installation 33 | git clone https://github.com/leo-arch/clifm.git 34 | cd clifm 35 | make -f misc/cygwin/Makefile install 36 | 37 | ## rust 38 | pacman -S mingw-w64-ucrt-x86_64-rust mingw-w64-ucrt-x86_64-rust-docs 39 | 40 | # tips 41 | XDG_DATA_HOME and XDG_DATA_DIRS 42 | -------------------------------------------------------------------------------- /msys64/home/.bash_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 | # ~/.bash_profile: executed by bash(1) for login shells. 9 | 10 | # The copy in your home directory (~/.bash_profile) is yours, please 11 | # feel free to customise it to create a shell 12 | # environment to your liking. If you feel a change 13 | # would be benifitial to all, please feel free to send 14 | # a patch to the msys2 mailing list. 15 | 16 | # User dependent .bash_profile file 17 | 18 | # source the users bashrc if it exists 19 | if [ -f "${HOME}/.bashrc" ] ; then 20 | source "${HOME}/.bashrc" 21 | fi 22 | 23 | # Set PATH so it includes user's private bin if it exists 24 | # if [ -d "${HOME}/bin" ] ; then 25 | # PATH="${HOME}/bin:${PATH}" 26 | # fi 27 | 28 | # Set MANPATH so it includes users' private man if it exists 29 | # if [ -d "${HOME}/man" ]; then 30 | # MANPATH="${HOME}/man:${MANPATH}" 31 | # fi 32 | 33 | # Set INFOPATH so it includes users' private info if it exists 34 | # if [ -d "${HOME}/info" ]; then 35 | # INFOPATH="${HOME}/info:${INFOPATH}" 36 | # fi 37 | -------------------------------------------------------------------------------- /msys64/home/.bashrc: -------------------------------------------------------------------------------- 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 | # ~/.bashrc: executed by bash(1) for interactive shells. 9 | 10 | # The copy in your home directory (~/.bashrc) is yours, please 11 | # feel free to customise it to create a shell 12 | # environment to your liking. If you feel a change 13 | # would be benifitial to all, please feel free to send 14 | # a patch to the msys2 mailing list. 15 | 16 | # User dependent .bashrc file 17 | 18 | # If not running interactively, don't do anything 19 | [[ "$-" != *i* ]] && return 20 | 21 | export PS1="[\[\e[2m\]\w\[\e[m\]]:\n↳" 22 | #export PATH=$PATH:~/clifm 23 | 24 | # Shell Options 25 | # 26 | # See man bash for more options... 27 | # 28 | # Don't wait for job termination notification 29 | # set -o notify 30 | # 31 | # Don't use ^D to exit 32 | # set -o ignoreeof 33 | # 34 | # Use case-insensitive filename globbing 35 | # shopt -s nocaseglob 36 | # 37 | # Make bash append rather than overwrite the history on disk 38 | # shopt -s histappend 39 | # 40 | # When changing directory small typos can be ignored by bash 41 | # for example, cd /vr/lgo/apaache would find /var/log/apache 42 | # shopt -s cdspell 43 | 44 | # Completion options 45 | # 46 | # These completion tuning parameters change the default behavior of bash_completion: 47 | # 48 | # Define to access remotely checked-out files over passwordless ssh for CVS 49 | # COMP_CVS_REMOTE=1 50 | # 51 | # Define to avoid stripping description in --option=description of './configure --help' 52 | # COMP_CONFIGURE_HINTS=1 53 | # 54 | # Define to avoid flattening internal contents of tar files 55 | # COMP_TAR_INTERNAL_PATHS=1 56 | # 57 | # Uncomment to turn on programmable completion enhancements. 58 | # Any completions you add in ~/.bash_completion are sourced last. 59 | # [[ -f /etc/bash_completion ]] && . /etc/bash_completion 60 | 61 | # History Options 62 | # 63 | # Don't put duplicate lines in the history. 64 | # export HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups 65 | # 66 | # Ignore some controlling instructions 67 | # HISTIGNORE is a colon-delimited list of patterns which should be excluded. 68 | # The '&' is a special pattern which suppresses duplicate entries. 69 | # export HISTIGNORE=$'[ \t]*:&:[fb]g:exit' 70 | # export HISTIGNORE=$'[ \t]*:&:[fb]g:exit:ls' # Ignore the ls command as well 71 | # 72 | # Whenever displaying the prompt, write the previous line to disk 73 | # export PROMPT_COMMAND="history -a" 74 | 75 | # Aliases 76 | # 77 | # Some people use a different file for aliases 78 | # if [ -f "${HOME}/.bash_aliases" ]; then 79 | # source "${HOME}/.bash_aliases" 80 | # fi 81 | # 82 | # Some example alias instructions 83 | # If these are enabled they will be used instead of any instructions 84 | # they may mask. For example, alias rm='rm -i' will mask the rm 85 | # application. To override the alias instruction use a \ before, ie 86 | # \rm will call the real rm not the alias. 87 | # 88 | # Interactive operation... 89 | # alias rm='rm -i' 90 | # alias cp='cp -i' 91 | # alias mv='mv -i' 92 | # 93 | # Default to human readable figures 94 | # alias df='df -h' 95 | # alias du='du -h' 96 | # 97 | # Misc :) 98 | # alias less='less -r' # raw control characters 99 | # alias whence='type -a' # where, of a sort 100 | # alias grep='grep --color' # show differences in colour 101 | # alias egrep='egrep --color=auto' # show differences in colour 102 | # alias fgrep='fgrep --color=auto' # show differences in colour 103 | # 104 | # Some shortcuts for different directory listings 105 | # alias ls='ls -hF --color=tty' # classify files in colour 106 | # alias dir='ls --color=auto --format=vertical' 107 | # alias vdir='ls --color=auto --format=long' 108 | # alias ll='ls -l' # long list 109 | # alias la='ls -A' # all but . and .. 110 | # alias l='ls -CF' # 111 | 112 | # Umask 113 | # 114 | # /etc/profile sets 022, removing write perms to group + others. 115 | # Set a more restrictive umask: i.e. no exec perms for others: 116 | # umask 027 117 | # Paranoid: neither group nor others have any perms: 118 | # umask 077 119 | 120 | # Functions 121 | # 122 | # Some people use a different file for functions 123 | # if [ -f "${HOME}/.bash_functions" ]; then 124 | # source "${HOME}/.bash_functions" 125 | # fi 126 | # 127 | # Some example functions: 128 | # 129 | # a) function settitle 130 | # settitle () 131 | # { 132 | # echo -ne "\e]2;$@\a\e]1;$@\a"; 133 | # } 134 | # 135 | # b) function cd_func 136 | # This function defines a 'cd' replacement function capable of keeping, 137 | # displaying and accessing history of visited directories, up to 10 entries. 138 | # To use it, uncomment it, source this file and try 'cd --'. 139 | # acd_func 1.0.5, 10-nov-2004 140 | # Petar Marinov, http:/geocities.com/h2428, this is public domain 141 | # cd_func () 142 | # { 143 | # local x2 the_new_dir adir index 144 | # local -i cnt 145 | # 146 | # if [[ $1 == "--" ]]; then 147 | # dirs -v 148 | # return 0 149 | # fi 150 | # 151 | # the_new_dir=$1 152 | # [[ -z $1 ]] && the_new_dir=$HOME 153 | # 154 | # if [[ ${the_new_dir:0:1} == '-' ]]; then 155 | # # 156 | # # Extract dir N from dirs 157 | # index=${the_new_dir:1} 158 | # [[ -z $index ]] && index=1 159 | # adir=$(dirs +$index) 160 | # [[ -z $adir ]] && return 1 161 | # the_new_dir=$adir 162 | # fi 163 | # 164 | # # 165 | # # '~' has to be substituted by ${HOME} 166 | # [[ ${the_new_dir:0:1} == '~' ]] && the_new_dir="${HOME}${the_new_dir:1}" 167 | # 168 | # # 169 | # # Now change to the new dir and add to the top of the stack 170 | # pushd "${the_new_dir}" > /dev/null 171 | # [[ $? -ne 0 ]] && return 1 172 | # the_new_dir=$(pwd) 173 | # 174 | # # 175 | # # Trim down everything beyond 11th entry 176 | # popd -n +11 2>/dev/null 1>/dev/null 177 | # 178 | # # 179 | # # Remove any other occurence of this dir, skipping the top of the stack 180 | # for ((cnt=1; cnt <= 10; cnt++)); do 181 | # x2=$(dirs +${cnt} 2>/dev/null) 182 | # [[ $? -ne 0 ]] && return 0 183 | # [[ ${x2:0:1} == '~' ]] && x2="${HOME}${x2:1}" 184 | # if [[ "${x2}" == "${the_new_dir}" ]]; then 185 | # popd -n +$cnt 2>/dev/null 1>/dev/null 186 | # cnt=cnt-1 187 | # fi 188 | # done 189 | # 190 | # return 0 191 | # } 192 | # 193 | # alias cd=cd_func 194 | 195 | -------------------------------------------------------------------------------- /msys64/home/.config/clifm/keybindings.clifm: -------------------------------------------------------------------------------- 1 | ############################## 2 | # Keybindings file for CliFM # 3 | ############################## 4 | 5 | # Empty and commented lines are omitted. 6 | 7 | # Emacs style key escapes are the simplest way of setting your 8 | # keybindings. For example, use "action:\C-t" to bind the action name 9 | # 'action' to Ctrl-t 10 | # Note: Available action names are defined below 11 | 12 | # If you need some more control, hex, octal, and decimal notation is 13 | # supported as well (this is needed for example for function keys). For 14 | # the sake of simplicity, CliFM provides a plugin to easily get the 15 | # adequate codes. 16 | 17 | # Use the 'kbgen' plugin (compile it first: 'gcc -o kbgen kbgen.c') to 18 | # find out the escape code for the key or key sequence you want. Use 19 | # either octal, hexadecimal codes or symbols. 20 | # 21 | # Example: For Alt-/ (in rxvt terminals) 'kbgen' will print the following 22 | # lines: 23 | # 24 | # Hex | Oct | Symbol 25 | # ---- | ---- | ------ 26 | # \x1b | \033 | ESC (\e) 27 | # \x2f | \057 | / 28 | # 29 | # In this case, the keybinding, if using symbols, is: "\e/:function" 30 | # In case you prefer the hex codes it would be: \x1b\x2f:function. 31 | # GNU emacs escape sequences are also allowed (ex: "\M-a", Alt-a 32 | # in most keyboards, or "\C-r" for Ctrl-r). 33 | 34 | # Some codes, especially those involving keys like Ctrl or the arrow 35 | # keys, vary depending on the terminal emulator and the system settings. 36 | # These keybindings should be set up thus on a per terminal basis. 37 | # You can also consult the terminfo database via the infocmp command. 38 | # See terminfo(5) and infocmp(1). 39 | 40 | # Alt-j 41 | previous-dir:\M-j 42 | # Shift-left (rxvt) 43 | previous-dir2:\e[d 44 | # Shift-left (xterm) 45 | previous-dir3:\e[2D 46 | # Shift-left (others) 47 | previous-dir4:\e[1;2D 48 | 49 | # Alt-k 50 | next-dir:\M-k 51 | # Shift-right (rxvt) 52 | next-dir2:\e[c 53 | # Shift-right (xterm) 54 | next-dir3:\e[2C 55 | # Shift-right (others) 56 | next-dir4:\e[1;2C 57 | 58 | # Alt-u 59 | parent-dir:\M-u 60 | # Shift-up (rxvt) 61 | parent-dir2:\e[a 62 | # Shift-up (xterm) 63 | parent-dir3:\e[2A 64 | # Shift-up (others) 65 | parent-dir4:\e[1;2A 66 | 67 | # Alt-e 68 | home-dir:\M-e 69 | # Home key (rxvt) 70 | #home-dir2:\e[7~ 71 | # Home key (xterm) 72 | #home-dir3:\e[H 73 | # Home key (Emacs term) 74 | #home-dir4:\e[1~ 75 | 76 | # Alt-r 77 | #root-dir:\M-r 78 | plugin3:\M-r 79 | 80 | # Alt-/ (rxvt) 81 | root-dir2:\e/ 82 | #root-dir3: 83 | 84 | pinned-dir:\M-p 85 | workspace1:\M-1 86 | workspace2:\M-2 87 | workspace3:\M-3 88 | workspace4:\M-4 89 | 90 | # Help 91 | # F1-3 92 | show-cmds:\eOQ 93 | show-cmds2:\e[12~ 94 | show-kbinds:\eOR 95 | show-kbinds2:\e[13~ 96 | show-manpage:\eOP 97 | show-manpage2:\e[11~ 98 | 99 | archive-sel:\C-\M-a 100 | bookmarks:\M-b 101 | clear-line:\M-c 102 | clear-msgs:\M-t 103 | create-file:\M-n 104 | deselect-all:\M-d 105 | dirs-first:\M-g 106 | export-sel:\C-\M-e 107 | launch-view:\M-- 108 | lock:\M-o 109 | mountpoints:\M-m 110 | move-sel:\C-\M-n 111 | new-instance:\C-x 112 | next-profile:\C-\M-p 113 | only-dirs:\M-, 114 | open-sel:\C-\M-g 115 | paste-sel:\C-\M-v 116 | prepend-sudo:\M-v 117 | previous-profile:\C-\M-o 118 | rename-sel:\C-\M-r 119 | remove-sel:\C-\M-d 120 | #refresh-screen:\C-r 121 | cmd-hist:\C-r 122 | selbox:\M-s 123 | select-all:\M-a 124 | show-dirhist:\M-h 125 | sort-previous:\M-z 126 | sort-next:\M-x 127 | toggle-hidden:\M-i 128 | toggle-hidden2:\M-. 129 | toggle-light:\M-y 130 | toggle-long:\M-l 131 | toggle-max-name-len:\C-\M-l 132 | toggle-disk-usage:\C-\M-i 133 | toggle-virtualdir-full-paths:\M-w 134 | trash-sel:\C-\M-t 135 | untrash-all:\C-\M-u 136 | 137 | # F6-12 138 | edit-color-scheme:\e[19~ 139 | open-bookmarks:\e[23~ 140 | open-config:\e[21~ 141 | #open-jump-db:\e[18~ 142 | open-keybinds:\e[20~ 143 | open-mime:\e[17~ 144 | open-preview:\e[18~ 145 | quit:\e[24~ 146 | 147 | # Plugins 148 | # 1) Make sure your plugin is in the plugins directory (or use any of the 149 | # plugins in there) 150 | # 2) Link pluginx to your plugin using the 'actions edit' command. Ex: 151 | # "plugin1=myplugin.sh" 152 | # 3) Set a keybinding here for pluginx. Ex: "plugin1:\M-7" 153 | 154 | # Bound to the xclip plugin 155 | plugin1:\C-y 156 | 157 | #plugin2: 158 | #plugin3: 159 | #plugin4: -------------------------------------------------------------------------------- /msys64/home/.config/clifm/plugins/BFG.cfg: -------------------------------------------------------------------------------- 1 | ############################################ 2 | # Configuration file CliFM's BFG previewer # 3 | ############################################ 4 | 5 | # Commented and blank lines are omitted 6 | 7 | # GENERAL OPTIONS 8 | 9 | # Maximum height of the FZF window. Defaults to 80% 10 | FZFHEIGHT="80%" 11 | 12 | # Location of the previwer script. Defaults to 13 | # "${XDG_CONFIG_HOME:-$HOME/.config}/clifm/plugins/BFG.sh" 14 | BFG_FILE="" 15 | 16 | # Resource opener to use. Defaults to Lira, CliFM's built-in opener 17 | OPENER="clifm" 18 | 19 | # BFG caches images to speed up the previewing process (only files 20 | # that need to be converted into images are cached). Specify where 21 | # to store these cached images. Defaults to 22 | # "${XDG_CACHE_HOME:-$HOME/.cache}/clifm/previews" 23 | PREVIEWDIR="" 24 | 25 | # Set to 1 to use Ranger's scope.sh file instead of BFG 26 | USE_SCOPE=0 27 | # Location of the scope.sh file. Defaults to 28 | # "${XDG_CONFIG_HOME:-$HOME/.config}/ranger/scope.sh" 29 | SCOPE_FILE="" 30 | 31 | # Set to 1 to use pistol instead of BFG 32 | USE_PISTOL=0 33 | 34 | PREVIEW_IMAGES=1 35 | PLAY_MUSIC=1 36 | ANIMATE_GIFS=1 37 | # Try to print file information if no previewing application is found 38 | FALLBACK_INFO=1 39 | 40 | # FILETYPE DEFINITIONS 41 | 42 | # Choose previewing applications for file types. Available options 43 | # are provided as comments above each line. 44 | 45 | # Use 'none' to prevent previews of the corresponding file type. 46 | 47 | # Leave blank to let BFG check for available applications and use 48 | # the first one found (the order of this check is the same as the 49 | # order in the comments below). Ex: for archives, atool will be 50 | # checked first, then bsdtar, and finally tar. 51 | 52 | # atool (recommended), bsdtar, tar 53 | ARCHIVES="" 54 | 55 | # w3m, linx, elinks, cat 56 | BROWSER="" 57 | 58 | # ddjvu (image preview), ddjvutxt (text preview) 59 | DDJVU="" 60 | 61 | # tree, ls, exa, exa-tree, lsd, lsd-tree 62 | DIR="" 63 | 64 | # libreoffice (image preview), text (text preview) 65 | # NOTE: 'text' is not iteself an application. It instructs BFG to 66 | # look for an application able to print documents as text. Checks 67 | # are made for the following applications: catdoc, odt2txt, xls2csv, 68 | # xls2xcsv, and pandoc 69 | DOC="" 70 | 71 | # epub-thumbnailer 72 | EPUB="" 73 | 74 | # exitool 75 | FILEINFO="" 76 | 77 | # fontpreview, fontimage 78 | FONTS="" 79 | 80 | # ueberzug, kitty, viu, catimg, chafa, img2txt, pixterm 81 | IMG="" 82 | 83 | # python, jq, cat 84 | JSON="" 85 | 86 | # glow, mdcat 87 | MARKDOWN="" 88 | 89 | # mediainfo 90 | MEDIAINFO="" 91 | 92 | # ffplay, mplayer, mpv 93 | MUSIC="" 94 | 95 | # pdftoppm (image preview), pdftotext (text preview), mutool 96 | PDF="" 97 | 98 | # bat, highlight, pygmentize, cat 99 | TEXT="" 100 | 101 | # ffmpegthumbailer 102 | VIDEO="" -------------------------------------------------------------------------------- /msys64/home/.config/clifm/plugins/bashh.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # .bash_history 4 | cat ~/.bash_history | fzf --prompt="bash history: " --height=12 --cycle --tac # awk '!a[$0]++' --> to remove duplicates -------------------------------------------------------------------------------- /msys64/home/.config/clifm/plugins/clih.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # clifm history: ~/.config/clifm/profiles/default/history.clifm 4 | cat ~/.config/clifm/profiles/default/history.clifm | sed '/^#/d' | fzf --prompt="clifm history: " --height=12 --cycle --tac # awk '!a[$0]++' --> to remove duplicates -------------------------------------------------------------------------------- /msys64/home/.config/clifm/profiles/default/.last: -------------------------------------------------------------------------------- 1 | *0:/d/workspace/other/winconf 2 | -------------------------------------------------------------------------------- /msys64/home/.config/clifm/profiles/default/actions.clifm: -------------------------------------------------------------------------------- 1 | ###################### 2 | # CliFM actions file # 3 | ###################### 4 | 5 | # Empty and commented lines are omitted. 6 | 7 | # Define here your custom actions. 8 | 9 | # Actions are custom command names bound to an executable file located 10 | # either in DATADIR/clifm/plugins (usually /usr/share/clifm/plugins) or 11 | # in $XDG_CONFIG_HOME/clifm/plugins (usually ~/.config/clifm/plugins). 12 | 13 | # Actions can be executed directly from the CliFM command line, as if 14 | # they were any other command: the associated file will be executed 15 | # instead. 16 | 17 | # All parameters passed to the action command will be passed to the 18 | # corresponding plugin as well. 19 | 20 | +=finder.sh 21 | ++=jumper.sh 22 | -=fzfnav.sh 23 | *=fzfsel.sh 24 | **=fzfdesel.sh 25 | //=rgfind.sh 26 | _=fzcd.sh 27 | bcp=batch_copy.sh 28 | bmi=bm_import.sh 29 | bn=batch_create.sh 30 | clip=clip.sh 31 | cr=cprm.sh 32 | da=disk_analyzer.sh 33 | dr=dragondrop.sh 34 | fdups=fdups.sh 35 | gg=pager.sh 36 | h=fzfhist.sh 37 | i=img_viewer.sh 38 | ih=ihelp.sh 39 | kbgen=kbgen 40 | kd=decrypt.sh 41 | ke=encrypt.sh 42 | ml=mime_list.sh 43 | music=music_player.sh 44 | ptot=pdf_viewer.sh 45 | rrm=recur_rm.sh 46 | update=update.sh 47 | vid=vid_viewer.sh 48 | vt=virtualize.sh 49 | wall=wallpaper_setter.sh 50 | plugin1=xclip.sh 51 | plugin2=clih.sh 52 | plugin3=bashh.sh -------------------------------------------------------------------------------- /msys64/home/.config/clifm/profiles/default/bookmarks.clifm: -------------------------------------------------------------------------------- 1 | ### This is the bookmarks file for clifm ### 2 | 3 | # Empty and commented lines are omitted. 4 | # Make your changes, save, and exit. 5 | # To remove a bookmark, delete the corresponding line, save, and exit 6 | # Changes are applied automatically at exit (to cancel just quit the editor). 7 | 8 | # The bookmarks syntax is: name:path 9 | # Example: 10 | bashrc:~/.bashrc 11 | profile:~/.profile 12 | bash_profile:~/.bash_profile 13 | inputrc:~/.inputrc 14 | c:/c 15 | 16 | winconf:/d/workspace/other/winconf 17 | wmenu:/d/workspace/c++/02_maintainance/wmenu 18 | rust:/d/workspace/rust 19 | clifm:~/.config/clifm 20 | clifm_default_profile:~/.config/clifm/profiles/default 21 | mpv:/c/Users/saeed/AppData/Local/nvim 22 | Downloads:~/Downloads 23 | life:/d/workspace/other/life/ 24 | mpv:/c/Users/saeed/AppData/Local/mpv 25 | trash:~/.local/share/Trash/files 26 | pardis:/d/workspace/assembly/pardis 27 | ArenOS:/d/workspace/other/ArenOS 28 | kaveh:/d/workspace/c/01_active/kaveh 29 | akoman:/d/workspace/c/01_active/akoman 30 | cave:/d/workspace/c/01_active/cave 31 | Nand2Tetris:/d/workspace/other/Nand2Tetris 32 | movies:/e/video/movies/ 33 | tv_series:/e/video/tv_series 34 | books:/d/books 35 | video:/d/video 36 | images:/d/images 37 | x64_compiler:/d/video/computer/languages/c/05_porgramming_an_x64_compiler 38 | write_your_own_os:/d/video/computer/languages/c/06_write_your_own_operating_system 39 | bitwise:/d/video/computer/languages/c/00_bitwise/ 40 | handmade_hero:/d/video/computer/languages/c/01_hand_made_hero 41 | text_editor_from_scratch:/d/video/computer/languages/c/04_programming_a_text_editor_from_scratch 42 | video_game_from_scratch:/d/video/computer/languages/c/02_make_video_game_from_scratch_in_c 43 | sample_profiler_from_scratch:/d/video/computer/languages/c/07_simple_profiler_from_scratch 44 | windbg:/d/video/computer/languages/c/09_using_win_dbg 45 | graphic_progamming:/d/video/computer/languages/c/11_graphic_programming 46 | 47 | 48 | -------------------------------------------------------------------------------- /msys64/home/.config/clifm/profiles/default/cmdlogs.clifm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LinArcX/winconf/2904d4e9904344473c06fc96577d576b326b162b/msys64/home/.config/clifm/profiles/default/cmdlogs.clifm -------------------------------------------------------------------------------- /msys64/home/.config/clifm/profiles/default/mimelist.clifm: -------------------------------------------------------------------------------- 1 | ################################### 2 | # Configuration file for Lira # 3 | # CliFM's resource opener # 4 | ################################### 5 | 6 | #----------------------------- 7 | # Description 8 | #----------------------------- 9 | 10 | # Commented and blank lines are omitted. 11 | 12 | # The below settings cover the most common filetypes. 13 | # It is recommended to edit this file placing your prefered applications 14 | # at the beginning of the apps list to speed up the opening process. 15 | 16 | # The file is read top to bottom and left to right; the first existent 17 | # application found will be used. 18 | 19 | # Applications defined here are NOT desktop files, but commands (arguments 20 | # can be used as well). Bear in mind that these commands will be executed 21 | # directly without shell intervention, so that no shell goodies (like pipes, 22 | # conditions, loops, etc) are available. In case you need something more 23 | # complex than a single command (including shell capabilities) write your 24 | # own script and place the path to the script in place of the command. 25 | # For example: X:^text/.*:~/scripts/my_cool_script.sh 26 | 27 | # Use 'X' to specify a GUI environment and '!X' for non-GUI environments, 28 | # like the kernel built-in console or a remote SSH session. 29 | 30 | # Use 'N' to match file names instead of MIME types. 31 | 32 | # Regular expressions are allowed for both file types and file names. 33 | 34 | # Use the %f placeholder to specify the position of the file name to be 35 | # opened in the command. Example: 36 | # 'mpv %f --no-terminal' -> 'mpv FILE --no-terminal' 37 | # If %f is not specified, the file name will be added to the end of the 38 | # command. Ex: 'mpv --no-terminal' -> 'mpv --no-terminal FILE' 39 | 40 | # Running the opening application in the background: 41 | # For GUI applications: 42 | # APP %f & 43 | # For terminal applications: 44 | # TERM -e APP %f & 45 | # Replace 'TERM' and 'APP' by the corresponding values. The -e option 46 | # might vary depending on the terminal emulator used (TERM) 47 | 48 | # Note on graphical applications: If the opening application is already 49 | # running, the file will be opened, usually in a new tab, and CliFM won't 50 | # wait for the file to be closed (because the procecss already returned). 51 | # To avoid this, instruct the application to run a new instance. For example: 52 | # geany -i, gedit -s, kate -n, pluma --new-window, and so on. 53 | 54 | # To silence STDERR and/or STDOUT use !E and !O respectively (they can be 55 | # used together). Examples: 56 | # Silence STDERR only and run in the foreground: 57 | # mpv %f !E 58 | # Silence both (STDERR and STDOUT) and run in the background: 59 | # mpv %f !EO & 60 | # For Ranger users, "!EO" is equivalent to "flag f" in rifle.conf 61 | 62 | # In the case of GUI apps, you most likely want this: 63 | # cmd %f !EO & 64 | # However, bear in mind that this will hide error messages. 65 | 66 | # Environment variables can be used as well. Example: 67 | # X:text/plain=$EDITOR %f &;$VISUAL;nano;vi 68 | 69 | # Use Ranger's rifle (or whatever opener you prefer) to open all files 70 | #.*=rifle 71 | 72 | ################################ 73 | # 1. File names/extensions # 74 | ################################ 75 | 76 | # Match a full file name 77 | #X:N:some_filename=cmd 78 | 79 | # Match all file names starting with 'str' 80 | #X:N:^str.*=cmd 81 | 82 | # Match files with extension 'ext' 83 | #X:N:.*\.ext$=cmd 84 | 85 | #----------------------------- 86 | # Clifm config files 87 | #----------------------------- 88 | 89 | X:N:(.*\.clifm$|clifmrc)=$EDITOR;$VISUAL;nvim;vim;vi;gedit -s 90 | !X:N:(.*\.clifm$|clifmrc)=$EDITOR;$VISUAL;nvim;vim;vi;nano 91 | 92 | ################################ 93 | # 2. MIME types # 94 | ################################ 95 | 96 | #----------------------------- 97 | # Directories 98 | #----------------------------- 99 | # Only for the open-with command (ow) and the --open command line switch 100 | # In graphical environments directories will be opened in a new window 101 | 102 | X:inode/directory=xterm -e clifm %f &;xterm -e vifm %f &;pcmanfm %f &;thunar %f &;xterm -e ncdu %f & 103 | !X:inode/directory=vifm;ranger;nnn;ncdu 104 | 105 | #----------------------------- 106 | # Web content 107 | #----------------------------- 108 | X:^text/html$=$BROWSER;surf;vimprobable;vimprobable2;qutebrowser;dwb;jumanji;luakit;uzbl;uzbl-tabbed;uzbl-browser;uzbl-core;iceweasel;midori;opera;firefox;seamonkey;brave;chromium-browser;chromium;google-chrome;epiphany;konqueror;elinks;links2;links;lynx;w3m 109 | !X:^text/html$=$BROWSER;elinks;links2;links;lynx;w3m 110 | 111 | #----------------------------- 112 | # Text 113 | #----------------------------- 114 | X:^text/rtf$=libreoffice;soffice;ooffice 115 | X:(^text/.*|application/json|application/javascript|inode/x-empty)=$EDITOR;$VISUAL;nvim;vim;vi;nano;gedit; 116 | !X:(^text/.*|application/json|application/javascript|inode/x-empty)=$EDITOR;$VISUAL;nvim;vim;vi;nano 117 | 118 | #----------------------------- 119 | # Office documents 120 | #----------------------------- 121 | ^application/.*(open|office)document\.spreadsheet.*=sc-im 122 | X:^application/.*(open|office)document.*=libreoffice;soffice;ooffice 123 | 124 | #----------------------------- 125 | # Archives 126 | #----------------------------- 127 | # Note: 'ad' is CliFM's built-in archives utility (based on atool). Remove it if you 128 | # prefer another application. 129 | 130 | X:^application/(zip|gzip|zstd|x-7z-compressed|x-xz|x-bzip*|x-tar|x-iso9660-image)=ad;xarchiver %f &;lxqt-archiver %f &;ark %f & 131 | !X:^application/(zip|gzip|zstd|x-7z-compressed|x-xz|x-bzip*|x-tar|x-iso9660-image)=ad 132 | 133 | #----------------------------- 134 | # PDF 135 | #----------------------------- 136 | X:.*/pdf$=zathura;okular 137 | 138 | #----------------------------- 139 | # Digital books 140 | #----------------------------- 141 | X:N:.*\.djvu$=zathura;evince 142 | X:N:.*\.(fb2|epub)$=zathura;foliate 143 | X:N:.*\.mobi$=zathura;foliate 144 | X:N:.*\.(cbr|cbz|cb7|cbt|cba)$=zathura;foliate 145 | 146 | #----------------------------- 147 | # Images 148 | #----------------------------- 149 | X:^image/svg=display 150 | X:^image/gif$=nsxiv_all.sh %f 151 | X:^image/.*=nsxiv_all.sh %f;nomacs 152 | !X:^image/.*=fim;img2txt;cacaview;fbi;fbv 153 | 154 | #----------------------------- 155 | # Video and audio 156 | #----------------------------- 157 | X:^video/.*=mpv --no-terminal %f 158 | X:^audio/.*=mpg123 %f 159 | 160 | #----------------------------- 161 | # Fonts 162 | #----------------------------- 163 | X:^font/.*=fontpreview.sh 164 | 165 | #----------------------------- 166 | # Torrent 167 | #----------------------------- 168 | X:application/x-bittorrent=qbittorrent 169 | 170 | #----------------------------- 171 | # Fallback 172 | #----------------------------- 173 | # Let's fallback to an external opener as last resource 174 | .*=handlr open;mimeopen -n;rifle;mimeo;xdg-open;open; -------------------------------------------------------------------------------- /msys64/home/.config/clifm/profiles/default/nets.clifm: -------------------------------------------------------------------------------- 1 | ##################################### 2 | # Remotes management file for CliFM # 3 | ##################################### 4 | 5 | # Blank and commented lines are omitted. 6 | 7 | # The syntax is as follows: 8 | 9 | # A name for this remote. It will be used by the 'net' command 10 | # and will be available for TAB completion 11 | #[work_smb] 12 | 13 | # Comment=My work samba server 14 | #Mountpoint=/home/user/.config/clifm/mounts/work_smb 15 | 16 | # Use %m as a placeholder for Mountpoint 17 | #MountCmd=mount.cifs //WORK_IP/shared %m -o OPTIONS 18 | #UnmountCmd=umount %m 19 | 20 | # Automatically mount this remote at startup 21 | #AutoMount=true 22 | 23 | # Automatically unmount this remote at exit 24 | #AutoUnmount=true 25 | 26 | # A few examples 27 | 28 | # A. Samba share 29 | #[samba_share] 30 | #Comment=my samba share 31 | #Mountpoint="~/.config/clifm/mounts/samba_share" 32 | #MountCmd=sudo mount.cifs //192.168.0.26/resource_name %m -o mapchars,credentials=/etc/samba/credentials/samba_share 33 | #UnmountCmd=sudo umount %m 34 | #AutoUnmount=false 35 | #AutoMount=false 36 | 37 | # B. SSH file system (sshfs) 38 | #[my_ssh] 39 | #Comment=my ssh 40 | #Mountpoint="/media/ssh" 41 | #MountCmd=sshfs user@192.168.0.12: %m -C -p 22 42 | #UnmountCmd=fusermount3 -u %m 43 | #AutoUnmount=false 44 | #AutoMount=false 45 | 46 | # C. Mounting a local file system 47 | #[local] 48 | #Comment=Local filesystem 49 | #Mountpoint="/media/extra" 50 | #MountCmd=sudo mount -U 1232dsd761278... %m 51 | #UnmountCmd=sudo umount %m 52 | #AutoUnmount=false 53 | #AutoMount=true 54 | 55 | # D. Mounting a removable device 56 | #[USB] 57 | #Comment=My USB drive 58 | #Mountpoint="/media/usb" 59 | #MountCmd=sudo mount -o gid=1000,fmask=113,dmask=002 -U 5647-1... %m 60 | #UnmountCmd=sudo umount %m 61 | #AutoUnmount=true 62 | #AutoMount=false 63 | -------------------------------------------------------------------------------- /msys64/home/.config/clifm/profiles/default/preview.clifm: -------------------------------------------------------------------------------- 1 | ###################################### 2 | # Configuration file for Shotgun # 3 | # CliFM's files previewer # 4 | ###################################### 5 | 6 | #-------------------------------- 7 | # Description 8 | #-------------------------------- 9 | 10 | # Commented and blank lines are omitted. 11 | 12 | # It is recommended to edit this file setting your preferred applications 13 | # first: the previewing process will be smoother and faster this way. 14 | # You can even remove whatever applications you don't use. 15 | 16 | # For syntax details consult the mimelist.clifm file (via 'mm edit' or F6). 17 | 18 | # Uncomment this line to use pistol (or any other previewing application): 19 | #.*=pistol 20 | 21 | # Uncomment and edit this line to use Ranger's scope script: 22 | #.*=~/.config/ranger/scope.sh %f 120 80 /tmp/clifm/ True 23 | 24 | # Image previews 25 | # 1. Uncomment the below lines to enable image previews for the specified file types. 26 | # 2. Copy the clifmrun and clifmimg scripts to somewhere in you PATH, say /usr/local/bin. 27 | # (You can find them in DATADIR/clifm/plugins, usually /usr/local/share/clifm/plugins). 28 | # 3. Run clifm via clifmrun (if using fzf 0.44 or later this is not necessary). 29 | # NOTE: You can edit clifmimg to change the way in which images are generated and displayed. 30 | # 31 | #X:^application/.*(officedocument|msword|ms-excel|opendocument).*=clifmimg doc; 32 | #X:^text/rtf$=clifmimg doc; 33 | #X:^application/epub\+zip$=clifmimg epub; 34 | #X:^application/pdf$=clifmimg pdf; 35 | #X:^image/vnd.djvu=clifmimg djvu; 36 | #X:^image/svg\+xml$=clifmimg svg; 37 | #X:^image/gif$=clifmimg gif; 38 | #X:^image/.*=clifmimg image; 39 | #X:^video/.*=clifmimg video; 40 | #X:^audio/.*=clifmimg audio; 41 | #X:^application/postscript$=clifmimg postscript; 42 | #X:N:.*\.otf$=clifmimg font; 43 | #X:font/.*=clifmimg font; 44 | 45 | #-------------------------------- 46 | # Directories 47 | #-------------------------------- 48 | 49 | inode/directory=exa -a --tree --level=1 --;eza -a --tree --level=1 --;lsd -A --tree --depth=1 --color=always;tree -a -L 1;ls -Ap --color=always --indicator-style=none; 50 | 51 | #-------------------------------- 52 | # Text 53 | #-------------------------------- 54 | 55 | ^text/rtf=catdoc --; 56 | N:.*\.json$=jq --color-output . ;python -m json.tool --; 57 | N:.*\.md$=glow -s dark --;mdcat --; 58 | ^text/html$=w3m -dump;lynx -dump --;elinks -dump;pandoc -s -t markdown --; 59 | ^text/.*=highlight -f --out-format=xterm256 --force --;bat --style=plain --color=always --;cat --; 60 | 61 | #-------------------------------- 62 | # Office documents 63 | #-------------------------------- 64 | 65 | N:.*\.xlsx$=xlsx2csv --;file -b --; 66 | N:.*\.(odt|ods|odp|sxw)$=odt2txt;pandoc -s -t markdown --; 67 | ^application/(.*wordprocessingml.document|.*epub+zip|x-fictionbook+xml)=pandoc -s -t markdown --; 68 | ^application/msword=catdoc --;file -b --; 69 | ^application/ms-excel=xls2csv --;file -b --; 70 | 71 | #-------------------------------- 72 | # Archives 73 | #-------------------------------- 74 | 75 | N:.*\.rar=unrar lt -p- --; 76 | application/zstd=file -b --;true 77 | application/(zip|gzip|x-7z-compressed|x-xz|x-bzip*|x-tar)=atool --list --;bsdtar --list --file; 78 | 79 | #-------------------------------- 80 | # PDF 81 | #-------------------------------- 82 | 83 | ^application/pdf$=pdftotext -l 10 -nopgbrk -q -- %f -;mutool draw -F txt -i --;exiftool; 84 | 85 | #-------------------------------- 86 | # Image, video, and audio 87 | #-------------------------------- 88 | 89 | ^image/vnd.djvu=djvutxt;exiftool; 90 | ^image/.*=exiftool; 91 | ^video/.*=mediainfo;exiftool; 92 | ^audio/.*=mediainfo;exiftool; 93 | 94 | #-------------------------------- 95 | # Torrent 96 | #-------------------------------- 97 | 98 | application/x-bittorrent=transmission-show --; 99 | 100 | #-------------------------------- 101 | # Fallback 102 | #-------------------------------- 103 | 104 | .*=file -b --; 105 | # Add true(1) to silence the 'no application found' warning 106 | #.*=file -b --;true; -------------------------------------------------------------------------------- /msys64/home/.config/clifm/profiles/default/profile.clifm: -------------------------------------------------------------------------------- 1 | # This is CliFM's profile file 2 | # 3 | # Write here the commands you want to be executed at startup 4 | # Ex: 5 | #echo "CliFM, the command line file manager"; read -r 6 | # 7 | # Uncommented, non-empty lines are executed line by line. If you 8 | # want a multi-line command, just write a script for it: 9 | #sh /path/to/my/script.sh 10 | -------------------------------------------------------------------------------- /msys64/home/.config/clifm/profiles/default/selbox.clifm: -------------------------------------------------------------------------------- 1 | /d/workspace/other/winconf/tor.md 2 | /d/workspace/other/winconf/TODO.md 3 | /d/workspace/other/winconf/services.md 4 | /d/workspace/other/winconf/scoop.md 5 | /d/workspace/other/winconf/README.md 6 | /d/workspace/other/winconf/LICENSE 7 | /d/workspace/other/winconf/.gitignore 8 | /d/workspace/other/winconf/.gitconfig 9 | /d/workspace/other/winconf/dev.md 10 | /d/workspace/other/winconf/create_symlinks.bat 11 | /d/workspace/other/winconf/wezterm 12 | /d/workspace/other/winconf/nvim 13 | /d/workspace/other/winconf/msys64 14 | /d/workspace/other/winconf/mpv 15 | /d/workspace/other/winconf/.git 16 | /d/workspace/other/winconf/garbage 17 | /d/workspace/other/winconf/fonts 18 | /d/workspace/other/winconf/clavier_plus 19 | -------------------------------------------------------------------------------- /msys64/home/.config/clifm/readline.clifm: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Readline keybindings file for CliFM # 3 | ####################################### 4 | 5 | # For the complete list of Readline options see: 6 | # https://www.gnu.org/software/bash/manual/html_node/Readline-Init-File-Syntax.html#Readline-Init-File-Syntax 7 | 8 | #$include /etc/inputrc 9 | 10 | # Color files by types 11 | set colored-stats on 12 | # Append char to indicate type 13 | set visible-stats on 14 | # Mark symlinked directories 15 | set mark-symlinked-directories on 16 | # Color the common prefix 17 | set colored-completion-prefix on 18 | # Color the common prefix in menu-complete 19 | set menu-complete-display-prefix on 20 | # Disable paste protection 21 | set enable-bracketed-paste off 22 | 23 | set show-all-if-ambiguous on 24 | set completion-ignore-case on 25 | 26 | set meta-flag on 27 | set input-meta on 28 | set output-meta on 29 | 30 | $if mode=vi 31 | "\e\C-e": emacs-editing-mode 32 | $endif 33 | 34 | $if mode=emacs 35 | 36 | # For linux console and RH/Debian xterm 37 | "\e[5C": forward-word 38 | "\e[5D": backward-word 39 | "\e\e[C": forward-word 40 | "\e\e[D": backward-word 41 | "\e[1;5C": forward-word 42 | "\e[1;5D": backward-word 43 | 44 | # For rxvt 45 | "\x1b\x4f\x64": backward-word 46 | "\x1b\x4f\x63": forward-word 47 | 48 | # A few keybinds to avoid conflicts with CliFM specific keybinds 49 | "\x1b\xd": 50 | "\C-d": 51 | "\e\e": 52 | "\e\C-j": vi-editing-mode 53 | "\C-r\C-r": re-read-init-file 54 | "\C-zA": do-lowercase-version 55 | "\C-zB": do-lowercase-version 56 | "\C-zC": do-lowercase-version 57 | "\C-zD": do-lowercase-version 58 | "\C-zE": do-lowercase-version 59 | "\C-zF": do-lowercase-version 60 | "\C-zG": do-lowercase-version 61 | "\C-zH": do-lowercase-version 62 | "\C-zI": do-lowercase-version 63 | "\C-zJ": do-lowercase-version 64 | "\C-zK": do-lowercase-version 65 | "\C-zL": do-lowercase-version 66 | "\C-zM": do-lowercase-version 67 | "\C-zN": do-lowercase-version 68 | "\C-zO": do-lowercase-version 69 | "\C-zP": do-lowercase-version 70 | "\C-zQ": do-lowercase-version 71 | "\C-zR": do-lowercase-version 72 | "\C-zS": do-lowercase-version 73 | "\C-zT": do-lowercase-version 74 | "\C-zU": do-lowercase-version 75 | "\C-zV": do-lowercase-version 76 | "\C-zW": do-lowercase-version 77 | "\C-zX": do-lowercase-version 78 | "\C-zY": do-lowercase-version 79 | "\C-zZ": do-lowercase-version 80 | 81 | # History completion based on prefix 82 | #"\e[A": history-search-backward 83 | #"\e[B": history-search-forward 84 | 85 | $endif -------------------------------------------------------------------------------- /msys64/home/.gitconfig: -------------------------------------------------------------------------------- 1 | [core] 2 | pager = delta 3 | symlinks = true 4 | #editor = nvim 5 | #gitproxy = /home/linarcx/bin/git-proxy-wrapper 6 | 7 | [credential] 8 | helper = manager 9 | 10 | [user] 11 | name = linarcx 12 | email = linarcx@gmail.com 13 | 14 | [delta] 15 | navigate = true # use n and N to move between diff sections 16 | light = false # set to true if you're in a terminal w/ a light background color (e.g. the default macOS terminal) 17 | line-numbers = true 18 | features = decorations 19 | #features = collared-trogon 20 | #side-by-side = true 21 | 22 | [diff] 23 | tool = nvimdiff 24 | colorMoved = default 25 | 26 | [pager] 27 | branch = true 28 | diff = true 29 | 30 | [interactive] 31 | diffFilter = delta --color-only --features=interactive 32 | 33 | [merge] 34 | conflictstyle = diff3 35 | 36 | [alias] 37 | lg = log --color --graph --pretty 38 | 39 | [delta "decorations"] 40 | commit-decoration-style = blue ol 41 | commit-style = raw 42 | file-style = omit 43 | hunk-header-decoration-style = blue box 44 | hunk-header-file-style = red 45 | hunk-header-style = file 46 | #hunk-header-line-number-style = "#067a00" 47 | 48 | # log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -- 49 | #[http] 50 | # proxy = http://localhost:9080 51 | 52 | #[socks5] 53 | # proxy = socks5h://localhost:1080 54 | 55 | #[http "https://gitlab.com"] 56 | # proxy = https://localhost:8123 57 | 58 | #[http "https://github.com"] 59 | # proxy = https://localhost:8123 60 | 61 | #[http] 62 | # proxy = socks://127.0.0.1:1080 63 | -------------------------------------------------------------------------------- /msys64/home/.inputrc: -------------------------------------------------------------------------------- 1 | $include /etc/inputrc 2 | set enable-keypad on 3 | set completion-ignore-case On 4 | 5 | # Make Tab cycle between possible completions 6 | # Cycle forward: Tab 7 | # Cycle backward: Shift-Tab 8 | 9 | TAB: menu-complete 10 | "\e[Z": menu-complete-backward 11 | 12 | # Make C-q display the list of possible completions 13 | 14 | Control-q: complete 15 | 16 | # Display the list of matches when no further completion is possible 17 | 18 | set show-all-if-unmodified on 19 | set completion-display-width 1 -------------------------------------------------------------------------------- /msys64/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 | # ~/.profile: executed by the command interpreter for login shells. 9 | 10 | # The copy in your home directory (~/.profile) is yours, please 11 | # feel free to customise it to create a shell 12 | # environment to your liking. If you feel a change 13 | # would be benificial to all, please feel free to send 14 | # a patch to the msys2 mailing list. 15 | 16 | # User dependent .profile file 17 | 18 | # Set user-defined locale 19 | export LANG=$(locale -uU) 20 | 21 | # This file is not read by bash(1) if ~/.bash_profile or ~/.bash_login 22 | # exists. 23 | # 24 | # if running bash 25 | if [ -n "${BASH_VERSION}" ]; then 26 | if [ -f "${HOME}/.bashrc" ]; then 27 | source "${HOME}/.bashrc" 28 | fi 29 | fi 30 | -------------------------------------------------------------------------------- /msys64/home/scripts/bash/books.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | commands=("/mnt/D/books/01_computer/programming/rust/TheRustProgrammingLanguage2ndEdition.pdf" 4 | "/mnt/D/books/01_computer/programming/c/compiler_design/CraftingInterpreters.pdf" 5 | "/mnt/D/books/01_computer/programming/c/C_Programming.pdf" 6 | "/mnt/D/books/01_computer/programming/c/gnu-c-manual.pdf" 7 | "/mnt/D/books/01_computer/programming/c/+Brian W Kernighan, Dennis M Ritchie - The Ansi C Programming Language-Prentice Hall.pdf" 8 | "/mnt/D/books/01_computer/programming/c/The Standard C Library.pdf" 9 | "/mnt/D/books/01_computer/programming/c/The Standard C Library.pdf" 10 | "/mnt/D/books/01_computer/programming/c/Advanced C 1992.pdf" 11 | "/mnt/D/books/01_computer/programming/c/wisdom/C_Programming_Just_the_Faqs.pdf" 12 | "/mnt/D/books/01_computer/programming/c/compiler_design/_Compiler_Design_In_C.pdf" 13 | "/mnt/D/books/01_computer/programming/c/language_features/C_The_Function_Pointer_Tutorials.pdf" 14 | "/mnt/D/books/01_computer/software_engineering/paradigms/oo/Object_Thinking_David_West.pdf" 15 | "/mnt/D/books/01_computer/programming/c++/windows/Windows_System_Programming.pdf" 16 | "/mnt/D/books/01_computer/programming/c/+Test_Driven_Development_for_Embedded_C.pdf" 17 | "/mnt/D/books/01_computer/programming/c++/c++_standard_n3690.pdf" 18 | "/mnt/D/books/01_computer/programming/c++/C++_FAQs.pdf" 19 | "/mnt/D/books/01_computer/programming/c++/wisdom/C++_Interview_Questions.pdf" 20 | "/mnt/D/books/01_computer/programming/c++/03/+API_Design_for_C++-Martin_ready.pdf" 21 | "/mnt/D/books/01_computer/programming/c++/security/Cryptography_in_C_and_C++.pdf" 22 | "/mnt/D/books/01_computer/programming/c++/wisdom/+C++_coding_standards_101_rules_guidelines_and_best_practices.pdf" 23 | "/mnt/D/books/01_computer/programming/c++/other/Functional_Programming_in_C++.pdf" 24 | "/mnt/D/books/01_computer/programming/c++/system_programming/C++_System_Programming_Cookbook.pdf" 25 | "/mnt/D/books/01_computer/programming/c++/wisdom/optimization/+Optimized_C++_Proven_Techniques_for_Heightened_Performance.pdf" 26 | "/mnt/D/books/01_computer/programming/c++/tdd/Modern_C++_Programming_with_Test-Driven_Development_Code_Better_Sleep_Better.pdf" 27 | ) 28 | selected=$(printf '%s\n' "${commands[@]}" | sed "s|~|$HOME|" | fzf --header="books:" --preview 'v {}') 29 | zathura $selected & -------------------------------------------------------------------------------- /msys64/home/scripts/bash/dirs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | commands=("/d/workspace/other/life/" "/d/workspace/c++/02_maintainance/wmenu" 4 | "/d/workspace/other/winconf" "~/Downloads" "~/.config/nvim" "~/.local/share/Trash/files" "~/.config/mpv" 5 | "/d/workspace/c++/01_active/pardis" 6 | "/d/workspace/other/ArenOs" 7 | "/d/workspace/c/01_active/kaveh" 8 | "/d/workspace/c/01_active/akoman" 9 | "/d/workspace/c/01_active/cave" 10 | "/d/workspace/other/Nand2Tetris" 11 | "/e" "/e/video/movies/" "/e/video/tv_series" "/d" "/d/books" "/d/video" "/d/images" 12 | "/d/video/computer/languages/c/00_bitwise/" 13 | "/d/video/computer/languages/c/01_hand_made_hero" 14 | "/d/video/computer/languages/c/02_make_video_game_from_scratch_in_c" 15 | "/d/video/computer/languages/c/04_programming_a_text_editor_from_scratch" 16 | "/d/video/computer/languages/c/05_porgramming_an_x64_compiler" 17 | "/d/video/computer/languages/c/06_write_your_own_os" 18 | "/d/video/computer/languages/c/07_simple_profiler_from_scratch" 19 | "/d/video/computer/languages/c/09_using_win_dbg" 20 | "/d/video/computer/languages/c/11_graphic_programming") 21 | 22 | selected=$(printf '%s\n' "${commands[@]}" | sed "s|~|$HOME|" | fzf --header="dirs:" --preview 'v {}') 23 | cd $selected 24 | -------------------------------------------------------------------------------- /msys64/home/scripts/bash/do_mount.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | selected=$(lsblk --noheadings --raw -o NAME,MOUNTPOINT | awk '$1~/[[:digit:]]/ && $2 == ""' | fzf --header="to mount:") 4 | if [[ -n "$selected" ]]; then 5 | udevil mount /dev/$selected 6 | echo "$selected mounted" 7 | fi -------------------------------------------------------------------------------- /msys64/home/scripts/bash/do_unmount.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | selected=$(lsblk --noheadings --raw -o NAME,MOUNTPOINT | awk '$1~/[[:digit:]]/ && $2 != ""' | sed 's/|/ /' | awk '{print $1}' | fzf --header="to unmount: " ) 4 | if [[ -n "$selected" ]]; then 5 | udevil unmount /dev/$selected 6 | echo "$selected unmounted" 7 | fi -------------------------------------------------------------------------------- /msys64/home/scripts/bash/e.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | commands=("Zzz(lock)" "logout" "restart" "poweroff") 4 | 5 | selected=$(printf '%s\n' "${commands[@]}" | fzf --header="apps:") 6 | 7 | case $selected in 8 | "Zzz(lock)") 9 | Rundll32.exe user32.dll,LockWorkStation ;; 10 | "logout") 11 | shutdown /l ;; 12 | "restart") 13 | shutdown -r -t 0 ;; 14 | "poweroff") 15 | shutdown -s -t 1 ;; 16 | *) ;; 17 | esac 18 | 19 | 20 | -------------------------------------------------------------------------------- /msys64/home/scripts/bash/files.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | commands=("~/.bashrc" "~/.xinitrc" "~/.asoundrc" "~/.profile" "~/.bash_profile" "~/.inputrc" "~/.xbindkeysrc" "~/.xmodmaprc") 4 | selected=$(printf '%s\n' "${commands[@]}" | sed "s|~|$HOME|" | fzf --header="files:" --preview 'v {}') 5 | . $HOME/scripts/bash/open_files.sh $selected -------------------------------------------------------------------------------- /msys64/home/scripts/bash/g.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #alias filesincommit='f() { git diff-tree --no-commit-id --name-only -r "$1"; }; f' 4 | #alias girc='git rebase --continue' 5 | #alias giri='f(){ git rebase -i HEAD~"$1"; }; f' 6 | #alias gich='f(){ git checkout "$1";}; f' 7 | #alias gichb='f(){ git checkout -b "$1";}; f' 8 | #alias grr='f(){ git remote set-url origin "$1;" }; f' 9 | #alias gar='f(){ git remote set-url --add origin "$1";}; f' 10 | 11 | commands=("commit history" "tag" "branches" "variables" "remotes" "gc" "purge" 12 | "edit local .gitconfig" "edit global .gitconfig" "init" "add remote" 13 | "add all" "add single" "commit" "push" "push --force" "clone") 14 | selected=$(printf '%s\n' "${commands[@]}" | fzf --header="git:") 15 | case $selected in 16 | "commit history") 17 | git log --graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" | \ 18 | fzf --ansi --no-sort --reverse --tiebreak=index --preview \ 19 | 'f() { set -- $(echo -- "$@" | grep -o "[a-f0-9]\{7\}"); [ $# -eq 0 ] || git show --color=always $1 ; }; f {}' \ 20 | --bind "j:down,k:up,alt-j:preview-down,alt-k:preview-up,ctrl-f:preview-page-down,ctrl-b:preview-page-up,q:abort,ctrl-m:execute: 21 | (grep -o '[a-f0-9]\{7\}' | head -1 | 22 | xargs -I % sh -c 'git show --color=always % | less -R') << 'FZF-EOF' 23 | {} 24 | FZF-EOF" --preview-window=right:60% 25 | ;; 26 | "tag") 27 | git tag ;; 28 | "branches") 29 | git branch -v ;; 30 | "variables") 31 | git var -l ;; 32 | "remotes") 33 | git remote -v ;; 34 | "gc") 35 | git gc ;; 36 | "purge") 37 | while true; do 38 | read -p "Do you really want to purge this repo? [y/n] " yn 39 | case $yn in 40 | [Yy]* ) git checkout --orphan TEMP_BRANCH; git add -A; git commit -am "Initial commit"; git branch -D master; git branch -m master; git push -f origin master ; break;; 41 | [Nn]* ) break;; 42 | * ) ;; 43 | esac 44 | done ;; 45 | "edit local .gitconfig") 46 | $EDITOR .git/config;; 47 | "edit global .gitconfig") 48 | $EDITOR ~/.gitconfig;; 49 | "init") 50 | echo "gii is more handy, isn't it?";; 51 | #git init ;; 52 | "add remote") 53 | read -p "remote: " remote_address; git remote add origin "$remote_address" ;; 54 | "add all") 55 | echo "gia is more handy, isn't it?";; 56 | #while true; do 57 | # read -p "Add all unstage files to git? [y/n] " yn 58 | # case $yn in 59 | # [Yy]* ) git add .; break;; 60 | # [Nn]* ) break;; 61 | # * ) ;; 62 | # esac 63 | #done 64 | #;; 65 | "add single") 66 | read -p "file: " file; git add "$file" ;; 67 | "commit") 68 | echo "gic is more handy, isn't it?";; 69 | #read -p "commit message: " message; git commit -m "$message" ;; 70 | "push") 71 | echo "gip is more handy, isn't it?";; 72 | #git push ;; 73 | "push --force") 74 | git push --force ;; 75 | "clone") 76 | read -p "clone from url: " url; git clone "$url" ;; 77 | esac -------------------------------------------------------------------------------- /msys64/home/scripts/bash/open_files.sh: -------------------------------------------------------------------------------- 1 | mime_type= 2 | if [[ -n "$2" ]]; then 3 | mime_type=$2 4 | else 5 | mime_type=$(file -b --mime-type "$1") 6 | fi 7 | 8 | case "$mime_type" in 9 | "inode/directory") 10 | cd $1 ;; 11 | "inode/symlink") 12 | mime_type_link=$(file -b --mime-type $(readlink -f "$1")) 13 | $HOME/scripts/bash/open_files.sh "$1" "$mime_type_link" 14 | ;; 15 | "text/plain") 16 | $EDITOR "$1" ;; 17 | "text/english") 18 | $EDITOR "$1" ;; 19 | "text/x-makefile") 20 | $EDITOR "$1" ;; 21 | "text/x-c") 22 | $EDITOR "$1" ;; 23 | "text/x-c++") 24 | $EDITOR "$1" ;; 25 | "text/x-c++hdr") 26 | $EDITOR "$1" ;; 27 | "text/x-c++src") 28 | $EDITOR "$1" ;; 29 | "text/x-chdr") 30 | $EDITOR "$1" ;; 31 | "text/x-csrc") 32 | $EDITOR "$1" ;; 33 | "text/x-lua") 34 | $EDITOR "$1" ;; 35 | "application/javascript") 36 | $EDITOR "$1" ;; 37 | "text/x-java") 38 | $EDITOR "$1" ;; 39 | "text/x-moc") 40 | $EDITOR "$1" ;; 41 | "text/x-pascal") 42 | $EDITOR "$1" ;; 43 | "text/x-tcl") 44 | $EDITOR "$1" ;; 45 | "text/x-tex") 46 | $EDITOR "$1" ;; 47 | "text/x-shellscript") 48 | $EDITOR "$1" ;; 49 | "application/x-shellscript") 50 | $EDITOR "$1" ;; 51 | "application/x-subrip") 52 | $EDITOR "$1" ;; 53 | "text/troff") 54 | $EDITOR "$1" ;; 55 | "text/mathml") 56 | $EDITOR "$1" ;; 57 | "x-scheme-handler/about") 58 | $EDITOR "$1" ;; 59 | "x-scheme-handler/unknown") 60 | $EDITOR "$1" ;; 61 | "application/json") 62 | $EDITOR "$1" ;; 63 | "application/pdf") 64 | $PDFVIEWER "$1" ;; 65 | "application/epub+zip") 66 | $EPUBVIEWER "$1" ;; 67 | "image/bmp") 68 | $IMAGEVIEWER "$1" ;; 69 | "image/gif") 70 | $IMAGEVIEWER "$1" ;; 71 | "image/jpeg") 72 | $IMAGEVIEWER "$1" ;; 73 | "image/jpg") 74 | $IMAGEVIEWER "$1" ;; 75 | "image/png") 76 | $IMAGEVIEWER "$1" ;; 77 | "image/x-png") 78 | $IMAGEVIEWER "$1" ;; 79 | "image/pjpeg") 80 | $IMAGEVIEWER "$1" ;; 81 | "image/x-bmp") 82 | $IMAGEVIEWER "$1" ;; 83 | "image/tiff") 84 | $IMAGEVIEWER "$1" ;; 85 | "video/mp4") 86 | $VIDEOPLAYER "$1" ;; 87 | "video/x-avi") 88 | $VIDEOPLAYER "$1" ;; 89 | "video/avi") 90 | $VIDEOPLAYER "$1" ;; 91 | "video/x-flic") 92 | $VIDEOPLAYER "$1" ;; 93 | "video/fli") 94 | $VIDEOPLAYER "$1" ;; 95 | "video/flv") 96 | $VIDEOPLAYER "$1" ;; 97 | "video/x-theora") 98 | $VIDEOPLAYER "$1" ;; 99 | "video/x-matroska") 100 | $VIDEOPLAYER "$1" ;; 101 | "video/mkv") 102 | $VIDEOPLAYER "$1" ;; 103 | "video/x-flv") 104 | $VIDEOPLAYER "$1" ;; 105 | "video/x-mpeg2") 106 | $VIDEOPLAYER "$1" ;; 107 | "video/x-mpeg3") 108 | $VIDEOPLAYER "$1" ;; 109 | "video/mpeg") 110 | $VIDEOPLAYER "$1" ;; 111 | "video/divx") 112 | $VIDEOPLAYER "$1" ;; 113 | "video/vnd.divx") 114 | $VIDEOPLAYER "$1" ;; 115 | "video/msvideo") 116 | $VIDEOPLAYER "$1" ;; 117 | "video/quicktime") 118 | $VIDEOPLAYER "$1" ;; 119 | "video/ogg") 120 | $VIDEOPLAYER "$1" ;; 121 | "video/3gp") 122 | $VIDEOPLAYER "$1" ;; 123 | "video/dv") 124 | $VIDEOPLAYER "$1" ;; 125 | "audio/mp3") 126 | $AUDIOPLAYER "$1" ;; 127 | "audio/aac") 128 | $AUDIOPLAYER "$1" ;; 129 | "audio/x-aac") 130 | $AUDIOPLAYER "$1" ;; 131 | "audio/aiff") 132 | $AUDIOPLAYER "$1" ;; 133 | "audio/m4a") 134 | $AUDIOPLAYER "$1" ;; 135 | "audio/mpeg") 136 | $AUDIOPLAYER "$1" ;; 137 | "audio/mpeg2") 138 | $AUDIOPLAYER "$1" ;; 139 | "audio/mpeg3") 140 | $AUDIOPLAYER "$1" ;; 141 | "audio/mpg") 142 | $AUDIOPLAYER "$1" ;; 143 | "audio/ogg") 144 | $AUDIOPLAYER "$1" ;; 145 | "audio/wav") 146 | $AUDIOPLAYER "$1" ;; 147 | "audio/wma") 148 | $AUDIOPLAYER "$1" ;; 149 | "audio/ogg") 150 | $AUDIOPLAYER "$1" ;; 151 | "audio/ac3") 152 | $AUDIOPLAYER "$1" ;; 153 | "text/html") 154 | $BROWSER "$1" ;; 155 | "text/x-sql") 156 | $DBBROWSER "$1" ;; 157 | esac -------------------------------------------------------------------------------- /msys64/home/scripts/bash/y.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | commands=("search" "history(videos)" "history(keywords)" "channel videos" "download video(history)" "download video" "download playlist" "play audio" "play audio(history)") 4 | selected=$(printf '%s\n' "${commands[@]}" | fzf --header="ytfzf:") 5 | case $selected in 6 | "search") 7 | read -p "keyword: " keyword; ~/bin/scripts/ytfzf.sh -t "$keyword" ;; 8 | "history(videos)") 9 | ~/bin/scripts/ytfzf.sh -H -t;; 10 | "history(keywords)") 11 | ~/bin/scripts/ytfzf.sh -q -t;; 12 | "channel videos") 13 | channels=("@TsodingDaily" "@MollyRocket" "@nashiora" "@pervognsen" "@ryanries09" "@tobyho92" "@HelloWorldCode" "@simonracz" "@LowLevelLearning" "@DmitrySoshnikov-education" "@AbnerCoimbre" "@CodeAesthetic" "@CoffeeBeforeArch" "@blixel" 14 | "@tobyho92" "@lowlevelgamedev9330" "@LexClips" "@SCVHA" "@DavesGarage" "@SystemsWithJT" "@ComputerHistory" "@F.T.L" "@PauloConstantino167" 15 | "@pcsecuritychannel" 16 | "@voxelrifts" "@connermcd" "@bugswriter_" "@sentdex" "@MotasemHamdan" "@retrogameinternals4707" "@PageKey" "@letsmakethetexteditor1369" 17 | "@learnelectronics" "@ChannelCreativeVN" "@hackaday" "@EEVblog" 18 | "@learnfrenchwithalexa" "@frenchyfrench2685" "@EasyFrench" "@MyFrenchStory" "@learn_french" "@Tohideh" "@MeandMonAmi" 19 | "@bbclearningenglish" "@EnglishClass101" "@EnglishFluencyJourney" "@EasyEnglishVideos" 20 | "@BambooLanguages" "@LindieBotes" 21 | "@NoCopyrightSounds" 22 | "@navabebrahimiii" "@MehrdadPaz1" "@mehrdadpaz291" "@kamransabouri" "@5MinuteRecipesOfficial" "@epicurious" 23 | "@TEDx" "@oxforduniversity") 24 | selected_channel=$(printf '%s\n' "${channels[@]}" | fzf --header="channels:") 25 | channel_raw=$(ytfzf.sh --channel-link=$selected_channel) 26 | channel_id=$(echo "$channel_raw" | sed 's#.*/##') 27 | ~/bin/scripts/ytfzf.sh --pages=3 -c invidious-playlist https://www.youtube.com/playlist?list=$channel_id 28 | ;; 29 | "download video") 30 | read -p "keyword: " keyword; ~/bin/scripts/ytfzf.sh -t -d "$keyword" ;; 31 | "download video(history)") 32 | ~/bin/scripts/ytfzf.sh -H -t -d;; 33 | #alias yd='f(){ torify youtube-dl -f "best[height<=720]"+bestaudio --write-auto-sub "$1"; }; f' 34 | #alias ydp='f(){ torify youtube-dl -f "best[height<=720]"+bestaudio --write-auto-sub -i "$1"; }; f' 35 | #alias ydh='f(){ torify youtube-dl -f "best[height=1080]"+bestaudio --write-auto-sub "$1"; }; f' 36 | #alias ydhp='f(){ torify youtube-dl -f "best[height=1080]"+bestaudio --write-auto-sub -i "$1"; }; f' 37 | #alias ydos='f(){ torify youtube-dl --write-auto-sub --sub-lang en --skip-download "$1"; }; f' 38 | #alias ytf='f(){ youtube-dl --proxy=socks5://127.0.0.1:9050 -F "$1"; }; f' 39 | #alias ytd='f(){ youtube-dl --write-auto-sub --proxy=socks5://127.0.0.1:9050 -f "$1" "$2"; }; f' 40 | "download playlist") 41 | ;; 42 | "play audio") 43 | read -p "keyword: " keyword; ~/bin/scripts/ytfzf.sh -t -m "$keyword" ;; 44 | "play audio(history)") 45 | ~/bin/scripts/ytfzf.sh -H -t -m ;; 46 | esac -------------------------------------------------------------------------------- /nvim/README.md: -------------------------------------------------------------------------------- 1 | put all the content of mpv directory here: 2 | C:\Users\\AppData\Local 3 | 4 | # Notes, tips, tricks about this configurations 5 | 6 | # fix colorshceme in diff mode 7 | ``` 8 | :diffoff! 9 | :windo diffthis 10 | ``` 11 | - light colorshcemes: github, tango-morning 12 | - dark colorschemes: monokai, gruvbox8, railscasts 13 | 14 | ## Tips 15 | - All files in `plugin` directory will load automatically. 16 | 17 | ## Normal Mode 18 | - o: insert new line below current line. 19 | - O: insert new line above current line. 20 | - CTRL-o: Go to Older cursor position in jump list. 21 | - CTRL-i: Go to Newer cursor position in jump list. 22 | - g; : Go to older position in change list. 23 | - g, : Go to newer position in change list. 24 | - diw: delete current word 25 | - ciw: change current word 26 | - : Replace from current position to end of line. 27 | - '. : Jump to last modification line. 28 | - `. : Jump to exact spot in last modification line 29 | - ]] : next section 30 | - ]m : next method 31 | - [m : back to the start of the method 32 | - ) : Next sentence |linarcx-notes| `code here` 33 | - CTRL-D : Down half a page 34 | - CTRL-U : Up half a page 35 | - ~ Uppercase a letter (works on ranges) 36 | - z commands: 37 | - z : Current line at the top 38 | - z. : current line at the center 39 | - z- : current line at the bottom 40 | - /: Pull word into command line (or search) 41 | 42 | ## Visual Mode 43 | - SHIFT-[LEFT/RIGHT] : Shift one word left or right 44 | - J : Join the highlighted lines, removing unnecessary whitespace. 45 | - va' : select a single-quoted string (also works with " and `) 46 | - vi' : select the contents of a single-quoted string 47 | - vab : select a "block" (works differently in different langs) 48 | - vat : select a and its contents (use i instead of a for just 49 | contents) 50 | 51 | ## Insert Mode 52 | - : Complete word 53 | - : Complete word (?) 54 | - : Complete line (!!) 55 | - \cc: cc Comment out all selected rows with a single-line comment 56 | (//) — part of NERDCommenter 57 | - \\w: Navigate to a word with EasyMotion’s help (works with any navigation 58 | commands) 59 | 60 | ## Command Mode 61 | - :wall : Save modified buffers 62 | - :x : Save buffer only if modified, then exit (better than :wq) 63 | - :reg : list registers (and show what’s in them) 64 | 65 | ## Windows 66 | - To increase a window to its maximum height, use Ctrl-w _. 67 | - To increase a window to its maximum width, use Ctrl-w |. 68 | - To full scree the current buffer: Ctrl-w-o 69 | - For a split window: You can use Ctrl-w + and Ctrl-w - to resize the height of the current window by a single row. 70 | - For a vsplit window: You can use Ctrl-w > and Ctrl-w < to resize the width of the current window by a single column. 71 | - Additionally, these key combinations accept a count prefix so that you can change the window size in larger steps. [e.g. Ctrl-w 10 + increases the window size by 10 lines] 72 | - To resize all windows to equal dimensions based on their splits, you can use Ctrl-w =. 73 | put all the content of nvim here: 74 | C:\Users\\AppData\Local 75 | 76 | # Awesome vim 77 | In this part i'll be discuss about awesome plugins that i found in vim 78 | community. 79 | 80 | ## Colorschemes 81 | - 'kristijanhusak/vim-hybrid-material' 82 | - 'gruvbox-material/vim' 83 | - 'morhetz/gruvbox/' 84 | - 'tomasr/molokai' 85 | - 'Mcmartelle/vim-monokai-bold' 86 | - 'doums/darcula' 87 | - 'sjl/badwolf' 88 | - 'levelone/tequila-sunrise.vim' 89 | - 'sainnhe/edge' 90 | - 'jnurmine/Zenburn' 91 | - 'nanotech/jellybeans.vim' 92 | 93 | ## Plugins 94 | Here i will describe my plugins. -------------------------------------------------------------------------------- /nvim/after/ftplugin/help.vim: -------------------------------------------------------------------------------- 1 | nnoremap 2 | nnoremap 3 | nnoremap o /'\l\{2,\}' 4 | nnoremap O ?'\l\{2,\}' 5 | nnoremap s /\|\zs\S\+\ze\| 6 | nnoremap S ?\|\zs\S\+\ze\| -------------------------------------------------------------------------------- /nvim/after/ftplugin/rust.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_create_augroup("AutoFormat", {}) 2 | vim.api.nvim_create_autocmd( 3 | "BufWritePost", 4 | { 5 | pattern = "*.rs", 6 | group = "AutoFormat", 7 | callback = function() 8 | vim.cmd("silent !rustfmt %") 9 | vim.cmd("edit") 10 | end, 11 | } 12 | ) -------------------------------------------------------------------------------- /nvim/after/ftplugin/srt.vim: -------------------------------------------------------------------------------- 1 | set formatoptions-=cro 2 | 3 | let sub_name = expand("%")[:-5] 4 | let base = 40 5 | let lower = "X1:10 X2:10 Y1:". base ." Y2:". base 6 | let middle = "X1:10 X2:10 Y1:". base*2 ." Y2:". base*2 7 | let large = "X1:10 X2:10 Y1:". base*4 ." Y2:". base*4 8 | 9 | function! SearchLine() 10 | let line_number = input('enter line number: ') 11 | execute ":silent /^". line_number ."$/" 12 | endfunction 13 | 14 | function! YankPiece(mode) 15 | execute "normal! ^vj$hy" 16 | execute ":wincmd w" 17 | execute "normal! Go \" 18 | execute "normal! Go \\"_x" 19 | 20 | if a:mode==0 21 | execute "normal! pjA". lower ."\o" 22 | elseif a:mode==1 23 | execute "normal! pjA". middle ."\o" 24 | elseif a:mode==2 25 | execute "normal! pjA". large ."\o" 26 | else 27 | echom "wrong mode!" 28 | endif 29 | 30 | call feedkeys('i') 31 | endfunction 32 | 33 | "call quickui#menu#clear('&Srt') 34 | "" tsyan 35 | "call quickui#menu#install('&Srt', [ 36 | " \ [ '&tips', "vsplit ". sub_name ."_en.srt" ], 37 | " \ [ '&search', "call SearchLine()" ], 38 | " \ [ '&yank', "call YankPiece(0)" ], 39 | " \ [ 'y&ank2x', "call YankPiece(1)" ], 40 | " \ [ 'ya&nk3x', "call YankPiece(2)" ], 41 | " \ ], '', 'srt') -------------------------------------------------------------------------------- /nvim/after/ftplugin/vim.vim: -------------------------------------------------------------------------------- 1 | set formatoptions-=cro -------------------------------------------------------------------------------- /nvim/init.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | Neovim is part of your IDE. but what's exactly a IDE? It is not just some separated tasks? including: 3 | - search for files: C-f (:lua require('telescope.builtin').find_files()) --> fd under the hood 4 | - search for keywords: C-g (:lua require'telescope.builtin'.live_grep()) --> rg under the hood 5 | - search&replace in one file: `:%s/foo/bar/gc` 6 | - search&replace in whole directory file: ambr 7 | - create/rename/delete files/dirs: lunch terminal and use lf 8 | - debugging: gdb from another terminal. (nvim-gdb, gdv, seergdb, DAP) 9 | 10 | - [DONE] organize m_whichkey file. 11 | - [] better git diff tool. 12 | - [] get rid of all vim scripts by converting them to lua. 13 | - [] show old files only related to current directory 14 | - [] make c-o works only for current directory. C-S-o for global come back. 15 | - [] create a telescope plugins to show runtimepath 16 | - [] create a telescope plugin to show list of path in runtimepath. 17 | - [] modes in neovim(like emacs) 18 | --]] 19 | 20 | require('user.settings') 21 | require('user.plugin_manager') 22 | require('user.wrapper.vim').init() 23 | require('user.wrapper.treesitter') 24 | require('user.plugins.m_gitsigns') 25 | require('user.plugins.m_whichkey') 26 | 27 | require('user.plugins.m_lsp') 28 | require('user.plugins.m_goto_preview') 29 | require('user.plugins.m_lsp_signature') 30 | 31 | vim.cmd([[highlight TabLineFill guibg=#544a5c guifg=#e3e3da]]) --8b4513 806c58 785a3c 94704b 9986b3 ffffff f5f5f2 64547a 6c567d -------------------------------------------------------------------------------- /nvim/lua/user/comments.lua: -------------------------------------------------------------------------------- 1 | -- [TODO]: should not comment empty lines 2 | --[TODO]: comment multiple lines. 3 | 4 | local comments = {} 5 | 6 | local symbols = { 7 | c = "//", cpp = "//", go = "//", java = "//", javascript = "//", scala = "//", php = "//", rust = "//", 8 | ruby = "#", python = "#", sh = "#", profile = "#", bashrc = "#", bashrc_profile = "#", conf = "#", 9 | bat = "REM", 10 | lua = "--", 11 | tex = '%', 12 | ahk = ";", 13 | vim = '"', 14 | } 15 | 16 | local function first_character_position(input) 17 | local position = 0 18 | for counter = 1, #input do 19 | local character = input:sub(counter, counter) 20 | if character == " " then 21 | position = position + 1 22 | else 23 | break 24 | end 25 | end 26 | return position 27 | end 28 | 29 | function comments.toggle() 30 | if symbols[vim.bo.filetype] then 31 | local t= {} 32 | table.insert(t, symbols[vim.bo.filetype]) 33 | 34 | local line_is_commented = false 35 | local current_line = vim.fn.getline(".") 36 | local first_non_space_position =first_character_position(current_line) 37 | local current_line_stripped = require('user.util.strings').trim(current_line) 38 | local current_line_stripped_table = require('user.util.strings').to_table(current_line_stripped) 39 | local buffer_type_table = require('user.util.strings').to_table(symbols[vim.bo.filetype]) 40 | 41 | for counter = 1, #buffer_type_table do 42 | if buffer_type_table[counter] == current_line_stripped_table[counter] then 43 | line_is_commented = true 44 | else 45 | line_is_commented = false 46 | end 47 | end 48 | 49 | local line_number = vim.api.nvim_win_get_cursor(0)[1] 50 | 51 | if line_is_commented then 52 | vim.cmd('normal 0') 53 | local go_to_pos = ':normal '..(first_non_space_position + 1)..'|' 54 | vim.cmd(go_to_pos) 55 | for counter = 1, #buffer_type_table do 56 | vim.cmd(":normal x") 57 | end 58 | vim.cmd('normal `z') 59 | else 60 | vim.api.nvim_buf_set_text(0, 61 | line_number - 1, 62 | (first_non_space_position), 63 | line_number - 1, 64 | (first_non_space_position), 65 | t) 66 | vim.cmd('normal mz') 67 | end 68 | end 69 | end 70 | 71 | return comments -------------------------------------------------------------------------------- /nvim/lua/user/plugin_manager.lua: -------------------------------------------------------------------------------- 1 | vim.cmd [[packadd packer.nvim]] 2 | return require('packer').startup({function(use) 3 | -- essential 4 | use 'wbthomason/packer.nvim' 5 | use 'nvim-lua/popup.nvim' 6 | use 'nvim-lua/plenary.nvim' 7 | 8 | -- fuzzy 9 | use 'nvim-telescope/telescope.nvim' 10 | 11 | use 'LinArcX/telescope-changes.nvim' 12 | require('telescope').load_extension('changes') 13 | 14 | use { "LinArcX/telescope-scriptnames.nvim" } 15 | require('telescope').load_extension('scriptnames') 16 | 17 | use { "LinArcX/telescope-env.nvim" } 18 | require('telescope').load_extension('env') 19 | 20 | --use { 'junegunn/fzf', run = ':execute fzf#install()' } 21 | --use 'junegunn/fzf.vim' 22 | --use { "ibhagwan/fzf-lua", 23 | -- -- optional for icon support 24 | -- requires = { "nvim-tree/nvim-web-devicons" } 25 | --} 26 | 27 | -- development 28 | use 'lewis6991/gitsigns.nvim' 29 | use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' } -- We recommend updating the parsers on update 30 | --use "romgrk/nvim-treesitter-context" 31 | use 'L3MON4D3/LuaSnip' 32 | use 'RRethy/vim-illuminate' 33 | 34 | -- lsp 35 | use 'neovim/nvim-lspconfig' 36 | -- completion 37 | use 'hrsh7th/cmp-nvim-lsp' 38 | use 'hrsh7th/nvim-cmp' 39 | use 'hrsh7th/cmp-buffer' 40 | use 'hrsh7th/cmp-path' 41 | use 'hrsh7th/cmp-cmdline' 42 | use 'saadparwaiz1/cmp_luasnip' 43 | use 'nvim-lua/lsp-status.nvim' 44 | use 'ray-x/lsp_signature.nvim' 45 | use 'onsails/lspkind-nvim' 46 | use { 47 | 'rmagatti/goto-preview', 48 | config = function() 49 | require('goto-preview').setup {} 50 | end 51 | } 52 | -- maybe 53 | -- use 'smjonas/inc-rename.nvim' 54 | -- use 'ojroques/nvim-lspfuzzy' 55 | -- use 'gfanto/fzf-lsp.nvim' 56 | 57 | -- utility 58 | use 'norcalli/nvim-colorizer.lua' 59 | require('colorizer').setup() 60 | 61 | use 'petertriho/nvim-scrollbar' 62 | require('scrollbar').setup() 63 | 64 | use 'MunifTanjim/nui.nvim' 65 | use 'dstein64/vim-startuptime' 66 | use 'danilamihailov/beacon.nvim' 67 | use 'MattesGroeger/vim-bookmarks' 68 | use 'folke/which-key.nvim' 69 | use 'kyoh86/momiji' 70 | use 'Mofiqul/vscode.nvim' 71 | 72 | end, 73 | config = { 74 | display = { 75 | open_fn = function() 76 | return require('packer.util').float({ border = 'single' }) 77 | end 78 | } 79 | } 80 | }) -------------------------------------------------------------------------------- /nvim/lua/user/plugins/m_gitsigns.lua: -------------------------------------------------------------------------------- 1 | require('gitsigns').setup({ 2 | -- numhl = true, 3 | }) -------------------------------------------------------------------------------- /nvim/lua/user/plugins/m_goto_preview.lua: -------------------------------------------------------------------------------- 1 | require('goto-preview').setup { 2 | width = 120; -- Width of the floating window 3 | height = 15; -- Height of the floating window 4 | border = {"↖", "─" ,"┐", "│", "┘", "─", "└", "│"}; -- Border characters of the floating window 5 | default_mappings = false; -- Bind default mappings 6 | debug = false; -- Print debug information 7 | opacity = nil; -- 0-100 opacity level of the floating window where 100 is fully transparent. 8 | resizing_mappings = false; -- Binds arrow keys to resizing the floating window. 9 | post_open_hook = nil; -- A function taking two arguments, a buffer and a window to be ran as a hook. 10 | post_close_hook = nil; -- A function taking two arguments, a buffer and a window to be ran as a hook. 11 | references = { -- Configure the telescope UI for slowing the references cycling window. 12 | telescope = require("telescope.themes").get_dropdown({ hide_preview = false }) 13 | }; 14 | -- These two configs can also be passed down to the goto-preview definition and implementation calls for one off "peak" functionality. 15 | focus_on_open = true; -- Focus the floating window when opening it. 16 | dismiss_on_move = false; -- Dismiss the floating window when moving the cursor. 17 | force_close = true, -- passed into vim.api.nvim_win_close's second argument. See :h nvim_win_close 18 | bufhidden = "wipe", -- the bufhidden option to set on the floating window. See :h bufhidden 19 | stack_floating_preview_windows = true, -- Whether to nest floating windows 20 | preview_window_title = { enable = true, position = "left" }, -- Whether to set the preview window title as the filename 21 | } -------------------------------------------------------------------------------- /nvim/lua/user/plugins/m_lsp.lua: -------------------------------------------------------------------------------- 1 | require('lspconfig').clangd.setup({ 2 | on_attach = function(client) 3 | require 'illuminate'.on_attach(client) 4 | end, 5 | }) 6 | 7 | local capabilities = vim.lsp.protocol.make_client_capabilities() 8 | capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) 9 | local lspconfig = require('lspconfig') 10 | vim.o.completeopt = 'menuone,noselect' 11 | local luasnip = require 'luasnip' 12 | local lspkind = require('lspkind') 13 | require'lspconfig'.lua_ls.setup { 14 | on_init = function(client) 15 | local path = client.workspace_folders[1].name 16 | if not vim.loop.fs_stat(path..'/.luarc.json') and not vim.loop.fs_stat(path..'/.luarc.jsonc') then 17 | client.config.settings = vim.tbl_deep_extend('force', client.config.settings, { 18 | Lua = { 19 | runtime = { 20 | -- Tell the language server which version of Lua you're using 21 | -- (most likely LuaJIT in the case of Neovim) 22 | version = 'LuaJIT' 23 | }, 24 | -- Make the server aware of Neovim runtime files 25 | workspace = { 26 | checkThirdParty = false, 27 | library = { 28 | vim.env.VIMRUNTIME 29 | -- "${3rd}/luv/library" 30 | -- "${3rd}/busted/library", 31 | } 32 | -- or pull in all of 'runtimepath'. NOTE: this is a lot slower 33 | -- library = vim.api.nvim_get_runtime_file("", true) 34 | } 35 | } 36 | }) 37 | 38 | client.notify("workspace/didChangeConfiguration", { settings = client.config.settings }) 39 | end 40 | return true 41 | end 42 | } 43 | 44 | -- Enable some language servers with the additional completion capabilities offered by nvim-cmp 45 | local servers = { 'clangd' } 46 | for _, lsp in ipairs(servers) do 47 | lspconfig[lsp].setup { 48 | capabilities = capabilities, 49 | } 50 | end 51 | 52 | -- Set completeopt to have a better completion experience 53 | local cmp = require 'cmp' 54 | cmp.setup { 55 | formatting = { 56 | format = lspkind.cmp_format({ 57 | --with_text = true, -- do not show text alongside icons 58 | mode = 'symbol_text', 59 | maxwidth = 45, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) 60 | -- preset = 'default', 61 | symbol_map = { 62 | Class = "", 63 | Color = "", 64 | Constant = "", 65 | Constructor = "", 66 | Enum = "", 67 | EnumMember = "", 68 | Event = "", 69 | Field = "", 70 | File = "", 71 | Folder = "", 72 | Function = "", 73 | Interface = "", 74 | Keyword = "", 75 | Module = "", 76 | Method = "", 77 | Operator = "", 78 | Property = "", 79 | Reference = "", 80 | Snippet = "", 81 | Struct = "", 82 | Text = "", 83 | TypeParameter = "", 84 | Unit = "塞", 85 | Value = "", 86 | Variable = "", 87 | }, 88 | }) 89 | }, 90 | snippet = { 91 | expand = function(args) 92 | require('luasnip').lsp_expand(args.body) 93 | end, 94 | }, 95 | completion = { autocomplete = false }, 96 | mapping = { 97 | [''] = cmp.mapping.select_next_item(), 98 | [''] = cmp.mapping.select_next_item(), 99 | [''] = cmp.mapping.select_prev_item(), 100 | [''] = cmp.mapping.select_prev_item(), 101 | 102 | [''] = cmp.mapping.scroll_docs(4), 103 | [''] = cmp.mapping.scroll_docs(4), 104 | [''] = cmp.mapping.scroll_docs(-4), 105 | [''] = cmp.mapping.scroll_docs(-4), 106 | 107 | [''] = cmp.mapping.complete(), 108 | [''] = cmp.mapping.close(), 109 | [''] = cmp.mapping.confirm { 110 | behavior = cmp.ConfirmBehavior.Replace, 111 | select = true, 112 | }, 113 | [''] = function(fallback) 114 | if cmp.visible() then 115 | cmp.select_next_item() 116 | elseif luasnip.expand_or_jumpable() then 117 | luasnip.expand_or_jump() 118 | else 119 | fallback() 120 | end 121 | end, 122 | [''] = function(fallback) 123 | if cmp.visible() then 124 | cmp.select_prev_item() 125 | elseif luasnip.jumpable(-1) then 126 | luasnip.jump(-1) 127 | else 128 | fallback() 129 | end 130 | end, 131 | }, 132 | sources = { 133 | { name = 'nvim_lsp' }, 134 | { name = 'luasnip' }, 135 | }, 136 | window = { 137 | documentation = { 138 | maxwidth = 70, 139 | }, 140 | }, 141 | } 142 | 143 | local nvim_lsp = require('lspconfig') 144 | -- Use an on_attach function to only map the following keys after the language server attaches to the current buffer 145 | local on_attach = function(client, bufnr) 146 | local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end 147 | local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end 148 | 149 | -- Enable completion triggered by 150 | buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') 151 | end 152 | 153 | -- Use a loop to conveniently call 'setup' on multiple servers and map buffer local keybindings when the language server attaches 154 | local servers = { 'clangd' } 155 | for _, lsp in ipairs(servers) do 156 | nvim_lsp[lsp].setup { 157 | on_attach = on_attach, 158 | flags = { 159 | debounce_text_changes = 150, 160 | } 161 | } 162 | end 163 | 164 | require'lspconfig'.rust_analyzer.setup{} 165 | 166 | -- Lua LSP 167 | -- local runtime_path = vim.split(package.path, ';') 168 | -- table.insert(runtime_path, "lua/?.lua") 169 | -- table.insert(runtime_path, "lua/?/init.lua") 170 | -- require'lspconfig'.sumneko_lua.setup { 171 | -- settings = { 172 | -- Lua = { 173 | -- completion = { callSnippet = "Both" }, 174 | -- runtime = { version = 'LuaJIT', path = runtime_path }, 175 | -- diagnostics = { globals = {'vim'} }, 176 | -- workspace = { library = vim.api.nvim_get_runtime_file("", true) }, 177 | -- telemetry = { enable = false }, 178 | -- }, 179 | -- }, 180 | -- } 181 | 182 | --require'lspconfig'.zls.setup{} 183 | --require'lspconfig'.nimls.setup{} 184 | --require'lspconfig'.jdtls.setup{ cmd = { 'jdtls' } } 185 | --require'lspconfig'.jdtls.setup{} 186 | -------------------------------------------------------------------------------- /nvim/lua/user/plugins/m_lsp_signature.lua: -------------------------------------------------------------------------------- 1 | cfg = { 2 | debug = false, -- set to true to enable debug logging 3 | log_path = vim.fn.stdpath("cache") .. "/lsp_signature.log", -- log dir when debug is on 4 | -- default is ~/.cache/nvim/lsp_signature.log 5 | verbose = false, -- show debug line number 6 | 7 | bind = true, -- This is mandatory, otherwise border config won't get registered. 8 | -- If you want to hook lspsaga or other signature handler, pls set to false 9 | doc_lines = 10, -- will show two lines of comment/doc(if there are more than two lines in doc, will be truncated); 10 | -- set to 0 if you DO NOT want any API comments be shown 11 | -- This setting only take effect in insert mode, it does not affect signature help in normal 12 | -- mode, 10 by default 13 | 14 | max_height = 12, -- max height of signature floating_window 15 | max_width = 80, -- max_width of signature floating_window 16 | noice = false, -- set to true if you using noice to render markdown 17 | wrap = true, -- allow doc/signature text wrap inside floating_window, useful if your lsp return doc/sig is too long 18 | 19 | floating_window = true, -- show hint in a floating window, set to false for virtual text only mode 20 | 21 | floating_window_above_cur_line = true, -- try to place the floating above the current line when possible Note: 22 | -- will set to true when fully tested, set to false will use whichever side has more space 23 | -- this setting will be helpful if you do not want the PUM and floating win overlap 24 | 25 | floating_window_off_x = 1, -- adjust float windows x position. 26 | -- can be either a number or function 27 | floating_window_off_y = 0, -- adjust float windows y position. e.g -2 move window up 2 lines; 2 move down 2 lines 28 | -- can be either number or function, see examples 29 | 30 | close_timeout = 4000, -- close floating window after ms when laster parameter is entered 31 | fix_pos = false, -- set to true, the floating window will not auto-close until finish all parameters 32 | hint_enable = true, -- virtual hint enable 33 | hint_prefix = "🐼 ", -- Panda for parameter, NOTE: for the terminal not support emoji, might crash 34 | hint_scheme = "String", 35 | hint_inline = function() return false end, -- should the hint be inline(nvim 0.10 only)? default false 36 | hi_parameter = "LspSignatureActiveParameter", -- how your parameter will be highlight 37 | handler_opts = { 38 | border = "rounded" -- double, rounded, single, shadow, none, or a table of borders 39 | }, 40 | 41 | always_trigger = false, -- sometime show signature on new line or in middle of parameter can be confusing, set it to false for #58 42 | 43 | auto_close_after = nil, -- autoclose signature float win after x sec, disabled if nil. 44 | extra_trigger_chars = {}, -- Array of extra characters that will trigger signature completion, e.g., {"(", ","} 45 | zindex = 200, -- by default it will be on top of all floating windows, set to <= 50 send it to bottom 46 | 47 | padding = '', -- character to pad on left and right of signature can be ' ', or '|' etc 48 | 49 | transparency = nil, -- disabled by default, allow floating win transparent value 1~100 50 | shadow_blend = 36, -- if you using shadow as border use this set the opacity 51 | shadow_guibg = 'Black', -- if you using shadow as border use this set the color e.g. 'Green' or '#121315' 52 | timer_interval = 200, -- default timer check interval set to lower value if you want to reduce latency 53 | toggle_key = nil, -- toggle signature on and off in insert mode, e.g. toggle_key = '' 54 | toggle_key_flip_floatwin_setting = false, -- true: toggle float setting after toggle key pressed 55 | 56 | select_signature_key = nil, -- cycle to next signature, e.g. '' function overloading 57 | move_cursor_key = nil, -- imap, use nvim_set_current_win to move cursor between current win and floating 58 | } 59 | -- recommended: 60 | require'lsp_signature'.setup(cfg) -- no need to specify bufnr if you don't use toggle_key 61 | 62 | -- You can also do this inside lsp on_attach 63 | -- note: on_attach deprecated 64 | require'lsp_signature'.on_attach(cfg, bufnr) -- no need to specify bufnr if you don't use toggle_key -------------------------------------------------------------------------------- /nvim/lua/user/settings.lua: -------------------------------------------------------------------------------- 1 | local set = vim.opt 2 | local global = vim.g 3 | 4 | function get_git_branch() 5 | local branch = vim.fn.systemlist('git branch --show-current 2>/dev/null') 6 | if branch and #branch > 0 then 7 | return ' ' .. branch[1] 8 | else 9 | return '' 10 | end 11 | end 12 | 13 | function buffer_count() 14 | local bufinfo = vim.fn.getbufinfo({ buflisted = 1 }) 15 | return #bufinfo 16 | end 17 | 18 | vim.o.showtabline = 2 19 | vim.o.tabline="%{v:lua.buffer_count()} %{&modified ? '[+]' : ''} %f %{&readonly ? '[RO]' : ''} %{&paste ? '[PASTE]' : ''} %= %{v:lua.get_git_branch()} %{getcwd()} " 20 | 21 | global.do_filetype_lua = 1 22 | global.filetype="on" 23 | global.mapleader="," -- change from \ to , 24 | global.maplocalleader="," 25 | 26 | global.asyncrun_open = 6 27 | global.session_autosave = 'no' 28 | global.session_directory = '~/.config/nvim/sessions' 29 | global.python3_host_prog="/bin/python3" 30 | 31 | set.mouse='a' -- Mouse Integration 32 | set.path= '**' -- For clever completion with the :find command 33 | set.exrc=true 34 | set.wrap=false 35 | set.number=true 36 | set.secure=true 37 | set.undofile=true 38 | set.cindent=false 39 | set.swapfile=false 40 | set.showmatch=true 41 | set.laststatus=0 42 | set.timeoutlen = 0 43 | set.expandtab=true -- When expandtab is set, hitting Tab in insert mode will produce the appropriate number of spaces. 44 | set.autowrite=true 45 | set.smartcase=true 46 | set.autochdir=false -- Don't change directory(it's important for build projects) 47 | set.ignorecase=true 48 | set.splitright=true 49 | set.splitbelow=true -- Open windows as split always in below or right 50 | set.smartindent=true 51 | set.foldenable=false 52 | set.termguicolors=true 53 | set.pastetoggle='' --PasteMode disable auto-indent and bracket auto-compelation and it helps you to paste code from elsewhere. 54 | set.shiftwidth=2 55 | set.shiftwidth=2 56 | set.pumheight=10 57 | set.tabstop=2 58 | set.softtabstop=2 -- Set softtabstop to control how many columns vim uses when you hit Tab in insert mode. If softtabstop is less than tabstop and expandtab is not set, vim will use a combination of tabs and spaces to make up the desired spacing. If softtabstop equals tabstop and expandtab is not set, vim will always use tabs. When expandtab is set, vim will always use the appropriate number of spaces. 59 | set.foldlevel=2 60 | set.foldnestmax=10 61 | set.colorcolumn="160" 62 | set.foldmethod='indent' 63 | set.shell='/usr/bin/bash' 64 | set.clipboard='unnamedplus' 65 | set.spellfile={ "~/.config/nvim/spell/en.utf-8.add" } 66 | set.completeopt={ "menuone", "preview" } 67 | set.wildignore= { '*/cache/*', '*/tmp/*', '*.swp', '*.pyc', '*.pyo', '.DS_Store', 'Thumbs.db', '*.so', '*.dll', '*.exe', '*.lib', '*.pdb' } 68 | 69 | vim.cmd [[ 70 | set t_Co=256 71 | set wildmode=list:longest,full 72 | set wildmode=list,full 73 | set omnifunc=syntaxcomplete#Complete 74 | set cursorline 75 | 76 | command -bang -bar WA wa 77 | command -bang -bar Wa wall 78 | command -bang -bar Q quit 79 | command -bang -bar Qa qall 80 | command -bang -bar QA qall 81 | command -bang -bar -complete=file -nargs=? E edit 82 | command -bang -bar -complete=file -nargs=? W write 83 | command -bang -bar -complete=file -nargs=? WQ wq 84 | command -bang -bar -complete=file -nargs=? Wq wq 85 | 86 | hi ColorColumn ctermbg=DarkGray 87 | hi Search cterm=NONE ctermfg=white ctermbg=blue 88 | hi Visual cterm=NONE ctermfg=white ctermbg=blue 89 | highlight WinSeparator guibg=None 90 | 91 | exec "set listchars=tab:\uBB\uBB,trail:\uB7,nbsp:~" 92 | 93 | " filetype=plugin on 94 | " filetype=indent off 95 | " filetype=indent plugin off 96 | " termguicolors = true 97 | ]] -------------------------------------------------------------------------------- /nvim/lua/user/ui/menu.lua: -------------------------------------------------------------------------------- 1 | local menu = {} 2 | 3 | local Menu = require("nui.menu") 4 | local event = require("nui.utils.autocmd").event 5 | 6 | local m_action 7 | 8 | local function on_item_selected(item) 9 | if item.text == "Yes" then 10 | vim.fn.jobstart(m_action, 11 | { on_stderr = require("user.util.neovim").on_event, 12 | on_stdout = require("user.util.neovim").on_event, 13 | on_exit = require("user.util.neovim").on_event, 14 | stdout_buffered = true, 15 | stderr_buffered = true }) 16 | end 17 | end 18 | 19 | function menu.show(title, items, successful_message, action) 20 | m_action = action 21 | require("user.util.neovim").set_successfull_message(successful_message) 22 | 23 | local new_lines = {} 24 | for counter, item in ipairs(items) do 25 | new_lines[counter] = Menu.item(item) 26 | end 27 | 28 | local m_menu = Menu({ 29 | position = { row = "5%", col = "50%" }, 30 | size = { width = 40, height = 2 }, 31 | relative = "editor", 32 | border = { 33 | highlight = "MyHighlightGroup", 34 | style = "single", 35 | text = { 36 | top = title, 37 | top_align = "center", 38 | }, 39 | }, 40 | win_options = { winblend = 10, winhighlight = "Normal:Normal" }, 41 | }, 42 | { 43 | lines = new_lines, 44 | max_width = 20, 45 | keymap = { 46 | focus_next = { "j", "", "" }, 47 | focus_prev = { "k", "", "" }, 48 | close = { "", "" }, 49 | submit = { "", "" }, 50 | }, 51 | on_submit = function(item) 52 | on_item_selected(item) 53 | end, 54 | }) 55 | 56 | m_menu:mount() 57 | m_menu:on(event.BufLeave, m_menu.menu_props.on_close, { once = true }) 58 | end 59 | 60 | return menu -------------------------------------------------------------------------------- /nvim/lua/user/ui/popup.lua: -------------------------------------------------------------------------------- 1 | local popup = {} 2 | 3 | local Popup = require("nui.popup") 4 | local event = require("nui.utils.autocmd").event 5 | 6 | local function show_popup(rows) 7 | local m_popup = Popup({ 8 | enter = true, 9 | focusable = true, 10 | border = { style = "rounded" }, 11 | position = { row = "20%", col = "50%" }, 12 | size = { width = "70%", height = "40%" }, 13 | buf_options = { modifiable = true, readonly = true }, 14 | }) 15 | 16 | m_popup:mount() 17 | m_popup:on(event.BufLeave, function() m_popup:unmount() end) 18 | vim.api.nvim_buf_set_lines(m_popup.bufnr, 0, 1, false, rows) 19 | end 20 | 21 | local function on_event(job_id, data, event) 22 | local has_error = false 23 | if event == "stderr" then 24 | local lines = { "" } 25 | local error_lines = "" 26 | vim.list_extend(lines, data) 27 | 28 | for i = 1, #lines do 29 | if not require('user.util.strings').isempty(lines[i]) then 30 | error_lines = error_lines .. "\n" .. lines[i] 31 | has_error = true 32 | end 33 | end 34 | if has_error then 35 | require("notify").notify(error_lines, "ERROR", { title = "ERROR", timeout = 500 }) 36 | end 37 | end 38 | if event == "stdout" then 39 | show_popup(data) 40 | end 41 | end 42 | 43 | function popup.show(command) 44 | vim.fn.jobstart(command, 45 | { on_stderr = on_event, 46 | on_stdout = on_event, 47 | on_exit = on_event, 48 | stdout_buffered = true, 49 | stderr_buffered = true }) 50 | end 51 | 52 | function popup.show_internal(command) 53 | local result = require("user.util.neovim").run_command_return_output_as_table(command) 54 | show_popup(result) 55 | end 56 | 57 | return popup -------------------------------------------------------------------------------- /nvim/lua/user/ui/telescope.lua: -------------------------------------------------------------------------------- 1 | local telescope = {} 2 | 3 | local themes = require("telescope.themes") 4 | local pickers = require("telescope.pickers") 5 | local finders = require("telescope.finders") 6 | local actions = require("telescope.actions") 7 | local conf = require("telescope.config").values 8 | local action_state = require("telescope.actions.state") 9 | 10 | local m_action_after_submit 11 | 12 | function themes.vscode(opts) 13 | opts = opts or {} 14 | local theme_opts = { 15 | theme = "dropdown", 16 | results_title = false, 17 | sorting_strategy = "ascending", 18 | layout_strategy = "vertical", 19 | layout_config = { 20 | anchor = "N", 21 | prompt_position = "top", 22 | width = function(_, max_columns, _) 23 | return math.min(max_columns, 120) 24 | end, 25 | height = function(_, _, max_lines) 26 | return math.min(max_lines, 15) 27 | end, 28 | }, 29 | } 30 | if opts.layout_config and opts.layout_config.prompt_position == "bottom" then 31 | theme_opts.borderchars = { 32 | prompt = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, 33 | results = { "─", "│", "─", "│", "╭", "╮", "┤", "├" }, 34 | preview = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, 35 | } 36 | end 37 | return vim.tbl_deep_extend("force", theme_opts, opts) 38 | end 39 | 40 | local function on_submited(prompt_bufnr) 41 | local selection = action_state.get_selected_entry() 42 | 43 | if string.match(selection[1], "*") then 44 | local updated_value = selection[1]:gsub("%*", "") 45 | selection[1] = updated_value 46 | end 47 | actions.close(prompt_bufnr) 48 | 49 | local command = m_action_after_submit .. selection[1] 50 | 51 | vim.fn.jobstart(command, 52 | { on_exit = require("user.util.neovim").on_event, 53 | on_stderr = require("user.util.neovim").on_event, 54 | on_stdout = require("user.util.neovim").on_event, 55 | stdout_buffered = true, 56 | stderr_buffered = true }) 57 | end 58 | 59 | function telescope.show(title, action_startup, action_after_submit, successful_message) 60 | require("user.util.neovim").run_command_return_output_as_table(action_startup) 61 | 62 | m_action_after_submit = action_after_submit 63 | require("user.util.neovim").set_successfull_message(successful_message) 64 | 65 | local opts = require("telescope.themes").vscode({}) 66 | pickers.new(opts, { 67 | prompt_title = title, 68 | finder = finders.new_table { 69 | results = require("user.util.neovim").run_command_return_output_as_table(action_startup), 70 | }, 71 | sorter = conf.generic_sorter(opts), 72 | attach_mappings = function(prompt_bufnr, map) 73 | actions.select_default:replace(on_submited) 74 | return true 75 | end, 76 | }):find() 77 | end 78 | 79 | return telescope -------------------------------------------------------------------------------- /nvim/lua/user/util/file.lua: -------------------------------------------------------------------------------- 1 | local file = {} 2 | 3 | function file.read_file_and_return_lines_as_table(path) 4 | local rows = {} 5 | local m_file = io.open(path, "rb") 6 | if not m_file then return nil end 7 | 8 | for line in io.lines(path) do 9 | for word in line:gmatch("%w+") do 10 | table.insert(rows, word) 11 | end 12 | end 13 | 14 | m_file:close() 15 | return rows 16 | end 17 | 18 | function file.exists(name) 19 | local f=io.open(name,"r") 20 | if f~=nil then 21 | io.close(f) 22 | return true 23 | else 24 | return false 25 | end 26 | end 27 | 28 | return file -------------------------------------------------------------------------------- /nvim/lua/user/util/strings.lua: -------------------------------------------------------------------------------- 1 | local strings = {} 2 | 3 | function strings.isempty(s) 4 | return s == nil or s == "" 5 | end 6 | 7 | function strings.split(input, delimiter) 8 | local result = {}; 9 | for match in (input..delimiter):gmatch("(.-)"..delimiter) do 10 | table.insert(result, match); 11 | end 12 | return result; 13 | end 14 | 15 | function strings.trim(input) 16 | return input:match'^()%s*$' and '' or input:match'^%s*(.*%S)' 17 | end 18 | 19 | function strings.to_table(input) 20 | local table = {} 21 | for counter = 1, #input do 22 | table[counter] = input:sub(counter, counter) 23 | end 24 | return table 25 | end 26 | 27 | return strings -------------------------------------------------------------------------------- /nvim/lua/user/wrapper/treesitter.lua: -------------------------------------------------------------------------------- 1 | vim.cmd [[ 2 | function! EnableTreesitter() 3 | :TSEnable highlight 4 | :TSBufEnable highlight 5 | 6 | :TSEnable rainbow 7 | :TSBufEnable rainbow 8 | 9 | :TSEnable indent 10 | :TSBufEnable indent 11 | 12 | :TSEnable incremental_selection 13 | :TSBufEnable incremental_selection 14 | endfunction 15 | ]] 16 | 17 | vim.api.nvim_create_autocmd("VimEnter", { 18 | command = ":call EnableTreesitter()", 19 | }) 20 | 21 | require'nvim-treesitter.configs'.setup { 22 | ensure_installed = { 23 | "make", "cmake", 24 | "latex", "lua", "glsl", 25 | "bash", "vim", "yaml", "regex", 26 | "c", "cpp", 27 | "python", "rust", "vala", "commonlisp", "zig", 28 | "html", "http", "json", "markdown", "javascript", "css", 29 | "go", "java", 30 | }, 31 | sync_install = false, 32 | highlight = { 33 | enable = true, 34 | additional_vim_regex_highlighting = false, 35 | }, 36 | indent = { 37 | enable = true 38 | }, 39 | rainbow = { 40 | enable = true, 41 | extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean 42 | max_file_lines = nil, -- Do not enable for files with more than n lines, int 43 | } 44 | } 45 | 46 | local treesitter = {} 47 | 48 | function treesitter.install() 49 | -- [TODO] second command is a vim command, but show() run it as external command. 50 | require("user.ui.telescope").show("Languages", ":TSInstallInfo", ":TSInstall ", "SUCCESS: treesitter.list()") 51 | end 52 | 53 | return treesitter -------------------------------------------------------------------------------- /nvim/lua/user/wrapper/vim.lua: -------------------------------------------------------------------------------- 1 | local function unmanaged_stuff() 2 | vim.cmd [[ 3 | function! AnimateWindowDelta(duration, width_delta, height_delta) abort 4 | " Store state so that we can access it in the step function 5 | let animation = { 6 | \ 'width_initial': winwidth(0), 'height_initial': winheight(0), 7 | \ 'width_delta': a:width_delta, 'height_delta': a:height_delta, 8 | \ 'duration': a:duration, 'start_time': str2float(reltimestr(reltime())) * 1000.0, 9 | \} 10 | 11 | " The main animation step function that is called on each interval 12 | function! animation.step(timer) 13 | " Calculate the time elapsed, appropriate width/height for this amount of elapsed time 14 | let elapsed = min([float2nr(self.duration), float2nr(str2float(reltimestr(reltime())) * 1000.0 - self.start_time)]) 15 | let width = float2nr(-self.width_delta * elapsed / self.duration * ( elapsed / self.duration- 2) + self.width_initial) 16 | let height = float2nr(-self.height_delta * elapsed / self.duration * ( elapsed / self.duration- 2) + self.height_initial) 17 | 18 | " Perform the animation if the widths/heights are different 19 | if width != winwidth(0) 20 | execute 'vertical resize ' . string(width) 21 | endif 22 | if height != winheight(0) 23 | execute 'resize ' . string(height) 24 | endif 25 | 26 | " If the time elapsed is less than the animation duration then schedule anoanother step, otherwise remove the timer id 27 | if elapsed < self.duration 28 | call timer_start(5, self.step) 29 | endif 30 | endfunction 31 | 32 | " Run the first step 33 | call animation.step(0) 34 | endfunction 35 | 36 | function! Animate(percent, duration) 37 | let l:availabel_height = &lines - &cmdheight - (&laststatus == 0 ? 0 : 1) - (&showtabline == 0 ? 0 : 1) 38 | if winwidth('%')==&columns || winwidth('%')==winwidth(winnr('$') - 1) 39 | call AnimateWindowDelta(a:duration, 0, float2nr(l:availabel_height * a:percent - winheight(0))) 40 | elseif winheight('%')==l:availabel_height || winheight('%')==winheight(winnr('$') - 1) 41 | call AnimateWindowDelta(a:duration, float2nr(&columns * a:percent - winwidth(0)), 0) 42 | else 43 | echom "WTF!" 44 | endif 45 | endfunction 46 | "autocmd WinNew * call Animate(0.4, 300.0) 47 | 48 | function! ProjectLuaExists() 49 | if filereadable("project.lua") 50 | :source project.lua 51 | endif 52 | endfunction 53 | 54 | function! LoadSession() 55 | let lists_of_dirs = split(getcwd(), '/') 56 | let lenght_of_dirs = len(lists_of_dirs) 57 | let parent_directory = get(lists_of_dirs, lenght_of_dirs - 2) 58 | let directory = get(lists_of_dirs, lenght_of_dirs - 1) 59 | let final = parent_directory . "_" . directory 60 | 61 | let b:sessiondir = $HOME . "/.config/nvim/sessions/" 62 | let b:sessionfile = b:sessiondir . final . ".vim" 63 | if (filereadable(b:sessionfile)) 64 | exe 'source ' b:sessionfile 65 | exe 'source .nvimrc' 66 | if filereadable(".nvimrc") 67 | endif 68 | else 69 | echo "No session loaded." 70 | endif 71 | endfunction 72 | 73 | function! SaveSession(overwrite) 74 | let lists_of_dirs = split(getcwd(), '/') 75 | let lenght_of_dirs = len(lists_of_dirs) 76 | let parent_directory = get(lists_of_dirs, lenght_of_dirs - 2) 77 | let directory = get(lists_of_dirs, lenght_of_dirs - 1) 78 | let final = parent_directory . "_" . directory 79 | 80 | let b:sessiondir = $HOME . "/.config/nvim/sessions/" 81 | if (filewritable(b:sessiondir) != 2) 82 | exe 'silent !mkdir -p ' b:sessiondir 83 | redraw! 84 | endif 85 | let b:filename = b:sessiondir . final . '.vim' 86 | if a:overwrite == 0 && !empty(glob(b:filename)) 87 | return 88 | endif 89 | exe "mksession! " . b:filename 90 | endfunction 91 | 92 | function! FTerminal(...) " a:1 >> command 93 | exec("terminal") 94 | if exists("a:1") 95 | let l:tid = b:terminal_job_id 96 | "call jobsend(l:tid, a:1) 97 | call chansend(l:tid, [a:1, "\n", ""]) 98 | endif 99 | endfunction 100 | 101 | function! HTerminal(...) " a:1 >> speed, a:2 >> width | height, a:3 >> command 102 | new term://bash 103 | wincmd J | resize 1 104 | call Animate(a:1, a:2) 105 | if exists("a:3") 106 | let l:tid = b:terminal_job_id 107 | "call jobsend(l:tid, a:3) 108 | " chansend crashes, see: 16040, whenever it fixed switch to chansend. >> update: seems it's working. 109 | call chansend(l:tid, [a:3, "\n", ""]) 110 | endif 111 | endfunction 112 | 113 | function! VTerminal(...) " a:1 >> speed, a:2 >> width | height, a:3 >> command 114 | vnew term://bash 115 | vertical resize 10 116 | call Animate(a:1, a:2) 117 | if exists("a:3") 118 | let l:tid = b:terminal_job_id 119 | " call jobsend(l:tid, a:3) 120 | call chansend(l:tid, [a:3, "\n", ""]) 121 | endif 122 | endfunction 123 | 124 | nnoremap :call HTerminal(0.4, 300.0) 125 | nnoremap :call FTerminal() 126 | " nnoremap :call VTerminal(0.5, 300.0) 127 | ]] 128 | end 129 | 130 | --vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI"}, { 131 | -- command = "lua require'nvim-lightbulb'.update_lightbulb()", 132 | --}) 133 | 134 | vim.api.nvim_create_autocmd("TermClose", { 135 | command = ":call feedkeys('i')", 136 | }) 137 | 138 | vim.api.nvim_create_autocmd("TermOpen", { 139 | command = "set bufhidden=hide", 140 | }) 141 | 142 | vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { 143 | pattern = "*.txt", 144 | command = ":only", 145 | }) 146 | 147 | --vim.api.nvim_create_autocmd("VimEnter", { 148 | -- command = ":call ProjectLuaExists()", 149 | --}) 150 | 151 | --vim.api.nvim_create_autocmd("VimEnter", { 152 | -- command = ":lua require('user.wrapper.statusline.sections').init()", 153 | --}) 154 | 155 | vim.api.nvim_create_autocmd("TermOpen", { 156 | command = ":setlocal nonumber | startinsert", 157 | }) 158 | 159 | vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { 160 | pattern = ".envrc", 161 | command = ":set filetype=sh", 162 | }) 163 | 164 | vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { 165 | pattern = "*.md", 166 | command = ":set filetype=md", 167 | }) 168 | 169 | vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { 170 | pattern = "*.srt", 171 | command = ":set filetype=srt", 172 | }) 173 | 174 | vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, { 175 | pattern = "*.vala", 176 | command = ":set filetype=vala", 177 | }) 178 | 179 | --autocmd FileType qf 12wincmd_ 180 | vim.api.nvim_create_autocmd("FileType", { 181 | pattern = "qf", 182 | command = "12wincmd_", 183 | }) 184 | 185 | local function set_theme() 186 | vim.opt.termguicolors = true 187 | vim.opt.background='dark' 188 | 189 | require('vscode').setup({ 190 | -- Override colors (see ./lua/vscode/colors.lua) 191 | color_overrides = { 192 | vscBack = '#3d3d3d', 193 | vscLineNumber = "#a3a3a3", 194 | vscSelection = "#7d7566", 195 | }, 196 | }) 197 | require('vscode').load('dark') 198 | end 199 | 200 | local vim = {} 201 | 202 | function vim.init() 203 | set_theme() 204 | unmanaged_stuff() 205 | end 206 | 207 | function vim.variables() 208 | require("user.ui.popup").show_internal("let v:") 209 | end 210 | 211 | function vim.global_variables() 212 | require("user.ui.popup").show_internal("let g:") 213 | end 214 | 215 | function vim.differ_options() 216 | require("user.ui.popup").show_internal("set") 217 | end 218 | 219 | function vim.all_options() 220 | require("user.ui.popup").show_internal("set all") 221 | end 222 | 223 | return vim -------------------------------------------------------------------------------- /scoop.md: -------------------------------------------------------------------------------- 1 | # packages 2 | ## utility 3 | scoop install gsudo clavier-plus clink clink-completions clink-flex-prompt 4 | brave flameshot nircmd nomacs ntop uutils-coreutils winget autohotkey 5 | kdenlive libreoffice vokoscreenng-np xournalpp 6 | 7 | ## development 8 | scoop install amber arc lua-language-server clangd dependencies drmemory mandoc 9 | regdllview x64dbg arduino-cli 10 | -------------------------------------------------------------------------------- /services.md: -------------------------------------------------------------------------------- 1 | # Services 2 | Search for a service: 3 | `Get-Service | grep Event` 4 | 5 | ## Start a service 6 | `Start-Service EventLog` 7 | 8 | ## Delete a service 9 | ``` 10 | gsudo sc stop tor 11 | gsudo sc delete tor 12 | ``` 13 | -------------------------------------------------------------------------------- /tor.md: -------------------------------------------------------------------------------- 1 | # Tor 2 | First you should download torbrowser(because it contains obfs4proxy.exe). 3 | 4 | obfs4proxy is located here: 5 | `E:\Tor Browser\Browser\TorBrowser\Tor\PluggableTransports\obfs4proxy` 6 | 7 | You need it since in your torrc, you need bridges. 8 | 9 | - Download Tor-Expert-Bundle: 10 | https://www.torproject.org/dist/torbrowser/10.0/tor-win32-0.4.3.6.zip 11 | 12 | C:\tor\Tor\tor.exe -f "C:\tor\Tor\torrc" 13 | 14 | - Unzip it, and install as as service: 15 | 16 | `C:\Tor\tor.exe --service install` 17 | 18 | - To check if the service with the settings file starts (it does not contain errors), you can use this command: 19 | 20 | `C:\Tor\tor.exe -f "C:\Tor\torrc"` 21 | 22 | - Now install the Tor service, which will read the settings from the C:\Tor\torrc file: 23 | `gsudo C:\tor\Tor\tor.exe --service install -options -f "C:\tor\Tor\torrc"` 24 | 25 | * Remember that you must specify options after the -options flag, otherwise they will be ignored. 26 | - To start and stop the service, use the following commands: 27 | ``` 28 | C:\Tor\tor.exe --service start 29 | C:\Tor\tor.exe --service stop 30 | ``` 31 | 32 | - To remove the service: 33 | ``` 34 | C:\Tor\tor.exe --service stop 35 | C:\Tor\tor.exe --service remove 36 | ``` 37 | 38 | * Note that you must first stop the service and then delete it. 39 | * By default, the Tor service listens on port 9050. 40 | So you can check whether it is started by a command that shows if port 9050 is listened: 41 | `netstat -aon | findstr ":9050"` 42 | 43 | ## Refrences 44 | - https://miloserdov.org/?p=1839 45 | -------------------------------------------------------------------------------- /wezterm/.wezterm.lua: -------------------------------------------------------------------------------- 1 | local wezterm = require 'wezterm' 2 | local action = wezterm.action 3 | local mux = wezterm.mux 4 | local config = {} 5 | 6 | config.use_fancy_tab_bar = true 7 | config.show_tabs_in_tab_bar = true 8 | config.window_decorations = "INTEGRATED_BUTTONS|RESIZE" 9 | config.integrated_title_button_style = "Windows" 10 | config.use_fancy_tab_bar = false 11 | config.show_tabs_in_tab_bar = false 12 | config.show_new_tab_button_in_tab_bar = false 13 | config.window_close_confirmation = 'NeverPrompt' 14 | 15 | wezterm.on("gui-startup", function() 16 | local tab, pane, window = mux.spawn_window{} 17 | window:gui_window():maximize() 18 | end) 19 | 20 | wezterm.on('disable-tab-bar', function(window, pane) 21 | local overrides = window:get_config_overrides() or {} 22 | if overrides.show_tabs_in_tab_bar == true then 23 | overrides.use_fancy_tab_bar = false 24 | overrides.show_tabs_in_tab_bar = false 25 | overrides.show_new_tab_button_in_tab_bar = false 26 | else 27 | overrides.use_fancy_tab_bar = true 28 | overrides.show_tabs_in_tab_bar = true 29 | overrides.show_new_tab_button_in_tab_bar = true 30 | end 31 | window:set_config_overrides(overrides) 32 | end) 33 | 34 | local padding = { 35 | top = "0.4cell", 36 | bottom = "0.0cell", 37 | left = "0.3cell", 38 | right = "0.1cell", 39 | } 40 | 41 | -- Reload the configuration every ten minutes 42 | wezterm.time.call_after(600, function() 43 | wezterm.reload_configuration() 44 | end) 45 | 46 | -- A helper function for my fallback fonts 47 | local function font_with_fallback(name, params) 48 | local names = { name, "FiraCode Nerd Font", "mini-file-icons", "Hack Nerd Font", "SauceCodePro Nerd Font" } 49 | return wezterm.font_with_fallback(names, params) 50 | end 51 | 52 | local function get_theme() 53 | local _time = os.date("*t") 54 | if _time.hour >= 1 and _time.hour < 9 then 55 | return "Rosé Pine (base16)" 56 | elseif _time.hour >= 9 and _time.hour < 17 then 57 | return "Gruvbox Light" 58 | elseif _time.hour >= 17 and _time.hour < 21 then 59 | return "Earthsong" 60 | elseif _time.hour >= 21 and _time.hour < 24 or _time.hour >= 0 and _time.hour < 1 then 61 | return "kanagawabones" 62 | end 63 | end 64 | 65 | config.bidi_enabled = true 66 | -- config.exit_behavior = "CloseOnCleanExit" 67 | config.default_prog = { 'clifm'} -- , '-c' , ' clifm; bash' 68 | config.enable_scroll_bar = true 69 | config.window_background_opacity = 0.95 70 | config.window_padding = padding 71 | 72 | config.inactive_pane_hsb = { 73 | saturation = 0.5, 74 | brightness = 0.6, 75 | --hue = 0.5, 76 | } 77 | 78 | config.bold_brightens_ansi_colors = false 79 | config.bidi_direction = "AutoLeftToRight" 80 | config.color_scheme = 'Eighties (dark) (terminal.sexy)' --get_theme() 81 | config.font = wezterm.font 'CaskaydiaMono Nerd Font' 82 | config.font_size = 10.5 83 | config.font_shaper = "Harfbuzz" 84 | config.scrollback_lines = 9999 85 | config.font = font_with_fallback({ 86 | family = "CaskaydiaMono Nerd Font", 87 | harfbuzz_features = { 88 | "zero", 89 | }, 90 | }) 91 | 92 | -- timeout_milliseconds defaults to 1000 and can be omitted 93 | config.leader = { key = 'b', mods = 'CTRL', timeout_milliseconds = 1000 } 94 | config.keys = { 95 | { 96 | key = 'LeftArrow', 97 | mods = 'LEADER', 98 | action = action.AdjustPaneSize { 'Left', 2 }, 99 | }, 100 | { 101 | key = 'RightArrow', 102 | mods = 'LEADER', 103 | action = action.AdjustPaneSize { 'Right', 2 }, 104 | }, 105 | { 106 | key = 'UpArrow', 107 | mods = 'LEADER', 108 | action = action.AdjustPaneSize { 'Up', 2 } 109 | }, 110 | { 111 | key = 'DownArrow', 112 | mods = 'LEADER', 113 | action = action.AdjustPaneSize { 'Down', 2 }, 114 | }, 115 | 116 | { 117 | key = 'LeftArrow', 118 | mods = 'SHIFT|CTRL', 119 | action = action.ActivatePaneDirection 'Left', 120 | }, 121 | { 122 | key = 'RightArrow', 123 | mods = 'SHIFT|CTRL', 124 | action = action.ActivatePaneDirection 'Right', 125 | }, 126 | { 127 | key = 'UpArrow', 128 | mods = 'SHIFT|CTRL', 129 | action = action.ActivatePaneDirection 'Up', 130 | }, 131 | { 132 | key = 'DownArrow', 133 | mods = 'SHIFT|CTRL', 134 | action = action.ActivatePaneDirection 'Down', 135 | }, 136 | 137 | --{ 138 | -- key = 'a', 139 | -- mods = 'ALT', 140 | -- action = action.ActivatePaneByIndex(0) 141 | --}, 142 | --{ 143 | -- key = 'b', 144 | -- mods = 'ALT', 145 | -- action = action.ActivatePaneByIndex(1) 146 | --}, 147 | --{ 148 | -- key = 'c', 149 | -- mods = 'ALT', 150 | -- action = action.ActivatePaneByIndex(2) 151 | --}, 152 | { 153 | key = 'h', 154 | mods = 'LEADER', 155 | action = action.SplitHorizontal { domain = 'CurrentPaneDomain' }, 156 | }, 157 | { 158 | key = 'v', 159 | mods = 'LEADER', 160 | action = action.SplitVertical { domain = 'CurrentPaneDomain' }, 161 | }, 162 | { 163 | key = 't', 164 | mods = 'LEADER', 165 | action = action({ SpawnTab = "CurrentPaneDomain" }) 166 | }, 167 | { 168 | key = 'f', 169 | mods = 'LEADER', 170 | action = action.ToggleFullScreen, 171 | }, 172 | { 173 | key = 'z', 174 | mods = 'LEADER', 175 | action = wezterm.action.TogglePaneZoomState, 176 | }, 177 | { 178 | key = 'l', 179 | mods = 'LEADER', 180 | action = action.ShowLauncher, 181 | }, 182 | { 183 | key = 'w', 184 | mods = 'LEADER', 185 | action = action.CloseCurrentTab { confirm = true }, 186 | }, 187 | { 188 | key = 'x', 189 | mods = 'LEADER', 190 | action = action.CloseCurrentPane { confirm = true }, 191 | }, 192 | -- Send "CTRL-A" to the terminal when pressing CTRL-A, CTRL-A 193 | { 194 | key = 'a', 195 | mods = 'LEADER|CTRL', 196 | action = wezterm.action.SendKey { key = 'a', mods = 'CTRL' }, 197 | }, 198 | { 199 | key = 'd', 200 | mods = 'LEADER', 201 | action = wezterm.action.EmitEvent 'disable-tab-bar', 202 | }, 203 | } 204 | return config 205 | 206 | --config.unzoom_on_switch_pane = false 207 | --wezterm.on('update-status', function(window, pane) 208 | -- local overrides = window:get_config_overrides() or {} 209 | -- if window:is_focused() then 210 | -- overrides.window_background_opacity = 1 211 | -- --overrides.color_scheme = 'nightfox'--'Eighties (dark) (terminal.sexy)' 212 | -- else 213 | -- overrides.window_background_opacity = 0.20 214 | -- --overrides.color_scheme = 'nordfox' -- 'nightfox' 215 | -- end 216 | -- window:set_config_overrides(overrides) 217 | --end) 218 | -------------------------------------------------------------------------------- /wezterm/README.md: -------------------------------------------------------------------------------- 1 | put .wezterm.lua here: 2 | C:\Users\ --------------------------------------------------------------------------------