Skip to content

Instantly share code, notes, and snippets.

@diogob
Last active July 11, 2020 00:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diogob/b75d3228e457ddc7233349e27a27364f to your computer and use it in GitHub Desktop.
Save diogob/b75d3228e457ddc7233349e27a27364f to your computer and use it in GitHub Desktop.
call plug#begin('~/.vim/plugged')
" General editting goodies
Plug 'bronson/vim-trailing-whitespace'
Plug 'tpope/vim-commentary'
Plug 'danilamihailov/beacon.nvim'
" Show Registers
Plug 'junegunn/vim-peekaboo'
" Status line
Plug 'bling/vim-airline'
" Search & Replace
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'osyo-manga/vim-over'
Plug 'nelstrom/vim-visual-star-search'
" Brackets & Pairs
Plug 'tpope/vim-surround'
Plug 'tpope/vim-endwise'
Plug 'luochen1990/rainbow'
Plug 'jiangmiao/auto-pairs'
" LSP
Plug 'liuchengxu/vista.vim'
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
" Git
Plug 'tpope/vim-fugitive'
Plug 'mhinz/vim-signify'
" Haskell
Plug 'neovimhaskell/haskell-vim', { 'for': 'haskell' }
" TypeScript
Plug 'HerringtonDarkholme/yats.vim'
Plug 'mhartington/nvim-typescript', {'do': './install.sh'}
" Elm
Plug 'elmcast/elm-vim', { 'for': 'elm' }
" Ruby
Plug 'vim-ruby/vim-ruby'
" Colors
Plug 'liuchengxu/space-vim-dark'
" Initialize plugin system
call plug#end()
" Color setup
if (has("termguicolors"))
set termguicolors
endif
set background=dark
colorscheme space-vim-dark
" Generic editting config
set number
set incsearch
set smartindent
set ignorecase
set smartcase
set cursorline
set nowrap " wrap long lines
set autoindent " indent at the same level of the previous line
set shiftwidth=2 " use indents of 4 spaces
set tabstop=2
set softtabstop=2
set smarttab
set matchpairs+=<:> " match, to be used with %
set expandtab
nnoremap <silent> <Leader>d :close<cr>
" mhinz/vim-signify
set updatetime=100
nnoremap <leader>gd :SignifyDiff<cr>
nnoremap <leader>gp :SignifyHunkDiff<cr>
nnoremap <leader>gu :SignifyHunkUndo<cr>
omap ic <plug>(signify-motion-inner-pending)
xmap ic <plug>(signify-motion-inner-visual)
omap ac <plug>(signify-motion-outer-pending)
xmap ac <plug>(signify-motion-outer-visual)
" neovimhaskell/haskell-vim config
let g:haskell_enable_quantification = 1 " to enable highlighting of `forall`
let g:haskell_enable_recursivedo = 1 " to enable highlighting of `mdo` and `rec`
let g:haskell_enable_arrowsyntax = 1 " to enable highlighting of `proc`
let g:haskell_enable_pattern_synonyms = 1 " to enable highlighting of `pattern`
let g:haskell_enable_typeroles = 1 " to enable highlighting of type roles
let g:haskell_enable_static_pointers = 1 " to enable highlighting of `static`
let g:haskell_backpack = 1 " to enable highlighting of backpack keywords
" luochen1990/rainbow config
let g:rainbow_active = 1
" FZF {{{
" <C-p> or <C-t> to search files
nnoremap <silent> <C-t> :GFiles<cr>
nnoremap <silent> <C-p> :FZF -m<cr>
nnoremap <silent> <C-b> :Buffers<cr>
nnoremap <silent> <C-g> :Commits<cr>
command! -bang -nargs=* Rg
\ call fzf#vim#grep(
\ 'rg --column --line-number --no-heading --color=always --smart-case -- '.shellescape(<q-args>), 1,
\ fzf#vim#with_preview(), <bang>0)
" Elm
let g:elm_format_autosave = 0
let g:elm_format_fail_silently = 0
function! s:build_quickfix_list(lines)
call setqflist(map(copy(a:lines), '{ "filename": v:val }'))
copen
cc
endfunction
let g:fzf_action = {
\ 'ctrl-q': function('s:build_quickfix_list'),
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit' }
let $FZF_DEFAULT_OPTS = '--bind ctrl-a:select-all'
" bronson/vim-trailing-whitespace
nnoremap <silent> <Leader><space> :FixWhitespace<cr>
" Required for operations modifying multiple buffers like rename.
set hidden
let g:LanguageClient_serverCommands = {
\ 'ruby': ['~/.rbenv/shims/solargraph', 'stdio'],
\ 'haskell': ['hie-wrapper', '--lsp']
\ }
nnoremap <F5> :call LanguageClient_contextMenu()<CR>
nnoremap <silent>lk :call LanguageClient#textDocument_hover()<CR>
nnoremap <silent>lg :call LanguageClient#textDocument_definition()<CR>
nnoremap <silent>lr :call LanguageClient#textDocument_rename()<CR>
nnoremap <silent>lf :call LanguageClient#textDocument_formatting()<CR>
nnoremap <silent>lb :call LanguageClient#textDocument_references()<CR>
nnoremap <silent>la :call LanguageClient#textDocument_codeAction()<CR>
nnoremap <silent>ls :call LanguageClient#textDocument_documentSymbol()<CR>
nnoremap <silent><F3> :OverCommandLine<CR>
vnoremap <silent><F3> :OverCommandLine<CR>
hi link ALEError Error
hi Warning term=underline cterm=underline ctermfg=Yellow gui=undercurl guisp=Gold
hi link ALEWarning Warning
hi link ALEInfo SpellCap
set completefunc=LanguageClient#complete
set formatexpr=LanguageClient#textDocument_rangeFormatting_sync()
let g:LanguageClient_diagnosticsList = "Location"
let g:LanguageClient_diagnosticsEnable = 1
let g:LanguageClient_selectionUI = "fzf"
" vista
function! NearestMethodOrFunction() abort
return get(b:, 'vista_nearest_method_or_function', '')
endfunction
set statusline+=%{NearestMethodOrFunction()}
" By default vista.vim never run if you don't call it explicitly.
"
" If you want to show the nearest function in your statusline automatically,
" you can add the following line to your vimrc
autocmd VimEnter * call vista#RunForNearestMethodOrFunction()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment