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

Option to set the target for compilation to a newly opened subfile automatically #1838

Closed
p135246 opened this issue Oct 21, 2020 · 3 comments

Comments

@p135246
Copy link

p135246 commented Oct 21, 2020

Situation: My LaTeX documents use the subfiles package and have the following structure. There is a main file text.tex in the root folder . and a bunch of subfiles subfile1.tex, subfile2.tex, ... in the folder ./subfiles. I mostly edit one subfile at a time, e.g., subfile1.tex, and hence press <localleader>ls immediately after opening it to change the target for compilation to subfile1.tex. This is because vimtex automatically finds the main file text.tex after opening a subfile and sets the target for compilation to text.tex.

Request: Would it be possible to add a variable which would modify the default behavior and save me of pressing <localleader>ls every time I open a subfile in a session where no valid target for compilation is set yet?

Details: If the variable was set to 0, then everything would work as it does now. If it was set to 1, then, after opening a subfile, the target for compilation would be automatically set to that subfile. This should happen only if no valid target for compilation is set yet, e.g., when vim is freshly started or when the file which is the current target for compilation is closed. In other cases, i.e., opening additional tabs, the target for compilation should remain the same.

Thanks!

lervag added a commit that referenced this issue Oct 24, 2020
Start in local file by default if g:vimtex_subfile_start_local is
specified to 1.

refer: #1838
@lervag
Copy link
Owner

lervag commented Oct 24, 2020

I think this should work now. The option is named g:vimtex_subfile_start_local. Please test and let me know what you think.

@lervag lervag closed this as completed Oct 24, 2020
@p135246
Copy link
Author

p135246 commented Nov 3, 2020

Great, it works. Thank you!

@lervag
Copy link
Owner

lervag commented Nov 3, 2020

Great, happy to hear it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants