Skip to content

Instantly share code, notes, and snippets.

@roziscoding
Last active August 8, 2024 14:17
Show Gist options
  • Save roziscoding/f653e4c897ca2a0beebbeab7bf1549c0 to your computer and use it in GitHub Desktop.
Save roziscoding/f653e4c897ca2a0beebbeab7bf1549c0 to your computer and use it in GitHub Desktop.
" Disable compatibility with vi which can cause unexpected issues.
set nocompatible
" Enable type file detection. Vim will be able to try to detect the type of file in use.
filetype on
" Enable plugins and load plugin for the detected file type.
filetype plugin on
" Load an indent file for the detected file type.
filetype indent on
" Enable syntax highlighting
syntax enable
" Display line numbers
set number
" Highlight cursor line underneath the cursor horizontally.
set cursorline
" Highlight cursor line underneath the cursor vertically.
set cursorcolumn
" Set shift width to 4 spaces.
set shiftwidth=2
" Set tab width to 4 columns.
set tabstop=2
" Use space characters instead of tabs.
set expandtab
" Do not save backup files.
set nobackup
" Do not let cursor scroll below or above N number of lines when scrolling.
set scrolloff=10
" While searching though a file incrementally highlight matching characters as you type.
set incsearch
" Ignore capital letters during search.
set ignorecase
" Override the ignorecase option if searching for capital letters.
" This will allow you to search specifically for capital letters.
set smartcase
" Show partial command you type in the last line of the screen.
set showcmd
" Show the mode you are on the last line.
set showmode
" Show matching words during a search.
set showmatch
" Use highlighting when doing a search.
set hlsearch
" Set the commands to save in history default number is 20.
set history=1000
" Enable auto completion menu after pressing TAB.
set wildmenu
" Make wildmenu behave like similar to Bash completion.
set wildmode=list:longest
" There are certain files that we would never want to edit with Vim.
" Wildmenu will ignore files with these extensions.
set wildignore=*.docx,*.jpg,*.png,*.gif,*.pdf,*.pyc,*.exe,*.flv,*.img,*.xlsx
" Enables automatic line number changing
set number
augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu && mode() != "i" | set rnu | endif
autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif
augroup END
" Clears search when hitting return again
nnoremap <silent> <cr> :noh<CR><CR>
eval "$(starship init zsh)"
. "$HOME/.asdf/asdf.sh"
# Fixing completions
setopt automenu nolistambiguous
zstyle ':completion:*' menu select
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt autocd beep extendedglob nomatch notify
# End of lines configured by zsh-newuser-install
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line
bindkey "^[[3~" delete-char
# append completions to fpath
fpath=(${ASDF_DIR}/completions $fpath)
# initialise completions with ZSH's compinit
autoload -Uz compinit && compinit
### Added by Zinit's installer
if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then
print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f"
command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit"
command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" && \
print -P "%F{33} %F{34}Installation successful.%f%b" || \
print -P "%F{160} The clone has failed.%f%b"
fi
source "$HOME/.local/share/zinit/zinit.git/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
# Load a few important annexes, without Turbo
# (this is currently required for annexes)
zinit light-mode for \
zdharma-continuum/zinit-annex-as-monitor \
zdharma-continuum/zinit-annex-bin-gem-node \
zdharma-continuum/zinit-annex-patch-dl \
zdharma-continuum/zinit-annex-rust
### End of Zinit's installer chunk
# Sets default editor to vim
export EDITOR=vim
# Loads plugins
zinit wait lucid for \
atinit'ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay' \
zdharma-continuum/fast-syntax-highlighting \
blockf \
zsh-users/zsh-completions \
atload'!_zsh_autosuggest_start' \
zsh-users/zsh-autosuggestions \
hlissner/zsh-autopair \
zpm-zsh/colorize \
Tarrasch/zsh-command-not-found \
zpm-zsh/ls \
atload'unalias gst; alias gst="git status"' davidde/git \
atload'alias python=python3' amstrad/oh-my-matrix \
reegnz/jq-zsh-plugin \
atload'bindkey "^[[A" history-substring-search-up; bindkey "^[[B" history-substring-search-down;' zsh-users/zsh-history-substring-search \
Tarrasch/zsh-colors
# Aliases
function cz () {
code $(z -e $1)
}
function cfz () {
code $(fzf)
}
function mkd () {
mkdir -p $1 && cd $1
}
function ghc () {
OWNER=$(basename $(pwd))
gh repo clone $OWNER/$1
}
alias rd="rm -rf"
alias mongo="docker exec -it mongodb mongo"
eval "$(zoxide init zsh)"
source /Users/roziscoding/.config/op/plugins.sh
eval "$(op inject -i ~/.envs.sh)"
export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=${HOME}/.colima/docker.sock
export DOCKER_HOST="unix:///${HOME}/.colima/docker.sock"
export TESTCONTAINERS_RYUK_DISABLED=true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment