mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-23 03:51:31 +01:00
zsh: vimscratch: add filetype arg
Allows setting filetype for vimscratch command. Usage: `<command> | vimscratch [filetype]`. For example: ```bash curl https://myip.wtf/json | vimscratch json ``` Will open the output of the curl command as a json temporary file in vim.
This commit is contained in:
parent
f4e960be35
commit
41eb8f1a5f
|
@ -6,5 +6,13 @@ vimscratch() {
|
|||
if [ ! -t 0 ] ; then
|
||||
stdin_arg="-"
|
||||
fi
|
||||
vim -c "set buftype=nofile" $@ $stdin_arg
|
||||
set +x
|
||||
if [[ -n "$1" ]]; then
|
||||
filetype=$1
|
||||
shift
|
||||
vim -c "set buftype=nofile" -c "set filetype=$filetype" $@ $stdin_arg
|
||||
else
|
||||
vim -c "set buftype=nofile" $filetype_arg $@ $stdin_arg
|
||||
fi
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user