aboutsummaryrefslogtreecommitdiffstats
path: root/nnn.c
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-03-19 05:59:15 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2018-03-19 06:18:25 +0530
commit0e623010e624832b16458e85925d2a2ac2dd1a4b (patch)
treefa196c8d89d832d9fdf94cc655048e8aba5a4573 /nnn.c
parent95a3e0fca4367be6b2f91b93fee4ecdfdad1c994 (diff)
downloadnnn-0e623010e624832b16458e85925d2a2ac2dd1a4b.tar.gz
Switch to current dir to run editor/vidir
Diffstat (limited to 'nnn.c')
-rw-r--r--nnn.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/nnn.c b/nnn.c
index bcba125..0e63081 100644
--- a/nnn.c
+++ b/nnn.c
@@ -2520,7 +2520,7 @@ nochange:
*/
if (editor) {
if (getmime(dents[cur].name)) {
- spawn(editor, newpath, NULL, NULL, F_NORMAL);
+ spawn(editor, newpath, NULL, path, F_NORMAL);
continue;
}
@@ -2531,7 +2531,7 @@ nochange:
continue;
if (strstr(g_buf, "text/") == g_buf) {
- spawn(editor, newpath, NULL, NULL, F_NORMAL);
+ spawn(editor, newpath, NULL, path, F_NORMAL);
continue;
}
}
@@ -3150,24 +3150,7 @@ nochange:
goto nochange;
}
- /* Save the program start dir */
- tmp = getcwd(newpath, PATH_MAX);
- if (tmp == NULL) {
- printwarn();
- goto nochange;
- }
-
- /* Switch to current path for readline(3) */
- if (chdir(path) == -1) {
- printwarn();
- goto nochange;
- }
-
- spawn(utils[VIDIR], ".", NULL, NULL, F_NORMAL);
-
- /* Change back to program start dir */
- if (chdir(newpath) == -1)
- printwarn();
+ spawn(utils[VIDIR], ".", NULL, path, F_NORMAL);
/* Save current */
if (ndents > 0)