-
Notifications
You must be signed in to change notification settings - Fork 1
Editor
TReq follows the Unix philosophy. It seeks to be great in one purpose: make HTTP requests given some datas and returning the response. As a result, TReq doesn't have a built in way to edit a Body of Requests. It delegates this work to the text editor of your choice. It is recommend you use a terminal text editor like 'vim', 'neovim', 'nano', or even 'emacs' to edit these.
To make use of the full set of feature provided by TReq, theEDITOR
environment variable needs to be set. TReq will use this variable when opening the text editor.
If the EDITOR environment variable is code
, the command code /tmp/some_tmp_file.json
is executed, and if it is nvim
, the command nvim /tmp/some_tmp_file.json
is executed.
If you do not already have an EDITOR set (to check, type echo $EDITOR
, into your terminal. The output is the editor that will be used by TReq), you can set up the EDITOR environment variable in a terminal session using the command below. However, after you close the terminal session (window) this configuration will be dropped.
# instead vim you can use 'nano', 'emacs', 'code', etc...
export EDITOR=vim
To set this up permanent it is necessary to edit your shell configuration. For example:
# for bash users
echo 'export EDITOR=vim' >> ~/.bashrc
# for zsh users
echo 'export EDITOR=vim' >> ~/.zshrc
# for fish users
echo 'set EDITOR vim' >> ~/.config/fish/config.fish
We recommend you to use a terminal text editor like vi or nano.
However, TReq will work fine with some graphical editors, like VS Code or Atom. You'll only need to set EDITOR
variable as below seen with command to open it.
In these cases, when you hit the command to 'edit body', TReq will open the graphical editor up, and you will need to hit reload the file with r in TReq ever time you make some change.
This command will load again the content of file used to edit body in memory to make the request.