diff --git a/config.def.h b/config.def.h index a9c3456..386cf63 100644 --- a/config.def.h +++ b/config.def.h @@ -51,6 +51,7 @@ static Command cmds[] = { { "^e(dit)?!?$", cmd_edit, false }, { "^new$", cmd_new, false }, { "^o(pen)?$", cmd_open, false }, + { "^pwd$", cmd_pwd, false }, { "^qa(ll)?!?$", cmd_qall, false }, { "^q(quit)?!?$", cmd_quit, false }, { "^r(ead)?$", cmd_read, false }, diff --git a/vis.c b/vis.c index 17b7cf2..ffa5567 100644 --- a/vis.c +++ b/vis.c @@ -465,6 +465,8 @@ static bool cmd_write(const char *argv[]); * associate the new name with the buffer. further :w commands * without arguments will write to the new filename */ static bool cmd_saveas(const char *argv[]); +/* display the current directory */ +static bool cmd_pwd(const char *argv[]); static void action_reset(Action *a); static void switchmode_to(Mode *new_mode); @@ -1291,6 +1293,13 @@ static bool cmd_saveas(const char *argv[]) { return false; } +static bool cmd_pwd(const char *argv[]) { + char cwd[1024]; + if (getcwd(cwd, sizeof(cwd)) != NULL) + editor_info_show(vis, "%s", cwd); + return true; +} + static bool exec_command(char *cmdline) { static bool init = false; if (!init) {