-
-
Save Miliox/83e723fec0ad6e0043dde1fc45ef46d0 to your computer and use it in GitHub Desktop.
emiliano's dotfiles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# wrapper to launch vscode with enough file watches | |
function code() | |
{ | |
if [[ $(sysctl fs.inotify.max_user_watches | awk '{print $3}') -ne 524288 ]]; then | |
echo 'Authorize to increase number of files watchable by vscode.' | |
sudo sysctl -n -w 'fs.inotify.max_user_watches=524288' | |
fi | |
command code | |
} | |
# Utilities | |
alias ,='pwd' | |
alias ..='cd ..' | |
alias _='sudo' | |
alias apt='sudo apt' | |
alias fd='fdfind' | |
alias now='date +"%T"' | |
alias src='cd ~/src' | |
alias open='xdg-open' | |
alias path='echo -e ${PATH//:/\\n}' | |
alias pbcopy='xclip -sel clip' | |
alias pbpaste='xclip -sel clip -o' | |
# Applications | |
alias cpp='cling' | |
alias cling='${HOME}/Repos/cling/cling-build/builddir/bin/cling' | |
alias ghidra="${HOME}/ghidra_10.1.2_PUBLIC/ghidraRun" | |
alias qnxsoftwarecenter=${HOME}/qnx/qnxsoftwarecenter/qnxsoftwarecenter | |
alias qde='${HOME}/qnxmomenticside/qde' | |
alias panoply='${HOME}/Downloads/PanoplyJ/panoply.sh' | |
# Replacements | |
alias cat='pygmentize -g -O full,linenos=1,style=monokai' | |
alias cdi='change_directory_interactive' | |
alias cp='rsync --progress --verbose --human-readable' | |
alias cpr='rsync --progress --verbose --human-readable --stats --recursive' | |
alias du='du -lh' | |
alias df='df -lh' | |
alias edit='nvim' | |
alias h5='panoply' | |
alias h5v='panoply' | |
alias h5ll='h5ls -r' | |
alias hd='most -b' | |
alias hexdump='hd' | |
alias ls='ls --almost-all --classify --color=auto --group-directories-first --ignore-backups --human-readable' | |
alias ll='ls -l' | |
alias man='PAGER=most man' | |
alias mkdir='mkdir -pv' | |
alias mv='rsync --progress --verbose --human-readable --remove-source-files' | |
alias ps='procs --tree' | |
alias top='htop --tree --sort-key=PERCENT_CPU' | |
alias vi='nvim' | |
alias vim='nvim' | |
# File search | |
alias rg='rg --vimgrep --color=auto' | |
alias rgbz='rg --type=bazel' | |
alias rgcc='rg --type=cpp' | |
alias rgjj='rg --type=jinja' | |
alias rgjs='rg --type=json' | |
alias rgjv='rg --type=java' | |
alias rgpy='rg --type=py' | |
alias rgrs='rg --type=rust' | |
alias rgsh='rg --type=sh' | |
alias grep='rg' | |
alias cgrep='rgcc' | |
alias jgrep='rgjv' | |
alias jsgrep='rgjs' | |
alias jjgrep='rgjj' | |
# single letter commands | |
alias a='cat' | |
alias b='cd -' | |
alias c='clear' | |
alias d='cd' | |
alias e='nvim' | |
alias f='fd' | |
alias g='git' | |
alias h='rg' | |
alias i='ls' | |
alias j='' | |
alias k="ncal -w -y $(date +'%Y')" | |
alias l='ls' | |
alias L='ll' | |
alias m='man' | |
alias n='nvim' | |
alias o='open' | |
alias p='git add -p' | |
alias q='howdoi' | |
#alias r='!' | |
alias s='git st' | |
alias t='todo-txt' | |
alias u='git add -u' | |
alias v='code' | |
alias w='htop' | |
alias x='extract' | |
alias z='cd ~/Projects' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# don't put duplicate lines or lines starting with space in the history. | |
# See bash(1) for more options | |
HISTCONTROL=ignoreboth | |
# append to the history file, don't overwrite it | |
shopt -s histappend | |
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) | |
HISTSIZE= | |
HISTFILESIZE= | |
# check the window size after each command and, if necessary, | |
# update the values of LINES and COLUMNS. | |
shopt -s checkwinsize | |
# If set, the pattern "**" used in a pathname expansion context will | |
# match all files and zero or more directories and subdirectories. | |
#shopt -s globstar | |
# colored GCC warnings and errors | |
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' | |
# Alias definitions. | |
# You may want to put all your additions into a separate file like | |
# ~/.bash_aliases, instead of adding them here directly. | |
# See /usr/share/doc/bash-doc/examples in the bash-doc package. | |
if [ -f ~/.bash_aliases ]; then | |
source ~/.bash_aliases | |
fi | |
# enable programmable completion features (you don't need to enable | |
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile | |
# sources /etc/bash.bashrc). | |
if ! shopt -oq posix; then | |
if [ -f /usr/share/bash-completion/bash_completion ]; then | |
source /usr/share/bash-completion/bash_completion | |
elif [ -f /etc/bash_completion ]; then | |
source /etc/bash_completion | |
fi | |
fi | |
####### | |
# ENV # | |
####### | |
source ~/.cargo/env | |
export EDITOR=nvim | |
export FZF_DEFAULT_COMMAND='fdfind --type f' | |
export PROMPT_DIRTRIM=3 | |
function git_blame_authors { | |
git blame --porcelain $@ | grep '^author ' | sort -u | |
} | |
function parse_git_branch { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
export PS1="\[\033[38;5;83m\]\t \!\[$(tput sgr0)\]\[$(tput sgr0)\] \$? \[$(tput sgr0)\]\[\033[38;5;117m\]\w\[$(tput sgr0)\]\[\033[38;5;9m\]\$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/')\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;11m\]\\$\[$(tput sgr0)\] " | |
# switch of to tmux | |
if command -v tmux &> /dev/null && \ | |
[ -n "$PS1" ] && \ | |
[[ ! "$TERM" =~ screen ]] && \ | |
[[ ! "$TERM" =~ tmux ]] \ | |
&& [ -z "$TMUX" ]; then | |
exec tmux | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ~/.tmux.conf | |
# 8bit color | |
set -g default-terminal "screen-256color" | |
# Status | |
# Install: https://github.com/thewtex/tmux-mem-cpu-load | |
set -g status on | |
set -g status-interval 1 | |
set -g status-justify centre | |
set -g status-keys vi | |
set -g status-position top | |
set -g status-style fg=colour136,bg=colour235 | |
set -g status-right-length 140 | |
set -g status-right-style default | |
set -g status-right "#[fg=green,bg=default,bright]#(tmux-mem-cpu-load) " | |
set -ag status-right " #[fg=white,bg=default]%a%l:%M:%S %p#[default] #[fg=blue]%Y-%m-%d" | |
set-window-option -g window-status-style fg=colour244 | |
set-window-option -g window-status-style bg=default | |
set-window-option -g window-status-current-style fg=colour166 | |
set-window-option -g window-status-current-style bg=default | |
# Large scrollback buffer | |
set -g history-limit 65536 | |
# UTF-8 | |
set -q -g status on | |
set -q -g status-utf8 on | |
setw -q -g utf8 on | |
# Rebind Prefix to Ctrl+A | |
unbind C-b | |
set -g prefix C-a | |
bind C-a send-prefix | |
# Faster key repetition | |
set -sg escape-time 0 | |
# Easy reload | |
bind r source-file ~/.tmux.conf \; display "reloaded!" | |
# Paste | |
unbind p | |
bind p paste-buffer | |
# Splits | |
bind _ split-window -vb # Top | |
bind \\ split-window -h # Left | |
bind | split-window -hb # Right | |
bind - split-window -v # Bottom | |
unbind '"' | |
unbind '%' | |
# Split Nav | |
bind -n C-t select-pane -U # Top | |
bind -n C-h select-pane -L # Left | |
bind -n C-s select-pane -R # Right | |
bind -n C-n select-pane -D # Bottom | |
# Home/End Behavior | |
bind -n End send-key C-e | |
bind -n Home send-key C-a | |
# Mouse Behavior | |
set -g mouse on | |
# Mouse Scroll | |
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'" | |
bind -n WheelDownPane select-pane -t= \; send-keys -M | |
bind -n C-WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M | |
bind -T copy-mode-vi C-WheelUpPane send-keys -X halfpage-up | |
bind -T copy-mode-vi C-WheelDownPane send-keys -X halfpage-down | |
bind -T copy-mode-emacs C-WheelUpPane send-keys -X halfpage-up | |
bind -T copy-mode-emacs C-WheelDownPane send-keys -X halfpage-down | |
# To copy, left click and drag to highlight text in yellow, | |
# once you release left click yellow text will disappear and will automatically be available in clibboard | |
# # Use vim keybindings in copy mode | |
setw -g mode-keys vi | |
# Update default binding of `Enter` to also use copy-pipe | |
unbind -T copy-mode-vi Enter | |
# Linux | |
bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -selection c" | |
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard" | |
# Mac OSX | |
# bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy" | |
# bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" .config/nvim/init.vim | |
" Space over tabs | |
set expandtab | |
set shiftround | |
set shiftwidth=4 | |
set softtabstop=4 | |
set tabstop=4 | |
" Convenience | |
set clipboard=unnamed | |
set hidden | |
set nowrap | |
set number | |
set mouse=a | |
set wildmenu | |
set wildmode=list:longest,full | |
set virtualedit=onemore | |
" Typos | |
cab W w | |
cab Q q | |
cab Wq wq | |
cab wQ wq | |
cab WQ wq | |
cab Qa qa | |
cab qA qa | |
cab QA qa | |
" Avoid unconfortable shift press | |
nnoremap ; : | |
nnoremap <Tab> : | |
" Better hjkl for dvorka | |
" text nav | |
nmap h <Left> | |
nmap t <Up> | |
nmap n <Down> | |
nmap s <Right> | |
" split nav | |
nmap H <c-w><Left> | |
nmap T <c-w><Up> | |
nmap N <c-w><Down> | |
nmap S <c-w><Right> | |
" Escape with ctrl-c | |
nmap <c-c> <esc> | |
imap <c-c> <esc> | |
vmap <c-c> <esc> | |
omap <c-c> <esc> | |
" Easier movement over code blocks | |
vnoremap < <gv | |
vnoremap > >gv | |
" Bubble single line | |
nmap <silent><C-Up> <Esc>:m -2<Return> | |
nmap <silent><C-Down> <Esc>:m +1<Return> | |
call plug#begin() | |
" Clang format | |
Plug 'rhysd/vim-clang-format' | |
" Colorschemes | |
Plug 'flazz/vim-colorschemes' | |
" Ctrl Space | |
Plug 'vim-ctrlspace/vim-ctrlspace' | |
" Fuzzy Finder | |
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } | |
Plug 'junegunn/fzf.vim' | |
" Git | |
Plug 'tpope/vim-fugitive' | |
" Snippets Engine | |
Plug 'SirVer/ultisnips' | |
" Snippets Collection | |
Plug 'honza/vim-snippets' | |
" Status Line | |
Plug 'vim-airline/vim-airline' | |
" Status line themes | |
Plug 'vim-airline/vim-airline-themes' | |
" code completion support | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
" Useful splash page | |
Plug 'mhinz/vim-startify' | |
" gdb | |
Plug 'sakhnik/nvim-gdb', { 'do': ':!./install.sh' } | |
" python formatter | |
Plug 'averms/black-nvim', { 'do': ':UpdateRemotePlugins' } | |
" Keep undo sanity accessible | |
Plug 'mbbill/undotree' | |
" File navigation | |
" Need nerd font, see: https://github.com/ryanoasis/nerd-fonts | |
" Need nerd font set on terminal: https://www.behova.net/fonts-in-alacritty/ | |
Plug 'ryanoasis/vim-devicons' | |
Plug 'ms-jpq/chadtree', {'branch': 'chad', 'do': 'python3 -m chadtree deps'} | |
call plug#end() | |
" Use monokai | |
colorscheme monokai-phoenix | |
" Format C/C++ | |
let g:clang_format#command = 'clang-format' | |
let g:clang_format#detect_style_file = 1 | |
autocmd BufWritePre *.h :ClangFormat | |
autocmd BufWritePre *.c :ClangFormat | |
autocmd BufWritePre *.hpp :ClangFormat | |
autocmd BufWritePre *.cpp :ClangFormat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment