├── .gitignore ├── .travis.yml ├── Gemfile ├── Makefile ├── README.md ├── Rakefile ├── VimFlavor ├── doc └── tabpagecd.txt ├── plugin └── tabpagecd.vim └── t ├── basics.vim ├── path-with-spaces.vim └── sample └── spaced path └── .keep /.gitignore: -------------------------------------------------------------------------------- 1 | .vim-flavor 2 | Gemfile.lock 3 | VimFlavor.lock 4 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | rvm: 3 | - 2.0.0 4 | script: rake ci 5 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'vim-flavor', '~> 1.1' 4 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for usual Vim plugin 2 | 3 | REPOS_TYPE := vim-script 4 | INSTALLATION_DIR := $(HOME)/.vim 5 | TARGETS_STATIC = $(filter %.vim %.txt,$(all_files_in_repos)) 6 | TARGETS_ARCHIVED = $(all_files_in_repos) mduem/Makefile 7 | 8 | 9 | 10 | 11 | include mduem/Makefile 12 | 13 | # __END__ 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This plugin is deprecated. 2 | 3 | Vim supports tabpage-local working directory since version 8.1.1218. 4 | Use `:tcd` instead of this plugin. 5 | 6 | This plugin might still be useful if you want to make `:cd` to behave as if `:tcd`. 7 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rake 2 | 3 | task :ci => [:dump, :test] 4 | 5 | task :dump do 6 | sh 'vim --version' 7 | end 8 | 9 | task :test do 10 | sh 'bundle exec vim-flavor test' 11 | end 12 | -------------------------------------------------------------------------------- /VimFlavor: -------------------------------------------------------------------------------- 1 | # No dependencies. 2 | -------------------------------------------------------------------------------- /doc/tabpagecd.txt: -------------------------------------------------------------------------------- 1 | *tabpagecd.txt* Turn :cd into :tabpagecd, to use one tab page per project 2 | 3 | Version 0.0.2 4 | Script ID: 4201 5 | Copyright (C) 2012-2013 Kana Natsuno 6 | License: MIT License {{{ 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files (the 9 | "Software"), to deal in the Software without restriction, including 10 | without limitation the rights to use, copy, modify, merge, publish, 11 | distribute, sublicense, and/or sell copies of the Software, and to 12 | permit persons to whom the Software is furnished to do so, subject to 13 | the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included 16 | in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 19 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 | }}} 26 | 27 | CONTENTS *tabpagecd-contents* 28 | 29 | Introduction |tabpagecd-introduction| 30 | Interface |tabpagecd-interface| 31 | Events |tabpagecd-events| 32 | Variables |tabpagecd-variables| 33 | Bugs |tabpagecd-bugs| 34 | Changelog |tabpagecd-changelog| 35 | 36 | 37 | 38 | 39 | ============================================================================== 40 | INTRODUCTION *tabpagecd-introduction* 41 | 42 | *tabpagecd* is a Vim plugin to turn `:cd` into :tabpagecd. In other words, 43 | 44 | - The current working directory for each tab page is automatically recorded. 45 | - The current working directory is automatically restored to the recorded one 46 | whenever you activate another tab page. 47 | 48 | When you work on multiple projects at once, you probably use |tab-page| to 49 | organize files of each project. For example, tab page 1 for files in project 50 | A, while tab page 2 for files in project B. In this case, you might want to 51 | set the current working directory per tab page to quickly manipulate files in 52 | each project. This plugin makes :cd local to a tab page, like `:lcd` for 53 | windows. So that it makes easy to deal with project-local files. 54 | 55 | 56 | Requirements: 57 | - Vim 7.3 or later 58 | 59 | Latest version: 60 | http://github.com/kana/vim-tabpagecd 61 | 62 | Document in HTML format: 63 | http://vim-doc.heroku.com/view?https://github.com/kana/vim-tabpagecd/blob/master/doc/tabpagecd.txt 64 | 65 | 66 | 67 | 68 | ============================================================================== 69 | INTERFACE *tabpagecd-interface* 70 | 71 | ------------------------------------------------------------------------------ 72 | EVENTS *tabpagecd-events* 73 | 74 | |TabEnter| 75 | The current working directory will be changed to the 76 | recorded one for the current tab page, or nothing will 77 | happen if nothing is recorded for the current tab 78 | page. 79 | 80 | |TabLeave| 81 | The current working directory is recorded as the one 82 | for the current tab page. 83 | 84 | 85 | ------------------------------------------------------------------------------ 86 | VARIABLES *tabpagecd-variables* 87 | 88 | *t:cwd* 89 | The current working directory for a tab page. 90 | 91 | 92 | 93 | 94 | ============================================================================== 95 | BUGS *tabpagecd-bugs* 96 | 97 | - If you find any problem or have any suggestion, please give your feedback to 98 | the author via: https://github.com/kana/vim-tabpagecd/issues 99 | 100 | 101 | 102 | 103 | ============================================================================== 104 | CHANGELOG *tabpagecd-changelog* 105 | 106 | 0.0.2 2013-11-29T23:09:35+09:00 *tabpagecd-changelog-0.0.2* 107 | - Fix a bug. Old versions fail to restore the current working 108 | directory for a tab page if the recorded directory path contains 109 | spaces or other fancy characters. 110 | 111 | 0.0.1 2012-09-01T13:25:17+09:00 *tabpagecd-changelog-0.0.1* 112 | - Tidy up the document a bit. 113 | 114 | 0.0.0 2012-04-11T22:41:24+09:00 *tabpagecd-changelog-0.0.0* 115 | - Initial version. Derived from my vimrc. 116 | 117 | 118 | 119 | 120 | ============================================================================== 121 | vim:tw=78:ts=8:ft=help:norl:fen:fdl=0:fdm=marker: 122 | -------------------------------------------------------------------------------- /plugin/tabpagecd.vim: -------------------------------------------------------------------------------- 1 | " tabpagecd - Turn :cd into :tabpagecd, to use one tab page per project 2 | " Version: 0.0.2 3 | " Copyright (C) 2012-2013 Kana Natsuno 4 | " License: MIT License {{{ 5 | " Permission is hereby granted, free of charge, to any person obtaining 6 | " a copy of this software and associated documentation files (the 7 | " "Software"), to deal in the Software without restriction, including 8 | " without limitation the rights to use, copy, modify, merge, publish, 9 | " distribute, sublicense, and/or sell copies of the Software, and to 10 | " permit persons to whom the Software is furnished to do so, subject to 11 | " the following conditions: 12 | " 13 | " The above copyright notice and this permission notice shall be included 14 | " in all copies or substantial portions of the Software. 15 | " 16 | " THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 | " OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | " MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | " IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | " CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 | " TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 | " SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | " }}} 24 | 25 | if exists('g:loaded_tabpagecd') 26 | finish 27 | endif 28 | 29 | 30 | 31 | 32 | augroup plugin-tabpagecd 33 | autocmd! 34 | 35 | autocmd TabEnter * 36 | \ if exists('t:cwd') 37 | \ | cd `=t:cwd` 38 | \ | endif 39 | 40 | autocmd TabLeave * 41 | \ let t:cwd = getcwd() 42 | augroup END 43 | 44 | 45 | 46 | 47 | let g:loaded_tabpagecd = 1 48 | 49 | " __END__ 50 | " vim: foldmethod=marker 51 | -------------------------------------------------------------------------------- /t/basics.vim: -------------------------------------------------------------------------------- 1 | runtime! plugin/tabpagecd.vim 2 | 3 | describe 'tabpagecd' 4 | before 5 | let g:cwd = getcwd() 6 | end 7 | 8 | after 9 | cd `=g:cwd` 10 | end 11 | 12 | it 'records and restores the current working directory for each tab page' 13 | Expect exists('t:cwd') toBeFalse 14 | 15 | let t:id = 1 16 | cd ./t 17 | tabnew 18 | let t:id = 2 19 | cd ../plugin 20 | 21 | tabnext 1 22 | Expect t:id == 1 23 | Expect t:cwd ==# g:cwd . '/t' 24 | Expect getcwd() ==# t:cwd 25 | 26 | tabnext 2 27 | Expect t:id == 2 28 | Expect t:cwd ==# g:cwd . '/plugin' 29 | Expect getcwd() ==# t:cwd 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /t/path-with-spaces.vim: -------------------------------------------------------------------------------- 1 | runtime! plugin/tabpagecd.vim 2 | 3 | describe 'tabpagecd' 4 | it 'works well with a path with spaces' 5 | let cwd = getcwd() 6 | 7 | cd `=cwd . '/plugin'` 8 | tabnew 9 | cd `=cwd . '/t/sample/spaced path'` 10 | 11 | tabnext 1 12 | Expect t:cwd ==# cwd . '/plugin' 13 | Expect getcwd() ==# t:cwd 14 | 15 | tabnext 2 16 | Expect t:cwd ==# cwd . '/t/sample/spaced path' 17 | Expect getcwd() ==# t:cwd 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /t/sample/spaced path/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kana/vim-tabpagecd/5f647097d868318002de4d971ed446b8b44e4e90/t/sample/spaced path/.keep --------------------------------------------------------------------------------