瀏覽代碼

Pass current file name as first argument to custom scripts

master
Arun Prakash Jana 7 年之前
父節點
當前提交
042d008392
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: A75979F35C080412
共有 3 個檔案被更改,包括 9 行新增2 行删除
  1. +2
    -0
      README.md
  2. +1
    -1
      nnn.1
  3. +6
    -1
      nnn.c

+ 2
- 0
README.md 查看文件

@@ -421,6 +421,8 @@ Note that you may want to keep quotes disabled in this case.

#### run custom scripts

`nnn` can invoke custom scripts with the currently selected file name as argument 1.

Export the path to the custom executable script:

export NNN_SCRIPT=/usr/local/bin/nscript


+ 1
- 1
nnn.1 查看文件

@@ -263,7 +263,7 @@ screensaver.
\fBNNN_QUOTE_ON:\fR wrap copied paths within single quotes. Useful for pasting
names in the shell.
.Pp
\fBNNN_SCRIPT:\fR path to a custom script to run.
\fBNNN_SCRIPT:\fR path to a custom script to invoke with currently selected file name as argument 1.
.Bd -literal
export NNN_SCRIPT=/usr/local/bin/nscript
.Ed


+ 6
- 1
nnn.c 查看文件

@@ -3239,7 +3239,12 @@ nochange:

tmp = newpath;
}
spawn(run, tmp, NULL, path, F_NORMAL | F_SIGINT);

char *curfile = NULL;
if (ndents > 0)
curfile = dents[cur].name;

spawn(run, tmp, curfile, path, F_NORMAL | F_SIGINT);
}
} else {
spawn(run, NULL, NULL, path, F_NORMAL | F_MARKER);


Loading…
取消
儲存