mirror of
https://github.com/jarun/nnn.git
synced 2024-12-01 02:49:44 +00:00
Resolve ~ (HOME) at chdir prompt
This commit is contained in:
parent
2e3502ea4b
commit
b7e4968a48
|
@ -12,9 +12,9 @@ static char *idlecmd = "rain"; /* The screensaver program */
|
|||
|
||||
struct assoc assocs[] = {
|
||||
{ "\\.(c|cpp|h|txt|log|sh)$", "vi" },
|
||||
//{ "\\.(avi|mp4|mkv|3gp|mov)$", "mpv" },
|
||||
{ "\\.(avi|mp4|mkv|3gp|mov)$", "mpv" },
|
||||
{ "\\.(wma|mp3|ogg|flac|m4a)$", "mpv" },
|
||||
//{ "\\.(png|jpg|gif)$", "feh" },
|
||||
{ "\\.(png|jpg|gif)$", "viewnior" },
|
||||
//{ "\\.(html|svg)$", "firefox" },
|
||||
{ "\\.pdf$", "zathura" },
|
||||
//{ "\\.sh$", "sh" },
|
||||
|
|
12
nnn.c
12
nnn.c
|
@ -1247,7 +1247,17 @@ nochange:
|
|||
clearprompt();
|
||||
goto nochange;
|
||||
}
|
||||
mkpath(path, tmp, newpath, sizeof(newpath));
|
||||
|
||||
if (tmp[0] == '~') {
|
||||
char *home = getenv("HOME");
|
||||
if (home)
|
||||
snprintf(newpath, PATH_MAX,
|
||||
"%s%s", home, tmp + 1);
|
||||
else
|
||||
mkpath(path, tmp, newpath, sizeof(newpath));
|
||||
} else
|
||||
mkpath(path, tmp, newpath, sizeof(newpath));
|
||||
|
||||
if (canopendir(newpath) == 0) {
|
||||
printwarn();
|
||||
goto nochange;
|
||||
|
|
Loading…
Reference in a new issue