Last active
February 24, 2020 10:28
-
-
Save layflags/3814756 to your computer and use it in GitHub Desktop.
my config files
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
[core] | |
excludesfile = ~/.gitignore | |
editor = vim | |
[alias] | |
st = status | |
ci = commit -v | |
co = checkout | |
br = branch | |
lg = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(black)%s%C(reset) %C(yellow)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all | |
cm = "!sh -c 'git bm | grep -v \"\\*\" | grep -v master | grep -v edge | grep -v develop | xargs -n 1 git branch -d'" | |
bm = branch --merged | |
[user] | |
name = Lay Flags | |
email = [email protected] | |
[color] | |
branch = auto | |
diff = auto | |
interactive = auto | |
status = auto | |
[merge] | |
ff = no | |
tool = vimdiff | |
[http] | |
sslVerify = false | |
[push] | |
default = simple | |
[filter "lfs"] | |
required = true | |
clean = git-lfs clean %f | |
smudge = git-lfs smudge %f | |
[pager] | |
# $ brew install diff-so-fancy | |
diff = diff-so-fancy | less --tabs=1,5 -RFX | |
show = diff-so-fancy | less --tabs=1,5 -RFX |
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
.DS_Store | |
*~ | |
*.swp | |
*.swo |
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
set completion-ignore-case On | |
"\e[3~": delete-char | |
set meta-flag on | |
set input-meta on | |
set output-meta on | |
set convert-meta off |
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
### defaults | |
# set terminal (xterm on osx for best compatibility with vim) | |
set -g default-terminal "screen-256color" | |
# https://github.com/tmux/tmux/issues/543 (fix for MacOS Sierra) | |
set -g default-shell $SHELL | |
set -g default-command "reattach-to-user-namespace -l ${SHELL}" | |
# change prefix key to CTRL-a (I use CAPS LOCK key as CTRL) | |
set -g prefix C-a | |
bind C-a send-prefix | |
unbind C-b | |
# setting the delay between prefix and command | |
set -s escape-time 1 | |
# start counting with 1 instead of 0 for windows and panes | |
set -g base-index 1 | |
setw -g pane-base-index 1 | |
# reload config with PREFIX r | |
bind r source-file ~/.tmux.conf \; display "Reloaded!" | |
# switch between panes using hjkl instead of cursor keys | |
bind h select-pane -L | |
bind j select-pane -D | |
bind k select-pane -U | |
bind l select-pane -R | |
# resize panes easily using HJKL | |
bind -r H resize-pane -L 5 | |
bind -r J resize-pane -D 5 | |
bind -r K resize-pane -U 5 | |
bind -r L resize-pane -R 5 | |
# never use the mouse ;) | |
setw -g mouse off | |
# enable activity alerts | |
setw -g monitor-activity on | |
set -g visual-activity on | |
### COPY & PASTE ON OSX | |
# https://robots.thoughtbot.com/tmux-copy-paste-on-os-x-a-better-future | |
# Use vim keybindings in copy mode | |
setw -g mode-keys vi | |
# Setup 'v' to begin selection as in Vim | |
bind-key -T copy-mode-vi v send-keys -X begin-selection | |
bind-key -T copy-mode-vi y send-keys -X copy-pipe "reattach-to-user-namespace pbcopy" | |
# Update default binding of `Enter` to also use copy-pipe | |
unbind -T copy-mode-vi Enter | |
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe "reattach-to-user-namespace pbcopy" | |
### STATUS BAR | |
# extend left status length | |
set -g status-left-length 30 | |
# battery status on status bar | |
# https://github.com/Goles/Battery | |
set -g status-right "#(date \"+%a %d %b %H:%M\") #(/usr/local/bin/battery -t)" | |
# center window list for clarity | |
set -g status-justify centre | |
# set theme based on $THEME env var | |
source ~/.tmux_dark_theme.conf | |
if '[[ "$THEME" =~ light ]]' 'source ~/.tmux_light_theme.conf' |
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
#### COLOUR (Solarized dark) | |
# default statusbar colors | |
set-option -g status-bg black #base02 | |
set-option -g status-fg yellow #yellow | |
set-option -g status-attr default | |
# default window title colors | |
set-window-option -g window-status-fg brightblue #base0 | |
set-window-option -g window-status-bg default | |
#set-window-option -g window-status-attr dim | |
# active window title colors | |
set-window-option -g window-status-current-fg brightred #orange | |
set-window-option -g window-status-current-bg default | |
#set-window-option -g window-status-current-attr bright | |
# pane border | |
set-option -g pane-border-fg black #base02 | |
set-option -g pane-active-border-fg brightgreen #base01 | |
# message text | |
set-option -g message-bg black #base02 | |
set-option -g message-fg brightred #orange | |
# pane number display | |
set-option -g display-panes-active-colour blue #blue | |
set-option -g display-panes-colour brightred #orange | |
# clock | |
set-window-option -g clock-mode-colour green #green | |
# bell | |
set-window-option -g window-status-bell-style fg=black,bg=red #base02, red |
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
#### COLOUR (Solarized light) | |
# default statusbar colors | |
set-option -g status-bg white #base2 | |
set-option -g status-fg yellow #yellow | |
set-option -g status-attr default | |
# default window title colors | |
set-window-option -g window-status-fg brightyellow #base00 | |
set-window-option -g window-status-bg default | |
#set-window-option -g window-status-attr dim | |
# active window title colors | |
set-window-option -g window-status-current-fg brightred #orange | |
set-window-option -g window-status-current-bg default | |
#set-window-option -g window-status-current-attr bright | |
# pane border | |
set-option -g pane-border-fg white #base2 | |
set-option -g pane-active-border-fg brightcyan #base1 | |
# message text | |
set-option -g message-bg white #base2 | |
set-option -g message-fg brightred #orange | |
# pane number display | |
set-option -g display-panes-active-colour blue #blue | |
set-option -g display-panes-colour brightred #orange | |
# clock | |
set-window-option -g clock-mode-colour green #green | |
# bell | |
set-window-option -g window-status-bell-style fg=white,bg=red #base2, red |
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
call plug#begin('~/.vim/bundle') | |
Plug 'andymass/vim-matchup' | |
Plug 'altercation/vim-colors-solarized' | |
Plug 'ryanoasis/vim-devicons' | |
" $ brew tap homebrew/cask-fonts | |
" $ brew cask install font-hack-nerd-font | |
Plug 'alvan/vim-closetag' | |
let g:closetag_filenames = "*.js,*.xml,*.xhtml,*.html,*.html.erb,*.hbs,*.ejs" | |
Plug 'Raimondi/delimitMate' | |
" don't match < > - conflicts with closetag | |
let g:delimitMate_matchpairs = "(:),[:],{:}" | |
Plug 'JulesWang/css.vim' | |
Plug 'hail2u/vim-css3-syntax' | |
Plug 'ctrlpvim/ctrlp.vim' | |
" ignore files in .gitignore | |
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard'] | |
set runtimepath^=~/.vim/bundle/ctrlp.vim | |
Plug 'mustache/vim-mustache-handlebars' | |
let g:mustache_abbreviations = 1 " enable mustache abbreviations | |
Plug 'othree/html5.vim' | |
Plug 'othree/yajs.vim' | |
Plug 'othree/es.next.syntax.vim' | |
Plug 'briancollins/vim-jst' " highlighting for ejs files | |
Plug 'plasticboy/vim-markdown' | |
let g:vim_markdown_folding_disabled = 1 | |
let g:vim_markdown_conceal = 0 | |
let g:vim_markdown_frontmatter = 1 | |
Plug 'tpope/vim-fugitive' " git wrapper | |
Plug 'tpope/vim-repeat' | |
Plug 'tpope/vim-surround' | |
Plug 'scrooloose/nerdcommenter' | |
let g:NERDSpaceDelims = 1 | |
let g:NERDDefaultAlign = 'left' | |
Plug 'regedarek/ZoomWin' | |
Plug 'rking/ag.vim' | |
" $ brew install the_silver_searcher | |
let g:ag_highlight = 1 " highlight search terms after searching | |
Plug 'Yggdroot/indentLine' | |
if $THEME == 'light' | |
let g:indentLine_color_term = 7 | |
else | |
let g:indentLine_color_term = 0 | |
endif | |
let g:indentLine_faster = 1 | |
let g:indentLine_indentLevel = 8 | |
Plug 'Wolfy87/vim-enmasse' | |
Plug 'Lokaltog/vim-easymotion' | |
nmap s <Plug>(easymotion-s2) | |
map / <Plug>(easymotion-sn) | |
omap / <Plug>(easymotion-tn) | |
nmap \ :nohl<CR> | |
Plug 'mxw/vim-jsx' | |
let g:jsx_ext_required = 0 | |
Plug 'elzr/vim-json' | |
let g:vim_json_syntax_conceal = 0 | |
Plug 'airblade/vim-gitgutter' | |
Plug 'vim-airline/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
let g:airline_powerline_fonts = 1 | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline_skip_empty_sections = 1 | |
Plug 'scrooloose/nerdtree' | |
Plug 'Xuyuanp/nerdtree-git-plugin' | |
Plug 'majutsushi/tagbar' | |
" $ brew install --HEAD universal-ctags/universal-ctags/universal-ctags | |
Plug 'yardnsm/vim-import-cost' | |
" $ npm install # inside plugin folder | |
Plug 'w0rp/ale' | |
let g:ale_linters = { | |
\ 'javascript': ['eslint'], | |
\ 'css': ['stylelint'], | |
\} | |
" Put this in vimrc or a plugin file of your own. | |
" After this is configured, :ALEFix will try and fix your JS code with ESLint. | |
let g:ale_fixers = { | |
\ 'haskell': ['brittany'], | |
\ 'javascript': ['eslint'], | |
\ 'json': ['fixjson', 'prettier'], | |
\ 'css': ['stylelint', 'prettier'], | |
\ 'purescript': ['purty'], | |
\ 'haskell': ['hfmt'], | |
\} | |
" Set this setting in vimrc if you want to fix files automatically on save. | |
" This is off by default. | |
let g:ale_fix_on_save = 1 | |
" futher options | |
let g:ale_open_list = 0 | |
let g:ale_set_loclist = 1 | |
let g:ale_set_quickfix = 0 | |
let g:ale_sign_column_always = 1 | |
" config for standard | |
let g:ale_javascript_standard_executable = 'standard' | |
let g:ale_javascript_standard_options = '' | |
let g:ale_javascript_standard_use_global = 0 | |
" config for airline | |
let g:airline#extensions#ale#enabled = 1 | |
" delay linting a bit | |
" let g:ale_lint_delay = 200 | |
" Write this in your vimrc file | |
let g:ale_lint_on_text_changed = 'never' | |
" You can disable this option too | |
" if you don't want linters to run on opening a file | |
let g:ale_lint_on_enter = 0 | |
Plug 'sirver/ultisnips' | |
let g:UltiSnipsExpandTrigger="<c-space>" | |
let g:UltiSnipsJumpForwardTrigger="<c-j>" | |
let g:UltiSnipsJumpBackwardTrigger="<c-k>" | |
let g:UltiSnipsEditSplit="vertical" | |
Plug 'honza/vim-snippets' | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
" $ yarn global add vim-node-rpc # for vim | |
" :call coc#util#build() # in vim | |
set hidden | |
set cmdheight=2 | |
set updatetime=300 | |
set shortmess+=c | |
set signcolumn=yes | |
let g:airline_section_error = '%{airline#util#wrap(airline#extensions#coc#get_error(),0)}' | |
let g:airline_section_warning = '%{airline#util#wrap(airline#extensions#coc#get_warning(),0)}' | |
" use <tab> for trigger completion and navigate to next complete item | |
function! s:check_back_space() abort | |
let col = col('.') - 1 | |
return !col || getline('.')[col - 1] =~ '\s' | |
endfunction | |
inoremap <silent><expr> <TAB> | |
\ pumvisible() ? "\<C-n>" : | |
\ <SID>check_back_space() ? "\<TAB>" : | |
\ coc#refresh() | |
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>" | |
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>" | |
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<CR>" | |
autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif | |
" haskell / purescript / elm (FP FTW) | |
Plug 'Zaptic/elm-vim' | |
Plug 'antew/vim-elm-analyse' | |
let g:ale_elm_analyse_use_global = 1 | |
Plug 'neovimhaskell/haskell-vim' | |
" Plug 'purescript-contrib/purescript-vim' | |
" Haskell | |
Plugin 'neovimhaskell/haskell-vim' | |
call plug#end() | |
" ----------------------------------------------------------------------------- | |
set nocompatible " be iMproved, required | |
filetype plugin indent on | |
syntax on | |
if has("vms") | |
set nobackup " do not keep a backup file, use versions instead | |
else | |
set backup " keep a backup file | |
endif | |
" provide nice colors | |
if $THEME == 'light' | |
set background=light | |
else | |
set background=dark | |
endif | |
colorscheme solarized | |
call togglebg#map("<F5>") | |
" use the old regex engine because vim was getting slow over time | |
set regexpengine=1 | |
set ttyfast | |
set lazyredraw | |
set visualbell " disable bell | |
set cursorline " highlight current line | |
set number " show line numbers | |
set history=50 " keep 50 lines of command line history | |
set hlsearch | |
set showcmd " display incomplete commands | |
set incsearch " do incremental searching | |
set backspace=indent,eol,start " allow backspacing over everything in insert mode | |
set t_kb=ctrl-vBACKSPACE | |
if !has('nvim') | |
fixdel | |
endif | |
" disable modeline | |
set nomodeline | |
" Always show statusline | |
set laststatus=2 | |
" Start scrolling 3 lines before the border | |
set scrolloff=3 | |
" concealing | |
set conceallevel=0 | |
" default identation, 2 spaces for tabs, ... | |
set ai sw=2 sts=2 ts=2 et enc=utf-8 | |
set list lcs=tab:»⋅,trail:⋅ " show tabs and trailing white spaces | |
autocmd BufWritePre * :%s/\s\+$//e " autom. remove trailing white spaces before saving | |
set autoread | |
set formatoptions+=j " Delete comment character when joining commented lines | |
set wildmenu | |
set autoindent | |
set smarttab | |
" set different cursor styles for different modes | |
if exists('$TMUX') | |
" For tmux running in iTerm2 on OS X | |
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\" | |
let &t_SR = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=2\x7\<Esc>\\" | |
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\" | |
else | |
" For iTerm2 on OS X | |
let &t_SI = "\<Esc>]50;CursorShape=1\x7" | |
let &t_SR = "\<Esc>]50;CursorShape=2\x7" | |
let &t_EI = "\<Esc>]50;CursorShape=0\x7" | |
endif | |
"""""""""""""""""""""" | |
" filetype settings | |
"""""""""""""""""""""" | |
augroup vimrcEx | |
autocmd! | |
" For all text files set 'textwidth' to 80 characters. | |
autocmd FileType text setlocal textwidth=80 | |
" When editing a file, always jump to the last known cursor position. | |
" Don't do it when the position is invalid or when inside an event handler | |
" (happens when dropping a file on gvim). | |
autocmd BufReadPost * | |
\ if line("'\"") > 0 && line("'\"") <= line("$") | | |
\ exe "normal g`\"" | | |
\ endif | |
" show line length marker for some source files | |
autocmd FileType javascript,elm setlocal colorcolumn=80 | |
" 4 space identation for elm | |
autocmd Filetype elm setlocal sw=4 sts=4 ts=4 | |
" use gf to open files referenced by import (without .js suffix) | |
autocmd FileType javascript setlocal suffixesadd=.js | |
" Makes foo-bar considered one word | |
autocmd FileType css,scss,less setlocal iskeyword+=- | |
" Fix syntax highlighting for .tsx files | |
autocmd BufEnter *.tsx set filetype=typescript | |
" Fix syntax highlighting for .babelrc, etc. | |
autocmd BufEnter .babelrc,.eslintrc set filetype=json | |
" Speed up editing *.html[.ejs] files | |
autocmd FileType html,jst setlocal nocursorline | |
" Fix syntax highlighting for JSONC comments | |
autocmd FileType json syntax match Comment +\/\/.\+$+ | |
au BufWritePre mustache :set binary | set noeol | |
au BufWritePost mustache :set nobinary | set eol | |
augroup END | |
""""""""""""""""""""""" | |
" key mapping | |
""""""""""""""""""""""" | |
" <leader> key is <SPACE> | |
let mapleader=" " | |
" split long lines over multiple according to textwidth | |
vmap Q gq | |
nmap Q gqap | |
" block indent | |
vnoremap < <gv | |
vnoremap > >gv | |
" duplicate line on <C-d> | |
inoremap <C-d> <ESC>yypi | |
" NO ARROW KEYS COME ON | |
map <Left> :echo "no!"<cr> | |
map <Right> :echo "no!"<cr> | |
map <Up> :echo "no!"<cr> | |
map <Down> :echo "no!"<cr> | |
" use <leader>y and <leader>p for copy & paste to clipboard | |
map <leader>y "*y | |
map <leader>p "*p | |
" fast buffer cycling <Alt-h> <Alt-l> | |
map ¬ :bnext<cr> | |
map ˙ :bprev<cr> | |
" https://vim.fandom.com/wiki/Moving_lines_up_or_down <Alt-j> <Alt-k> | |
nnoremap ∆ :m .+1<CR>== | |
nnoremap ˚ :m .-2<CR>== | |
inoremap ∆ <Esc>:m .+1<CR>==gi | |
inoremap ˚ <Esc>:m .-2<CR>==gi | |
vnoremap ∆ :m '>+1<CR>gv=gv | |
vnoremap ˚ :m '<-2<CR>gv=gv | |
" :diffput and :diffget shortcuts | |
map <leader><leader>dp :diffput<cr> | |
map <leader><leader>dg :diffget<cr> | |
" jj for <Esc> in insert mode | |
inoremap jj <Esc> | |
" navigate long wrapped lines | |
map <C-j> gj | |
map <C-k> gk | |
" Plug key mappings | |
" - Fixmyjs | |
map <leader>f :ALEFix<CR> | |
" - NERDTree | |
map <leader>nt :NERDTreeToggle<CR> | |
map <leader>nf :NERDTreeFind<CR> | |
" Haskell | |
" run program in buffer | |
map <leader>h :!stack runghc %<CR> | |
" CoC mappings | |
nmap <silent> gd <Plug>(coc-definition) | |
nmap <silent> gy <Plug>(coc-type-definition) | |
nmap <silent> gr <Plug>(coc-references) | |
nmap <leader>i :call CocAction('doHover')<cr> | |
nmap <leader>rn <Plug>(coc-rename) | |
" location/clist | |
nmap <leader>ln :lne<cr> | |
nmap <leader>cn :cne<cr> | |
"""""""""""""""""""""" | |
" commands | |
"""""""""""""""""""""" | |
" OpenURL in chrome | |
command! -bar -nargs=1 OpenURL :exec 'silent !open -a /Applications/Google\ Chrome.app % &' | |
" close all buffers except the current one | |
command! BufOnly :%bd | e# | |
" open JS test file from current JS file in buffer and vice versa | |
command! Jtest :execute "e " . substitute(expand("%:."),".js",".test.js","g") | |
command! JStest :execute "sp " . substitute(expand("%:."),".js",".test.js","g") | |
command! Jsrc :execute "e " . substitute(expand("%:."),".test.js",".js","g") | |
command! JSsrc :execute "sp " . substitute(expand("%:."),".test.js",".js","g") | |
" choose ale linter/fixer (default: eslint) | |
command! ESLint : | |
\let g:ale_linters = { 'javascript': ['eslint'] } | | |
\let g:ale_fixers = { 'javascript': ['eslint'] } | |
command! Standard : | |
\let g:ale_linters = { 'javascript': ['standard'] } | | |
\let g:ale_fixers = { 'javascript': ['prettier-standard'] } |
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
# | |
# Executes commands at the start of an interactive session. | |
# | |
# Authors: | |
# Sorin Ionescu <[email protected]> | |
# | |
# Source Prezto. | |
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then | |
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" | |
fi | |
# ~~~ Customized ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
# my special aliases | |
alias rmtilde="find . -name '*~'|xargs rm -rf" | |
alias tmuxks='tmux kill-session -t ' | |
alias vimrc="vim ~/.vimrc" | |
alias serve="python -m SimpleHTTPServer" | |
alias zreload=". ~/.zshrc && echo 'ZSH config reloaded from ~/.zshrc'" | |
alias zshrc="vim ~/.zshrc && zreload" | |
alias zupdate="cd ~/.zprezto && git pull && git submodule update --init --recursive && cd -" | |
alias gpR="git pull --rebase" | |
alias isodate="date -u +%FT%TZ" | |
alias pr='hub pull-request -m "$(git rev-parse --abbrev-ref HEAD)"' | |
alias tmjs='tmuxinator start js-project $(pwd) -n $(basename $(pwd))' | |
# alias git-remove-widowed-local-branches="git fetch --prune && git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d" | |
alias elm-repl="elm repl" | |
# use vi mode (zle) | |
bindkey -v | |
# use common shell key bindings (zle) | |
bindkey '^P' up-history | |
bindkey '^N' down-history | |
bindkey '^?' backward-delete-char | |
bindkey '^h' backward-delete-char | |
bindkey '^w' backward-kill-word | |
bindkey '^r' history-incremental-search-backward | |
# kill the lag when switching to vi command mode (zle) | |
export KEYTIMEOUT=1 | |
# add NPM to PATH | |
export PATH="/usr/local/share/npm/bin:$PATH" | |
# add RVM to PATH for scripting | |
# add Postgres scripts to PATH | |
export PATH="$PATH:/Applications/Postgres.app/Contents/Versions/latest/bin" | |
# terminal colors | |
export TERM=screen-256color | |
# JAVA home | |
export JAVA_HOME=$(/usr/libexec/java_home) | |
# load NVM | |
export NVM_DIR="/Users/martin/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm | |
# tab completion for npm | |
. <(npm completion) | |
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting | |
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion | |
# NOTE: generated by: npm i -g yarn-completions | |
# tabtab source for yarn package | |
# uninstall by removing these lines or running `tabtab uninstall yarn` | |
[[ -f /Users/martin/.nvm/versions/node/v8.9.3/lib/node_modules/yarn-completions/node_modules/tabtab/.completions/yarn.zsh ]] && . /Users/martin/.nvm/versions/node/v8.9.3/lib/node_modules/yarn-completions/node_modules/tabtab/.completions/yarn.zsh | |
source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh | |
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh | |
fpath=(/usr/local/share/zsh-completions $fpath) | |
export PATH="/usr/local/opt/node@8/bin:$PATH" | |
export PATH="$HOME/.local/bin:$PATH" | |
export PATH="/usr/local/opt/node@10/bin:$PATH" | |
export PATH="/usr/local/opt/icu4c/bin:$PATH" | |
export PATH="/usr/local/opt/icu4c/sbin:$PATH" |
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
{ | |
"languageserver": { | |
"elmLS": { | |
"command": "elm-language-server", | |
"filetypes": ["elm"], | |
"rootPatterns": ["elm.json"], | |
"initializationOptions": { | |
"elmAnalyseTrigger": "change" | |
} | |
} | |
}, | |
"codeLens.enable": true, | |
"tsserver.npm": "/usr/local/bin/node", | |
"javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true, | |
"eslint.autoFixOnSave": true, | |
"coc.preferences.formatOnSaveFiletypes": ["css", "markdown", "elm"], | |
"stylelintplus.autoFixOnSave": true | |
} |
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
" <leader> key is <SPACE> | |
let mapleader=" " | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" PLUGINS | |
" /// specify a directory for plugins \\\ | |
call plug#begin('~/.vim/plugged') | |
" ... and here comes Mr. Tim Pope | |
Plug 'tpope/vim-sensible' " sensible defaults | |
Plug 'tpope/vim-repeat' " fix . for plugin maps | |
Plug 'tpope/vim-fugitive' " git commands | |
Plug 'tpope/vim-surround' " quoting/parenthesizing made simple | |
Plug 'tpope/vim-sleuth' " automatically adjusts 'sw' and 'et' heuristically | |
" theming | |
Plug 'lifepillar/vim-solarized8' | |
" visual help | |
Plug 'sheerun/vim-polyglot' | |
Plug 'ryanoasis/vim-devicons' | |
Plug 'nathanaelkane/vim-indent-guides' | |
let g:indent_guides_guide_size = 1 | |
let g:indent_guides_start_level = 2 | |
let g:indent_guides_auto_colors = 0 | |
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=#F7F0DF ctermbg=NONE | |
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=#F7F0DF ctermbg=NONE | |
Plug 'vim-airline/vim-airline' " Custom status line | |
Plug 'vim-airline/vim-airline-themes' | |
let g:airline_theme='solarized' | |
" file manager | |
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } | |
Plug 'Xuyuanp/nerdtree-git-plugin' | |
map <leader>nt :NERDTreeToggle<CR> | |
map <leader>nf :NERDTreeFind<CR> | |
" file / content fuzzy finder <Ctrl-p> / :Find | |
" https://medium.com/@crashybang/supercharge-vim-with-fzf-and-ripgrep-d4661fc853d2 | |
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
Plug 'junegunn/fzf.vim' | |
" Customize fzf colors to match your color scheme | |
let g:fzf_colors = | |
\ { 'fg': ['fg', 'Normal'], | |
\ 'bg': ['bg', 'Normal'], | |
\ 'hl': ['fg', 'Comment'], | |
\ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], | |
\ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], | |
\ 'hl+': ['fg', 'Statement'], | |
\ 'info': ['fg', 'PreProc'], | |
\ 'border': ['fg', 'Ignore'], | |
\ 'prompt': ['fg', 'Conditional'], | |
\ 'pointer': ['fg', 'Exception'], | |
\ 'marker': ['fg', 'Keyword'], | |
\ 'spinner': ['fg', 'Label'], | |
\ 'header': ['fg', 'Comment'] } | |
map <C-p> :Files<CR> | |
map <C-f> :Find<CR> | |
" word under cursor search | |
map <M-f> :Find <C-r><C-w><CR> | |
" --column: Show column number | |
" --line-number: Show line number | |
" --no-heading: Do not show file headings in results | |
" --fixed-strings: Search term as a literal string | |
" --ignore-case: Case insensitive search | |
" XXX --no-ignore: Do not respect .gitignore, etc... | |
" --hidden: Search hidden files and folders | |
" --follow: Follow symlinks | |
" --glob: Additional conditions for search (in this case ignore everything in the .git/ folder) | |
" --color: Search color options | |
command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --hidden --follow --glob "!.git/*" --color "always" '.shellescape(<q-args>), 1, <bang>0) | |
set grepprg=rg\ --vimgrep | |
" elm specific | |
Plug 'andys8/vim-elm-syntax' | |
" handlebars | |
Plug 'mustache/vim-mustache-handlebars' | |
" markdown | |
Plug 'godlygeek/tabular' | |
Plug 'plasticboy/vim-markdown' | |
let g:vim_markdown_conceal = 0 | |
let g:vim_markdown_conceal_code_blocks = 0 | |
let g:vim_markdown_folding_disabled = 1 | |
" snippets | |
Plug 'honza/vim-snippets' | |
" code completion | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
" use <tab> for trigger completion and navigate to the next complete item | |
inoremap <silent><expr> <Tab> | |
\ pumvisible() ? "\<C-n>" : | |
\ <SID>check_back_space() ? "\<Tab>" : | |
\ coc#refresh() | |
function! s:check_back_space() abort | |
let col = col('.') - 1 | |
return !col || getline('.')[col - 1] =~ '\s' | |
endfunction | |
" use <S-tab> to navigate to the prev complete item | |
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>" | |
" use <cr> to confirm selection | |
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<CR>" | |
" hide pum when completion is done | |
autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif | |
" format code (mostly autom. anyway) | |
map <leader>f :call CocAction('format')<CR> | |
" use `[g` and `]g` to navigate diagnostics | |
nmap <silent> [g <Plug>(coc-diagnostic-prev) | |
nmap <silent> ]g <Plug>(coc-diagnostic-next) | |
" remap keys for gotos | |
nmap <silent> gd <Plug>(coc-definition) | |
nmap <silent> gy <Plug>(coc-type-definition) | |
nmap <silent> gi <Plug>(coc-implementation) | |
nmap <silent> gr <Plug>(coc-references) | |
" use K to show documentation in preview window | |
nnoremap <silent> K :call <SID>show_documentation()<CR> | |
function! s:show_documentation() | |
if (index(['vim','help'], &filetype) >= 0) | |
execute 'h '.expand('<cword>') | |
else | |
call CocAction('doHover') | |
endif | |
endfunction | |
" comments | |
Plug 'scrooloose/nerdcommenter' | |
let g:NERDSpaceDelims = 1 | |
let g:NERDDefaultAlign = 'left' | |
" multi-file search & replace | |
Plug 'Wolfy87/vim-enmasse' | |
" \\\ Initialize plugin system /// | |
call plug#end() | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" THEMEING | |
" set Vim-specific sequences for RGB colors | |
set termguicolors | |
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum" | |
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum" | |
set background=light | |
colorscheme solarized8 | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" MISC SETTINGS | |
" show tabs and trailing white spaces | |
set list lcs=tab:»⋅,trail:⋅ | |
" Delete comment character when joining commented lines | |
set formatoptions+=j | |
" show line numbers | |
set number | |
" always show sign column | |
set signcolumn=yes | |
" better display for messages | |
set cmdheight=2 | |
" don't give |ins-completion-menu| messages. | |
set shortmess+=c | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" KEY BINDINGS | |
" split long lines over multiple according to textwidth | |
vmap Q gq | |
nmap Q gqap | |
" block indent | |
vnoremap < <gv | |
vnoremap > >gv | |
" duplicate line on <C-d> | |
inoremap <C-d> <ESC>yypi | |
" NO ARROW KEYS COME ON | |
map <Left> :echo "no!"<cr> | |
map <Right> :echo "no!"<cr> | |
map <Up> :echo "no!"<cr> | |
map <Down> :echo "no!"<cr> | |
" use <leader>y and <leader>p for copy & paste to clipboard | |
map <leader>y "*y | |
map <leader>p "*p | |
" fast buffer cycling <Alt-h> <Alt-l> | |
map ¬ :bnext<cr> | |
map ˙ :bprev<cr> | |
" https://vim.fandom.com/wiki/Moving_lines_up_or_down <Alt-j> <Alt-k> | |
nnoremap ∆ :m .+1<CR>== | |
nnoremap ˚ :m .-2<CR>== | |
inoremap ∆ <Esc>:m .+1<CR>==gi | |
inoremap ˚ <Esc>:m .-2<CR>==gi | |
vnoremap ∆ :m '>+1<CR>gv=gv | |
vnoremap ˚ :m '<-2<CR>gv=gv | |
" :diffput and :diffget shortcuts | |
map <leader><leader>dp :diffput<cr> | |
map <leader><leader>dg :diffget<cr> | |
" jj for <Esc> in insert mode | |
inoremap jj <Esc> | |
" navigate long wrapped lines | |
map <C-j> gj | |
map <C-k> gk | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" FILETYPE SETTINGS | |
augroup filetypeSettings | |
autocmd! | |
" autom. remove trailing white spaces before saving | |
autocmd BufWritePre * :%s/\s\+$//e | |
" for all text files set 'textwidth' to 80 characters. | |
autocmd FileType text setlocal textwidth=80 | |
" show line length marker for some source files | |
autocmd FileType javascript,elm setlocal colorcolumn=80 | |
" use gf to open files referenced by import (without .js suffix) | |
autocmd FileType javascript setlocal suffixesadd=.js | |
" makes foo-bar considered one word | |
autocmd FileType css,scss,less setlocal iskeyword+=- | |
" fix syntax highlighting for .babelrc, etc. | |
autocmd BufEnter .babelrc,.eslintrc,.stylelintrc set filetype=json | |
" fix syntax highlighting for JSONC comments | |
autocmd FileType json syntax match Comment +\/\/.\+$+ | |
" When editing a file, always jump to the last known cursor position. | |
" Don't do it when the position is invalid or when inside an event handler | |
" (happens when dropping a file on gvim). | |
autocmd BufReadPost * | |
\ if line("'\"") > 0 && line("'\"") <= line("$") | | |
\ exe "normal g`\"" | | |
\ endif | |
augroup END | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" COMMANDS | |
" OpenURL in chrome | |
command! -bar -nargs=1 OpenURL :exec 'silent !open -a /Applications/Google\ Chrome.app % &' | |
" close all buffers except the current one | |
command! BufOnly :%bd | e# | |
" open JS test file from current JS file in buffer and vice versa | |
command! Jtest :execute "e " . substitute(expand("%:."),".js",".test.js","g") | |
command! JStest :execute "sp " . substitute(expand("%:."),".js",".test.js","g") | |
command! Jsrc :execute "e " . substitute(expand("%:."),".test.js",".js","g") | |
command! JSsrc :execute "sp " . substitute(expand("%:."),".test.js",".js","g") |
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
# es2015 snippets | |
snippet im "import a module" b | |
import ${1:variable} from '${2:module}';$0 | |
endsnippet | |
snippet af "arrow function" w | |
(${1:argument}) => { | |
${VISUAL}$2 | |
}$0 | |
endsnippet | |
snippet afe "arrow function expression" w | |
${1:argument} => ${VISUAL}$0 | |
endsnippet | |
# AVA | |
snippet test "test case" w | |
test('${1:description}', (t) => { | |
${VISUAL}$0 | |
}); | |
endsnippet | |
# mocha | |
snippet des "describe" w | |
describe('${1:description}', () => { | |
${VISUAL}$0 | |
}); | |
endsnippet | |
snippet it "it" w | |
it('${1:description}', () => { | |
${VISUAL}$0 | |
}); | |
endsnippet | |
snippet exp "expect to" w | |
expect(${1:subject}).to.$0 | |
endsnippet | |
# riteway | |
snippet ass "assert riteway" w | |
assert({ | |
given: '$1', | |
should: '$2', | |
actual: $3, | |
expected: $4, | |
}); | |
${VISUAL}$0 | |
endsnippet | |
# vim:ft=snippets: |
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
# ~/.tmuxinator/js-project.yml | |
# Usage from inside project folder: | |
# $ mux start js-project $(pwd) -n $(basename $(pwd)) | |
name: project | |
root: <%= @args[0] %> | |
on_project_start: | |
- git pull --rebase | |
- '[ -f ./yarn.lock ] && yarn install || npm install' | |
windows: | |
- editor: | |
layout: 3c80,208x57,0,0{118x57,0,0,67,89x57,119,0,69} | |
panes: | |
- nvim -c NERDTree | |
- npm run dev | |
- shell: clear |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment