Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user customization of termpath #25

Open
Konfekt opened this issue Nov 22, 2014 · 2 comments
Open

user customization of termpath #25

Konfekt opened this issue Nov 22, 2014 · 2 comments

Comments

@Konfekt
Copy link
Contributor

Konfekt commented Nov 22, 2014

Dear Justin, the lines

    if s:termpath =~? "bash" && executable(s:termpath)
      silent exe '!start '.$COMSPEC.' /c "cd "'.l:dir.'" & "' . s:termpath . '" --login -i "'
    else "Assume it's a path with the required arguments (considered 'not executable' by Vim).
      if s:empty(s:termpath) | let s:termpath = 'cmd.exe /k'  | endif
      " Yes, these are nested quotes (""foo" "bar""), and yes, that is what cmd.exe expects.
      silent exe '!start '.s:termpath.' "cd "'.l:dir.'""'
    endif

are insufficient to deal with user customized termpath variables.

For example, I wanted gtfo to set up such that it uses mintty of msys2 and

mintty -i /msys2.ico /usr/bin/env CHERE_INVOKING=1 /usr/bin/bash --login

would invoke the first case of the above if clause but the above command already takes care of the cd command. Wrapping the above command in a bat, so that gtfo does not detect the bash string, still leaves the unnecessary cd command.

Perhaps the way to go is to allow the user to specify all the parameters passed to the terminal AND their order by a wildcards for the path such as @PATH.

That is, something like

let g:gtfo#terminals = {'win' : 'ms2.bat @PATH@'}

or

let g:gtfo#terminals = {'win' : 'cd '' @PATH@ '' && cygstart mintty /bin/env CHERE_INVOKING=1' /bin/bash''}
@justinmk
Copy link
Owner

would invoke the first case of the above if clause

@Konfekt I can make the condition more precise so that it correctly falls through to the second clause.

still leaves the unnecessary cd command.

So it works, except for an unnecessary cd?

Perhaps the way to go is to allow the user to specify all the parameters passed

Configuration defeats the purpose of the plugin :) g:gtfo#terminals was added for desperate edge cases.

@Konfekt
Copy link
Contributor Author

Konfekt commented Nov 23, 2014

Yes, it works without cd, but this is a user defined batch file.

gtfo`s utility lies in providing defaults for spawning a terminal or file manager in any os from VIM.

However if the user decides to spawn in a particular OS its customized terminal or file manager, gtfo should not interfere. This is why, in case the user provides such a customization, the check for bash is not sufficient.

I think better would be do add an variable isUserTermpath that keeps track if the termpath was provided by the user or not. In this case, just

 silent exe '!start '.s:termpath

and allow for a wildcard in the user customized termpath to let the user decide where in the string of arguments passed to the shell the file path actually has to go. Everything else is out of scope.

If this sounds sane, I'd offer to implement this in a pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants