tomrijndorp / vscode-finditfaster

Find it, but faster! Fast file search for VS Code.
MIT License
299 stars 29 forks source link

Customizing of FZF_DEFAULT_OPTS or other options #25

Closed rkpatel33 closed 1 year ago

rkpatel33 commented 1 year ago

(I hope this is the right place to ask questions, this extension is amazing).

I was wondering if there was any way to override my system FZF_DEFAULT_OPTS variable when used in VSCode. I noticed at adding things like this in my .zshrc file:

FZF_DEFAULT_OPTS="--height=50% --layout=reverse

Will take effect in VSCode (the 50% for example will make the take half the VSC terminal and look weird). My use case is using --layout=reverse in VSC and not using it in my terminal.

I took a quick look at the code and see that it seems to just default to the one set in your terminal.

I supposed one could write an if/then in the .zshrc to configure it, but not sure how to tell if the terminal sourcing the .zshrc file is inside VSC.

Thx.

tomrijndorp commented 1 year ago

Hi @rkpatel33, glad you like the extension! Could you check if this generic solution works for you?

https://code.visualstudio.com/docs/terminal/profiles

That would be ideal. If that does not, I think it should be possible to specify additional options in the extension settings and pass them to the terminal, but I haven't had time to look yet.

rkpatel33 commented 1 year ago

Ah thanks, that seems like there would be a solution in there, however, I just added this to my .zshrc and it did the trick perfectly. There are a few VScode env vars in the terminal. I have no idea what they mean, but they are an easy what to detect you on in a VSCode terminal.

if [[ -z "$VSCODE_INJECTION" ]]; then
  # NOT in Vscode environment
  export FZF_DEFAULT_OPTS="--info=inline --border"
else
  # In vscode environment
  export FZF_DEFAULT_OPTS="--info=inline --border --layout=reverse"
fi