Created
October 7, 2020 23:40
-
-
Save bbagno/1559204db396c5fa24ee0a7b9c3faab6 to your computer and use it in GitHub Desktop.
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
let os = substitute(system('uname'), "\n", "", "") | |
call plug#begin('~/.vim/plugged') | |
Plug 'morhetz/gruvbox' | |
Plug 'kassio/neoterm' | |
Plug 'janko-m/vim-test' | |
Plug 'benekastah/neomake' | |
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } | |
Plug 'fishbullet/deoplete-ruby', { 'for': 'ruby' } | |
Plug 'ujihisa/neco-look' | |
Plug 'plasticboy/vim-markdown', { 'for': 'markdown' } | |
Plug 'bling/vim-airline' | |
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' | |
Plug 'slim-template/vim-slim' | |
Plug 'tomtom/tcomment_vim' | |
Plug 'nelstrom/vim-textobj-rubyblock' | |
Plug 'kana/vim-textobj-user' | |
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 'honza/vim-snippets' | |
Plug 'ap/vim-css-color' | |
Plug 'bfredl/nvim-miniyank' | |
" Other languages | |
Plug 'myint/clang-complete', { 'for': ['c', 'cpp'] } | |
Plug 'zchee/deoplete-go', { 'for': 'go', 'do': 'make'} | |
Plug 'elixir-lang/vim-elixir', { 'for': 'elixir' } | |
call plug#end() | |
set exrc " loads project specific .nvimrc | |
""""""""""""""""""""""""" | |
" KEYBINDINGS | |
""""""""""""""""""""""""" | |
let mapleader="," | |
map // :TComment<CR> | |
map <F5> :so $MYVIMRC<CR> | |
" Rubocop fix current file | |
nmap <leader>rc :call RubocopAutoFix()<CR> | |
command! Q q " Bind :Q to :q | |
command! Qall qall | |
command! W w | |
""""""""""""""""""""""""" | |
" Basic features | |
""""""""""""""""""""""""" | |
" Misc | |
set ttimeoutlen=100 | |
set secure | |
set lazyredraw | |
set splitbelow | |
set splitright | |
set complete+=kspell | |
set diffopt+=vertical | |
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:« | |
colorscheme gruvbox | |
let g:gruvbox_contrast_dark = "hard" " soft, medium, hard | |
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 | |
" 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 | |
" Show a vertical line/guard at column 80 | |
let &colorcolumn=join(range(121,999),",") | |
highlight ColorColumn ctermbg=235 guibg=#2c2d27 | |
let &colorcolumn="120,".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 | |
""""""""""""""""""""""""" | |
" Use deoplete. | |
let g:deoplete#enable_at_startup = 1 | |
let g:monster#completion#rcodetools#backend = "async_rct_complete" | |
let g:deoplete#sources#omni#input_patterns = { | |
\ "ruby" : '[^. *\t]\.\w*\|\h\w*::' | |
\} | |
call deoplete#custom#option({ | |
\ 'auto_complete_delay': 200, | |
\ 'max_list': 10 | |
\ }) | |
call deoplete#custom#source('buffer', 'rank', 501) | |
" 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' | |
" Airline | |
let g:airline#extensions#tabline#enabled = 1 | |
let g:airline_powerline_fonts = 1 | |
let g:tmuxline_powerline_separators = 0 | |
let g:airline_left_sep = '' | |
let g:airline_right_sep = '' | |
" 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 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 | |
" 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 | |
" 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 | |
" Git turn on spellcheck | |
autocmd Filetype gitcommit setlocal spell textwidth=72 | |
""""""""""""""""""""""""" | |
" Custom functions | |
""""""""""""""""""""""""" | |
function! RubocopAutoFix() | |
exe "w" | |
silent exe "!rubocop -a -R % &> /dev/null" | |
silent exe "e %" | |
silent exe "Neomake" | |
endfun | |
" When opening a file, always jump to the last cursor position | |
autocmd BufReadPost * | |
\ if line("'\"") > 0 && line ("'\"") <= line("$") | | |
\ exe "normal g'\"" | | |
\ endif | | |
if $VIM_CRONTAB == "true" | |
set nobackup | |
set nowritebackup | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment