Skip to content

Instantly share code, notes, and snippets.

@rub1cc
Last active April 4, 2019 04:22
Show Gist options
  • Save rub1cc/c8529bc3887951e6625fe942ef9c926f to your computer and use it in GitHub Desktop.
Save rub1cc/c8529bc3887951e6625fe942ef9c926f to your computer and use it in GitHub Desktop.
My vim configuration
call plug#begin("~/.config/vim/plugged")
Plug 'lifepillar/vim-solarized8' " Solarized8 theme for vim
Plug 'drewtempelmeyer/palenight.vim' " Palenight theme for vim
Plug 'sheerun/vim-polyglot' " A collection of language packs for Vim.
Plug 'mattn/emmet-vim' " Emmet for vim
Plug 'tpope/vim-surround' " Quoting/parenthesizing made simple
Plug 'jiangmiao/auto-pairs' " Insert or delete brackets, parens, quotes in pair.
Plug 'ap/vim-css-color' " A very fast, multi-syntax context-sensitive color name highlighter
Plug 'EinfachToll/DidYouMean' " Vim plugin which asks for the right file to open.
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } " A command-line fuzzy finder
Plug 'junegunn/fzf.vim' " A command-line fuzzy finder
Plug 'aaren/arrowkeyrepurpose' " A plugin for repurposing the arrow keys mostly for shifting lines of text around
Plug 'vim-airline/vim-airline' " Lean & mean status/tabline for vim that's light as air
Plug 'vim-airline/vim-airline-themes' " A collection of themes for vim-airline
Plug 'w0rp/ale' " Asynchronous Lint Engine
Plug 'prettier/vim-prettier', { 'do': 'yarn install' } " Prettier for vim
Plug 'scrooloose/nerdtree' " A tree explorer plugin for vim
Plug 'airblade/vim-gitgutter' " A Vim plugin which shows a git diff in the gutter (sign column) and stages/undoes hunks.
Plug 'airblade/vim-rooter' " Find project root
Plug 'pangloss/vim-javascript' " Better JS support
Plug 'mxw/vim-jsx' " JSX support
Plug 'yggdroot/indentline' " A vim plugin to display the indention levels with thin vertical lines
" Plugin for Autocomplete + Snippets
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
Plug 'Shougo/neosnippet.vim'
Plug 'Shougo/neosnippet-snippets'
Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' } " Markdown Preview for (Neo)vim
Plug 'tpope/vim-commentary' " comment stuff out
Plug 'gregsexton/matchtag'
call plug#end()
autocmd! bufwritepost .vimrc source %
set mouse=a
set encoding=utf-8
" Indentation
set tabstop=4
set softtabstop=4
set expandtab
set shiftwidth=2
set autochdir
set autoindent
set copyindent
set nowrap
" Display extra whitespace
set list listchars=tab:»·,trail:·
" Remapping some keys
imap kk <Esc>
cmap kk <c-c>
vmap v <Esc>
map ; :
map s ^
map e $
map <c-h> <c-w><c-h>
map <c-j> <c-w><c-j>
map <c-k> <c-w><c-k>
map <c-l> <c-w><c-l>
let g:mapleader=','
nnoremap <leader><leader> <c-^>
" Autosave
set autowrite
set number
set pastetoggle=<f2>
set clipboard+=unnamedplus
" Easy search
nnoremap / /\v
vnoremap / /\v
set hlsearch
set incsearch
set ignorecase
set smartcase
map <CR> :nohl<CR>
set cursorline
"set cursorcolumn
set title
runtime ~/.config/vim/macros/matchit.vim
filetype plugin on
" Make persistent undo
set undofile
set undodir=~/.config/vim/undodir
" Theming
set background=dark
set t_Co=256
syntax enable
colorscheme palenight
" Autocomplete
set complete-=i
set completeopt=preview
set wildmenu
set wildmode=list:longest,full
" Remap tab to bracket in normal mode
nnoremap <tab> %
" Remap tab to match in visual mode
vnoremap <tab> %
" Set solarized color
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8d = "\<Esc>[48;2;%lu;%lu;%lum"
" Emmet configurations
let g:user_emmet_settings = {
\ 'javascript.jsx' : {
\ 'extends' : 'jsx',
\ },
\}
" Remapping key for opening files
map <C-P> :Files<CR>
map <C-B> :Buffer<CR>
" Vim airlines configurations
set laststatus=2
let g:airline_powerline_fonts = 1
set noshowmode
set statusline=%=&P\ %f\ %m
set fillchars=vert:\ ,stl:\ ,stlnc:\
let g:airline_theme='onedark'
" Ale linter configarations
let g:ale_sign_error = '●'
let g:ale_sign_warning = '.'
let g:ale_sign_column_always = 1
let g:ale_lint_on_enter = 1
let g:ale_set_highlights = 1
let g:ale_fixers = { 'javascript': ['prettier', 'eslint'], 'elixir': [], 'python': ['remove_trailing_lines', 'trim_whitespace', 'autopep8'] }
let g:ale_linters = { 'javascript': ['eslint'], 'elixir': ['dogma'], 'python': ['flake8'] }
let g:ale_fix_on_save = 1
let g:ale_history_log_output=1
let g:ale_javascript_eslint_use_global = 1
autocmd! BufWritePost * ALELint
set autoread
autocmd BufWritePost *.exs silent :!mix format %
autocmd BufWritePost *.ex silent :!mix format %
" Tabs
map tn :tabnew<CR>
map tj :tabp<CR>
map tk :tabn<CR>
" deoplete + neosnippet + autopairs changes
let g:deoplete#enable_at_startup = 1
let g:AutoPairsMapCR=0
let g:deoplete#auto_complete_start_length = 1
let g:deoplete#enable_at_startup = 1
let g:deoplete#enable_smart_case = 1
imap <expr><TAB> pumvisible() ? "\<C-n>" : (neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>")
imap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<S-TAB>"
imap <expr><CR> pumvisible() ? deoplete#mappings#close_popup() : "\<CR>\<Plug>AutoPairsReturn"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment