Skip to content

Instantly share code, notes, and snippets.

@atmd83
Created December 6, 2018 17:05
Show Gist options
  • Save atmd83/c98471f1ad12080a540450e29f20db7d to your computer and use it in GitHub Desktop.
Save atmd83/c98471f1ad12080a540450e29f20db7d to your computer and use it in GitHub Desktop.
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
" look and style
Plugin 'ryanoasis/vim-devicons'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'colepeters/spacemacs-theme.vim'
" code navigation
Plugin 'scrooloose/nerdtree'
Plugin 'junegunn/fzf.vim'
Plugin 'junegunn/fzf'
Plugin 'universal-ctags/ctags'
Plugin 'craigemery/vim-autotag'
Plugin 'majutsushi/tagbar'
Plugin 'editorconfig/editorconfig-vim'
Plugin 'tpope/vim-surround'
" git
Plugin 'airblade/vim-gitgutter'
Plugin 'tpope/vim-fugitive'
" quality
Plugin 'w0rp/ale'
Plugin 'scrooloose/syntastic'
Plugin 'roktas/syntastic-more'
Plugin 'Valloric/YouCompleteMe'
" Languages
Plugin 'sheerun/vim-polyglot'
Plugin 'elixir-lang/vim-elixir'
Plugin 'avdgaag/vim-phoenix'
Plugin 'mmorearty/elixir-ctags'
Plugin 'mattreduce/vim-mix'
Plugin 'BjRo/vim-extest'
Plugin 'frost/vim-eh-docs'
Plugin 'slashmili/alchemist.vim'
Plugin 'tpope/vim-endwise'
Plugin 'jadercorrea/elixir_generator.vim'
call vundle#end()
filetype plugin indent on
" GLOBAL KEY BINDINGS
let mapleader = ","
syntax enable " Syntax highlighting
set termguicolors
colorscheme spacemacs-theme
set number " show line numbers
set showcmd " shows the commands you are typing
set splitbelow " new buffers open below the current one
set splitright " new buffers open to the right of the current one
set incsearch " turns on incremental search
set hlsearch " highlight search results
" map C-w j to C-j etc
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
let g:elite_mode=1
set cursorline
" PLUGIN CONFIG
map <leader>n :NERDTreeToggle<CR>
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
map <C-m> :TagbarToggle<CR>
" Use the correct file source, based on context
function! ContextualFZF()
" Determine if inside a git repo
silent exec "!git rev-parse --show-toplevel"
redraw!
if v:shell_error
" Search in current directory
call fzf#run({
\'sink': 'e',
\'down': '40%',
\})
else
" Search in entire git repo
call fzf#run({
\'sink': 'e',
\'down': '40%',
\'source': 'git ls-tree --full-tree --name-only -r HEAD',
\})
endif
endfunction
map <C-p> :call ContextualFZF()<CR>
" Configure FZF to find ctags
" https://github.com/junegunn/fzf/wiki/Examples-(vim)#jump-to-tags
function! s:tags_sink(line)
let parts = split(a:line, '\t\zs')
let excmd = matchstr(parts[2:], '^.*\ze;"\t')
execute 'silent e' parts[1][:-2]
let [magic, &magic] = [&magic, 0]
execute excmd
let &magic = magic
endfunction
function! s:tags()
if empty(tagfiles())
echohl WarningMsg
echom 'Preparing tags'
echohl None
call system('ctags -R --exclude=.git --exclude=node_modules --html-kinds=-ij')
endif
call fzf#run({
\ 'source': 'cat '.join(map(tagfiles(), 'fnamemodify(v:val, ":S")')).
\ '| grep -v -a ^!',
\ 'options': '+m -d "\t" --with-nth 1,4.. -n 1 --tiebreak=index',
\ 'down': '40%',
\ 'sink': function('s:tags_sink')})
endfunction
command! Tags call s:tags()
nnoremap <C-t> :Tags<CR>
nmap <C-t> :Tags<CR>
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
let g:airline_theme='hybrid'
let g:hybrid_custom_term_colors = 1
let g:hybrid_reduced_contrast = 1
let g:tagbar_type_typescript = {
\ 'ctagstype': 'typescript',
\ 'kinds': [
\ 'c:classes',
\ 'n:modules',
\ 'f:functions',
\ 'v:variables',
\ 'v:varlambdas',
\ 'm:members',
\ 'i:interfaces',
\ 'e:enums',
\ ]
\ }
let g:ale_lint_on_text_changed = 'never'
let g:ale_lint_on_save = 1
let g:ale_lint_on_enter = 0
:match ErrorMsg /\%>120v.\+/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment