mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-18 17:29:28 +03:00
Merge branch '4203_custom_zshrc'
* 4203_custom_zshrc: Ticket #4203: support custom .zshrc.
This commit is contained in:
commit
26e568cd7e
@ -2465,7 +2465,10 @@ and special keyboard maps in ~/.local/share/mc/inputrc (fallback ~/.inputrc).
|
|||||||
.B ash/dash
|
.B ash/dash
|
||||||
users (BusyBox or Debian) may specify startup commands in ~/.local/share/mc/ashrc (fallback ~/.profile).
|
users (BusyBox or Debian) may specify startup commands in ~/.local/share/mc/ashrc (fallback ~/.profile).
|
||||||
.PP
|
.PP
|
||||||
.B tcsh, zsh, fish
|
.B zsh
|
||||||
|
users may specify startup commands in ~/.local/share/mc/.zshrc (fallback ~/.zshrc).
|
||||||
|
.PP
|
||||||
|
.B tcsh, fish
|
||||||
users cannot specify mc-specific startup commands at present. They have to rely on
|
users cannot specify mc-specific startup commands at present. They have to rely on
|
||||||
shell-specific startup files.
|
shell-specific startup files.
|
||||||
.PP
|
.PP
|
||||||
|
@ -2801,6 +2801,11 @@ subshell, в файле
|
|||||||
.B ~/.local/share/mc/bashrc
|
.B ~/.local/share/mc/bashrc
|
||||||
и специальную карту раскладки клавиатуры в файле
|
и специальную карту раскладки клавиатуры в файле
|
||||||
.BR ~/.local/share/mc/inputrc .
|
.BR ~/.local/share/mc/inputrc .
|
||||||
|
Если вы используете
|
||||||
|
.BR zsh ,
|
||||||
|
можно указать команды, которые будут выполняться при запуске
|
||||||
|
subshell, в файле
|
||||||
|
.B ~/.local/share/mc/.zshrc .
|
||||||
Пользователи
|
Пользователи
|
||||||
.B tcsh
|
.B tcsh
|
||||||
могут задать выполняемые при запуске команды в файле
|
могут задать выполняемые при запуске команды в файле
|
||||||
|
@ -52,6 +52,7 @@
|
|||||||
#define MC_EXTFS_DIR "extfs.d"
|
#define MC_EXTFS_DIR "extfs.d"
|
||||||
|
|
||||||
#define MC_BASHRC_FILE "bashrc"
|
#define MC_BASHRC_FILE "bashrc"
|
||||||
|
#define MC_ZSHRC_FILE ".zshrc"
|
||||||
#define MC_CONFIG_FILE "ini"
|
#define MC_CONFIG_FILE "ini"
|
||||||
#define MC_FILEBIND_FILE "mc.ext"
|
#define MC_FILEBIND_FILE "mc.ext"
|
||||||
#define MC_FILEPOS_FILE "filepos"
|
#define MC_FILEPOS_FILE "filepos"
|
||||||
|
@ -77,6 +77,7 @@ static const struct
|
|||||||
{ &mc_data_str, "ashrc" },
|
{ &mc_data_str, "ashrc" },
|
||||||
{ &mc_data_str, "bashrc" },
|
{ &mc_data_str, "bashrc" },
|
||||||
{ &mc_data_str, "inputrc" },
|
{ &mc_data_str, "inputrc" },
|
||||||
|
{ &mc_data_str, MC_ZSHRC_FILE },
|
||||||
{ &mc_data_str, MC_EXTFS_DIR },
|
{ &mc_data_str, MC_EXTFS_DIR },
|
||||||
{ &mc_data_str, MC_HISTORY_FILE },
|
{ &mc_data_str, MC_HISTORY_FILE },
|
||||||
{ &mc_data_str, MC_FILEPOS_FILE },
|
{ &mc_data_str, MC_FILEPOS_FILE },
|
||||||
|
@ -97,6 +97,7 @@
|
|||||||
|
|
||||||
#include "lib/global.h"
|
#include "lib/global.h"
|
||||||
|
|
||||||
|
#include "lib/fileloc.h"
|
||||||
#include "lib/unixcompat.h"
|
#include "lib/unixcompat.h"
|
||||||
#include "lib/tty/tty.h" /* LINES */
|
#include "lib/tty/tty.h" /* LINES */
|
||||||
#include "lib/tty/key.h" /* XCTRL */
|
#include "lib/tty/key.h" /* XCTRL */
|
||||||
@ -370,9 +371,26 @@ init_subshell_child (const char *pty_name)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* TODO: Find a way to pass initfile to TCSH, ZSH and FISH */
|
|
||||||
case SHELL_TCSH:
|
|
||||||
case SHELL_ZSH:
|
case SHELL_ZSH:
|
||||||
|
/* ZDOTDIR environment variable is the only way to point zsh
|
||||||
|
* to an other rc file than the default. */
|
||||||
|
|
||||||
|
/* Don't overwrite $ZDOTDIR */
|
||||||
|
if (g_getenv ("ZDOTDIR") != NULL)
|
||||||
|
{
|
||||||
|
/* Do we have a custom init file ~/.local/share/mc/.zshrc?
|
||||||
|
* Otherwise use standard ~/.zshrc */
|
||||||
|
init_file = mc_config_get_full_path (MC_ZSHRC_FILE);
|
||||||
|
if (exist_file (init_file))
|
||||||
|
{
|
||||||
|
/* Set ZDOTDIR to ~/.local/share/mc */
|
||||||
|
g_setenv ("ZDOTDIR", mc_config_get_data_path (), TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* TODO: Find a way to pass initfile to TCSH and FISH */
|
||||||
|
case SHELL_TCSH:
|
||||||
case SHELL_FISH:
|
case SHELL_FISH:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -416,7 +434,6 @@ init_subshell_child (const char *pty_name)
|
|||||||
/* Use -g to exclude cmds beginning with space from history
|
/* Use -g to exclude cmds beginning with space from history
|
||||||
* and -Z to use the line editor on non-interactive term */
|
* and -Z to use the line editor on non-interactive term */
|
||||||
execl (mc_global.shell->path, "zsh", "-Z", "-g", (char *) NULL);
|
execl (mc_global.shell->path, "zsh", "-Z", "-g", (char *) NULL);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHELL_ASH_BUSYBOX:
|
case SHELL_ASH_BUSYBOX:
|
||||||
|
@ -134,37 +134,41 @@ static const struct test_user_config_paths_ds
|
|||||||
},
|
},
|
||||||
{ /* 14. */
|
{ /* 14. */
|
||||||
CONF_DATA,
|
CONF_DATA,
|
||||||
MC_EXTFS_DIR
|
MC_ZSHRC_FILE
|
||||||
},
|
},
|
||||||
{ /* 15. */
|
{ /* 15. */
|
||||||
CONF_DATA,
|
CONF_DATA,
|
||||||
MC_HISTORY_FILE
|
MC_EXTFS_DIR
|
||||||
},
|
},
|
||||||
{ /* 16. */
|
{ /* 16. */
|
||||||
CONF_DATA,
|
CONF_DATA,
|
||||||
MC_FILEPOS_FILE
|
MC_HISTORY_FILE
|
||||||
},
|
},
|
||||||
{ /* 17. */
|
{ /* 17. */
|
||||||
CONF_DATA,
|
CONF_DATA,
|
||||||
EDIT_HOME_CLIP_FILE
|
MC_FILEPOS_FILE
|
||||||
},
|
},
|
||||||
{ /* 18. */
|
{ /* 18. */
|
||||||
CONF_DATA,
|
CONF_DATA,
|
||||||
MC_MACRO_FILE
|
EDIT_HOME_CLIP_FILE
|
||||||
},
|
},
|
||||||
{ /* 19. */
|
{ /* 19. */
|
||||||
CONF_CACHE,
|
CONF_DATA,
|
||||||
"mc.log"
|
MC_MACRO_FILE
|
||||||
},
|
},
|
||||||
{ /* 20. */
|
{ /* 20. */
|
||||||
CONF_CACHE,
|
CONF_CACHE,
|
||||||
MC_TREESTORE_FILE
|
"mc.log"
|
||||||
},
|
},
|
||||||
{ /* 21. */
|
{ /* 21. */
|
||||||
CONF_CACHE,
|
CONF_CACHE,
|
||||||
EDIT_HOME_TEMP_FILE
|
MC_TREESTORE_FILE
|
||||||
},
|
},
|
||||||
{ /* 22. */
|
{ /* 22. */
|
||||||
|
CONF_CACHE,
|
||||||
|
EDIT_HOME_TEMP_FILE
|
||||||
|
},
|
||||||
|
{ /* 23. */
|
||||||
CONF_CACHE,
|
CONF_CACHE,
|
||||||
EDIT_HOME_BLOCK_FILE
|
EDIT_HOME_BLOCK_FILE
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user