Skip to content

Instantly share code, notes, and snippets.

@adimircolen
Last active December 27, 2018 17:02
Show Gist options
  • Save adimircolen/6dffcf641145853860b20a55aadb9819 to your computer and use it in GitHub Desktop.
Save adimircolen/6dffcf641145853860b20a55aadb9819 to your computer and use it in GitHub Desktop.
HOME DOT
[user]
email = [email protected]
name = Adimir Colen
[core]
editor = vim
excludesfile = /home/adimir/.gitignore_global
[alias]
co = checkout
br = branch
ci = commit
st = status
[color]
pager = true
ui = auto
status = auto
diff = auto
branch = auto
showBranch = auto
interactive = auto
grep = auto
[color "status"]
header = black bold
branch = cyan
nobranch = red
unmerged = red
untracked = cyan
added = green
changed = red bold
[color "diff"]
meta = red bold
frag = black bold
func = blue
old = red strike
new = green
commit = blue
whitespace = red
context = normal
[color "branch"]
current = cyan
local = blue
remote = magenta
upstream = magenta
plain = normal
[color "decorate"]
branch = blue
remoteBranch = magenta
tag = magenta
stash = cyan
HEAD = blue
[color "interactive"]
prompt = red
header = red bold
error = red
help = black bold
[color "grep"]
context = normal
match = cyan
filename = blue
function = blue
selected = normal
separator = red bold
linenumber = normal
# Ruby
#################################
*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/
# Used by dotenv library to load environment variables.
# .env
## Specific to RubyMotion:
.dat*
.repl_history
build/
*.bridgesupport
build-iPhoneOS/
build-iPhoneSimulator/
## Specific to RubyMotion (use of CocoaPods):
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# vendor/Pods/
## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/
## Environment normalization:
/.bundle/
/vendor/bundle
/lib/bundler/man/
# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# Gemfile.lock
.ruby-version
.ruby-gemset
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc
# Rails
#################################
*.rbc
capybara-*.html
.rspec
/log
/tmp
/db/*.sqlite3
/db/*.sqlite3-journal
/public/system
/coverage/
/spec/tmp
*.orig
rerun.txt
pickle-email-*.html
# TODO Comment out this rule if you are OK with secrets being uploaded to the repo
config/initializers/secret_token.rb
config/master.key
# Only include if you have production secrets in this file, which is no longer a Rails default
# config/secrets.yml
# dotenv
# TODO Comment out this rule if environment variables can be committed
.env
## Environment normalization:
/.bundle
/vendor/bundle
# these should all be checked in to normalize the environment:
# Gemfile.lock, .ruby-version, .ruby-gemset
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc
# if using bower-rails ignore default bower_components path bower.json files
/vendor/assets/bower_components
*.bowerrc
bower.json
# Ignore pow environment settings
.powenv
# Ignore Byebug command history file.
.byebug_history
# Ignore node_modules
node_modules/
.pryrc
# Editors
#################################
# Cache files for Sublime Text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
# Workspace files are user-specific
*.sublime-workspace
# Project files should be checked into the repository, unless a significant
# proportion of contributors will probably not be using Sublime Text
# *.sublime-project
# SFTP configuration file
sftp-config.json
# Package control specific files
Package Control.last-run
Package Control.ca-list
Package Control.ca-bundle
Package Control.system-ca-bundle
Package Control.cache/
Package Control.ca-certs/
Package Control.merged-ca-bundle
Package Control.user-ca-bundle
oscrypto-ca-bundle.crt
bh_unicode_properties.cache
# Sublime-github package stores a github token in this file
# https://packagecontrol.io/packages/sublime-github
GitHub.sublime-settings
# Swap
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-v][a-z]
[._]sw[a-p]
# Session
Session.vim
# Temporary
.netrwhist
*~
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/dictionaries
.idea/**/shelf
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# CMake
cmake-build-debug/
cmake-build-release/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
.idea/
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
.docker_service_name
.vscode/**
.solargraph.yml
# TMUX ADIMIR
unbind C-b
set-option -g prefix C-a
set-option -sg escape-time 0
bind-key C-a send-prefix
# split panes using | and -
bind | split-window -h
bind - split-window -v
set -g base-index 1
setw -g pane-base-index 1
#reload tmux.conf
bind r source-file ~/.tmux.conf \; display “Reloaded!”
######################
### DESIGN CHANGES ###
######################
# loud or quiet?
set-option -g visual-activity off
set-option -g visual-bell off
set-option -g visual-silence off
set-window-option -g monitor-activity off
set-option -g bell-action none
# modes
setw -g clock-mode-colour colour5
setw -g mode-attr bold
setw -g mode-fg colour1
setw -g mode-bg colour18
# panes
set -g pane-border-bg colour0
set -g pane-border-fg colour19
set -g pane-active-border-bg colour0
set -g pane-active-border-fg colour9
# statusbar
set -g status-position bottom
set -g status-justify left
set -g status-bg colour18
set -g status-fg colour137
set -g status-attr dim
set -g status-left ''
set -g status-right '#[fg=colour233,bg=colour19,bold] %d/%m #[fg=colour233,bg=colour8,bold] %H:%M:%S '
set -g status-right-length 50
set -g status-left-length 20
setw -g window-status-current-fg colour1
setw -g window-status-current-bg colour19
setw -g window-status-current-attr bold
setw -g window-status-current-format ' #I#[fg=colour249]:#[fg=colour255]#W#[fg=colour249]#F '
setw -g window-status-fg colour9
setw -g window-status-bg colour18
setw -g window-status-attr none
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
setw -g window-status-bell-attr bold
setw -g window-status-bell-fg colour255
setw -g window-status-bell-bg colour1
# messages
set -g message-attr bold
set -g message-fg colour232
set -g message-bg colour16
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
source ~/.vim/plugins.vim
call vundle#end()
let mapleader = ","
set shortmess+=I
set timeoutlen=1000
set ttimeoutlen=0
set nobackup
set noswapfile
set autoread
set history=2048
set undolevels=2048
set backspace=indent,eol,start
set clipboard=unnamedplus
set t_Co=256
set background=light
colorscheme solarized
set colorcolumn=90
colorscheme nova
syntax on
filetype plugin indent on
set title
set laststatus=2
set showcmd
set ruler
set showmode
set wildmenu
set number
set nowrap
set scrolloff=1
set sidescrolloff=5
set statusline=%w%h\ %F\ %m
if isdirectory(expand('~/.vim/plugins/vim-fugitive'))
set statusline+=\ %{fugitive#statusline()}
endif
set statusline+=\ %r%=%l-%v/%L
set incsearch
set hlsearch
set ignorecase
set smartcase
set smarttab
set expandtab
set tabstop=2
set softtabstop=2
set shiftwidth=2
set autoindent
set smartindent
set shiftround
set splitright
augroup MakeProgram
autocmd!
autocmd FileType ruby setl makeprg=ruby\ %
autocmd FileType html setl makeprg=sensible-browser\ %
autocmd FileType sh setl makeprg=./%
augroup END
augroup auto_comment
au!
au FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
augroup END
autocmd BufWritePre * %s/\s\+$//e
hi diffAdded ctermbg=NONE ctermfg=118 cterm=NONE
hi diffRemoved ctermbg=NONE ctermfg=196 cterm=NONE
hi link diffLine String
hi link diffSubname Normal
""" FZF
" Similarly, we can apply it to fzf#vim#grep. To use ripgrep instead of ag:
command! -bang -nargs=* Rg
\ call fzf#vim#grep(
\ 'rg --column --line-number --no-heading --color=always --ignore node_modules'.shellescape(<q-args>), 1,
\ <bang>0 ? fzf#vim#with_preview('up:60%')
\ : fzf#vim#with_preview('right:50%:hidden', '?'),
\ <bang>0)
" [Buffers] Jump to the existing window if possible
let g:fzf_buffers_jump = 1
let g:fzf_layout = { 'down': '~40%' }
" 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'] }
source ~/.vim/options.vim
source ~/.vim/mappings.vim
alias dcrr="dcr --rm scores"
alias sc-c="cd ~/Projects/paycertify/docker-services/ && docker-compose run --rm scores bundler exec rails c && cd -"
alias sc-dbc="cd ~/Projects/paycertify/docker-services/ && docker-compose run --rm scores bundler exec rails dbconsole && cd -"
alias sc-migrate="cd ~/Projects/paycertify/docker-services/ && docker-compose run --rm scores bundler exec rails db:migrate db:test:prepare && cd -"
alias sc-recreate="cd ~/Projects/paycertify/docker-services/ && docker-compose run --rm scores bundler exec rails db:drop db:create db:migrate && cd -"
spec () {
cd ~/Projects/paycertify/docker-services/
docker-compose run --rm confirmation bundle exec rspec "$@"
cd -
}
dcrscores () {
cd ~/Projects/paycertify/docker-services/
docker-compose run --rm scores "$@"
cd -
}
let os = substitute(system('uname'), "\n", "", "")
call plug#begin('~/.vim/plugged')
Plug 'morhetz/gruvbox'
Plug 'chusiang/vim-sdcv' " How to install dict see https://askubuntu.com/questions/191125/is-there-an-offline-command-line-dictionary
Plug 'kassio/neoterm'
Plug 'janko-m/vim-test'
Plug 'benekastah/neomake'
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
Plug 'Shougo/neco-syntax'
Plug 'ujihisa/neco-look', { 'for': ['text', 'note', 'gitcommit', 'markdown'] }
Plug 'plasticboy/vim-markdown', { 'for': 'markdown' }
Plug 'itchyny/lightline.vim'
Plug 'shinchu/lightline-gruvbox.vim'
Plug 'vim-ruby/vim-ruby', { 'for': ['ruby', 'haml', 'eruby'] }
Plug 'tpope/vim-rake', { 'for': 'ruby' }
Plug 'tpope/vim-surround'
Plug 'tpope/vim-rails', { 'for': ['ruby', 'eruby', 'haml', 'coffee', 'javascript'] }
Plug 'tpope/vim-rbenv', { 'for': 'ruby' }
Plug 'tpope/vim-bundler', { 'for': 'ruby' }
Plug 'Keithbsmiley/rspec.vim', { 'for': 'ruby' }
Plug 'thoughtbot/vim-rspec', { 'for': 'ruby' }
Plug 'tpope/vim-vinegar'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-abolish'
Plug 'tpope/vim-fugitive'
Plug 'junegunn/gv.vim'
Plug 'tpope/vim-haml', { 'for': ['haml'] }
Plug 'slim-template/vim-slim', { 'for': ['slim'] }
Plug 'tomtom/tcomment_vim'
Plug 'nelstrom/vim-textobj-rubyblock', { 'for': ['ruby'] }
Plug 'kana/vim-textobj-user', { 'for': ['ruby'] }
Plug 'thinca/vim-localrc'
Plug 'jgdavey/vim-blockle'
Plug 'othree/eregex.vim'
Plug 'wakatime/vim-wakatime'
Plug 'othree/html5.vim'
Plug 'xolox/vim-misc'
Plug 'xolox/vim-notes'
Plug 'Shougo/neco-syntax'
Plug 'easymotion/vim-easymotion'
Plug 'junegunn/vim-easy-align'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'mustache/vim-mustache-handlebars'
Plug 'othree/javascript-libraries-syntax.vim', { 'for': ['javascript', 'javascript.jsx'] }
Plug 'kchmck/vim-coffee-script', { 'for': ['coffee', 'haml', 'eruby'] }
Plug 'mxw/vim-jsx', { 'for': 'javascript.jsx' }
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'othree/jspc.vim', { 'for': ['javascript', 'javascript.jsx'] }
Plug 'ap/vim-css-color'
Plug 'editorconfig/editorconfig-vim'
Plug 'rhysd/vim-grammarous'
Plug 'cespare/vim-toml'
Plug 'bfredl/nvim-miniyank'
Plug 'int3/vim-extradite'
Plug 'dzeban/vim-log-syntax'
Plug 'stephpy/vim-yaml'
" Other languages
" Plug 'myint/clang-complete', { 'for': ['c', 'cpp'] }
Plug 'rhysd/vim-crystal', { 'for': 'crystal' }
Plug 'fatih/vim-go', { 'for': 'go' }
Plug 'zchee/deoplete-go', { 'for': 'go', 'do': 'make'}
" Plug 'vim-scripts/groovy.vim', { 'for': 'groovy' }
" Plug 'elixir-lang/vim-elixir', { 'for': 'elixir' }
call plug#end()
set termguicolors " true colors
set exrc " loads project spedific .nvimrc
"-----------------------
"""""""""""""""""""""""""
" KEYBINDINGS
"""""""""""""""""""""""""
let mapleader=","
inoremap jj <ESC>
map <Leader>r "hy:%S/<C-r>h//gc<left><left><left>
map <Leader>f *
map <Leader>rr :!ruby %<CR>
map <Leader>w :w<CR>
map <Leader>qa :wqa<CR>
map <Leader>[ :bprevious<CR>
map <Leader>] :bnext<CR>
map <Leader>p "+p<CR>
map <Leader>y "+y<CR>
map <Leader>D "_dd<CR>
map <Leader>d "_d<CR>
map // :TComment<CR>
map <Leader>r8 :vertical resize 80<CR>
map <Leader>r12 :vertical resize 130<CR>
map <F5> :so $MYVIMRC<CR>
nnoremap <leader>. :Tags <CR>
nnoremap <Leader>fu :BTags<Cr>
nnoremap <C-e> :Buffers<CR>
" run set tests
nmap <silent> <leader>R :TestNearest<CR>
nmap <silent> <leader>T :TestFile<CR>
nmap <silent> <leader>A :TestSuite<CR>
nmap <silent> <leader>L :TestLast<CR>
nmap <silent> <leader>G :TestVisit<CR>
" Explain current word from dictionary
nmap <silent> <leader>d :call SearchWord()<CR>
" Useful maps
" closes the all terminal buffers
nnoremap <Leader>tc :call neoterm#close_all()<cr>
" clear terminal
nnoremap <Leader>tl :call neoterm#clear()<cr>
" clear highlight
map <Leader><Leader>h :set hlsearch!<CR>
" regenerate CTAGS with ripper-tags and coffeetags
map <Leader>ct !~/.rbenv/shims/ripper-tags -R --exclude=vendor && coffeetags -R -a -f tags<CR>
" Devdocs docs
command! -nargs=? DevDocs :call system('type -p open >/dev/null 2>&1 && open http://devdocs.io/#q=<args> || xdg-open http://devdocs.io/#q=<args>')
au FileType python,ruby,rspec,javascript,html,php,eruby,coffee,haml nmap <buffer> K :exec "DevDocs " . fnameescape(expand('<cword>'))<CR>
" Grammarous
let g:grammarous#default_comments_only_filetypes = {
\ '*' : 1, 'help' : 0, 'markdown' : 0,
\ }
" Edit another file in the same directory as the current file
" uses expression to extract path from current file's path
map <Leader>e :e <C-R>=escape(expand("%:p:h"),' ') . '/'<CR>
map <Leader>s :split <C-R>=escape(expand("%:p:h"), ' ') . '/'<CR>
map <Leader>v :vnew <C-R>=escape(expand("%:p:h"), ' ') . '/'<CR>
" EasyMotion
nmap s <Plug>(easymotion-s2)
nmap t <Plug>(easymotion-t2)
map <Leader>l <Plug>(easymotion-lineforward)
map <Leader>j <Plug>(easymotion-j)
map <Leader>k <Plug>(easymotion-k)
map <Leader>h <Plug>(easymotion-linebackward)
" Rubocop fix current file
nmap <leader>rc :call RubocopAutoFix()<CR>
" Easy align
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ea <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ea <Plug>(EasyAlign)
command! Q q " Bind :Q to :q
command! Qall qall
command! W w
nnoremap <C-t> :FZF<cr>
nmap <F7> :setlocal spell! spell?<CR>
" Toggle relative numbers
map <Leader>n :call NumberToggle()<CR>
" Toggle dark/ligh colortheme
map <Leader>c :call ColorToggle()<CR>
" Open Neomake warning/error split
nnoremap <Leader><Leader>l :lopen<CR>tocmd! BufWritePost * Neomake
" some built in keybindings for included plugins
"
" matchit - <%> jums to other end of selected brackets
" surround - <cs'"> - change ' to " around current selection
" surround - <ds"> - remove " around current selection
" surround - <yss[> - surounds current selection with [
" textobj-rubyblock - var - selects outer ruby block
" vir - selects inner ruby block
"""""""""""""""""""""""""
" Basic features
"""""""""""""""""""""""""
" Misc
set secure
set lazyredraw
set splitbelow
set splitright
set diffopt+=vertical
set shell=/bin/zsh
scriptencoding utf-8
set encoding=utf-8
set termencoding=utf-8
set clipboard=unnamed
filetype plugin indent on " Do filetype detection and load custom file plugins and indent files
set laststatus=2 " When you go into insert mode,
" the status line color changes.
" When you leave insert mode,
" the status line color changes back.
" Display options
syntax on
set pastetoggle=<F12>
set nocursorline
set number
set list! " Display unprintable characters
set listchars=tab:▸\ ,trail:•,extends:»,precedes:«
autocmd filetype html,xml,go set listchars=tab:\│\ ,trail:-,extends:>,precedes:<,nbsp:+
colorscheme gruvbox
let g:gruvbox_contrast_dark = "medium" " soft, medium, hard
let g:gruvbox_contrast_light = "medium"
set background=dark
set t_ut= " fixes transparent BG on tmux
" Always edit file, even when swap file is found
set shortmess+=A
set hidden " Don't abandon buffers moved to the background
set wildmenu " Enhanced completion hints in command line
set backspace=eol,start,indent " Allow backspacing over indent, eol, & start
set complete=.,w,b,u,U,t,i,d " Do lots of scanning on tab completion
set directory=~/.config/nvim/swap " Directory to use for the swap file
set diffopt=filler,iwhite " In diff mode, ignore whitespace changes and align unchanged lines
set nowrap
set visualbell
set mouse=a
" Relative line numbers
set norelativenumber
autocmd InsertLeave * :call NumberToggle()
autocmd InsertEnter * :call NumberToggle()
" Indentation and tabbing
set autoindent smartindent
set smarttab " Make <tab> and <backspace> smarter
set tabstop=2
set expandtab
set shiftround
set shiftwidth=2
set incsearch
" viminfo: remember certain things when we exit
" (http://vimdoc.sourceforge.net/htmldoc/usr_21.html)
" % : saves and restores the buffer list
" '100 : marks will be remembered for up to 30 previously edited files
" /100 : save 100 lines from search history
" h : disable hlsearch on start
" "500 : save up to 500 lines for each register
" :100 : up to 100 lines of command-line history will be remembered
" n... : where to save the viminfo files
set viminfo=%100,'100,/100,h,\"500,:100,n~/.config/nvim/viminfo
" Undo
set undolevels=1000 " How many undos
set undoreload=10000 " number of lines to save for undo
if has("persistent_undo")
set undodir=~/.config/nvim/undo " Allow undoes to persist even after a file is closed
set undofile
endif
" Search settings
set ignorecase
set smartcase
set hlsearch
set incsearch
set showmatch
" to_html settings
let html_number_lines = 1
let html_ignore_folding = 1
let html_use_css = 1
"let html_no_pre = 0
let use_xhtml = 1
let xml_use_xhtml = 1
" Show a vertical line/guard at column 80
let &colorcolumn=join(range(81,999),",")
highlight ColorColumn ctermbg=235 guibg=#2c2d27
let &colorcolumn="80,".join(range(131,999),",")
" terminal colors
let g:terminal_color_0 = '#2e3436'
let g:terminal_color_1 = '#cc0000'
let g:terminal_color_2 = '#4e9a06'
let g:terminal_color_3 = '#c4a000'
let g:terminal_color_4 = '#3465a4'
let g:terminal_color_5 = '#75507b'
let g:terminal_color_6 = '#0b939b'
let g:terminal_color_7 = '#d3d7cf'
let g:terminal_color_8 = '#555753'
let g:terminal_color_9 = '#ef2929'
let g:terminal_color_10 = '#8ae234'
let g:terminal_color_11 = '#fce94f'
let g:terminal_color_12 = '#729fcf'
let g:terminal_color_13 = '#ad7fa8'
let g:terminal_color_14 = '#00f5e9'
let g:terminal_color_15 = '#eeeeec'
"""""""""""""""""""""""""
" Plugin's
"""""""""""""""""""""""""
" Fzf
command! -bang -nargs=+ -complete=dir Ag call fzf#vim#ag_raw(<q-args>, <bang>0)
command! -bang -nargs=* F
\ call fzf#vim#grep(
\ 'rg --iglob !tags --sort path --column --line-number --no-heading --color=always --colors match:none --colors match:style:bold --colors=match:fg:208 --smart-case '.shellescape(<q-args>), 1,
\ <bang>0 ? fzf#vim#with_preview('up:60%')
\ : fzf#vim#with_preview('right:50%:hidden', '?'),
\ <bang>0)
command! -bang -nargs=* Fr
\ call fzf#vim#grep(
\ 'rg --type ruby --sort path --column --line-number --no-heading --color=always --colors match:none --colors match:style:bold --colors=match:fg:208 --smart-case '.shellescape(<q-args>), 1,
\ <bang>0 ? fzf#vim#with_preview('up:60%')
\ : fzf#vim#with_preview('right:50%:hidden', '?'),
\ <bang>0)
" Use deoplete.
let g:deoplete#enable_at_startup = 1
call deoplete#custom#source('buffer', 'rank', 501)
call deoplete#custom#source('_', 'max_candidates', 5)
" deoplete-go settings
let g:deoplete#sources#go#gocode_binary = $GOPATH.'/bin/gocode'
let g:deoplete#sources#go#sort_class = ['package', 'func', 'type', 'var', 'const']
" use tab
imap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ deoplete#mappings#manual_complete()
function! s:check_back_space() abort "{{{
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction"}}}
" For clang with
let g:clang_complete_auto = 0
let g:clang_auto_select = 0
let g:clang_omnicppcomplete_compliance = 0
let g:clang_make_default_keymappings = 0
let g:clang_library_path = '/usr/local/opt/llvm/lib'
" Ultisnip
let g:UltiSnipsExpandTrigger="<C-j>"
let g:UltiSnipsSnippetsDir="~/.config/nvim/UltiSnips"
" Notes
let g:notes_directories = ['~/Dropbox/Notes']
let g:notes_tab_indents = 0
let g:notes_word_boundaries = 1
" Lightline
let g:lightline = {
\ 'colorscheme': 'gruvbox',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'gitbranch': 'fugitive#head'
\ },
\ }
" Vim test
let test#strategy = "neoterm"
" Neomake
" let g:neomake_verbose = 3
let g:neomake_logfile = '/tmp/neomake.log'
let g:neomake_ruby_reek_maker_errorformat =
\ '%E%.%#: Racc::ParseError: %f:%l :: %m,' .
\ '%W%f:%l: %m'
let g:neomake_ruby_reek_maker = {
\ 'args': ['--single-line'],
\ 'errorformat': g:neomake_ruby_reek_maker_errorformat,
\ }
let b:neomake_ruby_rubocop_exe = "~/.rvm/gems/ruby-2.4.0/bin/rubocop"
let g:neomake_ruby_enabled_makers = ['mri', 'rubocop']
let g:neomake_javascript_enabled_makers = ['eslint']
let g:neomake_serialize = 1
let g:neomake_serialize_abort_on_error = 1
function! MyOnBattery()
if filereadable('/usr/bin/pmset')
silent exe "!pmset -g batt | grep discharging"
return !v:shell_error
else
return readfile('/sys/class/power_supply/AC/online') == ['0']
endif
endfunction
if MyOnBattery()
call neomake#configure#automake('w')
else
call neomake#configure#automake('inrw', 1000)
endif
" Neoterm
let g:neoterm_clear_cmd = "clear; printf '=%.0s' {1..80}; clear"
let g:neoterm_run_tests_bg = 1
let g:neoterm_raise_when_tests_fail = 1
let g:neoterm_default_mod = 'botright'
let g:neoterm_size = 10
let g:neoterm_rspec_lib_cmd = 'bundle exec rspec'
" JS libs
let g:used_javascript_libs = 'jquery,handlebars,underscore,backbone'
" ignored files
set wildignore+=tags
set wildignore+=*/tmp/*
set wildignore+=*/spec/vcr/*
set wildignore+=*/public/*
set wildignore+=*/coverage/*
set wildignore+=*.png,*.jpg,*.otf,*.woff,*.jpeg,*.orig
" Markdown
let g:vim_markdown_folding_disabled=1
" EasyMotion
" Use uppercase target labels and type as a lower case
let g:EasyMotion_use_upper = 1
" type `l` and match `l`&`L`
let g:EasyMotion_smartcase = 1
" Smartsign (type `3` and match `3`&`#`)
let g:EasyMotion_use_smartsign_us = 1
" ruby
autocmd FileType ruby,eruby,yaml,haml setlocal iskeyword+=?
autocmd FileType ruby,eruby,yaml,haml setlocal iskeyword+=!
" omnifuncs
set omnifunc=syntaxcomplete#Complete
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
" Markdown
autocmd BufRead,BufNewFile *.md setlocal textwidth=80
" Handlebars/Mustache
autocmd BufRead,BufNewFile *.hb.erb set filetype=mustache
" Turn on spellcheck
autocmd Filetype gitcommit,markdown,note setlocal spell textwidth=72
autocmd Filetype gitcommit,markdown,note setlocal complete+=kspell
" Crystal
" ecr - like erb
autocmd BufRead,BufNewFile *.ecr set filetype=.html.eruby
" Golang
au FileType go nmap <leader>R <Plug>(go-run)
au FileType go nmap <leader>B <Plug>(go-build)
au FileType go nmap <leader>T <Plug>(go-test)
au FileType go nmap <leader>C <Plug>(go-coverage)
"""""""""""""""""""""""""
" Custom functions
"""""""""""""""""""""""""
"Toggle arrow keys
function! RubocopAutoFix()
exe "w"
silent exe "!rubocop -a -R % &> /dev/null"
silent exe "e %"
silent exe "Neomake"
endfun
"This allows for change paste motion cp{motion}
nmap <silent> cp :set opfunc=ChangePaste<CR>g@
function! ChangePaste(type, ...)
silent exe "normal! `[v`]\"_c"
silent exe "normal! p"
endfunction
" When opening a file, always jump to the last cursor position
autocmd BufReadPost *
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif |
function! NumberToggle()
if(&relativenumber == 1)
set norelativenumber
set number
else
set relativenumber
endif
endfunc
function! ColorToggle()
if(&background == "dark")
set background=light
else
set background=dark
endif
endfunction
if $VIM_CRONTAB == "true"
set nobackup
set nowritebackup
endif
" " Disable Arrow keys in Escape mode
" map <up> <nop>
" map <down> <nop>
" map <left> <nop>
" map <right> <nop>
"
" " Disable Arrow keys in Insert mode
" imap <up> <nop>
" imap <down> <nop>
" imap <left> <nop>
" imap <right> <nop>
" fzf-vim
map <leader>p :FZF<cr>
map <leader>b :Buffers<cr>
map <leader>f :Rg
map <leader>nn :NERDTreeToggle<cr>
map <leader>nf :NERDTreeFind<cr>
map <leader>d :bd<cr>
nnoremap <leader>j :m .+1<CR>==
nnoremap <leader>k :m .-2<CR>==
" nnoremap <C-j> :m .+1<CR>==
" nnoremap <C-k> :m .-2<CR>==
" inoremap <C-j> <Esc>:m .+1<CR>==gi
" inoremap <C-k> <Esc>:m .-2<CR>==gi
" vnoremap <C-j> :m '>+1<CR>gv=gv
" vnoremap <C-k> :m '<-2<CR>gv=gv
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" PROMOTE VARIABLE TO RSPEC LET
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! PromoteToLet()
:normal! dd
" :exec '?^\s*it\>'
:normal! P
:.s/\(\w\+\) = \(.*\)$/let(:\1) { \2 }/
:normal ==
endfunction
:command! PromoteToLet :call PromoteToLet()
:map <leader>l :PromoteToLet<cr>
let s:grep_program = 'rg'
let s:grep_options = ' --vimgrep --silent --ignore tmp --ignore log --ignore vendor --ignore node_modules'
" vim-ripgrep
let g:rg_command='rg --vimgrep'
let g:rg_highlight=1
" NERDTree
let NERDTreeQuitOnOpen=1
" tagbar
let g:tagbar_compact = 1
" vimfiler.vim
let g:vimfiler_as_default_explorer = 1
let g:vimfiler_no_default_key_mappings = 1
let g:vimfiler_expand_jump_to_first_child = 0
let g:vimfiler_ignore_pattern = ' '
let g:vimfiler_time_format = '%Y-%m-%d %H:%M'
let g:vimfiler_tree_leaf_icon = ' '
let g:vimfiler_tree_opened_icon = '▾'
let g:vimfiler_tree_closed_icon = '▸'
let g:vimfiler_readonly_file_icon = '×'
if isdirectory(expand('~/.vim/plugins/vimfiler.vim'))
call vimfiler#custom#profile('default', 'context', { 'columns': 'size', 'safe': 0 })
endif
" emmet-vim
let g:user_emmet_leader_key = '<C-e>'
" vim-tags
let g:vim_tags_auto_generate = 0
let g:vim_tags_ctags_binary = 'ripper-tags'
let g:vim_tags_use_language_field = 0
" vim-trailing-whitespace
let g:extra_whitespace_ignored_filetypes = ['vimfiler', 'agsv', 'far_vim', 'conque_term']
" delimitMate
let delimitMate_expand_cr = 2
let delimitMate_expand_space = 1
let delimitMate_expand_inside_quotes = 1
augroup delimitMate_quotes
autocmd!
autocmd FileType ruby,eruby,haml,slim let delimitMate_quotes = "\" ' ` |"
augroup END
" vim-gitgutter
let g:gitgutter_max_signs = 5000
" vim-pasta
let g:pasta_disabled_filetypes = ['vimfiler', 'agsv']
" splitjoin.vim
let g:splitjoin_ruby_hanging_args = 0
" vim-instant-markdown
let g:instant_markdown_autostart = 0
" vim-extradite
let g:extradite_showhash = 1
" vim-extract
let g:extract_hidden = 1
" vim-executor
let g:executor_reuse_buffer = 1
" unite.vim
let g:unite_enable_auto_select = 0
if isdirectory(expand('~/.vim/plugins/unite.vim'))
call unite#custom#profile('default', 'context', {
\ 'direction': 'below',
\ 'prompt': '> ',
\ 'prompt_focus': 1
\ })
endif
if executable(s:grep_program)
let g:unite_source_grep_command = s:grep_program
let g:unite_source_grep_default_opts = s:grep_options
endif
" ale
let g:ale_sign_warning = '>'
let g:ale_echo_msg_format = '[%linter%] %severity%: %s'
let g:ale_linters = {
\ 'ruby': ['ruby', 'rubocop', 'reek']
\ }
" far.vim
let g:far#preview_window_height = 15
let g:far#file_mask_favorites = [
\ '%',
\ '**/*.*',
\ '**/*.rb',
\ '**/*.js',
\ '**/*.coffee',
\ '**/*.html',
\ '**/*.erb',
\ '**/*.haml',
\ '**/*.slim',
\ '**/*.css',
\ '**/*.scss',
\ '**/*.less',
\ '**/*.vim',
\ '**/*.exs',
\ ]
if executable(s:grep_program)
let g:far#source = s:grep_program
let g:far#file_mask_favorites = [
\ '%',
\ '\.rb$',
\ '\.js$',
\ '\.coffee$',
\ '\.html$',
\ '\.erb$',
\ '\.haml$',
\ '\.slim$',
\ '\.css$',
\ '\.scss$',
\ '\.less$',
\ '\.vim$',
\ '\.exs$'
\ ]
endif
" vim-plug
highlight def link plugDeleted Title
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
endif
"Use TAB to complete when typing words, else inserts TABs as usual.
"Uses dictionary and source files to find matching words to complete.
"See help completion for source,
"Note: usual completion is on <C-n> but more trouble to press all the time.
"Never type the same word twice and maybe learn a new spellings!
"Use the Linux dictionary when spelling is in doubt.
"Window users can copy the file to their machine.
" function! Tab_Or_Complete()
" if col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^\w'
" return "\<C-N>"
" else
" return "\<Tab>"
" endif
" endfunction
" inoremap <Tab> <C-R>=Tab_Or_Complete()<CR>
" set dictionary="/usr/dict/words"
if filereadable(expand('~/.vim/options.local.vim'))
source ~/.vim/options.local.vim
endif
" File explorer
Plugin 'scrooloose/nerdtree'
" Class outline viewer
Plugin 'majutsushi/tagbar'
Plugin 'instant-markdown.vim'
" Fuzzy search
" Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'junegunn/fzf', { 'dir':'~/.fzf', 'do': './install --all' }
Plugin 'junegunn/fzf.vim'
" Grep
Plugin 'jremmen/vim-ripgrep'
" Find and replace
Plugin 'brooth/far.vim'
" Syntax checker
Plugin 'scrooloose/syntastic'
" Autocompletion
Plugin 'othree/vim-autocomplpop'
Plugin 'cmdline-completion'
Plugin 'tpope/vim-endwise'
" Snippets
Plugin 'garbas/vim-snipmate'
Plugin 'honza/vim-snippets'
" Ruby
Plugin 'tpope/vim-rails'
Plugin 'tpope/vim-rake'
Plugin 'tpope/vim-bundler'
" Plugin 'tpope/vim-rvm'
Plugin 'tpope/vim-rbenv'
Plugin 'ngmy/vim-rubocop'
" Tests
Plugin 'janko-m/vim-test'
" Additional syntaxes and markup/programming languages
Plugin 'sheerun/vim-polyglot'
Plugin 'trevordmiller/nova-vim'
Plugin 'mattn/emmet-vim'
Plugin 'gregsexton/MatchTag'
" Git
Plugin 'airblade/vim-gitgutter'
Plugin 'tpope/vim-fugitive'
Plugin 'rhysd/committia.vim'
Plugin 'int3/vim-extradite'
" Other
" Plugin 'airblade/vim-rooter'
Plugin 'tyru/caw.vim'
Plugin 'Raimondi/delimitMate'
Plugin 'sickill/vim-pasta'
Plugin 'AndrewRadev/splitjoin.vim'
Plugin 'ck3g/vim-change-hash-syntax'
Plugin 'bronson/vim-trailing-whitespace'
Plugin 'kshenoy/vim-signature'
Plugin 'mkitt/tabline.vim'
Plugin 'google/vim-searchindex'
" Plugin 'bogado/file-line'
Plugin 'wakatime/vim-wakatime'
Plugin 'rafi/awesome-vim-colorschemes'
Plugin 'Solarized'
" Refactoring tools
Plugin 'ecomba/vim-ruby-refactoring'
Plugin 'chrisbra/NrrwRgn'
Plugin 'lucerion/vim-extract'
" Dependencies
Plugin 'MarcWeber/vim-addon-mw-utils' " snipmate
Plugin 'tomtom/tlib_vim' " snipmate
Plugin 'l9' " vim-autocomplpop
Plugin 'vim-scripts/matchit.zip' " vim-ruby-refactoring
Plugin 'lucerion/vim-buffr' " vim-extract
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/home/adimir/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="spaceship"
# Set list of themes to load
# Setting this variable when ZSH_THEME=random
# cause zsh load theme from this variable instead of
# looking in ~/.oh-my-zsh/themes/
# An empty array have no effect
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
git
rbenv
linux
ruby
docker
docker-compose
vim
git-flow-completion
)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# ssh
# export SSH_KEY_PATH="~/.ssh/rsa_id"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
export PATH="$HOME/.rbenv/bin:$PATH"
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
fpath=(~/.zsh/completion $fpath)
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment