1
0
forked from aniani/vim

patch 8.1.1218: cannot set a directory for a tab page

Problem:    Cannot set a directory for a tab page.
Solution:   Add the tab-local directory. (Yegappan Lakshmanan, closes #4212)
This commit is contained in:
Bram Moolenaar
2019-04-27 20:37:57 +02:00
parent 2155a6abaa
commit 00aa069db8
20 changed files with 441 additions and 66 deletions

View File

@@ -2398,6 +2398,7 @@ has({feature}) Number |TRUE| if feature {feature} supported
has_key({dict}, {key}) Number |TRUE| if {dict} has entry {key}
haslocaldir([{winnr} [, {tabnr}]])
Number |TRUE| if the window executed |:lcd|
or |:tcd|
hasmapto({what} [, {mode} [, {abbr}]])
Number |TRUE| if mapping to {what} exists
histadd({history}, {item}) String add an item to a history
@@ -4918,9 +4919,28 @@ getcwd([{winnr} [, {tabnr}]])
directory. See also |haslocaldir()|.
With {winnr} and {tabnr} return the local current directory of
the window in the specified tab page.
the window in the specified tab page. If {winnr} is -1 return
the working directory of the tabpage.
If {winnr} is zero use the current window, if {tabnr} is zero
use the current tabpage.
Without any arguments, return the working directory of the
current window.
Return an empty string if the arguments are invalid.
Examples: >
" Get the working directory of the current window
:echo getcwd()
:echo getcwd(0)
:echo getcwd(0, 0)
" Get the working directory of window 3 in tabpage 2
:echo getcwd(3, 2)
" Get the global working directory
:echo getcwd(-1)
" Get the working directory of tabpage 3
:echo getcwd(-1, 3)
" Get the working directory of current tabpage
:echo getcwd(-1, 0)
<
getfsize({fname}) *getfsize()*
The result is a Number, which is the size in bytes of the
given file {fname}.
@@ -5478,16 +5498,39 @@ has_key({dict}, {key}) *has_key()*
an entry with key {key}. Zero otherwise.
haslocaldir([{winnr} [, {tabnr}]]) *haslocaldir()*
The result is a Number, which is 1 when the window has set a
local path via |:lcd|, and 0 otherwise.
The result is a Number:
1 when the window has set a local directory via |:lcd|
2 when the tab-page has set a local directory via |:tcd|
0 otherwise.
Without arguments use the current window.
With {winnr} use this window in the current tab page.
With {winnr} and {tabnr} use the window in the specified tab
page.
{winnr} can be the window number or the |window-ID|.
If {winnr} is -1 it is ignored and only the tabpage is used.
Return 0 if the arguments are invalid.
Examples: >
if haslocaldir() == 1
" window local directory case
elseif haslocaldir() == 2
" tab-local directory case
else
" global directory case
endif
" current window
:echo haslocaldir()
:echo haslocaldir(0)
:echo haslocaldir(0, 0)
" window n in current tab page
:echo haslocaldir(n)
:echo haslocaldir(n, 0)
" window n in tab page m
:echo haslocaldir(n, m)
" tab page m
:echo haslocaldir(-1, m)
<
hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()*
The result is a Number, which is 1 if there is a mapping that
contains {what} in somewhere in the rhs (what it is mapped to)