Mercurial > vim
comparison src/testdir/test_cd.vim @ 20711:d91b8d1e5198 v8.2.0909
patch 8.2.0909: cannot go back to the previous local directory
Commit: https://github.com/vim/vim/commit/002bc79991286934a9593b80635c27d4238cdfc4
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jun 5 22:33:42 2020 +0200
patch 8.2.0909: cannot go back to the previous local directory
Problem: Cannot go back to the previous local directory.
Solution: Add "tcd -" and "lcd -". (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/4362)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 05 Jun 2020 22:45:04 +0200 |
parents | b60bb094af52 |
children | d3fa0d29fa9a |
comparison
equal
deleted
inserted
replaced
20710:24fa685e72e9 | 20711:d91b8d1e5198 |
---|---|
127 only | tabonly | 127 only | tabonly |
128 call chdir(topdir) | 128 call chdir(topdir) |
129 call delete('Xdir', 'rf') | 129 call delete('Xdir', 'rf') |
130 endfunc | 130 endfunc |
131 | 131 |
132 " Test for changing to the previous directory '-' | |
133 func Test_prev_dir() | |
134 let topdir = getcwd() | |
135 call mkdir('Xdir/a/b/c', 'p') | |
136 | |
137 " Create a few tabpages and windows with different directories | |
138 new | only | |
139 tabnew | new | |
140 tabnew | |
141 tabfirst | |
142 cd Xdir | |
143 tabnext | wincmd t | |
144 tcd a | |
145 wincmd w | |
146 lcd b | |
147 tabnext | |
148 tcd a/b/c | |
149 | |
150 " Change to the previous directory twice in all the windows. | |
151 tabfirst | |
152 cd - | cd - | |
153 tabnext | wincmd t | |
154 tcd - | tcd - | |
155 wincmd w | |
156 lcd - | lcd - | |
157 tabnext | |
158 tcd - | tcd - | |
159 | |
160 " Check the directory of all the windows | |
161 tabfirst | |
162 call assert_equal('Xdir', fnamemodify(getcwd(), ':t')) | |
163 tabnext | wincmd t | |
164 call assert_equal('a', fnamemodify(getcwd(), ':t')) | |
165 wincmd w | |
166 call assert_equal('b', fnamemodify(getcwd(), ':t')) | |
167 tabnext | |
168 call assert_equal('c', fnamemodify(getcwd(), ':t')) | |
169 | |
170 " Change to the previous directory using chdir() | |
171 tabfirst | |
172 call chdir("-") | call chdir("-") | |
173 tabnext | wincmd t | |
174 call chdir("-") | call chdir("-") | |
175 wincmd w | |
176 call chdir("-") | call chdir("-") | |
177 tabnext | |
178 call chdir("-") | call chdir("-") | |
179 | |
180 " Check the directory of all the windows | |
181 tabfirst | |
182 call assert_equal('Xdir', fnamemodify(getcwd(), ':t')) | |
183 tabnext | wincmd t | |
184 call assert_equal('a', fnamemodify(getcwd(), ':t')) | |
185 wincmd w | |
186 call assert_equal('b', fnamemodify(getcwd(), ':t')) | |
187 tabnext | |
188 call assert_equal('c', fnamemodify(getcwd(), ':t')) | |
189 | |
190 only | tabonly | |
191 call chdir(topdir) | |
192 call delete('Xdir', 'rf') | |
193 endfunc | |
194 | |
132 func Test_cd_completion() | 195 func Test_cd_completion() |
133 call mkdir('XComplDir1', 'p') | 196 call mkdir('XComplDir1', 'p') |
134 call mkdir('XComplDir2', 'p') | 197 call mkdir('XComplDir2', 'p') |
135 call writefile([], 'XComplFile') | 198 call writefile([], 'XComplFile') |
136 | 199 |