diff --git a/vimrc b/vimrc index 7488da0..1568490 100644 --- a/vimrc +++ b/vimrc @@ -9,8 +9,6 @@ Plug 'nathanaelkane/vim-indent-guides' Plug 'chrisbra/Recover.vim' -" Plug 'Valloric/YouCompleteMe', { 'do': './install.sh --clang-completer --system-libclang' } - Plug 'Shougo/vimproc.vim' , { 'do': 'make -f make_unix.mak' } Plug 'junegunn/fzf', { 'dir': '~/.fzf' } @@ -25,8 +23,6 @@ Plug 'bling/vim-airline' Plug 'tomtom/tcomment_vim' " Plug 'jalcine/cmake.vim' --slow -" Plug 'roxma/nvim-completion-manager' - Plug 'editorconfig/editorconfig-vim' " vim-sleuth? @@ -36,7 +32,6 @@ Plug 'mtscout6/vim-cjsx' Plug 'mxw/vim-jsx' Plug 'othree/html5.vim' Plug 'digitaltoad/vim-jade' -" Plug 'marijnh/tern_for_vim' Plug 'ledger/vim-ledger' @@ -98,19 +93,10 @@ Plug 'c-cube/vim-tptp' Plug 'sirtaj/vim-openscad' -Plug 'SirVer/ultisnips' -Plug 'honza/vim-snippets' - Plug 'nanotech/jellybeans.vim' Plug 'sonph/onehalf', { 'rtp': 'vim' } -Plug '~/dgapt', { 'rtp': 'vim' } -" Plug '~/lean.vim' -Plug 'leanprover/lean.vim' - -" Plug 'neoclide/coc.nvim', {'do': { -> coc#util#install()}} -" Plug 'autozimu/LanguageClient-neovim', { 'do': ':UpdateRemotePlugins' } -Plug 'Shougo/echodoc.vim' +" Plug '~/dgapt', { 'rtp': 'vim' } Plug 'rickhowe/diffchar.vim' @@ -126,6 +112,23 @@ Plug 'elixir-editors/vim-elixir' " Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } } +if has('nvim-0.5') + +Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} +Plug 'nvim-treesitter/nvim-treesitter-textobjects' +Plug 'nvim-treesitter/playground' + +Plug 'hrsh7th/nvim-compe' +if isdirectory(expand('~/lean.nvim')) + Plug '~/lean.nvim' +else + " Plug 'Julian/lean.nvim' + Plug 'gebner/lean.nvim' +endif +Plug 'neovim/nvim-lspconfig' + +endif + call plug#end() filetype plugin indent on @@ -190,17 +193,83 @@ au FileChangedRO * set noreadonly nnoremap :FZF -" nnoremap K :call LanguageClient_textDocument_hover() -" nnoremap gd :call LanguageClient_textDocument_definition() +if has('nvim-0.5') +lua <lua vim.lsp.buf.definition()', {noremap = true}) + buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', {noremap = true}) + buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') + vim.api.nvim_exec([[ + augroup lsp_document_highlight + autocmd! + autocmd CursorHold lua vim.lsp.buf.document_highlight() + autocmd CursorMoved lua vim.lsp.buf.clear_references() + augroup END + ]], false) + end, + init_options = { + semanticHighlighting = true, + }, + cmd = {"lean", "--server"}, + }, + } -" let g:cm_completekeys = "\(cm_completefunc)" + require('nvim-treesitter.configs').setup{ + -- playground = { + -- enable = true, + -- disable = {}, + -- updatetime = 25, + -- }, + -- query_linter = { + -- enable = true, + -- use_virtual_text = true, + -- lint_events = {"BufWrite", "CursorHold"}, + -- }, + highlight = { enable = true }, + indent = { enable = true }, + textobjects = { + select = { + enable = true, + keymaps = { + ["af"] = "@function.outer", + ["if"] = "@function.inner", + ["ac"] = "@class.outer", + ["ic"] = "@class.inner", + ["aa"] = "@parameter.outer", + ["ia"] = "@parameter.inner", + }, + }, + }, + } -" " call LanguageClient_setLoggingLevel('DEBUG') -" let g:LanguageClient_trace = 'verbose' -" let g:LanguageClient_autoStart = 1 -" let g:LanguageClient_serverCommands = { -" \ 'lean': ['node', '/home/gebner/lean-client-js/lean-language-server/lib/index.js', '--stdio'], -" \ } +EOF + +hi LspReferenceRead cterm=bold ctermbg=red guibg=LightYellow +hi LspReferenceText cterm=bold ctermbg=red guibg=LightYellow +hi LspReferenceWrite cterm=bold ctermbg=red guibg=LightYellow +hi LspDiagnosticsDefaultError cterm=bold ctermfg=Red +hi LspDiagnosticsDefaultWarning cterm=bold ctermfg=Yellow +hi LspDiagnosticsDefaultInformation ctermfg=Blue + +endif let g:gutentags_cache_dir="~/.config/nvim/gutentags" @@ -220,66 +289,3 @@ augroup my_cm_setup \ 'cm_refresh': {'omnifunc': 'vimtex#complete#omnifunc'}, \ }) augroup END - -" " coc.nvim -" -" -" inoremap coc#refresh() -" -" " Use for confirm completion, `u` means break undo chain at current position. -" " Coc only does snippet and additional edit on confirm. -" inoremap pumvisible() ? "\" : "\u\" -" -" " Use `[c` and `]c` for navigate diagnostics -" nmap [c (coc-diagnostic-prev) -" nmap ]c (coc-diagnostic-next) -" -" " Remap keys for gotos -" nmap gd (coc-definition) -" nmap gy (coc-type-definition) -" nmap gi (coc-implementation) -" nmap gr (coc-references) -" -" " Use K for show documentation in preview window -" nnoremap K :call show_documentation() -" -" function! s:show_documentation() -" if &filetype == 'vim' -" execute 'h '.expand('') -" else -" call CocAction('doHover') -" endif -" endfunction -" -" " Highlight symbol under cursor on CursorHold -" autocmd CursorHold * silent call CocActionAsync('highlight') -" -" " Remap for rename current word -" nmap rn (coc-rename) -" -" " Remap for format selected region -" vmap f (coc-format-selected) -" nmap f (coc-format-selected) -" -" augroup mygroup -" autocmd! -" " Setup formatexpr specified filetype(s). -" autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') -" " Update signature help on jump placeholder -" autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') -" augroup end -" -" " Remap for do codeAction of selected region, ex: `aap` for current paragraph -" vmap a (coc-codeaction-selected) -" nmap a (coc-codeaction-selected) -" -" " Remap for do codeAction of current line -" nmap ac (coc-codeaction) -" " Fix autofix problem of current line -" nmap qf (coc-fix-current) -" -" " Use `:Format` for format current buffer -" command! -nargs=0 Format :call CocAction('format') -" -" " Use `:Fold` for fold current buffer -" command! -nargs=? Fold :call CocAction('fold', )