Skip to content

Instantly share code, notes, and snippets.

@AZagatti
Created December 10, 2019 12:46
Show Gist options
  • Save AZagatti/990efda509ac0cc9aaad3edeeb4cb224 to your computer and use it in GitHub Desktop.
Save AZagatti/990efda509ac0cc9aaad3edeeb4cb224 to your computer and use it in GitHub Desktop.
" LEADER KEY
let mapleader=","
" COMPATIBILITY
" Set 'nocompatible' to avoid unexpected things that your distro might have
set nocompatible
set t_ut=
" BUNDLE
" Automatically download vim-plug if it doesn't exist
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
" Configure vim-plug
call plug#begin('~/.vim/bundle')
Plug 'dracula/vim', { 'as': 'dracula' }
Plug 'junegunn/vim-easy-align'
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
Plug 'tpope/vim-bundler'
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-dispatch'
Plug 'tpope/vim-endwise'
Plug 'bling/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'janko-m/vim-test'
Plug 'rking/ag.vim'
Plug 'airblade/vim-gitgutter'
Plug 'ervandew/supertab'
Plug 'tomtom/tlib_vim' | Plug 'MarcWeber/vim-addon-mw-utils' | Plug 'garbas/vim-snipmate' | Plug 'honza/vim-snippets'
Plug 'w0rp/ale'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'scrooloose/syntastic'
Plug 'jeffkreeftmeijer/vim-numbertoggle'
Plug 'editorconfig/editorconfig-vim'
Plug 'vim-scripts/AutoComplPop'
Plug 'Raimondi/delimitMate'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'scrooloose/nerdcommenter'
Plug 'rking/ag.vim'
Plug 'sheerun/vim-polyglot'
call plug#end()
" [vim-airline] Status bar settings
let g:airline_theme='dracula'
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:dracula_colorterm = 0
let g:dracula_italic = 0
syntax on
colorscheme dracula
color dracula
" [vim-test] Test runner settings
let test#strategy = 'dispatch'
let test#ruby#minitest#file_pattern = 'test_.*\.rb'
nmap <silent> <leader>t :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>
" Personal settings
set cc=80 " Set rule to 80 columns
set showmode " Display the mode you're in
set hidden " Handle multiple buffers better
set wildmode=list:longest " Complete files like a shell
set number " Show absolute line numbers (cf. relativenumber)
set list " Highlight unwanted spaces
set wrap " Turn on line wrapping
set tabstop=2 " Tabs and spaces
set visualbell " No beeping
set nobackup " No backups
set nowritebackup " No backups
set noswapfile " No swap files; more hassle than they're worth
set undofile " Set persistent undo
set undodir=~/.vim/undo " Set .un~ files directory
set tildeop " Make tilde command behave like an operator
set shortmess=atI " Avoid unnecessary hit-enter prompts
set noequalalways " Resize windows as little as possible
set notimeout " Don't time out partially entered mapped key sequences
set ttimeout " But do time out key codes
set tags=.git/tags,tags " Look for tags in .git/
set clipboard=unnamed " Use OS clipboard by default
set cpo+=J " Two spaces delimit my sentences
set novisualbell
highlight ColorColumn ctermbg=8 guibg=lightgrey
" Remove trailing white space on write
autocmd BufWritePre * :%s/\s\+$//e
" Clear the search buffer when hitting return
nnoremap <CR> :nohlsearch<CR>
" Ale
let g:ale_sign_error = '●' " Less aggressive than the default '>>'
let g:ale_sign_warning = '.'
let g:ale_lint_on_enter = 0 " Less distracting when opening a new file
" SYNTAX
" Enable syntax highlighting
syntax on
" SEARCH
" Highlight search term. Use :nohl to redraw screen and disable highlight
set hlsearch
" Make Ag search from your project root
let g:ag_working_path_mode="r"
" Use case insensitive search, except when using capital letters
set ignorecase
set smartcase
" AUTO IDENTATION
" Enable auto identation with 'spaces' instead of 'tabs'
set smartindent
set expandtab
set softtabstop=2
set shiftwidth=2
" MOVING BETWEEN FILES
" Set 'hidden' if you want to open a new file inside the same buffer without the
" need to save it first (if there's any unsaved changes).
set hidden
" REMEMBER THIGS
" Tell vim to remember certain things when we exit
" '10 : marks will be remembered for up to 10 previously edited files
" "100 : will save up to 100 lines for each register
" :20 : up to 20 lines of command-line history will be remembered
" % : saves and restores the buffer list
" n... : where to save the viminfo files
set viminfo='10,\"100,:20,%,n~/.viminfo
function! ResCur()
if line("'\"") <= line("$")
normal! g`"
return 1
endif
endfunction
augroup resCur
autocmd!
autocmd BufWinEnter * call ResCur()
augroup END
" BACKUP
" Disable all backup files, never used them
set nobackup
set nowritebackup
set noswapfile
" SYNTASTIC
" Syntastic is a syntax checking plugin for Vim that runs files through
" external syntax checkers and displays any resulting errors to the user.
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" Configure Standar JS as default linter
let g:syntastic_javascript_checkers = ['standard']
" FONT
set guifont=Monaco\ for\ Powerline:h12
set antialias
" ENCODING
set encoding=utf-8
" COMMAND LINE
" Enhanced command line completion
set wildmenu
" Complete files like a shell
set wildmode=list:longest
" SEARCH
" Vim will start searching as you type
set incsearch
" FILE NUMBERS
" Enable relative and absolute file numbers
set number relativenumber
" WRAP
" Stop wrapping long lines
set nowrap
" AUTORELOAD
" Automatically reload buffers when file changes
set autoread
" PLUGINS CONFIGURATIONS
" CtrlP
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
" Syntastic
nnoremap <leader>st :SyntasticToggleMode<cr>
" NERDTree
nnoremap <leader>ft :NERDTreeToggle<cr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment