summaryrefslogtreecommitdiffstats
path: root/runtime/doc/terminal.txt
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/doc/terminal.txt')
-rw-r--r--runtime/doc/terminal.txt30
1 files changed, 30 insertions, 0 deletions
diff --git a/runtime/doc/terminal.txt b/runtime/doc/terminal.txt
index 81dd7c6784..56f0dc82d1 100644
--- a/runtime/doc/terminal.txt
+++ b/runtime/doc/terminal.txt
@@ -1019,6 +1019,36 @@ A trick to have Vim send this escape sequence: >
Rationale: Why not allow for any command or expression? Because that might
create a security problem.
+ *terminal-autoshelldir*
+This can be used to pass the current directory from a shell to Vim.
+Put this in your .vimrc: >
+ def g:Tapi_lcd(_, args: string)
+ execute 'silent lcd ' .. args
+ enddef
+<
+And, in a bash init file: >
+ if [[ -n "$VIM_TERMINAL" ]]; then
+ PROMPT_COMMAND='_vim_sync_PWD'
+ function _vim_sync_PWD() {
+ printf '\033]51;["call", "Tapi_lcd", "%q"]\007' "$PWD"
+ }
+ fi
+<
+Or, for zsh: >
+ if [[ -n "$VIM_TERMINAL" ]]; then
+ autoload -Uz add-zsh-hook
+ add-zsh-hook -Uz chpwd _vim_sync_PWD
+ function _vim_sync_PWD() {
+ printf '\033]51;["call", "Tapi_lcd", "%q"]\007' "$PWD"
+ }
+ fi
+<
+Or, for fish: >
+ if test -n "$VIM_TERMINAL"
+ function _vim_sync_PWD --on-variable=PWD
+ printf '\033]51;["call", "Tapi_lcd", "%s"]\007' "$PWD"
+ end
+ end
Using the client-server feature ~