Skip to content

Instantly share code, notes, and snippets.

@alanpilloud
Created June 7, 2018 13:07
Show Gist options
  • Save alanpilloud/9680d5a844bbd109152085b222a8bfab to your computer and use it in GitHub Desktop.
Save alanpilloud/9680d5a844bbd109152085b222a8bfab to your computer and use it in GitHub Desktop.
My Vimrc file
set nocompatible
set t_Co=256
" search and replace on the whole document by default, no need to add "g"
set gdefault
" enable color scheme
syntax on
set background=dark
colorscheme solarized
set cursorline
" write in the actual file, make a side backup.
" this avoid issues with webpack dev server watching files
set backupcopy=yes
" show relative line numbers and current line number
set rnu
set number
" leader is space bar
let mapleader="\<Space>"
" autoread file changes
set autoread
" search as characters are entered
set incsearch
" highlight matches
set hlsearch
" ignore case when searching
set ignorecase
" leave highlight mode
nnoremap <leader><space> :nohlsearch<CR>
" always display airline
set laststatus=2
" dont wrap lines
set nowrap
" indent mode
set smartindent
set expandtab
set shiftwidth=4
set softtabstop=4
" enable :find to search recursively
set path+=**
" enable suggestions when using Tab in :find command
set wildmenu
" ignore some path
set wildignore+=**/node_modules/**
set wildignore+=**/vendor/**
set wildignore+=**/wp-includes/**
set wildignore+=**/wp-admin/**
set wildignore+=**/wp-content/uploads/**
" always show NERDTree bookmarks
let NERDTreeShowBookmarks=1
" load nerdtree on opening a directory
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" highlight the 81th column and 120 th
let &colorcolumn="80,".join(range(120,999),",")
" ******
" * Remaps
noremap ; :
" tab switching
nnoremap <leader>h gT
nnoremap <leader>l gt
" ******
" * Plugins management
filetype plugin indent on
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-surround'
Plug 'vim-syntastic/syntastic'
Plug 'https://github.com/SirVer/ultisnips'
Plug 'https://github.com/honza/vim-snippets'
" code format for js
Plug 'prettier/vim-prettier', {
\ 'do': 'yarn install',
\ 'for': ['javascript', 'typescript', 'json', 'graphql', 'css', 'less', 'scss']}
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
endif
call plug#end()
" deoplete
let g:deoplete#enable_at_startup = 1
" run prettier on save
let g:prettier#autoformat = 0
autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.scss,*.less,*.json,*.graphql Prettier
" syntastic configuration
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
let g:syntastic_php_checkers = ['php', 'phpcs', 'phpmd']
" custom scripts
au Filetype scss,less source ~/.vim/scripts/bemconcat.vim
au Filetype php source ~/.vim/scripts/phptags.vim
" UtilSnip configuration
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
let g:UltiSnipsSnippetsDir="~/.vim/UltiSnips"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment