From 39dd5b7a7b4516d468a3100988ac88dbf1da7e66 Mon Sep 17 00:00:00 2001 From: Rack Lin Date: Sun, 15 May 2022 20:52:48 +0800 Subject: [PATCH] feat(editorconfig): add editorconfig and using php-cli from container --- editorconfig/dot-editorconfig | 36 +++++++++++++++++++++++++++++++++++ git/dot-gitconfig | 1 + zsh/dot-config-osx.zsh | 13 ++++++------- zsh/dot-zshrc | 16 ++++++++-------- 4 files changed, 51 insertions(+), 15 deletions(-) create mode 100644 editorconfig/dot-editorconfig diff --git a/editorconfig/dot-editorconfig b/editorconfig/dot-editorconfig new file mode 100644 index 0000000..160da6b --- /dev/null +++ b/editorconfig/dot-editorconfig @@ -0,0 +1,36 @@ +# This file is for unifying the coding style for different editors and IDEs +# editorconfig.org + +root = true + +[*] +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +# Spaces in coffee +[**.coffee] +indent_style = space +indent_size = 2 + +[**.js] +indent_style = space +indent_size = 2 + +# Tabs in less +[**.less] +indent_style = tab +indent_size = 2 + +[**.css] +indent_style = tab +indent_size = 2 + +[**.php] +indent_style = space +indent_size = 4 + +[**.html] +indent_style = tab +indent_size = 2 diff --git a/git/dot-gitconfig b/git/dot-gitconfig index c8f7fa6..39421c5 100755 --- a/git/dot-gitconfig +++ b/git/dot-gitconfig @@ -15,6 +15,7 @@ excludesfile = /Users/rack/.gitignore_global fileMode = false ignorecase = false + editor = nvim [difftool "sourcetree"] cmd = opendiff \"$LOCAL\" \"$REMOTE\" path = diff --git a/zsh/dot-config-osx.zsh b/zsh/dot-config-osx.zsh index 025ab72..d3a79ac 100644 --- a/zsh/dot-config-osx.zsh +++ b/zsh/dot-config-osx.zsh @@ -1,10 +1,9 @@ -# Add HomeBrew PATH -export PATH=/opt/homebrew/bin:$PATH - # EXA [ -x /opt/homebrew/bin/exa ] && alias ll="exa -l -g --icons" -# PHP -export PATH="/opt/homebrew/opt/php/bin:$PATH" -export PATH="/opt/homebrew/opt/php/sbin:$PATH" - +# PHP in container +[ -x /usr/local/bin/docker ] && alias composer="docker run --rm --interactive --tty --volume \$PWD:/app --volume \$HOME/.composer:/tmp composer:latest composer" +[ -x /usr/local/bin/docker ] && alias php="docker run --rm --interactive --tty --volume \$PWD:/app --volume /Users:/Users composer:latest php" +[ -x /usr/local/bin/docker ] && alias php8="docker run --rm --interactive --tty --volume \$PWD:/app composer:latest php" +[ -x /usr/local/bin/docker ] && alias php7="docker run --rm --interactive --tty --volume \$PWD:/app --workdir /app php:7.4-cli php" +[ -x /usr/local/bin/docker ] && alias laravel="docker run --rm --interactive --tty --volume \$PWD:/app --volume \$HOME/.composer:/tmp composer:latest /tmp/vendor/bin/laravel" diff --git a/zsh/dot-zshrc b/zsh/dot-zshrc index a1e73b5..ba4219f 100644 --- a/zsh/dot-zshrc +++ b/zsh/dot-zshrc @@ -10,7 +10,7 @@ if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]] fi # If you come from bash you might have to change your $PATH. -export PATH=$HOME/bin:/usr/local/bin:$PATH +export PATH=$HOME/bin:$PATH # Path to your oh-my-zsh installation. export ZSH="$HOME/.oh-my-zsh" @@ -82,7 +82,7 @@ ZSH_THEME="powerlevel10k/powerlevel10k" # Custom plugins may be added to $ZSH_CUSTOM/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. -plugins=(git) +plugins=(git docker ripgrep tig) source $ZSH/oh-my-zsh.sh @@ -91,14 +91,14 @@ source $ZSH/oh-my-zsh.sh # export MANPATH="/usr/local/man:$MANPATH" # You may need to manually set your language environment -# export LANG=en_US.UTF-8 +export LANG=en_US.UTF-8 # Preferred editor for local and remote sessions -# if [[ -n $SSH_CONNECTION ]]; then -# export EDITOR='vim' -# else -# export EDITOR='mvim' -# fi +if [[ -n $SSH_CONNECTION ]]; then + export EDITOR='vim' +else + export EDITOR='nvim' +fi # Compilation flags # export ARCHFLAGS="-arch x86_64"