Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
roktas committed Oct 28, 2023
1 parent 7567b32 commit 70fcb14
Show file tree
Hide file tree
Showing 25 changed files with 1,025 additions and 252 deletions.
81 changes: 81 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
inherit_gem:
rubocop-shopify: rubocop.yml

require:
- "rubocop-md"
- "rubocop-minitest"
- "rubocop-packaging"
- "rubocop-performance"
- "rubocop-rake"

Layout/ExtraSpacing:
Exclude:
- "**/lib/sevgi/standard/**/*.rb"
- "**/test/**/*.rb"
Layout/HashAlignment:
Enabled: true
EnforcedHashRocketStyle: table
EnforcedColonStyle: table
Layout/LineLength:
Max: 140
Exclude:
- "**/test/**/*.rb"
Layout/MultilineArrayLineBreaks:
Exclude:
- "**/test/**/*.rb"
Layout/MultilineMethodArgumentLineBreaks:
Exclude:
- "**/test/**/*.rb"
Layout/MultilineOperationIndentation:
Enabled: false

Metrics/BlockLength:
Exclude:
- "**/test/**/*.rb"
- "*.gemspec"
Metrics/ClassLength:
Exclude:
- "**/test/**/*.rb"
Metrics/MethodLength:
Exclude:
- "**/test/**/*.rb"

Naming/MethodName:
Enabled: false

Minitest/UselessAssertion:
Exclude:
- "**/test/test_common.rb" # TODO: to avoid a bug

Style/AsciiComments:
Enabled: false
Style/ClassAndModuleChildren:
Exclude:
- "**/test/**/*.rb"
Style/Documentation:
Enabled: false
Style/LambdaCall:
Enabled: false
Style/MethodCallWithArgsParentheses:
Exclude:
- "**/test/**/*.rb"
Style/ParallelAssignment:
Enabled: false
Style/SymbolArray:
Exclude:
- "**/lib/sevgi/standard/**/*.rb"
- "**/test/**/*.rb"
Style/SymbolLiteral:
Exclude:
- "**/lib/sevgi/standard/**/*.rb"
- "**/test/**/*.rb"
Style/TrailingCommaInArguments:
Exclude:
- "**/test/**/*.rb"

AllCops:
NewCops: enable
Exclude:
- "vendor/**/*"
- "_/**/*"
- "**/_/**/*"
6 changes: 3 additions & 3 deletions alacritty/alacritty.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ cursor:
live_config_reload: true

shell:
program: /usr/bin/tmux
program: /usr/bin/env
args:
- -u
- "tmux"
- "-u"

mouse:
hide_when_typing: false
Expand Down Expand Up @@ -119,7 +120,6 @@ colors:
cyan: '#6d96a5'
white: '#aeb3bb'

# Normal colors
window:
dimensions:
columns: 124
Expand Down
68 changes: 30 additions & 38 deletions bash/bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -88,28 +88,45 @@ prompt_command() {
export PROMPT_COMMAND=prompt_command

# ----------------------------------------------------------------------------------------------------------------------
# Aliases
# Aliases and/or Functions
# ----------------------------------------------------------------------------------------------------------------------

alias ...='cd $(git rev-parse --show-toplevel)'

alias a=apt
alias A='sudo apt'

b() {
local cmd=$1
shift

case $cmd in
e) bundle exec "$@" ;;
i) bundle install "$@" ;;
u) bundle update "$@" ;;
*) bundle "$@" ;;
esac
}
alias B=bexec

alias e=editor
alias E='sudo editor'

alias g=git

alias J='sudo journalctl'

alias S='sudo systemctl'

alias a=apt
alias e=editor
alias g=git
alias t='todo.sh -t'
alias T='todo.sh'

if [[ -x /usr/bin/dircolors ]]; then
eval -- "$(dircolors -b)"
command -v dircolors &>/dev/null && eval -- "$(dircolors -b)"

alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'

# ----------------------------------------------------------------------------------------------------------------------
# External
Expand Down Expand Up @@ -141,33 +158,8 @@ fi
# Zoxide
command -v zoxide &>/dev/null && eval "$(zoxide init bash)"

