Skip to content

Instantly share code, notes, and snippets.

@joaospinto
Last active January 24, 2018 17:29
Show Gist options
  • Save joaospinto/9ec0606a5a2456d542214f959fb6996d to your computer and use it in GitHub Desktop.
Save joaospinto/9ec0606a5a2456d542214f959fb6996d to your computer and use it in GitHub Desktop.
neovim configuration
call plug#begin()
" LSP for neovim
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
" Multi-entry selection UI.
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
" Nice status bar
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" Show git diff visually
" Or https://github.com/airblade/vim-gitgutter
Plug 'mhinz/vim-signify'
" Git wrapper (and access to git-grep)
Plug 'tpope/vim-fugitive'
" Completion plugin
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
" Asynchronous make calls
Plug 'neomake/neomake'
" Color schemes
Plug 'morhetz/gruvbox'
call plug#end()
" Color scheme
set background=dark
colorscheme gruvbox
" Smarter tabline (see https://github.com/vim-airline/vim-airline)
let g:airline#extensions#tabline#enabled = 1
let g:airline_theme ='dark'
" Configure LSP plugin
let g:LanguageClient_autoStart = 1
let g:LanguageClient_settingsPath = '/home/joao/.config/nvim/settings.json'
let g:LanguageClient_loadSettings = 1
set completefunc=LanguageClient#complete
set formatexpr=LanguageClient_textDocument_rangeFormatting()
let g:LanguageClient_rootMarkers = {
\ 'cpp': ['main.cpp', 'build', 'compile_commands.json'],
\ }
let g:LanguageClient_setLoggingLevel = 'DEBUG'
" Support for more languages may be added here.
let g:LanguageClient_serverCommands = {
\ 'cpp': ['cquery', '--language-server', '--log-file=/tmp/cq.log'],
\ }
" Required for operations modifying multiple buffers.
set hidden
" Add git information to status line.
set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
" Shortcuts for LSP
nnoremap <silent> gh :call LanguageClient_textDocument_hover()<CR>
nnoremap <silent> gd :call LanguageClient_textDocument_definition()<CR>
nnoremap <silent> gr :call LanguageClient_textDocument_references()<CR>
nnoremap <silent> gs :call LanguageClient_textDocument_documentSymbol()<CR>
nnoremap <silent> <F2> :call LanguageClient_textDocument_rename()<CR>
" enable mouse clicks
set mouse=a
" Completion setup.
call deoplete#enable()
set makeprg='ninja'
" Make when saving
call neomake#configure#automake('w')
" Use system clipboard
set clipboard=unnamedplus
" Show line numbers
set number
" Set width
set textwidth=100
" Handling tabs
let tabsize=2
execute "set tabstop=".tabsize
execute "set softtabstop=".tabsize
execute "set shiftwidth=".tabsize
set expandtab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment