├── VimifiedExplorer.exe ├── LICENSE ├── README.md └── VimifiedExplorer.ahk /VimifiedExplorer.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahilsehwag/ahk-vimified-explorer/HEAD/VimifiedExplorer.exe -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Sahil Sehwag 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## INTRODUCTION 2 | 3 | Finally the virus of _**VIM**_ has reached _**WINDOWS**_ 😈. _**VimifiedExplorer**_ is an _**AHK script**_ which provides _**VIM/Vifm**_ like bindings for _**Windows FileExplorer**_, and other features like _bookmarks, marks etc..._ 4 |
5 | If you do any kind of work/interaction with Windows Explorer and want to boost your productivity Or is frustrated with Windows Explorer(well I was 😆), you are at right place. Control Windows Explorer completely with just your _**KEYBOARD**_. Power of 😍 _**VIM**_ in Windows Explorer😍. 6 |
7 | **Note:** _**Executable**_ file is provided along with AHK script. 8 |
9 |
10 | **Author:** _Sahil Sehwag_ 11 | 12 | ## OVERVIEW 13 | 14 | - [Features](#features) 15 | - [Installation](#installation) 16 | - [Screenshots](#screenshots) 17 | - [Documentation](#documentation) 18 | - [Limitations](#limitations) 19 | - [Known Issues](#known-issues) 20 | - [Contribution](#contribution) 21 | - [Todo](#todo) 22 | 23 | 24 | ## FEATURES 25 | 26 | - _**VIM/VIFM like bindings**_ 27 | - _**Marks**_ 28 | - _**Bookmarks**_ 29 | - _**Integration with QTTabBar**_ 30 | - _**Colon Commands (currently only one)**_ 31 | - _**Displays current mode**_ 32 | - _**Currently works on Windows 10 and probably Windows 8(most features should work) too (Only tested on Windows 10)**_ 33 | - _**Persistent Marks and Bookmarks (creates .verc in HOME directory to store your marks and bookmarks)**_ 34 | 35 | 36 | ## INSTALLATION 37 | 38 | - Download _VimifiedExplorer.exe_. 39 | - Install AHK and run the _VimifiedExplorer.ahk_ script. 40 | 41 | 42 | ## SCREENSHOTS 43 | 44 | 45 | 46 | ## DOCUMENTATION 47 | ### MODES 48 | 49 | | Mode | KeyBinding | Description | 50 | |------|------------|-------------| 51 | | NORMAL | `` | Default mode where you will be spending most of your time | 52 | | INSERT | `i` | Mode in which all VimifiedExplorer bindings are disabled | 53 | | VISUAL | `v` | Like VIM's VISUAL-LINE mode, Files/Folders will be selected as you move UP and Down| 54 | | VISUAL-SELECT | `V` | Moving around won't select any File/Folder to select a File/Folder press `` or `s`. 55 | 56 | 57 | ### NAVIGATION 58 | 59 | __Note:__
60 | >General syntax for motion is ``.
61 | >Almost all motions accept COUNT as argument (except MOTIONS like gg etc..)
62 | >In table below `n` refers to the count passed to command.
63 | >Default value for count is 1
64 | 65 | | KeyBinding | Description | Takes COUNT | 66 | |------------|------------------------------------------|---------------| 67 | | `j` | To move `n` DOWN | yes | 68 | | `k` | To move `n` UP | yes | 69 | | `h` | To go `n` Directories back | yes | 70 | | `l` | To open selected File(s)/Directory(s) | no | 71 | | `J` | To go `n` locations back in history | yes | 72 | | `K` | To go `n` locations forward in history | yes | 73 | | `gg` | To go to FIRST file | no | 74 | | `G` | To go to LAST file | no | 75 | | `H` | To go to TOP of the visible screen | yes | 76 | | `L` | To go to BOTTOM of the visible screen | yes | 77 | 78 | 79 | ### FILE/FOLDER OPERATIONS 80 | 81 | **Note:** COUNT `n` to file operations selects Current item + `n-1` items down 82 | 83 | | KeyBinding | Description | Takes COUNT | 84 | |------------|-------------|-------------| 85 | | `dd` | Delete currently selected items | yes | 86 | | `DD` | Delete currently selected items permanently | yes | 87 | | `cc` | Rename currently selected item | no | 88 | | `yy` | Yank(Copy) currently selected items | yes | 89 | | `yp` | Yank(Copy) path of current folder | no | 90 | | `yt` | Yank(Copy) selected items to a folder(select using _CopyTo_ menu) | no | 91 | | `xx` | Cut currently selected items | yes | 92 | | `xx` | Cut currently selected items to a folder(select using _MoveTo_ menu) | yes | 93 | | `p` | Paste files/folders | no | 94 | | `P` | Paste shortcut of files/folders | no | 95 | | `fn` | Create new folder | no | 96 | | `fh` | Hide/Unhide selected items | no | 97 | 98 | 99 | ### MARKS 100 | 101 | | Keybinding | Description | 102 | |------------|-------------| 103 | | `m` | Creates a mark of current directory | 104 | | `'` | Opens mark (i.e goes to the location binded with \) | 105 | 106 | 107 | ### BOOKMARKS 108 | 109 | **Note:** A bar is opened to enter Bookmark `NAME` 110 | 111 | | Keybinding | Description | 112 | |------------|-------------| 113 | | `b NAME` | Creates a bookmark of current directory | 114 | | `" NAME` | Opens a bookmark (i.e goes to the location binded with NAME) | 115 | 116 | 117 | ### UI OPERATIONS 118 | 119 | | Keybinding | Description | 120 | |------------|-------------| 121 | | `uh` | Show/Hide hidden items | 122 | | `ue` | Show/Hide file extensions | 123 | | `uc` | Show/Hide checkboxes | 124 | | `uf` | Change column widths to fit its contents | 125 | | `up` | Show/Hide Preview Pane | 126 | | `ud` | Show/Hide Details Pane | 127 | | `un` | Show/Hide Navigation Pane | 128 | | `ul` | Select the location bar | 129 | 130 | 131 | ### MISCELLANOUS OPERATIONS 132 | 133 | | Keybinding | Description | 134 | |------------|-------------| 135 | | `/` | Incremental search (selects item as you type) | 136 | | `zc` | Compress selected items | 137 | | `zu` | UnCompress selected zip file(_**NOT IMPLEMENTED**_) | 138 | | `zp` | Pin selected item to QuickAccess | 139 | | `zq` | Close current explorer window | 140 | 141 | ##### SELECT OPERATIONS 142 | | Keybinding | Description | 143 | |------------|-------------| 144 | | s | Select/Deselect current item | 145 | | sa | Select all items | 146 | | sn | Deselect all currently selected elements | 147 | | si | Inverse selection (Deselects currently selected items and selects remaining items | 148 | 149 | ##### OPEN OPERATIONS 150 | | Keybinding | Description | 151 | |------------|-------------| 152 | | `ot` | Opens *__Command Prompt__* in current folder | 153 | | `on` | Opens selected folders in *__New Window__* (If selected item is a file opens current folder) | 154 | | `op` | Opens *__Properties__* dialog of selected items | 155 | | `os` | Opens *__Settings__* dialog of selected items | 156 | | `or` | Opens *__Recent Locations__* menu(In TOP-LEFT corner, use j,k to move DOWN/UP in the list)(_**Experimental**_) | 157 | | `ow` | Opens *__Open With__* menu | 158 | | `oq` | Opens explorer's *__QuickAccess__* menu(Press highlighted number to select) | 159 | 160 | ##### WINDOW OPERATIONS 161 | | Keybinding | Description | 162 | |------------|-------------| 163 | | `wh` | Pin window to left | 164 | | `wj` | Minimize/Pin to bottom | 165 | | `wk` | Maximize/Pin to top | 166 | | `wl` | Pin window to right | 167 | | `wm` | Move current window around(_`h,j,k,l`_ to move _left,down,up,right_ and `esc,enter` to cancel,confirm) | 168 | | `wr` | Resize current window(_`h,j,k,l`_ to increase/decrease in _left,down,up,right_ direction and `esc,enter` to cancel,confirm) | 169 | 170 | ##### TAB OPERATIONS (QTTabBar) 171 | | Keybinding | Description | 172 | |------------|-------------| 173 | | `tn` | Create new tab | 174 | | `tl` | Goto next tab | 175 | | `th` | Goto previous tab | 176 | | `tt` | Toggle tab lock | 177 | | `tq` | Close current tab | 178 | 179 | 180 | ### COMMANDS 181 | 182 | | Command | Description | 183 | |---------|-------------| 184 | | `:run` | Runs command-line commands in current explorer directory | 185 | 186 | 187 | ## LIMITATIONS 188 | 189 | - Currently only works in _List View_ (i.e. Only UP/DOWN motions are supported) 190 | 191 | 192 | ## KNOWN ISSUES 193 | 194 | - Mode tooltip doesn't automatically disappears when switching to other applications. (Use `` to remove it) 195 | - When using `J,K` to navigate history, system(keyboard) language is automatically cycled left,right (for people with more than 1 language installed) 196 | - When resizing a window in *__left/top__* direction causes wierd shaking. 197 | 198 | 199 | ## CONTRIBUTION 200 | 201 | Contributors are welcomed. 202 | 203 | 204 | ## TODO 205 | 206 | - Fix known issues 207 | - Implement motions for views other than _DETAIL VIEW_ 208 | - Implementing History Features (Ex. Jumping to last location) 209 | - Implement operations to perform operations like delete on `n` items up etc... 210 | - Implement *__HELP DOCUMENTATION__* in application itself 211 | - Complete rewrite to provide a more composable architecture, to provide features like _**Custom Commands, Extensibility, Custom Mappings, Customizability etc..**_) 212 | 213 | 214 | 215 | 216 | 217 | 218 | -------------------------------------------------------------------------------- /VimifiedExplorer.ahk: -------------------------------------------------------------------------------- 1 | #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. 2 | ; #Warn ; Enable warnings to assist with detecting common errors. 3 | SendMode Input ; Recommended for new scripts due to its superior speed and reliability. 4 | SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. 5 | 6 | #SingleInstance FORCE 7 | 8 | vimEnabled := true 9 | 10 | NORMAL_MODE := "normal" 11 | INSERT_MODE := "insert" 12 | VISUAL_MODE := "visual" 13 | VISUAL_LINE_MODE := "visual-line" 14 | PSUEDO_VISUAL_MODE := "psuedo-visual" 15 | PSUEDO_VISUAL_LINE_MODE := "psuedo-visual-line" 16 | 17 | miscMode := false 18 | windowMode := false 19 | bookmarkMode := false 20 | commandBarFlag := false 21 | 22 | mode := "normal" 23 | commandCount := 0 24 | setMode(NORMAL_MODE) 25 | 26 | wTransientState := false 27 | fTransientState := false 28 | dTransientState := false 29 | cTransientState := false 30 | yTransientState := false 31 | 32 | lastMode := "normal" 33 | 34 | lastNormalCommandCount := 0 35 | lastNormalCommand := "" 36 | 37 | lastVisualCommand := "" 38 | lastVisualCommandCount := 0 39 | 40 | lastVisualLineCommand := "" 41 | lastVisualLineCommandCount := 0 42 | 43 | operatorDelete := false 44 | operatorPermanentDelete := false 45 | operatorChange := false 46 | operatorYank := false 47 | operatorCut := false 48 | ggCommand := false 49 | 50 | 51 | iniPath = C:/Users/%A_UserName%/.verc 52 | 53 | CommandBar := 54 | commandBarCommand := 55 | 56 | 57 | ;F2::reload 58 | ;F3::suspend 59 | 60 | 61 | #USEHOOK on 62 | #InstallKeybdHook 63 | 64 | 65 | ;CTRL + ` TO TOGGLE ACTIVATION OF VIM MODE 66 | #`:: 67 | vimEnabled := !vimEnabled 68 | if vimEnabled { 69 | setMode(NORMAL_MODE) 70 | } else{ 71 | ToolTip, 72 | } 73 | RETURN 74 | 75 | 76 | ;TO REMOVE TOOLTIP PERSISTANT AFTER EXPLORER IS NOT ACTIVE (ISSUE) 77 | #IF (vimEnabled=false) || !(WinActive("AHK_CLASS CabinetWClass")) 78 | escape:: 79 | SEND, {ESCAPE} 80 | resetToolTip() 81 | GUI, CommandBar:Destroy 82 | return 83 | 84 | 85 | ;COMMAND BAR 86 | #IFWINACTIVE CommandBar 87 | tab:: 88 | enter:: 89 | GUI, CommandBar:Submit 90 | setMode(NORMAL_MODE) 91 | return 92 | 93 | 94 | 95 | ;MAIN VIM BINDINGS 96 | #IF (vimEnabled=true) && WinActive("AHK_CLASS CabinetWClass") 97 | escape:: 98 | SEND, {ESCAPE} 99 | setMode(NORMAL_MODE) 100 | commandCount := 0 101 | 102 | wTransientState := false 103 | fTransientState := false 104 | dTransientState := false 105 | cTransientState := false 106 | yTransientState := false 107 | 108 | operatorDelete := false 109 | operatorChange := false 110 | operatorYank := false 111 | operatorCut := false 112 | 113 | ggCommand := false 114 | windowMode := false 115 | 116 | ControlFocus, DirectUIHWND3 117 | ToolTip, ,,, 2 118 | Return 119 | 120 | enter:: 121 | SEND, {ENTER} 122 | windowMode := false 123 | operatorChange := false 124 | setMode(NORMAL_MODE) 125 | return 126 | 127 | 128 | #IF (vimEnabled=true) && WinActive("AHK_CLASS CabinetWClass") && (mode!=INSERT_MODE) && (miscMode=false) && (windowMode=false) && (bookmarkMode=false) 129 | +;:: 130 | createCommandBar(":") 131 | WinWaitClose, CommandBar 132 | execCommandModeCommand() 133 | return 134 | 135 | ;MODES 136 | i:: 137 | setMode(INSERT_MODE) 138 | Return 139 | v:: 140 | if (mode=VISUAL_LINE_MODE){ 141 | setMode(PSUEDO_VISUAL_MODE) 142 | }else{ 143 | setMode(VISUAL_MODE) 144 | } 145 | Return 146 | +v:: 147 | if (mode=VISUAL_MODE){ 148 | setMode(PSUEDO_VISUAL_LINE_MODE) 149 | }else{ 150 | setMode(VISUAL_LINE_MODE) 151 | } 152 | Return 153 | 154 | 155 | ;COMMAND COUNT 156 | 0:: 157 | commandCount := joinNumbers(commandCount, 0) 158 | RETURN 159 | 1:: 160 | commandCount := joinNumbers(commandCount, 1) 161 | RETURN 162 | 2:: 163 | commandCount := joinNumbers(commandCount, 2) 164 | RETURN 165 | 3:: 166 | commandCount := joinNumbers(commandCount, 3) 167 | RETURN 168 | 4:: 169 | commandCount := joinNumbers(commandCount, 4) 170 | RETURN 171 | 5:: 172 | commandCount := joinNumbers(commandCount, 5) 173 | RETURN 174 | 6:: 175 | commandCount := joinNumbers(commandCount, 6) 176 | RETURN 177 | 7:: 178 | commandCount := joinNumbers(commandCount, 7) 179 | RETURN 180 | 8:: 181 | commandCount := joinNumbers(commandCount, 8) 182 | RETURN 183 | 9:: 184 | commandCount := joinNumbers(commandCount, 9) 185 | RETURN 186 | 187 | 188 | ;BASIC NAVIGATION 189 | h:: 190 | runVimMotion("h") 191 | RETURN 192 | l:: 193 | runVimMotion("l") 194 | RETURN 195 | j:: 196 | runVimMotion("j") 197 | RETURN 198 | k:: 199 | runVimMotion("k") 200 | RETURN 201 | +j:: 202 | runVimMotion("+j") 203 | return 204 | +k:: 205 | runVimMotion("+k") 206 | return 207 | 208 | 209 | ;SCROLL NAVIGATION 210 | +g:: 211 | runVimMotion("+g") 212 | RETURN 213 | g:: 214 | if (ggCommand=false){ 215 | ggCommand := true 216 | } else{ 217 | runVimMotion("gg") 218 | ggCommand := false 219 | } 220 | RETURN 221 | +h:: 222 | runVimMotion("+h") 223 | RETURN 224 | +l:: 225 | runVimMotion("+l") 226 | RETURN 227 | 228 | 229 | ;OPERATORS 230 | d:: 231 | if (operatorDelete=false){ 232 | operatorDelete := true 233 | } else { 234 | runVimOperator("dd") 235 | operatorDelete := false 236 | } 237 | return 238 | +d:: 239 | if (operatorPermanentDelete=false){ 240 | operatorPermanentDelete := true 241 | } else { 242 | runVimOperator("DD") 243 | operatorPermanentDelete := false 244 | } 245 | return 246 | c:: 247 | if (operatorChange=false){ 248 | operatorChange := true 249 | } else { 250 | runVimOperator("cc") 251 | setMode(INSERT_MODE) 252 | } 253 | return 254 | y:: 255 | if (operatorYank=false){ 256 | operatorYank := true 257 | } else { 258 | runVimOperator("yy") 259 | operatorYank := false 260 | } 261 | return 262 | x:: 263 | if (operatorCut=false){ 264 | operatorCut := true 265 | } else { 266 | runVimOperator("xx") 267 | operatorCut := false 268 | } 269 | return 270 | p:: 271 | if (operatorYank=true){ 272 | SEND, {ALT DOWN}HCP{ALT UP} 273 | }else{ 274 | SEND, {CTRL DOWN}v{CTRL UP} 275 | } 276 | return 277 | +p:: 278 | SEND, {ALT DOWN}{H}{P}{S}{ALT UP} 279 | RETURN 280 | 281 | ;a:: 282 | ;if (operatorDelete=true){ 283 | ;runVimOperator("da") 284 | ;} else if(operatorYank=true){ 285 | ;runVimOperator("ya") 286 | ;} else if (operatorCut=true){ 287 | ;runVimOperator("xa") 288 | ;} 289 | ;return 290 | ;b:: 291 | ;if (operatorDelete=true){ 292 | ;runVimOperator("db") 293 | ;} else if (operatorYank=true){ 294 | ;runVimOperator("yb") 295 | ;} else if (operatorCut=true){ 296 | ;runVimOperator("xb") 297 | ;} 298 | ;return 299 | ;+a:: 300 | ;if (operatorDelete=true){ 301 | ;runVimOperator("dA") 302 | ;} else if (operatorYank=true){ 303 | ;runVimOperator("yA") 304 | ;} else if (operatorCut=true){ 305 | ;runVimOperator("xA") 306 | ;} 307 | ;return 308 | ;+b:: 309 | ;if (operatorDelete=true){ 310 | ;runVimOperator("dB") 311 | ;} else if(operatorYank=true){ 312 | ;runVimOperator("yB") 313 | ;} else if (operatorCut=true){ 314 | ;runVimOperator("xB") 315 | ;} 316 | ;return 317 | t:: 318 | if (operatorCut=true){ 319 | runVimOperator("xt") 320 | }else if (operatorYank=true){ 321 | runVimOperator("yt") 322 | }else if (command="c"){ 323 | SEND, {ALT DOWN}SC{ALT UP} 324 | }else { 325 | ;QTTABBAR INTEGRATION 326 | miscMode := true 327 | Input, command, L1 T1 328 | 329 | if (command="n"){ 330 | SEND, {CTRL DOWN}n{CTRL UP} 331 | }else if (command="t"){ 332 | SEND, {CTRL DOWN}l{CTRL UP} 333 | }else if (command="l"){ 334 | SEND, {CTRL DOWN}{TAB}{CTRL UP} 335 | }else if (command="h"){ 336 | SEND, {CTRL DOWN}{SHIFT DOWN}{TAB}{SHIFT UP}{CTRL UP} 337 | }else if (command="q"){ 338 | SEND, {CTRL DOWN}w{CTRL UP} 339 | } 340 | miscMode := false 341 | } 342 | operatorCut := false 343 | operatorYank := false 344 | return 345 | 346 | 347 | ;MISCELLANOUS OPERATIONS 348 | s:: 349 | SEND, {CTRL DOWN}{SPACE}{CTRL UP} 350 | return 351 | s & a:: 352 | SEND, {ALT DOWN}HSA{ALT UP} 353 | RETURN 354 | s & n:: 355 | SEND, {ALT DOWN}HSN{ALT UP} 356 | RETURN 357 | s & i:: 358 | SEND, {ALT DOWN}HSI{ALT UP} 359 | RETURN 360 | /:: 361 | setMode(INSERT_MODE) 362 | return 363 | 364 | 365 | 366 | 367 | #IF (vimEnabled=true) && WinActive("AHK_CLASS CabinetWClass") && (mode!=INSERT_MODE) && (bookmarkMode=false) 368 | ;UI OPERATIONS 369 | u:: 370 | miscMode := true 371 | ;HotKey, f, OFF 372 | Input, command, L1 T1 373 | 374 | if (command="c"){ 375 | SEND, {ALT DOWN}VHT{ALT UP} 376 | }else if(command="e"){ 377 | SEND, {ALT DOWN}VHF{ALT UP} 378 | }else if(command="h"){ 379 | SEND, {ALT}VHH 380 | }else if(command="f"){ 381 | SEND, {ALT DOWN}VSF{ALT UP} 382 | }else if(command="p"){ 383 | SEND, {ALT DOWN}VP{ALT UP} 384 | }else if(command="d"){ 385 | SEND, {ALT DOWN}VD{ALT UP} 386 | }else if(command="n"){ 387 | SEND, {ALT DOWN}VN{ALT UP}{ENTER} 388 | }else if (command="l"){ 389 | SEND, {ALT DOWN}d{ALT UP} 390 | } 391 | 392 | ;HotKey, f, ON 393 | miscMode := false 394 | return 395 | 396 | 397 | ;FILE OPERATIONS 398 | f:: 399 | miscMode := true 400 | Input, command, L1, T1 401 | if (command="n"){ 402 | SEND, {CTRL DOWN}{SHIFT DOWN}n{SHIFT UP}{CTRL UP} 403 | setMode(INSERT_MODE) 404 | }else if (command="h"){ 405 | SEND, {ALT DOWN}{V}{H}{S}{ALT UP} 406 | } 407 | miscMode := false 408 | return 409 | 410 | 411 | ;WINDOW OPERATIONS 412 | w:: 413 | miscMode := true 414 | 415 | ;HotKey, f, OFF 416 | 417 | Input, command, L1 T1 418 | 419 | if (command="."){ 420 | }else if (command="h"){ 421 | SEND, {LWIN DOWN}{LEFT}{LWIN UP} 422 | }else if (command="j"){ 423 | SEND, {LWIN DOWN}{DOWN}{LWIN UP} 424 | }else if (command="k"){ 425 | SEND, {LWIN DOWN}{UP}{LWIN UP} 426 | }else if (command="l"){ 427 | SEND, {LWIN DOWN}{RIGHT}{LWIN UP} 428 | }else if (command="m"){ 429 | SEND, {ALT DOWN}{SPACE}{ALT UP}M 430 | windowMode := true 431 | ;WINGET, isMaximized, MinMax, 432 | ; }else if (command="f"){ 433 | ; SEND, {SHIFT DOWN}{F11}{SHIFT UP} 434 | }else if (command="r"){ 435 | SEND, {ALT DOWN}{SPACE}{ALT UP}S 436 | windowMode := true 437 | } 438 | 439 | ;HotKey, f, ON 440 | miscMode := false 441 | wTransientState := false 442 | return 443 | 444 | 445 | ;OPEN OPERATIONS 446 | o:: 447 | miscMode := true 448 | ;HotKey, w, OFF 449 | 450 | Input, command, L1 T1 451 | 452 | if (command="n"){ 453 | SEND, {ALT DOWN}FN{ALT UP} 454 | }else if (command="t"){ 455 | currentPath := getExplorerPath() 456 | Run, "cmd.exe", %currentPath% 457 | }else if (command="p"){ 458 | SEND, {ALT DOWN}{ENTER}{ALT UP} 459 | }else if (command="s"){ 460 | SEND, {ALT DOWN}VYO{ALT UP} 461 | }else if (command="q"){ 462 | SEND, {ALT DOWN}F{ALT UP} 463 | ; }else if (command="w"){ 464 | ; SEND, {ALT DOWN}{HPE}{C}{ALT UP} 465 | }else if (command="r"){ 466 | CoordMode, Mouse, Window 467 | MouseClick, left, 77, 74 468 | } 469 | 470 | miscMode := false 471 | ;HotKey, w, ON 472 | return 473 | 474 | z:: 475 | miscMode := true 476 | ;HotKey, z, OFF 477 | Input, command, L1 T1 478 | if (command="q"){ 479 | SEND, {ALT DOWN}{F4}{ALT UP} 480 | }else if (command="c"){ 481 | SEND, {ALT DOWN}SC{ALT UP} 482 | ; }else if (command="u"){ 483 | ; SEND, {ALT DOWN}JZA{ALT UP} 484 | }else if (command="p"){ 485 | SEND, {ALT DOWN}HPI{ALT UP} 486 | } 487 | ;HotKey, z, ON 488 | miscMode := false 489 | return 490 | 491 | ;GOTO COMMANDS 492 | 493 | 494 | 495 | #IF (vimEnabled=true) && WinActive("AHK_CLASS CabinetWClass") && (mode!=INSERT_MODE) && (windowMode=true) && (bookmarkMode=false) 496 | h:: 497 | Loop, 10{ 498 | Sleep, 5 499 | SEND, {LEFT} 500 | } 501 | return 502 | j:: 503 | Loop, 10{ 504 | Sleep, 5 505 | SEND, {DOWN} 506 | } 507 | return 508 | k:: 509 | Loop, 10{ 510 | Sleep, 5 511 | SEND, {UP} 512 | } 513 | return 514 | l:: 515 | Loop, 10{ 516 | Sleep, 5 517 | SEND, {RIGHT} 518 | } 519 | return 520 | 521 | +h:: 522 | Loop, 10{ 523 | Sleep, 1 524 | SEND, {LEFT} 525 | } 526 | return 527 | +j:: 528 | Loop, 20{ 529 | Sleep, 1 530 | SEND, {DOWN} 531 | } 532 | return 533 | +k:: 534 | Loop, 20{ 535 | Sleep, 1 536 | SEND, {UP} 537 | } 538 | return 539 | +l:: 540 | Loop, 20{ 541 | Sleep, 1 542 | SEND, {RIGHT} 543 | } 544 | return 545 | 546 | 547 | 548 | ;MARKS AND BOOKARMS 549 | #IF (vimEnabled=true) && WinActive("AHK_CLASS CabinetWClass") && (mode!=INSERT_MODE) && (miscMode=false) 550 | ;MARKS/BOOKMARKS 551 | m:: 552 | bookmarkMode := true 553 | HotKey, m, OFF 554 | HotKey, b, OFF 555 | global iniPath 556 | 557 | checkIniFile() 558 | 559 | currentPath := getExplorerPath() 560 | currentPath := urlDecoder(currentPath) 561 | Input, command, L1 T1 562 | if (command!=""){ 563 | IniWrite, %currentPath%, %iniPath%, Marks, %command% 564 | 565 | status = MARK [%command% = %currentPath%] CREATED 566 | setStatus(status) 567 | } 568 | 569 | HotKey, m, ON 570 | HotKey, b, ON 571 | bookmarkMode := false 572 | return 573 | 574 | ':: 575 | bookmarkMode := true 576 | HotKey, m, OFF 577 | HotKey, b, OFF 578 | global iniPath 579 | 580 | checkIniFile() 581 | 582 | Input, command, L1 T1 583 | IniRead, path, %iniPath%, Marks, %command% 584 | 585 | if (path != "ERROR"){ 586 | SEND, {ESCAPE} 587 | SEND, {ALT DOWN}d{ALT UP} 588 | SEND, {CTRL DOWN}a{CTRL UP} 589 | SENDRAW, %path% 590 | SEND, {ENTER} 591 | }else { 592 | status = Mark "%command%" Doesn't Exist 593 | setStatus(status) 594 | } 595 | 596 | HotKey, m, ON 597 | HotKey, b, ON 598 | bookmarkMode := false 599 | return 600 | 601 | b:: 602 | bookmarkMode := true 603 | HotKey, m, OFF 604 | HotKey, b, OFF 605 | global iniPath 606 | 607 | checkIniFile() 608 | 609 | createCommandBar("New Bookmark >") 610 | WinWaitClose, CommandBar 611 | command := commandBarCommand 612 | commandBarCommand := "" 613 | currentPath := getExplorerPath() 614 | currentPath := urlDecoder(currentPath) 615 | 616 | if (command !=""){ 617 | IniWrite, %currentPath%, %iniPath%, Bookmarks, %command% 618 | 619 | status = BOOKMARK [%command% = %currentPath%] CREATED 620 | setStatus(status) 621 | } 622 | 623 | HotKey, m, ON 624 | HotKey, b, ON 625 | bookmarkMode := false 626 | return 627 | 628 | +':: 629 | bookmarkMode := true 630 | HotKey, m, OFF 631 | HotKey, b, OFF 632 | 633 | global iniPath 634 | checkIniFile() 635 | 636 | createCommandBar("Open Bookmark >") 637 | WinWaitClose, CommandBar 638 | bookmark := commandBarCommand 639 | commandBarCommand := "" 640 | 641 | if (bookmark=""){ 642 | }else{ 643 | IniRead, path, %iniPath%, Bookmarks, %bookmark% 644 | if (path != "ERROR"){ 645 | SEND, {ALT DOWN}d{ALT UP} 646 | SENDRAW, %path% 647 | SEND, {ENTER} 648 | }else { 649 | status = BOOKMARK "%bookmark%" Doesn't Exist 650 | setStatus(status) 651 | } 652 | } 653 | 654 | HotKey, m, ON 655 | HotKey, b, ON 656 | bookmarkMode := false 657 | return 658 | 659 | 660 | 661 | 662 | setStatus(status){ 663 | WinGetActiveStats, title, width, height, x, y 664 | y := height - 4 665 | x := 130 666 | 667 | ToolTip, %status%, x, y, 2 668 | ;SetTimer, RemoveStatus, 3000 669 | } 670 | 671 | removeToolTip(whichToolTip){ 672 | ;:RemoveStatus 673 | ;SetTimer, RemoveStatus, OFF 674 | ToolTip, , , , 2 675 | ;return 676 | } 677 | 678 | execCommandModeCommand(){ 679 | global commandBarCommand 680 | if (commandBarCommand="run"){ 681 | createCommandBar("run >") 682 | WinWaitClose, CommandBar 683 | 684 | cwd := getExplorerPath() 685 | runCommand := commandBarCommand 686 | if (runCommand != ""){ 687 | RUN, %runCommand%, %cwd% 688 | } 689 | } 690 | commandBarCommand := "" 691 | } 692 | 693 | showMode() { 694 | global mode 695 | global NORMAL_MODE 696 | global INSERT_MODE 697 | global VISUAL_MODE 698 | global VISUAL_LINE_MODE 699 | global PSUEDO_VISUAL_MODE 700 | global PSUEDO_VISUAL_LINE_MODE 701 | 702 | WinGetActiveStats, title, width, height, x, y 703 | height := height - 4 704 | width := 8 705 | 706 | if (mode=NORMAL_MODE) { 707 | ToolTip, NORMAL MODE, %width%, %height%, 1 708 | } else if (mode=INSERT_MODE){ 709 | ToolTip, INSERT MODE, %width%, %height%, 1 710 | } else if (mode=VISUAL_MODE){ 711 | ToolTip, VISUAL MODE, %width%, %height%, 1 712 | } else if (mode=VISUAL_LINE_MODE){ 713 | ToolTip, VISUAL-LINE MODE, %width%, %height%, 1 714 | } else if (mode=PSUEDO_VISUAL_MODE){ 715 | ToolTip, VISUAL MODE, %width%, %height%, 1 716 | } else if (mode=PSUEDO_VISUAL_LINE_MODE){ 717 | ToolTip, VISUAL-LINE MODE, %width%, %height%, 1 718 | } 719 | } 720 | 721 | joinNumbers(first, second){ 722 | RETURN first * 10 + second 723 | } 724 | 725 | setMode(newMode){ 726 | global mode 727 | global NORMAL_MODE 728 | global INSERT_MODE 729 | global VISUAL_MODE 730 | global VISUAL_LINE_MODE 731 | global PSUEDO_VISUAL_MODE 732 | global PSUEDO_VISUAL_LINE_MODE 733 | 734 | if (mode=NORMAL_MODE) || (newMode=NORMAL_MODE) || (newMode=PSUEDO_VISUAL_MODE) || (newMode=PSUEDO_VISUAL_LINE_MODE){ 735 | mode := newMode 736 | }else if (mode=PSUEDO_VISUAL_MODE) && (newMode=VISUAL_LINE_MODE){ 737 | mode := newMode 738 | } 739 | showMode() 740 | } 741 | 742 | setTransientState(state){ 743 | global transientState 744 | transientState := %state% 745 | showTransientState() 746 | } 747 | 748 | showTransientState(){ 749 | global transientState 750 | } 751 | 752 | enterVimTransientState(tState){ 753 | global mode 754 | 755 | if (mode=NORMAL_MODE){ 756 | if (tState="d") { 757 | dTransientState := true 758 | } else if (tState="c") { 759 | cTransientState := true 760 | } else if (tState="y") { 761 | yTransientState := true 762 | } else if (tState="w") { 763 | wTransientState := true 764 | } 765 | } 766 | } 767 | 768 | runVimMotion(motion){ 769 | global mode 770 | 771 | global NORMAL_MODE 772 | global INSERT_MODE 773 | global VISUAL_MODE 774 | global VISUAL_LINE_MODE 775 | global PSUEDO_VISUAL_MODE 776 | global PSUEDO_VISUAL_LINE_MODE 777 | 778 | global commandCount 779 | if (commandCount=0){ 780 | commandCount := 1 781 | } 782 | 783 | ;BASIC NAVIGATION 784 | if (motion="h"){ 785 | if (mode!=INSERT_MODE) { 786 | SEND, {ALT DOWN}{UP %commandCount%}{ALT UP} 787 | } 788 | } else if (motion="j"){ 789 | if (mode=NORMAL_MODE) { 790 | SEND, {DOWN %commandCount%} 791 | } else if(mode=VISUAL_MODE) { 792 | SEND, {SHIFT DOWN}{DOWN %commandCount%}{SHIFT UP} 793 | } else if(mode=VISUAL_LINE_MODE) { 794 | SEND, {CTRL DOWN}{DOWN %commandCount%}{CTRL UP} 795 | } else if(mode=PSUEDO_VISUAL_MODE) { 796 | Loop, %commandCount%{ 797 | SEND, {SPACE}{CTRL DOWN}{DOWN}{CTRL UP} 798 | } 799 | } else if(mode=PSUEDO_VISUAL_LINE_MODE) { 800 | SEND, {CTRL DOWN}{DOWN %commandCount%}{CTRL UP} 801 | } 802 | } else if (motion="k"){ 803 | if (mode=NORMAL_MODE) { 804 | SEND, {UP %commandCount%} 805 | } else if(mode=VISUAL_MODE) { 806 | SEND, {SHIFT DOWN}{UP %commandCount%}{SHIFT UP} 807 | } else if(mode=VISUAL_LINE_MODE) { 808 | SEND, {CTRL DOWN}{UP %commandCount%}{CTRL UP} 809 | } else if(mode=PSUEDO_VISUAL_MODE) { 810 | Loop, %commandCount%{ 811 | SEND, {SPACE}{CTRL DOWN}{UP}{CTRL UP} 812 | } 813 | } else if(mode=PSUEDO_VISUAL_LINE_MODE) { 814 | SEND, {CTRL DOWN}{UP %commandCount%}{CTRL UP} 815 | } 816 | } else if (motion="l"){ 817 | if (mode!=INSERT_MODE) { 818 | SEND, {ENTER} 819 | } 820 | }else if (motion="+j"){ 821 | SEND, {ALT DOWN}{LEFT %commandCount%}{ALT UP} 822 | }else if (motion="+k"){ 823 | SEND, {ALT DOWN}{RIGHT %commandCount%}{ALT UP} 824 | } 825 | 826 | ;SCROLL NAVIGATION 827 | else if (motion="gg"){ 828 | if (mode=NORMAL_MODE) { 829 | SEND, {HOME} 830 | } else if(mode=VISUAL_MODE) { 831 | SEND, {SHIFT DOWN}{HOME}{SHIFT UP} 832 | } else if(mode=VISUAL_LINE_MODE) { 833 | SEND, {CTRL DOWN}{HOME}{CTRL UP} 834 | } 835 | } 836 | else if (motion="+g"){ 837 | if (mode=NORMAL_MODE) { 838 | SEND, {END} 839 | } else if(mode=VISUAL_MODE) { 840 | SEND, {SHIFT DOWN}{END}{SHIFT UP} 841 | } else if(mode=VISUAL_LINE_MODE) { 842 | SEND, {CTRL DOWN}{END}{CTRL UP} 843 | } 844 | } else if (motion="+h"){ 845 | if (mode=NORMAL_MODE) { 846 | SEND, {PGUP} 847 | } else if(mode=VISUAL_MODE) { 848 | SEND, {SHIFT DOWN}{PGUP %commandCount%}{SHIFT UP} 849 | } else if(mode=VISUAL_LINE_MODE) { 850 | SEND, {CTRL DOWN}{PGUP %commandCount%}{CTRL UP} 851 | } 852 | } else if (motion="+l"){ 853 | if (mode=NORMAL_MODE) { 854 | SEND, {PGDN %commandCount%} 855 | } else if(mode=VISUAL_MODE) { 856 | SEND, {SHIFT DOWN}{PGDN %commandCount%}{SHIFT UP} 857 | } else if(mode=VISUAL_LINE_MODE) { 858 | SEND, {CTRL DOWN}{PGDN %commandCount%}{CTRL UP} 859 | } 860 | } else if (motion="+m"){ 861 | if (mode=NORMAL_MODE) { 862 | } else if(mode=VISUAL_MODE) { 863 | } else if(mode=VISUAL_LINE_MODE) { 864 | } 865 | } 866 | 867 | commandCount := 0 868 | } 869 | 870 | runVimOperator(command){ 871 | global mode 872 | global commandCount 873 | 874 | global operatorDelete 875 | global operatorPermanentDelete 876 | global operatorChange 877 | global operatorYank 878 | global operatorCut 879 | global ggCommand 880 | 881 | global NORMAL_MODE 882 | global INSERT_MODE 883 | global VISUAL_MODE 884 | global VISUAL_LINE_MODE 885 | global PSUEDO_VISUAL_MODE 886 | global PSUEDO_VISUAL_LINE_MODE 887 | 888 | commandCount := commandCount - 1 889 | 890 | ;VIM OPERATORS 891 | if (command="dd"){ 892 | SEND, {SHIFT DOWN}{DOWN %commandCount%}{SHIFT UP}{DELETE} 893 | } else if (command="da"){ 894 | } else if (command="db"){ 895 | } else if (command="dA"){ 896 | } else if (command="dB"){ 897 | } 898 | 899 | else if (command="DD"){ 900 | SEND, {SHIFT DOWN}{DOWN %commandCount%}{SHIFT UP}{SHIFT DOWN}{DELETE}{SHIFT UP} 901 | } else if (command="Da"){ 902 | } else if (command="Db"){ 903 | } else if (command="DA"){ 904 | } else if (command="DB"){ 905 | } 906 | 907 | else if (command="cc"){ 908 | SEND, {SHIFT DOWN}{DOWN %commandCount%}{SHIFT UP}{F2} 909 | }else if (command="c."){ 910 | } 911 | 912 | else if (command="yy"){ 913 | SEND, {SHIFT DOWN}{DOWN %commandCount%}{SHIFT UP}{CTRL DOWN}c{CTRL UP} 914 | } else if (command="ya"){ 915 | } else if (command="yb"){ 916 | } else if (command="yA"){ 917 | } else if (command="yB"){ 918 | } else if (command="yp"){ 919 | SEND, {ALT DOWN}HCP{ALT UP} 920 | } else if (command="yt"){ 921 | SEND, {SHIFT DOWN}{DOWN %commandCount%}{SHIFT UP}{ALT DOWN}HCF{ALT UP} 922 | } 923 | 924 | 925 | else if (command="xx"){ 926 | SEND, {SHIFT DOWN}{DOWN %commandCount%}{SHIFT UP}{CTRL DOWN}x{CTRL UP} 927 | } else if (command="xa"){ 928 | } else if (command="xb"){ 929 | } else if (command="xA"){ 930 | } else if (command="xB"){ 931 | } else if (command="xt"){ 932 | SEND, {SHIFT DOWN}{DOWN %commandCount%}{SHIFT UP}{ALT DOWN}HM{ALT UP} 933 | } 934 | 935 | commandCount := 0 936 | } 937 | 938 | 939 | createCommandBar(prompt=""){ 940 | global CommandBar 941 | global commandBarCommand 942 | 943 | customColor := 333333 944 | GUI CommandBar: NEW 945 | GUI CommandBar: FONT, s14 cFFFFFF 946 | GUI CommandBar: COLOR, %customColor%, %customColor% 947 | GUI CommandBar: MARGIN, 12, 12 948 | 949 | WINSET, TRANSCOLOR, %customColor% 20, CommandBar 950 | GUI CommandBar: +LASTFOUND -CAPTION +ALWAYSONTOP 951 | 952 | ;GUI CommandBar: ADD, TEXT, y13 c9966FF, %prompt% 953 | GUI CommandBar: ADD, TEXT, y13, %prompt% 954 | GUI CommandBar: ADD, EDIT, y12 h70 w600 cE6E6E6 r1 -E0x200 vcommandBarCommand 955 | GUI CommandBar: SHOW, xCENTER y100, CommandBar 956 | } 957 | 958 | 959 | checkIniFile(){ 960 | global iniPath 961 | if !(FileExist(iniPath)){ 962 | FileOpen(initPath, w) 963 | } 964 | } 965 | 966 | 967 | GetFileCount(Directory){ 968 | fso := ComObjCreate("Scripting.FileSystemObject") 969 | try 970 | objFiles := fso.GetFolder(Directory).Files 971 | catch 972 | return -1 973 | return objFiles.count 974 | } 975 | 976 | getExplorerPath(handler=""){ 977 | IF (handler = "" ) 978 | handler := WINEXIST("A") 979 | WINGET process, ProcessName, ahk_id %handler% 980 | IF (process = "explorer.exe"){ 981 | WINGETCLASS windowClass, ahk_id %handler% 982 | IF (windowClass ~= "Progman|WorkerW") 983 | windowPath := A_Desktop 984 | ELSE IF (windowClass ~= "(Cabinet|Explore)WClass"){ 985 | FOR window IN ComObjCreate("Shell.Application").Windows 986 | IF (window.HWnd == handler){ 987 | URL := window.LocationURL 988 | BREAK 989 | } 990 | STRINGTRIMLEFT, windowPath, URL, 8 ; remove "file:///" 991 | STRINGREPLACE windowPath, windowPath, /, \, All 992 | } 993 | } 994 | path := urlDecoder(windowPath) 995 | RETURN path 996 | } 997 | 998 | urlDecoder(string) { 999 | Loop 1000 | if RegExMatch(string, "i)(?<=%)[\da-f]{1,2}", hex) 1001 | StringReplace, string, string, `%%hex%, % Chr("0x" . hex), All 1002 | else break 1003 | return, string 1004 | } 1005 | 1006 | 1007 | resetOperators(){ 1008 | } 1009 | resetTransientState(){ 1010 | } 1011 | ressetMode(){ 1012 | } 1013 | resetEverything(){ 1014 | } 1015 | 1016 | resetToolTip(){ 1017 | ToolTip, ,,, 1 1018 | ToolTip, ,,, 2 1019 | } 1020 | 1021 | --------------------------------------------------------------------------------