( filename, command, modifiers )
| 655 | |
| 656 | |
| 657 | def JumpToFile( filename, command, modifiers ): |
| 658 | vim_command = GetVimCommand( command ) |
| 659 | try: |
| 660 | escaped_filename = EscapeFilepathForVimCommand( filename ) |
| 661 | vim.command( |
| 662 | f'keepjumps { modifiers } { vim_command } { escaped_filename }' ) |
| 663 | # When the file we are trying to jump to has a swap file |
| 664 | # Vim opens swap-exists-choices dialog and throws vim.error with E325 error, |
| 665 | # or KeyboardInterrupt after user selects one of the options. |
| 666 | except vim.error as e: |
| 667 | if 'E325' not in str( e ): |
| 668 | raise |
| 669 | # Do nothing if the target file is still not opened (user chose (Q)uit). |
| 670 | if filename != GetCurrentBufferFilepath(): |
| 671 | return False |
| 672 | # Thrown when user chooses (A)bort in .swp message box. |
| 673 | except KeyboardInterrupt: |
| 674 | return False |
| 675 | return True |
| 676 | |
| 677 | |
| 678 | # Both |line| and |column| need to be 1-based |
no test coverage detected