Skip to content
Permalink
Browse files

add :SyncTermCwdTablcd

  • Loading branch information...
tyru committed Aug 3, 2019
1 parent 581d708 commit 8ee86fd43bda3e5da6f57b68472c17d8411fc114
Showing with 35 additions and 2 deletions.
  1. +4 −1 README.md
  2. +15 −1 doc/synctermcwd.txt
  3. +16 −0 plugin/synctermcwd.vim
@@ -17,5 +17,8 @@ source (repo)/macros/synctermcwd.sh`
Add below to your `.vimrc` if you want to set current working directories only in windows of current tabpage.

```vim
let g:synctermcwd_cd_command = 'windo lcd'
let g:synctermcwd_cd_command = 'SyncTermCwdTabLcd'
```

`:SyncTermCwdTabLcd {path}` is almost same as `:windo lcd {path}`, but
`:SyncTermCwdTabLcd` does not change the current window.
@@ -23,6 +23,7 @@ CONTENTS *synctermcwd-contents*
Setup |synctermcwd-setup|
Interface |synctermcwd-interface|
Variables |synctermcwd-variables|
Commands |synctermcwd-commands|
Functions |synctermcwd-functions|
TODO & Bugs |synctermcwd-todo-and-bugs|
Changelog |synctermcwd-changelog|
@@ -49,8 +50,21 @@ g:synctermcwd_cd_command
Below example sets Vim's current working directory
in all windows in current tabpage.
>
let g:synctermcwd_cd_command = 'windo lcd'
let g:synctermcwd_cd_command = 'SyncTermCwdTabLcd'
<
This is same as: >
let g:synctermcwd_cd_command = 'windo lcd'
< but |:SyncTermCwdTabLcd| does not change current window.

}}}
------------------------------------------------------------------------------
COMMANDS *synctermcwd-commands* {{{

*:SyncTermCwdTabLcd*
:SyncTermCwdTabLcd {path}
Almost same as `:windo lcd {path}`, but |:SyncTermCwdTabLcd| does not
change the current window.

}}}
------------------------------------------------------------------------------
FUNCTIONS *synctermcwd-functions* {{{
@@ -13,4 +13,20 @@ function! Tapi_SyncTermCwd(_, cwd) abort
execute cd a:cwd
endfunction

command! -nargs=? -complete=dir SyncTermCwdTabLcd
\ call s:tablocal_lcd(<f-args>)

function! s:tablocal_lcd(...) abort
if !a:0
lcd
return
endif
let winid = win_getid()
try
execute 'windo lcd' a:1
finally
call win_gotoid(winid)
endtry
endfunction

let &cpo = s:save_cpo

0 comments on commit 8ee86fd

Please sign in to comment.
You can’t perform that action at this time.