Add .gitconfig

Add .skhdrc
Add .vimrc
Add .yabairc
This commit is contained in:
Felix Delattre 2023-03-04 13:04:46 +01:00
commit c6a6c7dfab
4 changed files with 705 additions and 0 deletions

59
dot_gitconfig Normal file
View File

@ -0,0 +1,59 @@
[include]
path = .gituser # Store personal data in external file
[alias]
b = branch
c = checkout
d = diff
co = commit
l = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'
ll = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)'
ls = ls-files
pl = pull
ps = push
r = rebase
s = status
sa = stash apply
sc = stash clear
st = stash
w = whatchanged -p
wo = whatchanged -p origin..
ign = ls-files -o -i --exclude-standard
track = branch --set-upstream
undo = reset --soft HEAD^
unstage = reset HEAD --
[color]
branch = auto
diff = auto
status = auto
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[push]
default = simple
autoSetupRemote = true
[pull]
rebase = true
[core]
editor = nvim
excludesfile = /Users/felix.delattre/.gitignore_global
[user]
name = Felix Delattre
email = felix.delattre@up42.com
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true

149
dot_skhdrc Normal file
View File

@ -0,0 +1,149 @@
####### Shortcut Hotkeys #############
# open terminal
alt - return : open -a iTerm
# restart Yabi, SpaceBar, and SKHD
alt + shift - r : \
launchctl kickstart -k "gui/${UID}/homebrew.mxcl.yabai"; \
skhd --reload
####### Window Management Hotkeys #############
# change focus
alt - h : yabai -m window --focus west
alt - j : yabai -m window --focus south
alt - k : yabai -m window --focus north
alt - l : yabai -m window --focus east
# (alt) change focus (using arrow keys)
alt - left : yabai -m window --focus west
alt - down : yabai -m window --focus south
alt - up : yabai -m window --focus north
alt - right : yabai -m window --focus east
# shift window in current workspace
alt + shift - h : yabai -m window --swap west || $(yabai -m window --display west; yabai -m display --focus west)
alt + shift - j : yabai -m window --swap south || $(yabai -m window --display south; yabai -m display --focus south)
alt + shift - k : yabai -m window --swap north || $(yabai -m window --display north; yabai -m display --focus north)
alt + shift - l : yabai -m window --swap east || $(yabai -m window --display east; yabai -m display --focus east)
# alternatively, use the arrow keys
alt + shift - left : yabai -m window --swap west || $(yabai -m window --display west; yabai -m display --focus west)
alt + shift - down : yabai -m window --swap south || $(yabai -m window --display south; yabai -m display --focus south)
alt + shift - up : yabai -m window --swap north || $(yabai -m window --display north; yabai -m display --focus north)
alt + shift - right : yabai -m window --swap east || $(yabai -m window --display east; yabai -m display --focus east)
# set insertion point in focused container
alt + ctrl - h : yabai -m window --insert west
alt + ctrl - j : yabai -m window --insert south
alt + ctrl - k : yabai -m window --insert north
alt + ctrl - l : yabai -m window --insert east
# (alt) set insertion point in focused container using arrows
alt + ctrl - left : yabai -m window --insert west
alt + ctrl - down : yabai -m window --insert south
alt + ctrl - up : yabai -m window --insert north
alt + ctrl - right : yabai -m window --insert east
# go back to previous workspace (kind of like back_and_forth in i3)
alt - b : yabai -m space --focus recent
# move focused window to previous workspace
alt + shift - b : yabai -m window --space recent; \
yabai -m space --focus recent
# navigate workspaces next / previous using arrow keys
# cmd - left : yabai -m space --focus prev
# cmd - right : yabai -m space --focus next
# move focused window to next/prev workspace
alt + shift - 1 : yabai -m window --space 1
alt + shift - 2 : yabai -m window --space 2
alt + shift - 3 : yabai -m window --space 3
alt + shift - 4 : yabai -m window --space 4
alt + shift - 5 : yabai -m window --space 5
alt + shift - 6 : yabai -m window --space 6
alt + shift - 7 : yabai -m window --space 7
alt + shift - 8 : yabai -m window --space 8
alt + shift - 9 : yabai -m window --space 9
alt + shift - 0 : yabai -m window --space 10
# # mirror tree y-axis
alt + shift - y : yabai -m space --mirror y-axis
# # mirror tree x-axis
alt + shift - x : yabai -m space --mirror x-axis
# balance size of windows
alt + shift - 0 : yabai -m space --balance
# increase window size
#alt + shift - a : yabai -m window --resize left:-20:0
#alt + shift - s : yabai -m window --resize bottom:0:20
#alt + shift - w : yabai -m window --resize top:0:-20
#alt + shift - d : yabai -m window --resize right:20:0
# decrease window size
#cmd + shift - a : yabai -m window --resize left:20:0
#cmd + shift - s : yabai -m window --resize bottom:0:-20
#cmd + shift - w : yabai -m window --resize top:0:20
#cmd + shift - d : yabai -m window --resize right:-20:0
# change layout of desktop
alt - e : yabai -m space --layout bsp
alt - s : yabai -m space --layout float
# float / unfloat window and center on screen
#alt - t : yabai -m window --toggle float;\
# yabai -m window --grid 4:4:1:1:2:2
# float / unfloat window and leave in its current location
alt + shift - space : yabai -m window --toggle float
#alt + ctrl - space : yabai -m window --toggle float
# make floating window fill screen
alt + cmd - up : yabai -m window --grid 1:1:0:0:1:1
# make floating window fill left-half of screen
alt + cmd - left : yabai -m window --grid 1:2:0:0:1:1
# make floating window fill right-half of screen
alt + cmd - right : yabai -m window --grid 1:2:1:0:1:1
# create desktop, move window and follow focus
alt + shift + cmd - n : yabai -m space --create;\
index="$(yabai -m query --spaces --display | jq 'map(select(."native-fullscreen" == 0))[-1].index')"; \
yabai -m window --space "${index}";\
yabai -m space --focus "${index}"
# create desktop, move window and stay in current workspace
alt + shift - n : yabai -m space --create;\
index="$(yabai -m query --spaces --display | jq 'map(select(."native-fullscreen" == 0))[-1].index')"; \
yabai -m window --space "${index}"
# create desktop and follow focus
# Note: script fails when workspace is empty due to Yabai not reporting the workspace (bug?)
# best to use the create + move window command instead of creating a blank window
alt - n : yabai -m space --create;\
index="$(yabai -m query --spaces --display | jq 'map(select(."native-fullscreen" == 0))[-1].index')"; \
yabai -m space --focus "${index}"
# destroy desktop
alt + cmd - w : yabai -m space --destroy
# close focused window
alt - w : yabai -m window --close
# toggle sticky
alt + ctrl - s : yabai -m window --toggle sticky
# enter fullscreen mode for the focused container
alt - f : yabai -m window --toggle zoom-fullscreen
# toggle window native fullscreen
alt + shift - f : yabai -m window --toggle native-fullscreen
# focus monitor
alt + ctrl - x : yabai -m display --focus recent
alt + ctrl - z : yabai -m display --focus prev
alt + ctrl - c : yabai -m display --focus next
alt + ctrl - 1 : yabai -m display --focus 1
alt + ctrl - 2 : yabai -m display --focus 2
alt + ctrl - 3 : yabai -m display --focus 3

423
dot_vimrc Normal file
View File

@ -0,0 +1,423 @@
" ================================== GENERAL =================================
set wildmenu " Better command-line completion
set lazyredraw " Redraw only when we need to
set relativenumber " Enable relative line numbers
set number " Display current line number
set tabstop=2 " Number of visual spaces per TAB
set softtabstop=2 " Number of spaces in tab when editing
set shiftwidth=2 " Number of spaces inserted on TAB press
set expandtab " Insert spaces instead of tabs
set incsearch " Show search matches as you type
set hlsearch " Highlight all search matches
set ignorecase " Use case insensitive search
set smartcase " Except when using capital letters
set encoding=utf-8 " Default encoding is UTF-8
scriptencoding utf-8
autocmd bufenter set colorcolumn=0 " Don't show colorcolumn by default
autocmd FileType python set colorcolumn=89 " Highlight 89th column for python files
set cursorline " Highlight current line
set fillchars=vert:🭰,fold:-,eob:\ ,
set splitbelow " Vertical split splits below the current buffer
set splitright " Horizontalsplit splits at the right of the current buffer
set nowrap " Disable line wrap
set noswapfile " Disavle swap file
set confirm " Always ask for saving changes
set background=dark " Use dark UI
set diffopt+=vertical " Use vertical split for diffs
set list " Show unprintable chars
set listchars=tab:>-,trail:•,extends:#,nbsp:• " List of chars to show
set history=100 " Remember 100 last commands
set undolevels=100 " Use more levels of undo
set nofoldenable " Don't fold by default
set foldmethod=indent " Fold based on indentation
set foldnestmax=5 " Maximum fold level
set scrolloff=4 " Keep 4 lines above and below while scrolling
highlight NonText ctermfg=0
" ============================== ABBREVIATIONS ===============================
cnoreabbrev Qa qa
cnoreabbrev QA qa
cnoreabbrev Wq wq
cnoreabbrev WQ wq
cnoreabbrev Wqa wqa
cnoreabbrev WQa wqa
cnoreabbrev WQA wqa
" =================================== KEYS ===================================
" Split navigations
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Change buffer width
nnoremap <Esc>> :vertical res +1<Enter>
nnoremap <Esc>< :vertical res -1<Enter>
" Change buffer height
nnoremap <Esc>+ :res +1<Enter>
nnoremap <Esc>- :res -1<Enter>
" Use H and L to move at the beggining and at the end of the line
nnoremap L $
nnoremap H ^
" Set Space as leader key
let mapleader = ' '
" Open this file on F12
nnoremap <F12> :vsplit ~/.vimrc <CR>
" Search mappings: These will make it so that going to the next one in a
" search will center on the line it's found in.
nnoremap n nzzzv
nnoremap N Nzzzv
" Insert python breakpoint
map <F9> obreakpoint()<C-c>
" Copy to clipboard
vnoremap <leader>y "+y
nnoremap <leader>Y "+yg_
nnoremap <leader>y "+y
nnoremap <leader>yy "+yy
" Paste from clipboard
nnoremap <leader>p "+p
nnoremap <leader>P "+P
vnoremap <leader>p "+p
vnoremap <leader>P "+P
" Use kj or jk for exit Insert mode, also move cursor rigth
inoremap jk <Esc>
inoremap kj <Esc>
" Use double space for save
nnoremap <leader><leader> :w <CR>
" This is important for COC and ALE work together
let g:ale_disable_lsp = 1
" Toggle folding by TAB
map <TAB> za
" ================================== PLUGINS =================================
call plug#begin('~/.vim/plugged')
" Commnet/uncomment the code
Plug 'tpope/vim-commentary'
" Quoting/parenthesizing made simple
Plug'tpope/vim-surround'
" Enable repeating supported plugin maps with '.'
Plug 'tpope/vim-repeat'
" Camelcase, undersore, acronym words motions
Plug 'chaoren/vim-wordmotion'
" Fuzzy funder
Plug 'junegunn/fzf.vim'
" Asynchronous linting/fixing
Plug 'dense-analysis/ale'
" Working with CSV files
Plug 'chrisbra/csv.vim'
" Copy link to line in repo
Plug 'biggerfisch/vim-gurl'
" A tree file system explorer
Plug 'scrooloose/nerdtree'
" Displays tags in a window, ordered by scope
Plug 'majutsushi/tagbar'
" === Git ===
" A Git wrapper
Plug 'tpope/vim-fugitive'
" Shows a git diff in the gutter (sign column) and stages/undoes hunks
Plug 'airblade/vim-gitgutter'
" A plugin of NERDTree showing git status
Plug 'Xuyuanp/nerdtree-git-plugin'
" Autocompletion
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" === Python ===
" Python docstring generator
Plug 'heavenshell/vim-pydocstring'
" Enhanced syntax highlightitng
Plug 'sheerun/vim-polyglot'
" No-BS Python code folding
Plug 'tmhedberg/SimpylFold'
" Syntax highlight for requerements.txt
Plug 'raimon49/requirements.txt.vim', {'for': 'requirements'}
" === UI ===
" Retro groove color scheme
Plug 'morhetz/gruvbox'
" Rainbow delimiters
Plug 'luochen1990/rainbow'
" Lean & mean status/tabline
Plug 'bling/vim-airline'
" Visually displaying indent levels
Plug 'Yggdroot/indentLine'
call plug#end()
" =============================== PLUGINS SETUP ==============================
" === Rainbow ===
let g:rainbow_active = 1
" === Tagbar ===
map <F4> :TagbarToggle<CR>
let g:tagbar_autofocus = 0
" === Indent lines ===
let g:indentLine_char = '🭰'
" === Theme ===
colorscheme gruvbox
let g:gruvbox_italic = 1
set background=dark
" === Airline ===
let g:airline_powerline_fonts = 1
let g:airline#extensions#tagbar#enabled = 1
let g:airline#extensions#ale#enabled = 1
let g:airline_skip_empty_sections = 1
let g:airline#parts#ffenc#skip_expected_string='utf-8[unix]'
let g:airline#extensions#virtualenv#enabled = 1
function! AirlineInit()
let g:airline_section_a = airline#section#create_left(['branch'])
let g:airline_section_b = airline#section#create_left(['file'])
let g:airline_section_c = airline#section#create_left(['tagbar'])
let g:airline_section_x = airline#section#create_left(['readonly'])
let g:airline_section_z = airline#section#create_right(['%l:%c/%L'])
endfunction
autocmd VimEnter * call AirlineInit()
" === Colorizer ===
let g:colorizer_auto_color = 1
" === Ale ===
map <C-f> :ALEFix <CR>
let g:ale_list_window_size = 5
let g:ale_sign_error = '•'
let g:ale_sign_warning = '•'
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_warning_str = 'W'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
let g:ale_lint_on_text_changed = 'never'
let g:ale_linters = {
\ 'python': ['flake8', 'black', 'mypy'],
\ 'md': ['mdl'],
\ 'yaml': ['yamllint'],
\ 'yml': ['yamllint'],
\}
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'python': ['black', 'isort'],
\ 'yaml': ['yamlfix'],
\ 'yml': ['yamlfix'],
\ 'json': ['jq']
\}
nnoremap <C-]> :ALENext<CR>
nnoremap <C-[> :ALEPrevious<CR>
" === GitGutter ===
nnoremap <C-p> :GitGutterPrevHunk<CR>
nnoremap <C-n> :GitGutterNextHunk<CR>
nnoremap U :GitGutterUndoHunk <CR>
highlight SignColumn ctermbg=bg
highlight GitGutterAdd ctermfg=2 ctermbg=bg
highlight GitGutterChange ctermfg=3 ctermbg=bg
highlight GitGutterDelete ctermfg=1 ctermbg=bg
highlight GitGutterChangeDelete ctermfg=166 ctermbg=bg
let g:gitgutter_highlight_linenrs = 0
let g:gitgutter_sign_modified_removed = '~͟'
let g:gitgutter_sign_removed_above_and_below = '_͞'
" === FZF ===
map <F5> :Ag <CR>
map <F6> :GFiles <CR>
nnoremap <F7> :Ag <C-R><C-W><CR>
" Save search results to quickfix list
function! s:build_quickfix_list(lines)
call setqflist(map(copy(a:lines), '{ "filename": v:val }'))
copen
cc
endfunction
let g:fzf_action = {
\ 'ctrl-q': function('s:build_quickfix_list'),
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit',
\ 'ctrl-a': 'select-all'
\}
command! -bang -nargs=? -complete=dir GFiles
\ call fzf#vim#gitfiles(<q-args>, fzf#vim#with_preview(), <bang>0)
command! -bang -nargs=* Ag call fzf#vim#ag(<q-args>, ' --ignore-dir={node_modules,fme,venv,jest_cache,logs} --ignore=package-lock.json', fzf#vim#with_preview({'options': '--delimiter : --nth 4..'}), <bang>0)
autocmd! FileType fzf set laststatus=0 noshowmode noruler
\| autocmd BufLeave <buffer> set laststatus=2 showmode ruler
" === NERDTree ===
map <F2> :NERDTreeToggle<CR>
nmap F :NERDTreeFind<CR>
let NERDTreeMapJumpParent='h'
let NERDTreeMapOpenSplit='<S-TAB>'
let NERDTreeMapOpenVSplit='<TAB>'
let NERDTreeShowHidden=1
augroup vimrc
" Close vim when only NERDTree is open
autocmd bufenter * if (
\winnr("$") == 1 &&
\exists("b:NERDTree") &&
\b:NERDTree.isTabTree()
\) | q | endif
augroup END
" Files to hide in NERDTree
let NERDTreeIgnore = ['\~$', '\.pyc$', '\.pyo$', '\.class$', 'pip-log\.txt$',
\'\.o$', '__pycache__', '.git', 'venv', '.cache']
let NERDTreeHighlightCursorline = 0
let g:NERDTreeFileExtensionHighlightFullName = 1
let g:NERDTreeExactMatchHighlightFullName = 1
let g:NERDTreePatternMatchHighlightFullName = 1
" Higlight NERDTree's filetypes with given color
function! NERDTreeHighlightFile(ext, color)
exec 'autocmd filetype nerdtree highlight ' . a:ext.' ctermfg='. a:color
exec 'autocmd filetype nerdtree syn match ' . a:ext.' #^\s\+.*'. a:ext.'$#'
endfunction
" Apply above function to all file types
call NERDTreeHighlightFile('css', 5)
call NERDTreeHighlightFile('csv', 8)
call NERDTreeHighlightFile('geojson', 10)
call NERDTreeHighlightFile('html', 166)
call NERDTreeHighlightFile('ipynb', 12)
call NERDTreeHighlightFile('js', 3)
call NERDTreeHighlightFile('json', 2)
call NERDTreeHighlightFile('less', 13)
call NERDTreeHighlightFile('log', 7)
call NERDTreeHighlightFile('md', 6)
call NERDTreeHighlightFile('MD', 6)
call NERDTreeHighlightFile('rst', 14)
call NERDTreeHighlightFile('mjml', 208)
call NERDTreeHighlightFile('mjs', 11)
call NERDTreeHighlightFile('py', 4)
call NERDTreeHighlightFile('scss', 13)
call NERDTreeHighlightFile('sh', 1)
call NERDTreeHighlightFile('sql', 9)
call NERDTreeHighlightFile('ts', 11)
call NERDTreeHighlightFile('spec.ts', 8)
call NERDTreeHighlightFile('xml', 15)
call NERDTreeHighlightFile('yaml', 'magenta')
call NERDTreeHighlightFile('yml', 'magenta')
" === NERDTree Git Plugin ===
" Prefixes for files with different git status
let g:NERDTreeGitStatusIndicatorMapCustom = {
\ 'Modified' : '*',
\ 'Staged' : '+',
\ 'Untracked' : '_',
\ 'Renamed' : '%',
\ 'Unmerged' : '═',
\ 'Deleted' : 'x',
\ 'Dirty' : '@',
\ 'Clean' : 'C',
\ 'Ignored' : '•',
\ 'Unknown' : '?'}
" === CSV.vim ===
augroup filetypedetect
au! BufRead,BufNewFile *.csv,*.dat,*.CSV setfiletype csv
augroup END
let g:vim_json_syntax_conceal = 0
" === PyDocstring ===
nmap <silent> <C-d> <Plug>(pydocstring)
" === COC ===
let g:coc_global_extensions = ['coc-tsserver', 'coc-jedi']
" Remap keys for applying codeAction to the current line.
nmap <leader>a <Plug>(coc-codeaction)
" Apply AutoFix to problem on the current line.
nmap <leader>f <Plug>(coc-fix-current)
" Completion
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gt <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Prettify selected code.
xmap <leader>p <Plug>(coc-format-selected)
nmap <leader>p <Plug>(coc-format-selected)
let g:python_highlight_all = 1
" Use (Shift-)TAB to iterate through autocomplete list
inoremap <expr> <Tab> coc#pum#visible() ? coc#pum#next(1) : "\<Tab>"
inoremap <expr> <S-Tab> coc#pum#visible() ? coc#pum#prev(1) : "\<S-Tab>"
" ======== Vim Gurl ======================
let g:vimgurl_yank_register = '+' " copy to system buffer

74
executable_dot_yabairc Normal file
View File

@ -0,0 +1,74 @@
#!/usr/bin/env sh
# the scripting-addition must be loaded manually if
# you are running yabai on macOS Big Sur. Uncomment
# the following line to have the injection performed
# when the config is executed during startup.
#
# for this to work you must configure sudo such that
# it will be able to run the command without password
#
# see this wiki page for information:
# - https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(latest-release)
#
# sudo yabai --load-sa
# yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"
#!/usr/bin/env sh
# global settings
yabai -m config mouse_follows_focus off
yabai -m config focus_follows_mouse autofocus
yabai -m config window_placement second_child
yabai -m config window_topmost off
yabai -m config window_opacity off
yabai -m config window_opacity_duration 0.0
yabai -m config window_shadow on
yabai -m config active_window_opacity 1.0
yabai -m config normal_window_opacity 0.90
yabai -m config split_ratio 0.50
yabai -m config auto_balance off
yabai -m config active_window_border_color 0xff775759
yabai -m config normal_window_border_color 0xff555555
# Mouse support
yabai -m config mouse_modifier alt
yabai -m config mouse_action1 move
yabai -m config mouse_action2 resize
# general space settings
yabai -m config layout bsp
yabai -m config bottom_padding 0
yabai -m config left_padding 0
yabai -m config right_padding 0
yabai -m config window_gap 0
# float system preferences
yabai -m rule --add app='^System Information$' manage=off
yabai -m rule --add app='^System Preferences$' manage=off
yabai -m rule --add title='Preferences$' manage=off
# float Better Touch Tool Preference window
# yabai -m rule --add title='^BetterTouchTool' manage=off
# float settings windows
yabai -m rule --add title='Settings$' manage=off
# float Cisco AnyConnect
yabai -m rule --add app='^Cisco AnyConnect Secure Mobility Client$' manage=off
# float IntelliJ Preference panes
yabai -m rule --add app='IntelliJ IDEA' title='^$' manage=off
yabai -m rule --add app='IntelliJ IDEA' title='Project Structure' manage=off
yabai -m rule --add app='IntelliJ IDEA' title='Preferences' manage=off
yabai -m rule --add app='IntelliJ IDEA' title='Edit configuration' manage=off
# spacebar padding on top screen
SPACEBAR_HEIGHT=$(spacebar -m config height)
yabai -m config external_bar all:$SPACEBAR_HEIGHT:0
echo "yabai configuration loaded.."