From 8e103dd8be3d2ea6bf38858da8d2b5a507886ece Mon Sep 17 00:00:00 2001 From: johannst Date: Thu, 7 Jan 2021 21:17:59 +0100 Subject: added nvim rc --- install | 16 ++++++++++ nvim.init.vim | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 nvim.init.vim diff --git a/install b/install index bcbec99..450d70e 100755 --- a/install +++ b/install @@ -13,6 +13,7 @@ gToolsConfig=( "gitconfig:git:gitConfigInstaller" "tmux.conf:tmux:tmuxConfigInstaller" "vimrc:vim:vimConfigInstaller" +"nvim:nvim:nvimConfigInstaller" "emacs:emacs:emacsInstaller" "Xresources:xterm:xtermConfigInstaller" "i3config:i3:i3ConfigInstaller" @@ -125,6 +126,21 @@ function vimConfigInstaller() { return 0 } +#}}} +#{{{ nvimConfigInstaller + +function nvimConfigInstaller() { + local vimrc=~/.config/nvim/init.vim + touch $vimrc + grep $gMagicNumber $vimrc > /dev/null 2>&1 + if [[ $? = 0 ]]; then + return 1 + fi + echo -e "\n\" $gMagicNumber - Auto generated, do not delete or modify!" >> $vimrc + echo -e "source $ABS_BASE_DIR/nvim.init.vim" >> $vimrc + return 0 +} + #}}} #{{{ emacsInstaller diff --git a/nvim.init.vim b/nvim.init.vim new file mode 100644 index 0000000..c3d0ba8 --- /dev/null +++ b/nvim.init.vim @@ -0,0 +1,95 @@ +" dotfiles -- nvim.init.vim +" author: johannst + +" {{{ Basic vim + +if !exists('&mapleader') + let mapleader=" " +endif + +" disable preview window in completion +set completeopt-=preview + +" allow modified buffers in the background +set hidden + +" make cmdprompt 2 lines high -> used for echodoc to display signature +set cmdheight=2 + +" enable mouse +set mouse=a + +" render `listchars` chars +set list +set listchars=tab:>-,trail:- + +" highlight search results +set hlsearch + +" }}} +" {{{ Plugins +call plug#begin(stdpath('data') . '/plugged') + +Plug 'autozimu/LanguageClient-neovim', { + \ 'branch': 'next', + \ 'do': 'bash install.sh', + \ } + +Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } +Plug 'junegunn/fzf.vim' + +Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } +Plug 'Shougo/echodoc.vim' + +call plug#end() + +" }}} +" {{{ LanguageClient + +let g:LanguageClient_serverCommands = { + \ 'rust': ['rust-analyzer'], + \ 'cpp': ['clangd', '--completion-style=detailed'], + \ 'c': ['clangd', '--completion-style=detailed'], + \ } + +let g:LanguageClient_autoStart = 1 +let g:LanguageClient_selectionUI = "fzf" + +function ConfigureLSP() + nnoremap ld :call LanguageClient#textDocument_definition() + nnoremap lr :call LanguageClient#textDocument_rename() + nnoremap lf :call LanguageClient#textDocument_formatting() + nnoremap lt :call LanguageClient#textDocument_typeDefinition() + nnoremap lx :call LanguageClient#textDocument_references() + nnoremap la :call LanguageClient_workspace_applyEdit() + nnoremap lc :call LanguageClient#textDocument_completion() + nnoremap lh :call LanguageClient#textDocument_hover() + nnoremap ls :call LanguageClient_textDocument_documentSymbol() + nnoremap lm :call LanguageClient_contextMenu() + + " set LSP formatting for 'gq' + set formatexpr=LanguageClient#textDocument_rangeFormatting_sync() +endfunction() + +augroup LSP + autocmd! + autocmd FileType rust,c,cpp call ConfigureLSP() +augroup END + +augroup LSP_autofmt + autocmd! + autocmd BufWritePre *.rs,*.h,,*.c,*.hh,*.cc,*.hpp,*.cpp call LanguageClient#textDocument_formatting() +augroup END + +" }}} +" {{{ Deoplete + +let g:deoplete#enable_at_startup = 1 + +" }}} +" {{{ Echodoc + +let g:echodoc#enable_at_startup = 1 +let g:echodoc#type = 'signature' + +" }}} -- cgit v1.2.3