Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the feature to customize the location of the project files. #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions doc/automatic-tex-plugin.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -910,6 +910,16 @@ The variable |b:atp_TexReturnCode| stores the return code of compilation.


See |atp-requirements-python| for python libraries that are used by ATP. See |atp-requirements-python| for python libraries that are used by ATP.


*g:atp_ProjectFileLocation*

The variable |g:atp_ProjectFileLocation| is the location of the project you
want to store. This directory you specified will have the same structure as
the filesystem tree on your system. For example, if you set this variable to
'~/.atp-project-files', the project file for '/path/to/my.tex' will be
'~/.atp-project-files/path/to/my.tex.project.vim'. If this variable is not set
or is set to an empty string, the project file will be created in the same
directory of the tex file, if no existing project file is found.

------------------------------------------------------------------------------- -------------------------------------------------------------------------------
CALL BACK AND DEBUG MODE *atp-callback* CALL BACK AND DEBUG MODE *atp-callback*
*atp-debug-mode* *atp-debug-mode*
Expand Down
14 changes: 13 additions & 1 deletion ftplugin/ATP_files/project.vim
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -231,7 +231,13 @@ function! FindProjectScripts()
let dir = fnamemodify(resolve(expand("%:p")), ":p:h") let dir = fnamemodify(resolve(expand("%:p")), ":p:h")
let cwd = getcwd() let cwd = getcwd()
try try
exe "lcd " . fnameescape(dir) if exists('g:atp_ProjectFileLocation') && !empty(g:atp_ProjectFileLocation)
let proj_dir = fnameescape(expand(g:atp_ProjectFileLocation) . dir)
silent! call mkdir(proj_dir, 'p')
exe "lcd " . proj_dir
else
exe "lcd " . fnameescape(dir)
endif
catch /E344:/ catch /E344:/
return [] return []
endtry endtry
Expand Down Expand Up @@ -315,6 +321,9 @@ function! <SID>LoadProjectScript(bang,...)
" Return if nothing was found " Return if nothing was found
if len(project_files) == 0 if len(project_files) == 0
let b:atp_ProjectScriptFile = resolve(expand("%:p")) . ".project.vim" let b:atp_ProjectScriptFile = resolve(expand("%:p")) . ".project.vim"
if exists('g:atp_ProjectFileLocation') && !empty(g:atp_ProjectFileLocation)
let b:atp_ProjectScriptFile = fnameescape(expand(g:atp_ProjectFileLocation)) . resolve(expand("%:p")) . ".project.vim"
endif
let b:atp_ProjectDir = fnamemodify(b:atp_ProjectScriptFile, ":h") let b:atp_ProjectDir = fnamemodify(b:atp_ProjectScriptFile, ":h")
return return
endif endif
Expand Down Expand Up @@ -685,6 +694,9 @@ function! <SID>WriteProjectScriptInterface(bang,...)
let b:atp_ProjectDir = fnamemodify(project_script, ":h") let b:atp_ProjectDir = fnamemodify(project_script, ":h")
else else
let b:atp_ProjectScriptFile = resolve(expand("%:p")) . ".project.vim" let b:atp_ProjectScriptFile = resolve(expand("%:p")) . ".project.vim"
if exists('g:atp_ProjectFileLocation') && !empty(g:atp_ProjectFileLocation)
let b:atp_ProjectScriptFile = fnameescape(expand(g:atp_ProjectFileLocation)) . resolve(expand("%:p")) . ".project.vim"
endif
let b:atp_ProjectDir = fnamemodify(b:atp_ProjectScriptFile, ":h") let b:atp_ProjectDir = fnamemodify(b:atp_ProjectScriptFile, ":h")
endif endif
endif endif
Expand Down