Skip to content

Instantly share code, notes, and snippets.

@OmarAlashqar
Last active July 19, 2024 22:02
Show Gist options
  • Save OmarAlashqar/a9ce2d2370fceee1ffaa4f81ebf7bf10 to your computer and use it in GitHub Desktop.
Save OmarAlashqar/a9ce2d2370fceee1ffaa4f81ebf7bf10 to your computer and use it in GitHub Desktop.
dotfiles that I roll with
you might find these interesting 👀
configs for my terminal, multiplexer, shell, etc.
currently rolling with: alacritty + zsh + oh-my-zsh + zellij + nvim
# ~/.config/alacritty/alacritty.toml
## See https://alacritty.org/config-alacritty.html for available settings
[window]
option_as_alt = "Both"
padding = { x = 10, y = 10 }
startup_mode = "Fullscreen"
[keyboard]
bindings = [
{ key = "Right", mods = "Alt", chars = "\u001BF" }, # Jump word forward
{ key = "Left", mods = "Alt", chars = "\u001BB" }, # Jump word backward
]
[font]
size = 16
" ~/.config/nvim/init.vim
" This config is for neovim
" The plugin manager used is VimPlug
call plug#begin()
Plug 'scrooloose/nerdtree'
Plug 'tpope/vim-commentary'
Plug 'ctrlpvim/ctrlp.vim'
" Plug 'christoomey/vim-tmux-navigator'
Plug 'morhetz/gruvbox'
call plug#end()
" General
filetype plugin indent on " turns on detection, plugin, indent
syntax on " enable syntax highlighting
set number " line numbers
set nocp " tuns off compatibility with old vi
set autoread " watch for file changes
set showmode " show INSERT, VISUAL, etc
set ruler " cursor position
set wildmenu " enhanced command line completion
set mouse-=a " disabled VISUAL mode
set showmatch " matching parens
set scrolloff=5 " keeps a margin of lines above/below line
set clipboard=unnamedplus " use system clipboard
" Theme
colorscheme gruvbox
set t_Co=256
" set background=dark
" set t_ut= " disable Background Color Erase
" Code folding
set foldmethod=manual
"Tabs and spacing
set autoindent " copy indentation from prev line
set cindent
set tabstop=4
set expandtab
set shiftwidth=4
set smarttab
" Other
set noerrorbells
set visualbell
set mouse=n " enables mouse
" Search
set hlsearch " highlight search items
set incsearch " incremental searching
set ignorecase " case insensitive search
set smartcase
set diffopt+=iwhite
" ctrlp
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
" NERDTree setup
" Check if NERDTree is open or active
function! IsNERDTreeOpen()
return exists("t:NERDTreeBufName") && (bufwinnr(t:NERDTreeBufName) != -1)
endfunction
function! CheckIfCurrentBufferIsFile()
return strlen(expand('%')) > 0
endfunction
" Call NERDTreeFind iff NERDTree is active, current window contains a modifiable
" file, and we're not in vimdiff
function! SyncTree()
if &modifiable && IsNERDTreeOpen() && CheckIfCurrentBufferIsFile() && !&diff
NERDTreeFind
wincmd p
endif
endfunction
" Highlight currently open buffer in NERDTree
autocmd BufRead * call SyncTree()
function! ToggleTree()
if CheckIfCurrentBufferIsFile()
if IsNERDTreeOpen()
NERDTreeClose
else
NERDTreeFind
endif
else
NERDTree
endif
endfunction
" NERDTree setup done
" WSL2 system clipboard support using win32yank.exe
" Enable if you want this and make sure win32yank.exe is installed
"let g:clipboard = {
" \ 'name': 'win32yank-wsl',
" \ 'copy': {
" \ '+': 'win32yank.exe -i --crlf',
" \ '*': 'win32yank.exe -i --crlf',
" \ },
" \ 'paste': {
" \ '+': 'win32yank.exe -o --lf',
" \ '*': 'win32yank.exe -o --lf',
" \ },
" \ 'cache_enabled': 0,
" \ }
" remapped keys
inoremap {<CR> {<CR>}<Esc>O
inoremap {{ {
inoremap {} {}
nnoremap q <c-v>
" shortcuts
nmap <C-b> :call ToggleTree()<CR>
" close vim if only thing open is NERDTree
" autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
// .config/zellij/config.kdl
// If you'd like to override the default keybindings completely, be sure to change "keybinds" to "keybinds clear-defaults=true"
keybinds {
normal {
// uncomment this and adjust key if using copy_on_select=false
// bind "Alt c" { Copy; }
}
locked {
bind "Ctrl g" { SwitchToMode "Normal"; }
}
resize {
bind "Ctrl n" { SwitchToMode "Normal"; }
bind "h" "Left" { Resize "Increase Left"; }
bind "j" "Down" { Resize "Increase Down"; }
bind "k" "Up" { Resize "Increase Up"; }
bind "l" "Right" { Resize "Increase Right"; }
bind "H" { Resize "Decrease Left"; }
bind "J" { Resize "Decrease Down"; }
bind "K" { Resize "Decrease Up"; }
bind "L" { Resize "Decrease Right"; }
bind "=" "+" { Resize "Increase"; }
bind "-" { Resize "Decrease"; }
}
pane {
bind "Ctrl p" { SwitchToMode "Normal"; }
bind "h" "Left" { MoveFocus "Left"; }
bind "l" "Right" { MoveFocus "Right"; }
bind "j" "Down" { MoveFocus "Down"; }
bind "k" "Up" { MoveFocus "Up"; }
bind "p" { SwitchFocus; }
bind "n" { NewPane; SwitchToMode "Normal"; }
bind "d" { NewPane "Down"; SwitchToMode "Normal"; }
bind "r" { NewPane "Right"; SwitchToMode "Normal"; }
bind "x" { CloseFocus; SwitchToMode "Normal"; }
bind "f" { ToggleFocusFullscreen; SwitchToMode "Normal"; }
bind "z" { TogglePaneFrames; SwitchToMode "Normal"; }
bind "w" { ToggleFloatingPanes; SwitchToMode "Normal"; }
bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "Normal"; }
bind "c" { SwitchToMode "RenamePane"; PaneNameInput 0;}
}
move {
bind "Ctrl h" { SwitchToMode "Normal"; }
bind "n" "Tab" { MovePane; }
bind "p" { MovePaneBackwards; }
bind "h" "Left" { MovePane "Left"; }
bind "j" "Down" { MovePane "Down"; }
bind "k" "Up" { MovePane "Up"; }
bind "l" "Right" { MovePane "Right"; }
}
tab {
bind "Ctrl t" { SwitchToMode "Normal"; }
bind "r" { SwitchToMode "RenameTab"; TabNameInput 0; }
bind "h" "Left" "Up" "k" { GoToPreviousTab; }
bind "l" "Right" "Down" "j" { GoToNextTab; }
bind "n" { NewTab; SwitchToMode "Normal"; }
bind "x" { CloseTab; SwitchToMode "Normal"; }
bind "s" { ToggleActiveSyncTab; SwitchToMode "Normal"; }
bind "b" { BreakPane; SwitchToMode "Normal"; }
bind "]" { BreakPaneRight; SwitchToMode "Normal"; }
bind "[" { BreakPaneLeft; SwitchToMode "Normal"; }
bind "1" { GoToTab 1; SwitchToMode "Normal"; }
bind "2" { GoToTab 2; SwitchToMode "Normal"; }
bind "3" { GoToTab 3; SwitchToMode "Normal"; }
bind "4" { GoToTab 4; SwitchToMode "Normal"; }
bind "5" { GoToTab 5; SwitchToMode "Normal"; }
bind "6" { GoToTab 6; SwitchToMode "Normal"; }
bind "7" { GoToTab 7; SwitchToMode "Normal"; }
bind "8" { GoToTab 8; SwitchToMode "Normal"; }
bind "9" { GoToTab 9; SwitchToMode "Normal"; }
bind "Tab" { ToggleTab; }
}
scroll {
bind "Ctrl s" { SwitchToMode "Normal"; }
bind "e" { EditScrollback; SwitchToMode "Normal"; }
bind "s" { SwitchToMode "EnterSearch"; SearchInput 0; }
bind "Ctrl c" { ScrollToBottom; SwitchToMode "Normal"; }
bind "j" "Down" { ScrollDown; }
bind "k" "Up" { ScrollUp; }
bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; }
bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; }
bind "d" { HalfPageScrollDown; }
bind "u" { HalfPageScrollUp; }
// uncomment this and adjust key if using copy_on_select=false
// bind "Alt c" { Copy; }
}
search {
bind "Ctrl s" { SwitchToMode "Normal"; }
bind "Ctrl c" { ScrollToBottom; SwitchToMode "Normal"; }
bind "j" "Down" { ScrollDown; }
bind "k" "Up" { ScrollUp; }
bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; }
bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; }
bind "d" { HalfPageScrollDown; }
bind "u" { HalfPageScrollUp; }
bind "n" { Search "down"; }
bind "p" { Search "up"; }
bind "c" { SearchToggleOption "CaseSensitivity"; }
bind "w" { SearchToggleOption "Wrap"; }
bind "o" { SearchToggleOption "WholeWord"; }
}
entersearch {
bind "Ctrl c" "Esc" { SwitchToMode "Scroll"; }
bind "Enter" { SwitchToMode "Search"; }
}
renametab {
bind "Ctrl c" { SwitchToMode "Normal"; }
bind "Esc" { UndoRenameTab; SwitchToMode "Tab"; }
}
renamepane {
bind "Ctrl c" { SwitchToMode "Normal"; }
bind "Esc" { UndoRenamePane; SwitchToMode "Pane"; }
}
session {
bind "Ctrl o" { SwitchToMode "Normal"; }
bind "Ctrl s" { SwitchToMode "Scroll"; }
bind "d" { Detach; }
bind "w" {
LaunchOrFocusPlugin "zellij:session-manager" {
floating true
move_to_focused_tab true
};
SwitchToMode "Normal"
}
}
tmux {
bind "[" { SwitchToMode "Scroll"; }
bind "Ctrl b" { Write 2; SwitchToMode "Normal"; }
bind "\"" { NewPane "Down"; SwitchToMode "Normal"; }
bind "%" { NewPane "Right"; SwitchToMode "Normal"; }
bind "z" { ToggleFocusFullscreen; SwitchToMode "Normal"; }
bind "c" { NewTab; SwitchToMode "Normal"; }
bind "," { SwitchToMode "RenameTab"; }
bind "p" { GoToPreviousTab; SwitchToMode "Normal"; }
bind "n" { GoToNextTab; SwitchToMode "Normal"; }
bind "Left" { MoveFocus "Left"; SwitchToMode "Normal"; }
bind "Right" { MoveFocus "Right"; SwitchToMode "Normal"; }
bind "Down" { MoveFocus "Down"; SwitchToMode "Normal"; }
bind "Up" { MoveFocus "Up"; SwitchToMode "Normal"; }
bind "h" { MoveFocus "Left"; SwitchToMode "Normal"; }
bind "l" { MoveFocus "Right"; SwitchToMode "Normal"; }
bind "j" { MoveFocus "Down"; SwitchToMode "Normal"; }
bind "k" { MoveFocus "Up"; SwitchToMode "Normal"; }
bind "o" { FocusNextPane; }
bind "d" { Detach; }
bind "Space" { NextSwapLayout; }
bind "x" { CloseFocus; SwitchToMode "Normal"; }
}
shared_except "locked" {
bind "Ctrl g" { SwitchToMode "Locked"; }
bind "Ctrl q" { Quit; }
bind "Alt n" { NewPane; }
bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; }
bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; }
bind "Alt j" "Alt Down" { MoveFocus "Down"; }
bind "Alt k" "Alt Up" { MoveFocus "Up"; }
bind "Alt =" "Alt +" { Resize "Increase"; }
bind "Alt -" { Resize "Decrease"; }
bind "Alt [" { PreviousSwapLayout; }
bind "Alt ]" { NextSwapLayout; }
}
shared_except "normal" "locked" {
bind "Enter" "Esc" { SwitchToMode "Normal"; }
}
shared_except "pane" "locked" {
bind "Ctrl p" { SwitchToMode "Pane"; }
}
shared_except "resize" "locked" {
bind "Ctrl n" { SwitchToMode "Resize"; }
}
shared_except "scroll" "locked" {
bind "Ctrl s" { SwitchToMode "Scroll"; }
}
shared_except "session" "locked" {
bind "Ctrl o" { SwitchToMode "Session"; }
}
shared_except "tab" "locked" {
bind "Ctrl t" { SwitchToMode "Tab"; }
}
shared_except "move" "locked" {
bind "Ctrl h" { SwitchToMode "Move"; }
}
shared_except "tmux" "locked" {
bind "Ctrl b" { SwitchToMode "Tmux"; }
}
}
plugins {
tab-bar { path "tab-bar"; }
status-bar { path "status-bar"; }
strider { path "strider"; }
compact-bar { path "compact-bar"; }
session-manager { path "session-manager"; }
}
// ~/.config/zellij/layouts/default.kdl
layout {
pane size=1 borderless=true {
plugin location="zellij:tab-bar"
}
pane
pane size=2 borderless=true {
plugin location="file:~/.config/zellij/plugins/zjstatus.wasm" {
format_left "#[bg=#b4fa72,fg=#001a0d,bold] {command_k8s}"
format_center ""
format_right "#[bg=#b4fa72,fg=#001a0d,bold]{datetime} "
format_space "#[bg=#b4fa72]"
border_enabled "true"
border_char "─"
border_format "#[fg=#6C7086]{char}"
border_position "bottom"
hide_frame_for_single_pane "false"
mode_normal "#[bg=blue] "
mode_tmux "#[bg=#ffc387] "
tab_normal "#[fg=#6C7086] {name} "
tab_active "#[fg=#9399B2,bold,italic] {name} "
command_git_branch_command "git rev-parse --abbrev-ref HEAD"
command_git_branch_format "#[fg=blue] {stdout} "
command_git_branch_interval "2"
command_git_branch_rendermode "static"
command_k8s_command "bash -c \"echo `kubectx -c`:`kubens -c`\""
command_k8s_format "k8s({stdout})"
command_k8s_interval "2"
command_k8s_rendermode "static"
datetime "{format} "
datetime_format "%A, %d %b %Y %H:%M"
datetime_timezone "America/Los_Angeles"
}
}
pane size=2 borderless=true {
plugin location="zellij:status-bar"
}
}
# ~/.gitconfig
[oh-my-zsh]
hide-dirty = 1
[url "[email protected]:"]
insteadOf = https://github.com/
[user]
name = ...
email = ...
[core]
editor = nvim
[push]
autoSetupRemote = true
[alias]
co = checkout
sw = switch
br = branch
st = status
logz = log --oneline
ls = show --pretty="" --name-only
[diff]
ignoreSubmodules = dirty
[pager]
branch = false
# ~/.tmux.conf
set -g default-terminal "screen-256color"
# split panes using [ and ]
bind ] split-window -h
bind [ split-window -v
unbind '"'
unbind %
# reload config file
bind r source-file ~/.tmux.conf
# ah yes, Alt-A is the best prefix
unbind C-b
set -g prefix M-a
# switch panes using Alt-Shift-<h,j,k,l> without prefix
bind -n M-H select-pane -L
bind -n M-L select-pane -R
bind -n M-K select-pane -U
bind -n M-J select-pane -D
# Enable mouse mode (tmux 2.1 and above)
set -g mouse on
# don't rename windows automatically
# (prefix + ,) to rename
set-option -g allow-rename off
# quick way to end current session
bind X confirm-before kill-session
###############
## tmux-plugins
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin '[email protected]:user/plugin'
# set -g @plugin '[email protected]:user/plugin'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
# ~/.zshrc
export PATH="/opt/homebrew/bin:$HOME/bin:$PATH"
autoload -U compinit; compinit
## ZSH Settings ##
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="robbyrussell"
zstyle ':omz:update' mode reminder # just remind me to update when it's time
zstyle ':omz:update' frequency 13
# CASE_SENSITIVE="true"
# DISABLE_MAGIC_FUNCTIONS="true"
# DISABLE_LS_COLORS="true"
# ENABLE_CORRECTION="true"
# COMPLETION_WAITING_DOTS="true"
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# HIST_STAMPS="mm/dd/yyyy"
# ZSH_CUSTOM=/path/to/new-custom-folder
plugins=(git)
source $ZSH/oh-my-zsh.sh
PROMPT="%(?:%{$fg_bold[green]%}%1{➜%} :%{$fg_bold[red]%}%1{➜%} ) %{$fg[cyan]%}%~%{$reset_color%}"
PROMPT+=' $(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}%1{✗%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
## Aliases ##
# General
alias vim='nvim' # 👀 hell yeah
alias vb='vim ~/.zshrc'
alias sb='source ~/.zshrc'
alias dive='__dive(){ mkdir "$1" && cd "$1" ; }; __dive'
## Misc ##
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='vim'
else
export EDITOR='nvim'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment