[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [feature request] Add ".sh" or ".bash" extension to tmpfile generate
From: |
Chet Ramey |
Subject: |
Re: [feature request] Add ".sh" or ".bash" extension to tmpfile generated by `fc` |
Date: |
Sat, 21 Sep 2024 16:27:21 -0400 |
User-agent: |
Mozilla Thunderbird |
On 9/21/24 1:03 AM, Oğuz wrote:
On Saturday, September 21, 2024, Koichi Murase <myoga.murase@gmail.com
<mailto:myoga.murase@gmail.com>> wrote:
Emacs has `auto-mode-alist'. VS Code has `files.associations'.
I think he meant a command line option. Like something you can put in FCEDIT
I did. But if there aren't any options to select the syntax editing mode,
you can use an approach like this:
: ${EDITOR:=emacs}
case $1 in
*.bash) FN=$1 MV=':' ;;
*) FN=${1}.bash MV=mv ;;
esac
$MV "$1" "$FN"
$EDITOR "$FN"
$MV "$FN" "$1"
Wrap that in a script or function and assign it to FCEDIT. You could
also use ln and rm instead of mv, but this works. And test it; I didn't.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature
Re: [feature request] Add ".sh" or ".bash" extension to tmpfile generated by `fc`, Martin D Kealey, 2024/09/20
Re: [feature request] Add ".sh" or ".bash" extension to tmpfile generated by `fc`, Chet Ramey, 2024/09/20
Re: [feature request] Add ".sh" or ".bash" extension to tmpfile generated by `fc`, shynur ., 2024/09/20