Neomutt는 매크로 키를 누르면 파일을 추가하는 명령을 실행합니다.

Neomutt는 매크로 키를 누르면 파일을 추가하는 명령을 실행합니다.

NeoMutt에서 메시지에 파일을 첨부하기 위해 Ranger를 사용하려고 합니다. 내가 지금까지 가지고 있는 것은

  1. Ranger를 실행하여 첨부할 파일을 선택하고 이름을 저장합니다 /tmp/muttattach.
ranger --choosefile=/tmp/muttattach
  1. 읽을 매크로 정의muttattach
macro compose V "<attach-file>`cat /tmp/muttattach`<enter>"

문제는 매크로가 시작 시에만 실행된다는 것입니다. 작성 화면을 눌러도 V파일 이름이 업데이트되지 않습니다.

<pipe-message>나는 또한 그들이 했던 것처럼 mutt에서 Ranger를 직접 실행해 보았습니다.여기첨부 파일을 다운로드했지만 zsh에서 실행되지 않습니다.

답변1

다음과 같은 구성 파일을 만듭니다.~/.neomutt/attach.macro매크로 정의만 포함됩니다.

macro compose W \
"<attach-file>`cat /tmp/muttattach`<enter>" \
"attach file"

다음을 수행하는 다른 매크로를 정의하십시오.

  1. 위의 구성 파일을 가져옵니다.~/.neomutt/attach.macro
  2. 주문 실행W를 누르세요(새로 정의된 매크로에 바인딩)
macro compose V \
"<enter-command>source ~/.neomutt/attach.macro<enter>\
<enter-command>push W<enter>" \
"redefine macro and attach"

따라서 키를 누르면 V/tmp/muttattach의 새 내용으로 매크로를 재정의하는 구성 파일을 다시 가져옵니다. 실행해 보세요.

답변2

Jakub의 답변 덕분에 나는 내가 원하는 것을 할 수 있었고 mutt에서 ranger를 실행하여 파일을 선택할 수 있었습니다. 이것은 매크로입니다:

macro compose V \ 
"<shell-escape> ranger --choosefile=/tmp/muttattach<enter>\  
<enter-command>source ~/.config/neomutt/attach.macro<enter>\   
<enter-command>push W<enter>"\   
"open ranger, redefine macro and attach"

그리고 내용~/.config/neomutt/attach.macro

macro compose W \
"<attach-file>`cat /tmp/muttattach`<enter>"\
"attach file"

관련 정보