Skip to content

Instantly share code, notes, and snippets.

@strikeraryu
Last active June 20, 2024 12:19
Show Gist options
  • Save strikeraryu/816d1bced2dccdfc125f7d237fdbd62e to your computer and use it in GitHub Desktop.
Save strikeraryu/816d1bced2dccdfc125f7d237fdbd62e to your computer and use it in GitHub Desktop.
#<config: .zshrc
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${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:$HOME/.local/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
# Plugins
plugins=(
git
zsh-syntax-highlighting
zsh-autosuggestions
aws
dirhistory
fzf-tab
)
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src
# disable sort when completing `git checkout`
zstyle ':completion:*:git-checkout:*' sort false
# set descriptions format to enable group support
# NOTE: don't use escape sequences here, fzf-tab will ignore them
zstyle ':completion:*:descriptions' format '[%d]'
# set list-colors to enable filename colorizing
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
# force zsh not to show completion menu, which allows fzf-tab to capture the unambiguous prefix
zstyle ':completion:*' menu no
# preview directory's content with eza when completing cd
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath'
# switch group using `<` and `>`
zstyle ':fzf-tab:*' switch-group '<' '>'
source $ZSH/oh-my-zsh.sh
intel() {
arch -x86_64 $@
}
export PATH="$PATH:/opt/homebrew/bin"
export PATH="/bin/zsh:$PATH"
export HOMEBREW_NO_AUTO_UPDATE=true
# Scaler Configuration
export PATH="/opt/homebrew/opt/mysql@5.7/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/mysql@5.7/lib"
export CPPFLAGS="-I/opt/homebrew/opt/mysql@5.7/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/mysql@5.7/lib/pkgconfig"
export PATH="/opt/homebrew/opt/imagemagick@6/bin:$PATH"
export PATH="/opt/homebrew/opt/imagemagick@6/bin:$PATH"
export PATH="/opt/homebrew/opt/imagemagick@6/bin:$PATH"
export ENV_ID="scaler"
export NODE_OPTIONS=--max_old_space_size=4096
export PATH="${HOME}/.pyenv/shims:${PATH}"
export BUNDLE_GEMFILE=Gemfile.next259
export NVM_DIR="$HOME/.nvm"
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
eval "$(rbenv init -)"
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
alias init-dynamodb="java -Djava.library.path=/Users/libs/dynamodb_local_latest/DynamoDBLocal_lib -jar /Users/libs/dynamodb_local_latest/DynamoDBLocal.jar -sharedDb"
alias scaler_start="~/.scripts/scaler_start.sh"
# ------
# Shell methods
function deep-spec() {
filtered_files=()
for item in "$@"; do
rspec_file=$item
if [[ $rspec_file != *_spec.rb ]]; then
rspec_file=$(echo "$rspec_file" | sed -e 's/^app\//spec\//' -e 's/.rb/_spec.rb/')
fi
if [[ ! $(echo ${filtered_files[*]} | fgrep -w $rspec_file) ]]; then
if [ -f $rspec_file ]; then
filtered_files+=("$rspec_file")
else
echo -e "\e[1;31m No Rspec for: ${item} \e[0m"
fi
fi
done
bundle exec rspec $filtered_files --order defined
}
function give_me_shell() {
INSTANCE_ID=$(aws --profile staging-dev ec2 describe-instances --filters "Name=tag:Name,Values=$1" --query 'Reservations[*].Instances[*].[InstanceId]' --output text | sort -R | head -n 1);
echo "Connecting to $1 on $INSTANCE_ID"
aws --profile staging-dev ssm start-session --target $INSTANCE_ID
}
# Link bar setup
source /Users/striker/workspace/striker/link_bar/.link_bar.sh
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# aliases
alias staged-files="git diff --name-only --staged"
alias vi='nvim'
alias mycmds='curl -Ls "https://gist.githubusercontent.com/strikeraryu/4f4e73cd30e627a9a8dd923feed44127/raw?q=$(date +%s)"'
alias mycnfgs='curl -Ls "https://gist.githubusercontent.com/strikeraryu/816d1bced2dccdfc125f7d237fdbd62e/raw?q=$(date +%s)"'
alias ls='eza --icons=always'
# fzf + bat setup for preview
export FZF_DEFAULT_OPTS="--ansi --preview-window 'right:60%' --preview 'bat --color=always --style=header,grid --line-range :300 {}'"
eval "$(zoxide init --cmd cd zsh)"
# Show sys info in start
neofetch --ascii striker_logo.txt --ascii_colors 2 5 6 1
#>config: .zshrc
#<config: nvim ~/.config/nvim/init.vim
:
call plug#begin()
" Appearance
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'ryanoasis/vim-devicons'
Plug 'EdenEast/nightfox.nvim'
" Utilities
Plug 'sheerun/vim-polyglot'
Plug 'jiangmiao/auto-pairs'
Plug 'ap/vim-css-color'
Plug 'preservim/nerdtree'
" Completion / linters / formatters
" Plug 'neoclide/coc.nvim', {'branch': 'master', 'do': 'npm install'}
Plug 'plasticboy/vim-markdown'
" Git
Plug 'airblade/vim-gitgutter'
call plug#end()
colorscheme Carbonfox
filetype plugin indent on
set termguicolors
syntax on
set background=dark
set clipboard=unnamedplus
set completeopt=noinsert,menuone,noselect
set cursorline
set hidden
set inccommand=split
set mouse=a
set number
set relativenumber
set splitbelow splitright
set title
" File Browser
let g:netrw_banner=0
let g:netrw_liststyle=0
let g:netrw_browse_split=4
let g:netrw_altv=1
let g:netrw_winsize=25
let g:netrw_keepdir=0
let g:netrw_localcopydircmd='cp -r'
set ttimeoutlen=0
set wildmenu
set expandtab
set shiftwidth=2
set tabstop=2
set t_Co=256
" Plugins
let NERDTreeShowHidden=1
let g:airline_theme='minimalist'
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
" Extra
set runtimepath^=~/.vim/bundle/ctrlp.vim
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
" KeyRemap
nnoremap <F6> :sp<CR>:terminal<CR>
function! NerdTreeToggleFind()
if exists("g:NERDTree") && g:NERDTree.IsOpen()
NERDTreeClose
elseif filereadable(expand('%'))
NERDTreeFind
else
NERDTree
endif
endfunction
nnoremap <C-b> :call NerdTreeToggleFind()<CR>
" Remap splits navigation to just CTRL + hjkl
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
nnoremap <C-S-Left> :tabprevious<CR>
nnoremap <C-S-Right> :tabnext<CR>
" Change 2 split windows from vert to horiz or horiz to vert
map <Leader>th <C-w>t<C-w>H
map <Leader>tk <C-w>t<C-w>K
" Remember cursor position
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | execute "normal! g`\"" | endif
endif
#>config: nvim ~/.config/nvim/init.vim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment