Created
December 7, 2018 05:30
-
-
Save h-east/c5020bc9be1a70631f0b72b018612558 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" カレントディレクトリを tagsファイルのあるディレクトリ(==プロジェクトルート)へ移動する | |
function! s:cdProjectRoot() | |
let filepath = findfile("tags", ".;") | |
if filepath != "" | |
let cd = substitute(filepath, "tags$", "", "") | |
if cd != "" | |
exec "cd" cd | |
echo "Cd to project root(" . cd . ")" | |
else | |
echo "Already in project root(" . getcwd() . ")" | |
endif | |
else | |
echo "\"tags\" is not found" | |
endif | |
endfunc | |
command! ProjRoot call s:cdProjectRoot() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment