From 75974abb8c02d95588edd12b8f88aac05a436522 Mon Sep 17 00:00:00 2001 From: Daan Vanoverloop Date: Wed, 18 Dec 2019 08:21:14 +0100 Subject: [PATCH] nvim config --- .config/nvim/init.vim | 216 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 216 insertions(+) create mode 100644 .config/nvim/init.vim diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim new file mode 100644 index 0000000..c21e26e --- /dev/null +++ b/.config/nvim/init.vim @@ -0,0 +1,216 @@ + +set nocompatible " be iMproved, required +filetype off " required + + +call plug#begin() +Plug 'vim-scripts/c.vim' +Plug 'arcticicestudio/nord-vim' +Plug 'scrooloose/nerdtree' +Plug 'jistr/vim-nerdtree-tabs' +Plug 'rhysd/vim-clang-format' +Plug 'kana/vim-operator-user' +Plug 'rust-lang/rust.vim' +Plug 'Shougo/deoplete.nvim' +Plug 'zchee/deoplete-clang' +Plug 'Shougo/neoinclude.vim' +Plug 'roxma/nvim-yarp' +Plug 'sebastianmarkow/deoplete-rust' +Plug 'carlitux/deoplete-flow' +Plug 'jpalardy/vim-slime' +Plug 'autozimu/LanguageClient-neovim', { + \ 'branch': 'next', + \ 'do': 'bash install.sh', + \ } +Plug 'calviken/vim-gdscript3' +Plug 'Shougo/neosnippet' +Plug 'Shougo/neosnippet-snippets' +Plug 'nikvdp/ejs-syntax' +Plug 'pangloss/vim-javascript' +Plug 'MaxMEllon/vim-jsx-pretty' +Plug 'jelera/vim-javascript-syntax' +Plug 'w0rp/ale' +Plug 'prettier/prettier' +Plug 'flrnprz/plastic.vim' +Plug 'rakr/vim-one' +Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' +Plug 'vim-pandoc/vim-rmarkdown' +Plug 'vim-pandoc/vim-pandoc' +Plug 'vim-pandoc/vim-pandoc-syntax' +Plug 'junegunn/fzf.vim' +call plug#end() " required + +filetype plugin indent on " required + +let g:jsx_ext_required = 0 + +let g:deoplete#enable_at_startup = 1 +let g:deoplete#sources#clang#libclang_path = "/usr/lib/libclang.so" +let g:deoplete#sources#clang#clang_header = "/usr/lib/clang" +let g:deoplete#sources#rust#racer_binary='/usr/bin/racer' +let g:deoplete#sources#rust#rust_source_path='/usr/src/rust/src' + +let g:LanguageClient_serverCommands = { + \ 'lua': ['lua-lsp'], + \ } +let g:LanguageClient_autoStart = 1 + +let g:neosnippet#enable_completed_snippet = 1 +let g:autocomplete_flow#insert_paren_after_function = 0 + +set tags+=./.tags + +set nobackup +set nowritebackup + +"Credit joshdick +"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux. +"If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support +"(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.) +if (empty($TMUX)) + if (has("nvim")) + "For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 > + let $NVIM_TUI_ENABLE_TRUE_COLOR=1 + endif + "For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 > + "Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd > + " < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 > + if (has("termguicolors")) + set termguicolors + endif +endif + +let g:airline_powerline_fonts = 1 + + +" Session management + +set switchbuf=useopen,usetab + +let g:session = 0 + +fu! AutoSaveSess() + if g:session == 1 + call SaveSess() + endif +endfunction + +fu! SaveSess() + execute 'NERDTreeTabsClose' + execute 'mksession! ' . getcwd() . '/.session.vim' + let g:session = 1 +endfunction + +fu! RemoveSess() + shell "rm " . getcwd() . "/.session.vim" +endfunction + +fu! RestoreSess() + if filereadable(getcwd() . '/.session.vim') + let initial_args = argv() + execute 'so ' . getcwd() . '/.session.vim' + for file in initial_args + if bufloaded(file) != 1 + execute 'tabnew ' . getcwd() . '/' . file + else + execute 'sb ' . file + endif + endfor + let g:session = 1 + endif +endfunction + +:command Savesess call SaveSess() +:command Restoresess call RestoreSess() +:command Removesess call RemoveSess() + +" Save session on quitting Vim +autocmd VimLeave * call AutoSaveSess() + +" Restore session on starting Vim +"autocmd VimEnter * nested call RestoreSess() + +"---------------------- + +" move between tabs +nnoremap :tabprevious +nnoremap :tabnext + + +map :NERDTreeMirrorToggle + +" prevent mouse vanishing +set nomousehide + +" toggles menu in graphical mode +function! ToggleGUICruft() + if &guioptions=='ir' + exec('set guioptions=imrLn') + else + exec('set guioptions=ir') + endif +endfunction + +map :call ToggleGUICruft() + +set number +set linebreak +set nobackup +set noswapfile +"set shortmess+=I +set backspace=indent,eol,start +set visualbell t_vb= +set showmode +"set smartcase + +nnoremap +nnoremap Q +nnoremap K + +runtime! ftplugin/man.vim +nnoremap K :Man + +set mouse=a +set nu + +let g:clang_format#code_style="llvm" + +set clipboard=unnamed +set backspace=indent,eol,start " allow backspacing over everything in insert mode + +cmap w!! w !sudo tee > /dev/null % + +set laststatus=2 +let g:nord_uniform_diff_background = 1 +let g:nord_cursor_line_number_background = 1 +"let g:lightline = { + "\ 'colorscheme': 'one', + "\ } +let g:airline_theme='one' + +set background=dark +colorscheme one + +filetype plugin indent on +set smartindent +set tabstop=4 +set shiftwidth=4 +set expandtab + +:command WQ wq +:command Wq wq +:command W w +:command Q q + +let g:C_Mapfeader = ',' +nnoremap :noh: + +let g:deoplete#enable_smart_case = 1 +imap pumvisible() ? "\" : "\" +imap pumvisible() ? "\" : "\" +imap pumvisible() ? deoplete#close_popup() : "\" +:tnoremap + +set completeopt=menu,noinsert +