Ver código fonte

Use \ as alternative prompt/run command keybind

master
Arun Prakash Jana 5 anos atrás
pai
commit
741f82b091
Nenhuma chave conhecida encontrada para esta assinatura no banco de dados ID da chave GPG: A75979F35C080412
3 arquivos alterados com 25 adições e 14 exclusões
  1. +1
    -1
      README.md
  2. +23
    -12
      src/nnn.c
  3. +1
    -1
      src/nnn.h

+ 1
- 1
README.md Ver arquivo

@@ -234,7 +234,7 @@ The list below is from the **dev branch**. Press <kbd>?</kbd> in `nnn` to see th
C Execute entry R ^V Pick plugin
U Manage session = Launch app
c Remote mount u Unmount
] ^P Prompt/run cmd L Lock
\ ^P Prompt/run cmd L Lock
```

Notes:


+ 23
- 12
src/nnn.c Ver arquivo

@@ -1397,7 +1397,8 @@ static bool xdiraccess(const char *path)

static void opstr(char *buf, char *op)
{
snprintf(buf, CMD_LEN_MAX, "xargs -0 sh -c '%s \"$0\" \"$@\" . < /dev/tty' < %s", op, g_selpath);
snprintf(buf, CMD_LEN_MAX, "xargs -0 sh -c '%s \"$0\" \"$@\" . < /dev/tty' < %s",
op, g_selpath);
}

static void rmmulstr(char *buf)
@@ -2073,12 +2074,13 @@ static int filterentries(char *path)
if (r == OK) {
/* Handle all control chars in main loop */
if ((*ch < ASCII_MAX && keyname(*ch)[0] == '^' && *ch != '^')
|| (*ch == ']' && len == 1)) {
|| (*ch == '\\')) {
DPRINTF_D(*ch);
DPRINTF_S(keyname(*ch));

/* If there's a filter, try a command on ^P */
if (cfg.filtercmd && *ch == CONTROL('P') && len > 1) {
if (cfg.filtercmd && (*ch == CONTROL('P') || *ch == '\\')
&& len > 1) {
prompt_run(pln, (ndents ? dents[cur].name : ""), path);

/* Clear the prompt */
@@ -2086,6 +2088,7 @@ static int filterentries(char *path)
wln[--len] = '\0';
wcstombs(ln, wln, REGEX_MAX);
ndents = total;
cur = oldcur = 0; /* Ran a command, refresh */
if (matches(pln) != -1)
redraw(path);

@@ -2898,10 +2901,14 @@ static void save_session(bool last_session, int *presel)
for (i = 0; i < CTX_MAX; ++i)
if ((fwrite(&g_ctx[i].c_cfg, sizeof(settings), 1, fsession) != 1)
|| (fwrite(&g_ctx[i].color, sizeof(uint), 1, fsession) != 1)
|| (header.nameln[i] > 0 && fwrite(g_ctx[i].c_name, header.nameln[i], 1, fsession) != 1)
|| (header.lastln[i] > 0 && fwrite(g_ctx[i].c_last, header.lastln[i], 1, fsession) != 1)
|| (header.fltrln[i] > 0 && fwrite(g_ctx[i].c_fltr, header.fltrln[i], 1, fsession) != 1)
|| (header.pathln[i] > 0 && fwrite(g_ctx[i].c_path, header.pathln[i], 1, fsession) != 1))
|| (header.nameln[i] > 0
&& fwrite(g_ctx[i].c_name, header.nameln[i], 1, fsession) != 1)
|| (header.lastln[i] > 0
&& fwrite(g_ctx[i].c_last, header.lastln[i], 1, fsession) != 1)
|| (header.fltrln[i] > 0
&& fwrite(g_ctx[i].c_fltr, header.fltrln[i], 1, fsession) != 1)
|| (header.pathln[i] > 0
&& fwrite(g_ctx[i].c_path, header.pathln[i], 1, fsession) != 1))
goto END;

status = TRUE;
@@ -2952,10 +2959,14 @@ static bool load_session(const char *sname, char **path, char **lastdir, char **
for (; i < CTX_MAX; ++i)
if ((fread(&g_ctx[i].c_cfg, sizeof(settings), 1, fsession) != 1)
|| (fread(&g_ctx[i].color, sizeof(uint), 1, fsession) != 1)
|| (header.nameln[i] > 0 && fread(g_ctx[i].c_name, header.nameln[i], 1, fsession) != 1)
|| (header.lastln[i] > 0 && fread(g_ctx[i].c_last, header.lastln[i], 1, fsession) != 1)
|| (header.fltrln[i] > 0 && fread(g_ctx[i].c_fltr, header.fltrln[i], 1, fsession) != 1)
|| (header.pathln[i] > 0 && fread(g_ctx[i].c_path, header.pathln[i], 1, fsession) != 1))
|| (header.nameln[i] > 0
&& fread(g_ctx[i].c_name, header.nameln[i], 1, fsession) != 1)
|| (header.lastln[i] > 0
&& fread(g_ctx[i].c_last, header.lastln[i], 1, fsession) != 1)
|| (header.fltrln[i] > 0
&& fread(g_ctx[i].c_fltr, header.fltrln[i], 1, fsession) != 1)
|| (header.pathln[i] > 0
&& fread(g_ctx[i].c_path, header.pathln[i], 1, fsession) != 1))
goto END;

*path = g_ctx[cfg.curctx].c_path;
@@ -3507,7 +3518,7 @@ static void show_help(const char *path)
"cC Execute entry R ^V Pick plugin\n"
"cU Manage session = Launch app\n"
"cc SSHFS mount u Unmount\n"
"9] ^P Prompt/run cmd L Lock\n"};
"9\\ ^P Prompt/run cmd L Lock\n"};

fd = create_tmp_file();
if (fd == -1)


+ 1
- 1
src/nnn.h Ver arquivo

@@ -257,7 +257,7 @@ static struct key bindings[] = {
/* Launcher */
{ '=', SEL_LAUNCH },
/* Run a command */
{ ']', SEL_RUNCMD },
{ '\\', SEL_RUNCMD },
{ CONTROL('P'), SEL_RUNCMD },
/* Open in EDITOR or PAGER */
{ 'e', SEL_RUNEDIT },


Carregando…
Cancelar
Salvar