Skip to content
Permalink
Browse files

add :SyncTermCwdDisableLcd, :SyncTermCwdEnableLcd

  • Loading branch information...
tyru committed Aug 3, 2019
1 parent 8ee86fd commit b614a34a17720c93aec0e8272f58b354a517d466
Showing with 30 additions and 10 deletions.
  1. +12 −4 README.md
  2. +12 −5 doc/synctermcwd.txt
  3. +6 −1 plugin/synctermcwd.vim
@@ -12,13 +12,21 @@ Add below to your `.bashrc` / `.zshrc`.
source (repo)/macros/synctermcwd.sh`
```

# Tips
# Change windows' directories in only current tabpage

Add below to your `.vimrc` if you want to set current working directories only in windows of current tabpage.
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 = 'SyncTermCwdTabLcd'
```

`:SyncTermCwdTabLcd {path}` is almost same as `:windo lcd {path}`, but
`:SyncTermCwdTabLcd` does not change the current window.
`:SyncTermCwdTabLcd {path}` is almost same as `:windo lcd {path}`, but:
* It does not change the current window
* It does not execute `:lcd {path}` if `:SyncTermCwdDisableLcd` is executed on the buffer

## `:SyncTermCwdDisableLcd`, `:SyncTermCwdEnableLcd`

If `:SyncTermCwdDisableLcd` is executed on a buffer,
`:lcd {path}` is not executed on the buffer.
`:SyncTermCwdEnableLcd` resets disabled buffer.
@@ -52,18 +52,25 @@ g:synctermcwd_cd_command
>
let g:synctermcwd_cd_command = 'SyncTermCwdTabLcd'
<
This is same as: >
let g:synctermcwd_cd_command = 'windo lcd'
< but |:SyncTermCwdTabLcd| does not change current window.
See |:SyncTermCwdTabLcd| for the details.

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

*:SyncTermCwdTabLcd*
:SyncTermCwdTabLcd {path}
Almost same as `:windo lcd {path}`, but |:SyncTermCwdTabLcd| does not
change the current window.
Almost same as `:windo lcd {path}`, but:
* It does not change the current window
* It does not execute `:lcd {path}` if `:SyncTermCwdDisableLcd` is
executed on the buffer

*:SyncTermCwdDisableLcd* *:SyncTermCwdEnableLcd*
:SyncTermCwdDisableLcd
:SyncTermCwdEnableLcd
If |:SyncTermCwdDisableLcd| is executed on a buffer,
`:lcd {path}` is not executed on the buffer.
|:SyncTermCwdEnableLcd| resets disabled buffer.

}}}
------------------------------------------------------------------------------
@@ -13,6 +13,9 @@ function! Tapi_SyncTermCwd(_, cwd) abort
execute cd a:cwd
endfunction

command! -bar SyncTermCwdDisableLcd let b:synctermcwd_no_lcd = 1
command! -bar SyncTermCwdEnableLcd unlet! b:synctermcwd_no_lcd

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

@@ -23,7 +26,9 @@ function! s:tablocal_lcd(...) abort
endif
let winid = win_getid()
try
execute 'windo lcd' a:1
windo if !get(b:, 'synctermcwd_no_lcd') |
\ execute 'lcd' a:1 |
\ endif
finally
call win_gotoid(winid)
endtry

0 comments on commit b614a34

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