Skip to content

Commit f22eda9

Browse files
committed
Add install.sh.
1 parent 5a9b46b commit f22eda9

File tree

2 files changed

+163
-2
lines changed

2 files changed

+163
-2
lines changed

README.md

Lines changed: 96 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,104 @@
1-
# tmux config
1+
# tmux Configuration
22

33
[![MIT License](https://img.shields.io/badge/license-MIT-red.svg)](./LICENSE.txt)
44

5+
My complete tmux configuration as a tmux plugin.
6+
7+
## Description
8+
9+
This configuration system works as a meta-plugin:
10+
all desired tmux plugins are loaded from `plugins.conf` using
11+
[Tmux Plugin Manager].
12+
Overall configuration then follows a normal plugin structure.
13+
14+
[Tmux Plugin Manager]: https://github.com/tmux-plugins/tpm
15+
16+
## Installation
17+
18+
You must be in a tmux session to install.
19+
20+
### Automatic Install
21+
22+
You can install this via the command-line with either curl
23+
24+
````bash
25+
curl -L https://io.evansosenko.com/tmuxrc/install.sh | sh
26+
````
27+
28+
or wget
29+
30+
````bash
31+
wget https://io.evansosenko.com/tmuxrc/install.sh -O - | sh
32+
````
33+
34+
### Manual Install
35+
36+
1. Install [Tmux Plugin Manager].
37+
2. Create `~/.tmux.conf` with
38+
39+
````tmux
40+
# razor-x/tmuxrc
41+
42+
if-shell "test -f ~/.tmux/plugins/tmuxrc/plugins.conf" "source ~/.tmux/plugins/tmuxrc/plugins.conf"
43+
44+
if-shell "test ! -f ~/.tmux/plugins/tmuxrc/plugins.conf" "set -g @tpm_plugins 'tmux-plugins/tpm razor-x/tmuxrc'"
45+
46+
run-shell '~/.tmux/plugins/tpm/tpm'
47+
````
48+
49+
and run this to install
50+
51+
````bash
52+
~/.tmux/plugins/tpm/scripts/install_plugins.sh
53+
~/.tmux/plugins/tpm/scripts/update_plugin.sh
54+
~/.tmux/plugins/tpm/scripts/install_plugins.sh
55+
~/.tmux/plugins/tpm/scripts/update_plugin.sh
56+
````
57+
58+
## Updating
59+
60+
Updating is handled via the normal [Tmux Plugin Manager]
61+
install and update commands.
62+
63+
Alternatively, you can run the commands listed in the Manual Install section.
64+
65+
## Customization
66+
67+
You can customize this configuration or manage your own in the same way.
68+
69+
1. Clone or fork this.
70+
If you prefer a clean start, clone the `minimal` branch:
71+
it has the same structure and development tools but with
72+
a very minimal configuration.
73+
2. Replace any instance of `razor-x/tmuxrc`
74+
with the path to your repository's location.
75+
If you do not host this on GitHub,
76+
you may need to adjust the repository path appropriately.
77+
3. Update `install.sh` on the `gh-pages` branch.
78+
4. Update the urls for the install script in this README.
79+
80+
Here is an example of a command you can use to make replacements:
81+
82+
````bash
83+
git ls-files -z | xargs -0 sed -i 's/razor-x\/tmuxrc/username\/tmuxrc/g'
84+
````
85+
86+
## Contributing
87+
88+
Please submit and comment on bug reports and feature requests.
89+
90+
To submit a patch:
91+
92+
1. Fork it (https://github.com/razor-x/tmuxrc/fork).
93+
2. Create your feature branch (`git checkout -b my-new-feature`).
94+
3. Make changes.
95+
4. Commit your changes (`git commit -am 'Add some feature'`).
96+
5. Push to the branch (`git push origin my-new-feature`).
97+
6. Create a new Pull Request.
98+
599
## License
6100

7-
This code is licensed under the MIT license.
101+
This tmux configuration is licensed under the MIT license.
8102

9103
## Warranty
10104

install.sh

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
set -e
2+
3+
if ! [ -n "$TMUX" ]; then
4+
echo -e "\033[31m✘ Must run in a tmux session to install!"
5+
exit 1
6+
fi
7+
8+
echo -e "\033[32m➤ Installing! \033[0m"
9+
10+
hash git >/dev/null 2>&1 \
11+
&& echo -e "\033[32m ✔ Found ❰ Git ❱ \033[0m" \
12+
|| {
13+
echo -e "\033[31m ✘ Missing ❰ Git ❱ \033[0m"
14+
echo -e "\033[31m✘ Install failed!"
15+
exit 1
16+
}
17+
18+
if [ -d ~/.tmux/plugins/tpm ]; then
19+
echo -e "\033[32m ✔ Found ❰ tpm ❱ \033[0m"
20+
else
21+
echo -e " ➤ Installing ❰ tpm ❱ \033[0m"
22+
23+
hash git >/dev/null 2>&1 && \
24+
env git clone https://github.com/tmux-plugins/tpm.git ~/.tmux/plugins/tpm >/dev/null 2>&1
25+
26+
echo -e "\033[32m ✔ Installed ❰ tpm ❱ \033[0m"
27+
fi
28+
29+
if [ -f ~/.tmux.conf ] || [ -h ~/.tmux.conf ]; then
30+
TMUXRC_LINE=$(head -n 1 ~/.tmux.conf);
31+
if [ "$TMUXRC_LINE" != '# razor-x/tmuxrc' ]; then
32+
echo -e " ➤ Exists ❰ ~/.tmux.conf ❱ \033[0m"
33+
34+
mv ~/.tmux.conf ~/.tmux.conf.preinstall
35+
36+
echo -e "\033[32m ✔ Moved to ❰ ~/.tmux.conf.preinstall ❱ \033[0m"
37+
else
38+
rm ~/.tmux.conf
39+
fi
40+
fi
41+
42+
echo -e " ➤ Installing ❰ ~/.tmux.conf ❱ \033[0m"
43+
44+
tee ~/.tmux.conf >/dev/null <<EOF
45+
# razor-x/tmuxrc
46+
47+
if-shell "test -f ~/.tmux/plugins/tmuxrc/plugins.conf" "source ~/.tmux/plugins/tmuxrc/plugins.conf"
48+
49+
if-shell "test ! -f ~/.tmux/plugins/tmuxrc/plugins.conf" "set -g @tpm_plugins 'tmux-plugins/tpm razor-x/tmuxrc'"
50+
51+
run-shell '~/.tmux/plugins/tpm/tpm'
52+
EOF
53+
54+
echo -e "\033[32m ✔ Installed ❰ ~/.tmux.conf ❱ \033[0m"
55+
56+
echo -e " ➤ Run ❰ Install Plugins ❱ \033[0m"
57+
58+
sh ~/.tmux/plugins/tpm/scripts/install_plugins.sh &>/dev/null
59+
sh ~/.tmux/plugins/tpm/scripts/update_plugin.sh all &>/dev/null
60+
sh ~/.tmux/plugins/tpm/scripts/install_plugins.sh &>/dev/null
61+
sh ~/.tmux/plugins/tpm/scripts/update_plugin.sh all &>/dev/null
62+
63+
echo -e "\033[32m ✔ Completed ❰ Install Plugins ❱ \033[0m"
64+
65+
echo -e "\033[32m✔ Install complete! \033[0m"
66+
67+
exit 0

0 commit comments

Comments
 (0)