From 649d7e171b120c0b14ef7e1a67afa3f2704eda25 Mon Sep 17 00:00:00 2001 From: Christian Nieves Date: Tue, 13 Sep 2022 15:23:43 +0000 Subject: [PATCH] Cider config --- config/.config/nvim/lua/lsp.lua | 32 +++++++++++++++++++------------- vim/.vim/prefs/google.vim | 4 ++++ vim/.vim/prefs/ui.vim | 12 ++++++++++++ vim/.vimrc | 1 - 4 files changed, 35 insertions(+), 14 deletions(-) diff --git a/config/.config/nvim/lua/lsp.lua b/config/.config/nvim/lua/lsp.lua index be82844..689cab5 100644 --- a/config/.config/nvim/lua/lsp.lua +++ b/config/.config/nvim/lua/lsp.lua @@ -3,9 +3,8 @@ local nvim_lsp = require("lspconfig") local configs = require("lspconfig.configs") configs.ciderlsp = { default_config = { - cmd = { "/google/bin/releases/cider/ciderlsp/ciderlsp", "--tooltag=nvim-lsp", "--noforward_sync_responses", - "--enable_semantic_tokens", - "--relay_mode=true", "--hub_addr=blade:languageservices-staging" }, + cmd = { "/google/bin/releases/cider/ciderlsp/ciderlsp", "--tooltag=nvim-lsp", "--noforward_sync_responses", "--enable_semantic_tokens", "--relay_mode=true", "--hub_addr=blade:languageservices-staging" ,"--enable_document_highlight"}, + -- cmd = {'/google/bin/releases/cider/ciderlsp/ciderlsp', '--forward_sync_responses', '--enable_document_highlight'}; filetypes = { "c", "cpp", "java", "kotlin", "proto", "textproto", "go", "python", "bzl" }, root_dir = nvim_lsp.util.root_pattern("BUILD"), settings = {}, @@ -82,6 +81,7 @@ cmp.setup({ { name = "nvim_lsp" }, { name = "path" }, { name = "vim_vsnip" }, + { name = 'nvim_ciderlsp', priority = 9 }, { name = "buffer", keyword_length = 5 }, }, @@ -121,6 +121,7 @@ cmp.setup({ with_text = true, maxwidth = 40, -- half max width menu = { + nvim_ciderlsp = "(ﮧ)", buffer = "[buffer]", nvim_lsp = "[CiderLSP]", nvim_lua = "[API]", @@ -181,17 +182,22 @@ local on_attach = function(client, bufnr) vim.api.nvim_command("augroup END") end + local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) -capabilities.textDocument.codeAction = { - codeActionLiteralSupport = { - codeActionKind = { - valueSet = { - '', 'quickfix', 'refactor', 'refactor.extract', 'refactor.inline', 'refactor.rewrite', 'source', 'source.organizeImports' - } - } - } -} -capabilities.textDocument.publishDiagnostics['versionSupport'] = false + +capabilities = require('cmp_nvim_ciderlsp').update_capabilities(capabilities) + +-- capabilities.textDocument.codeAction = { +-- codeActionLiteralSupport = { +-- codeActionKind = { +-- valueSet = { +-- '', 'quickfix', 'refactor', 'refactor.extract', 'refactor.inline', 'refactor.rewrite', 'source', 'source.organizeImports' +-- } +-- } +-- } +-- } +-- capabilities.textDocument.publishDiagnostics['versionSupport'] = false + nvim_lsp.ciderlsp.setup({ capabilities = capabilities, on_attach = on_attach, diff --git a/vim/.vim/prefs/google.vim b/vim/.vim/prefs/google.vim index dde882f..50bb1f0 100644 --- a/vim/.vim/prefs/google.vim +++ b/vim/.vim/prefs/google.vim @@ -5,6 +5,8 @@ source /google/data/ro/projects/vigor/vigor.vim Plug 'vim-scripts/vcscommand.vim' Plug 'sso://user/chmnchiang/google-comments' +Plug 'sso://googler@user/piloto/cmp-nvim-ciderlsp' +Plug 'williamboman/nvim-lsp-installer' if has('nvim') || has('patch-8.0.902') Plug 'mhinz/vim-signify' @@ -185,3 +187,5 @@ nnoremap po :PiperOpenPath nnoremap ws :CorpWebCs " search in codesearch for the current file nnoremap wf :CorpWebCsFile + +nmap rbs ss rb diff --git a/vim/.vim/prefs/ui.vim b/vim/.vim/prefs/ui.vim index 9eef0c4..08606b6 100644 --- a/vim/.vim/prefs/ui.vim +++ b/vim/.vim/prefs/ui.vim @@ -39,6 +39,18 @@ let g:airline#extensions#tabline#exclude_preview = 1 let g:airline#extensions#tabline#show_close_button = 0 let g:airline#extensions#tabline#fnamemod = ':t' +lua << EOF +function getCitc() + local fname = vim.api.nvim_buf_get_name(0) + if string.find(fname, '/google/src/cloud/', 1, true) then + local parts = split(fname, '/') + return parts[5] + end +end +EOF + +" let g:airline_section_c = execute("lua getCitc()") + let g:airline_mode_map = { \ '__' : '------', \ 'n' : 'NORMAL', diff --git a/vim/.vimrc b/vim/.vimrc index 121fa96..4e2d4c9 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -108,7 +108,6 @@ lua << EOF require("treesitter") require("telescope_config") - EOF source ~/.vim/prefs/cmp.vim if filereadable(expand("~/use_google"))