# Direnv (piggybacked)
_direnv_program=$(command -v direnv ||:)

if [[ -n "$_direnv_program" ]]; then
export LOCAL_CACHE_ROOT=${XDG_CACHE_DIR:-$HOME/.cache}/_
[[ -d $LOCAL_CACHE_ROOT ]] || mkdir -p "$LOCAL_CACHE_ROOT"

_direnv_piggyback() {
local here=${PWD//\//+}

export LOCAL_CACHE_DIR="$LOCAL_CACHE_ROOT"/"$here"
export VAGRANT_DOTFILE_PATH="$LOCAL_CACHE_DIR"/vagrant
}

_direnv_hook() {
local previous_exit_status=$?
trap -- '' SIGINT
_direnv_piggyback
eval "$("$_direnv_program" export bash)"
trap - SIGINT
return $previous_exit_status
}

if ! [[ "${PROMPT_COMMAND:-}" =~ _direnv_hook ]]; then
PROMPT_COMMAND="_direnv_hook${PROMPT_COMMAND:+;$PROMPT_COMMAND}"
fi
fi
# Direnv
command -v direnv &>/dev/null && eval "$(direnv hook bash)"

# ----------------------------------------------------------------------------------------------------------------------
# Customization
Expand Down
23 changes: 23 additions & 0 deletions bexec/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

source "https://rubygems.org"

if File.exist?(file = File.expand_path(".ruby-version", __dir__))
ruby File.read(file).strip
end

gem "bundler"
gem "debug", platforms: :mri
gem "minitest"
gem "minitest-focus"
gem "minitest-reporters"
gem "rake"
gem "rubocop"
gem "rubocop-md"
gem "rubocop-minitest"
gem "rubocop-packaging"
gem "rubocop-performance"
gem "rubocop-rake"
gem "rubocop-shopify"
gem "ruby-lsp"
gem "rubygems-tasks"
9 changes: 9 additions & 0 deletions bexec/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

set -euo pipefail; [[ -z ${TRACE:-} ]] || set -x; cd "$(dirname "$0")"

config=${XDG_CONFIG_HOME:-$HOME/.config}/bexec

rm -rf "$config" && install -d "$config" && {
ln -sf "$PWD"/Gemfile -t "$config"
}
7 changes: 7 additions & 0 deletions bin/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail; [[ -z ${TRACE:-} ]] || set -x; cd "$(dirname "$0")"

install -d "$HOME"/.local/bin && {
find $PWD -executable -type f | xargs ln -t "$HOME"/.local/bin -sf
}
18 changes: 18 additions & 0 deletions bin/search
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

# Switch between Ripgrep launcher mode (CTRL-R) and fzf filtering mode (CTRL-F)
rm -f /tmp/rg-fzf-{r,f}
RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case "
INITIAL_QUERY="${*:-}"
: | fzf --ansi --disabled --query "$INITIAL_QUERY" \
--bind "start:reload($RG_PREFIX {q})+unbind(ctrl-r)" \
--bind "change:reload:sleep 0.1; $RG_PREFIX {q} || true" \
--bind "ctrl-f:unbind(change,ctrl-f)+change-prompt(2. fzf> )+enable-search+rebind(ctrl-r)+transform-query(echo {q} > /tmp/rg-fzf-r; cat /tmp/rg-fzf-f)" \
--bind "ctrl-r:unbind(ctrl-r)+change-prompt(1. ripgrep> )+disable-search+reload($RG_PREFIX {q} || true)+rebind(change,ctrl-f)+transform-query(echo {q} > /tmp/rg-fzf-f; cat /tmp/rg-fzf-r)" \
--color "hl:-1:underline,hl+:-1:underline:reverse" \
--prompt '1. ripgrep> ' \
--delimiter : \
--header '╱ CTRL-R (ripgrep mode) ╱ CTRL-F (fzf mode) ╱' \
--preview 'bat --color=always {1} --highlight-line {2}' \
--preview-window 'down,40%,border-bottom,+{2}+3/3,~3' \
--bind 'enter:become(nvim {1} +{2})'
Loading

0 comments on commit 70fcb14

Please sign in to comment.