Create a temporary scratch file and open it in your default editor.
vimtmp [OPTIONS]Creates a temporary file in the system's temporary directory and opens it in your preferred text editor (defined by the EDITOR environment variable). The file persists after the editor closes, allowing you to reference it later in the same session.
This is useful for quick notes, temporary calculations, or drafting text without cluttering your workspace with permanent files.
EDITORenvironment variable must be set to your preferred editor
-h, --help: Show help message and exit
# Create and edit a scratch file
vimtmp
# Show help
vimtmp --help- Checks that
EDITORis set - Creates a temporary file using
mktemp - Displays the file path
- Opens the file in your editor
- Returns when you close the editor
The temporary file remains on disk until your system cleans up temporary files (typically on reboot), so you can reference it multiple times in the same session.
If EDITOR is not set, add it to your shell configuration:
# For vim
export EDITOR=vim
# For nano
export EDITOR=nano
# For VS Code
export EDITOR=code
# For emacs
export EDITOR=emacs0: Scratch file created and editor launched successfully1:EDITORnot set or other error occurred