diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-08-08 15:42:38 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-08-08 15:42:38 +0100 |
commit | 48c3f4e0bff7efd289a7001b68c777b6f89a7057 (patch) | |
tree | 519686e73427026f133ce10ff9f8ce7243f011d2 /runtime/doc/terminal.txt | |
parent | cf85d97bafdcc7837a77ab79cc04da189fa3dd0c (diff) |
Update runtime files
Diffstat (limited to 'runtime/doc/terminal.txt')
-rw-r--r-- | runtime/doc/terminal.txt | 30 |
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 ~ |