Skip to content

Try to launch gvim instead vim internally by this script, but it not work. #1

Description

@tangyi217

When try to use "gvim" instead of "vim" in below line in this script:
vim_rc = subprocess.call(['gvim', '-R', '--cmd', 'au VimEnter * so ' + vim_file_name])

gvim is lunched, but with an error to say that tmp file can not found.....

After i made below change in this script, gvim works fine. Can you have look at it and consider to merge it into master later ?

.....
vim_rc = os.EX_OK
import re
pattern = re.compile("gvim")

if changed_file:
    if pattern.search(script_name):
         vim_rc = subprocess.call(['gvim', '-R', '--cmd', 'au VimEnter * so ' + vim_file_name])
    else:
         vim_rc = subprocess.call(['vim',  '-R', '--cmd', 'au VimEnter * so ' + vim_file_name])
         shutil.rmtree(temp_dir)  ### in gvim case, we can NOT call this which will delete files which is still used by gvim.
sys.exit(vim_rc)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions