aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/main.c')
-rw-r--r--src/nvim/main.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 9f4bc22ae0..47bb2bc515 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -285,6 +285,17 @@ int main(int argc, char **argv)
input_start_stdin(fd);
}
+ // open terminals when opening files that start with term://
+ do_cmdline_cmd((uint8_t *)
+ "autocmd BufReadCmd term://* "
+ ":call termopen( "
+ // Capture the command string
+ "matchstr(expand(\"<amatch>\"), "
+ "'\\c\\mterm://\\%(.\\{-}//\\%(\\d\\+:\\)\\?\\)\\?\\zs.*'), "
+ // capture the working directory
+ "get(matchlist(expand(\"<amatch>\"), "
+ "'\\c\\mterm://\\(.\\{-}\\)//'), 1, ''))");
+
/* Execute --cmd arguments. */
exe_pre_commands(&params);