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

Update automatic tpm installation instructions to avoid linting error #234

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lobis
Copy link

@lobis lobis commented Nov 14, 2022

Currently the automatic tpm instructions are detected as syntax error by VS Code (1:1: "if <cond>" must be followed by "then"). This can be fixed by using if-shell instead (if is an alias for if-shell so behaviour should be identical, more info at https://linux.die.net/man/1/tmux).

image

I also added some hyperlinks to original author profiles.

@@ -5,8 5,8 @@ One of the first things we do on a new machine is cloning our dotfiles. Not ever
If you want to install `tpm` and plugins automatically when tmux is started, put the following snippet in `.tmux.conf` before the final `run '~/.tmux/plugins/tpm/tpm'`:

```
if "test ! -d ~/.tmux/plugins/tpm" \
if-shell "test ! -d ~/.tmux/plugins/tpm" \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if without then is valid tmux conf syntax.
I think VS code lint is complaining because it thinks this snippet is shell script.

Can you change the language for this snippet to be tmux and see what happens?
Try adding tmux like this at the top:

```tmux

I'd prefer to keep the current shorter if version because it's more succinct.

Copy link
Author

@lobis lobis Nov 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I like the more verbose keyword as it's easy to look up for a newcomer like me. At first I didn't know what that if meant, didn't even know tmux had its own language. I guess using if-shell a user is more likely to find the correct documentation page using a search engine, but its a matter of opinion of course!

EDIT: I checked and VSCode by default does not detect the language of the .tmux.conf file, but does not give errors if you do use the full keywords such as shell-if. I guess because its not colliding with reserved keywords such as if.

After installing a VSCode extension for tmux, the language is correctly detected and no errors are thrown regardless of the if keyword.

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

Successfully merging this pull request may close these issues.

2 participants