Skip to content

Instantly share code, notes, and snippets.

@OmarAlashqar
Last active December 22, 2024 03:12
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
[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/layouts/default.kdl
layout {
pane size=2 borderless=true {
plugin location="zellij:tab-bar"
}
pane
pane size=1 borderless=true {
plugin location="zellij:status-bar"
}
}
# ~/.gitconfig
[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
[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'
export ZSH="$HOME/.oh-my-zsh"
zstyle ':omz:update' mode auto
zstyle ':omz:update' frequency 13
plugins=(git)
ZSH_THEME="robbyrussell"
DISABLE_AUTO_TITLE="true"
DISABLE_UNTRACKED_FILES_DIRTY="true"
source $ZSH/oh-my-zsh.sh
export EDITOR='nvim'
# prompt #
PROMPT="%(?:%{$fg_bold[green]%}%1{➜%} :%{$fg_bold[red]%}%1{➜%} ) %{$fg[cyan]%}%~%{$reset_color%} "
PROMPT+='$(git_prompt_info)'
# aliases #
alias vb="nvim ~/.zshrc"
alias sb="source ~/.zshrc"
alias vim="nvim"
alias z="zellij"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment