Compare commits

...
Sign in to create a new pull request.

5 commits

Author SHA1 Message Date
Maciej Sypien
ed4430b0b5
feat: update readme 2024-09-14 20:06:41 +02:00
Maciej Sypien
92c67eb87d
fix(shfmt): arrays are a bash/mksh feature (parsed as bash via -ln=auto) 2024-09-14 19:48:32 +02:00
Maciej Sypien
2fb3dc8d45
feat: add command for checking script 2024-09-14 19:47:00 +02:00
Maciej Sypien
d084c5bf84
feat: use 2 indent for sh,tmux files 2024-09-14 19:43:09 +02:00
Maciej Sypien
48c8dcb2b6
feat: enhance code quality for project files 2024-09-07 23:24:26 +02:00
4 changed files with 79 additions and 17 deletions

View file

@ -19,3 +19,19 @@ trim_trailing_whitespace = false
# windows shell scripts
[*.{cmd,bat,ps1}]
end_of_line = crlf
[*.{sh,tmux}]
indent_style = space
indent_size = 2
shell_variant = posix # like -ln=posix
binary_next_line = true # like -bn
switch_case_indent = true # like -ci
space_redirects = true # like -sr
keep_padding = true # like -kp
function_next_line = true # like -fn
never_split = true # like -ns
[Makefile]
indent_style = tab
indent_size = 8

5
Makefile Normal file
View file

@ -0,0 +1,5 @@
.PHONY: check-scripts
check-scripts:
@# Fail if any of these files have warnings
find . -type f -not -path "./uncommited/*" -a \( -iname "*.sh" -o -iname "*.tmux" \) | xargs -I % sh -c 'shellcheck %'
find . -type f -not -path "./uncommited/*" -a \( -iname "*.sh" -o -iname "*.tmux" \) | xargs -I % sh -c 'shfmt -l -d %'

View file

@ -54,6 +54,44 @@ set -g @tmux-gruvbox 'dark' # or 'light', 'dark-transparent', 'light-transparent
Hit `prefix + I` to fetch the plugin and source it. Your Tmux should be updated with the theme at this point.
## Development
To run project locally:
1. clone the repo to desired place
```bash
cd $HOME/projects/
git clone ...
```
1. create symlink in plugin dir to the cloned repo:
```bash
# cd to tmux plugin directory
cd ~/.tmux/plugins/
# create simlink to cloned repo
ln -sf $HOME/projects/tmux-gruvbox/ tmux-gruvbox
```
1. and in `~/.tmux.conf` set
```bash
# add plugin
set -g @plugin 'egel/tmux-gruvbox'
# set desired options...
set -g @tmux-gruvbox 'dark'
```
### Linters & formatters
To keep the files clean we use few program to help us achieve it:
1. Editorconfig (make sure your editor have it)
2. Markdown (prettier/prettierd)
3. Shell (shellcheck, shfmt)
## License
GPLv3 - Maciej Sypień

View file

@ -1,27 +1,30 @@
#!/usr/bin/env bash
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
THEME_OPTION="@tmux-gruvbox"
DEFAULT_THEME="dark"
SCRIPT_SRC="$(dirname "${BASH_SOURCE[${#BASH_SOURCE[@]} - 1]}")"
readonly SCRIPT_SRC
CURRENT_DIR=$(cd "${SCRIPT_SRC}" >/dev/null 2>&1 && pwd)
readonly CURRENT_DIR
readonly THEME_OPTION="@tmux-gruvbox"
readonly DEFAULT_THEME="dark"
get_theme() {
local option="$1"
local default_value="$2"
local option_value
option_value=$(tmux show-option -gqv "$option")
if [ -z "$option_value" ]; then
echo "$default_value"
else
echo "$option_value"
fi
local option="$1"
local default_value="$2"
local option_value
option_value=$(tmux show-option -gqv "$option")
if [ -z "$option_value" ]; then
echo "$default_value"
else
echo "$option_value"
fi
}
main() {
local theme
theme=$(get_theme "$THEME_OPTION" "$DEFAULT_THEME")
tmux source-file "$CURRENT_DIR/tmux-gruvbox-${theme}.conf"
local theme
theme=$(get_theme "$THEME_OPTION" "$DEFAULT_THEME")
tmux source-file "$CURRENT_DIR/tmux-gruvbox-${theme}.conf"
}
main
main "$@"
# vi: ft=bash
# vim: ai et ft=bash