@@ -177,11 +177,46 @@ vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper win
177
177
vim .keymap .set (' n' , ' <leader>fs' , ' <cmd>:w<CR>' , { desc = ' [F]ile [S]ave' })
178
178
vim .keymap .set (' n' , ' <leader>qq' , ' <cmd>:q<CR>' , { desc = ' [Q]uit [Q]uit' })
179
179
180
+ local is_google3 = function (fname )
181
+ local citc_results = vim .fs .find (' .citc' , { upward = true , path = fname })
182
+ if # citc_results ~= 0 then
183
+ return vim .fs .dirname (citc_results [1 ])
184
+ else
185
+ return nil
186
+ end
187
+ end
188
+
189
+ -- TODO: Shove google-specific config elsewhere.
190
+ vim .lsp .config (' ciderlsp' , {
191
+ cmd = { ' /google/bin/releases/cider/ciderlsp/ciderlsp' , ' --tooltag=nvim-lsp' , ' --noforward_sync_responses' },
192
+ filetypes = { ' c' , ' cpp' , ' cc' , ' java' , ' kotlin' , ' objc' , ' proto' , ' textpb' , ' go' , ' python' , ' bzl' , ' typescript' },
193
+ -- root_markers = { '.citc' },
194
+ root_dir = function (bufnr , on_dir )
195
+ local citc_dir = is_google3 (vim .api .nvim_buf_get_name (bufnr ))
196
+ if citc_dir then
197
+ on_dir (citc_dir )
198
+ end
199
+ end ,
200
+ })
201
+ vim .lsp .enable ' ciderlsp'
202
+
180
203
-- clangd is set up differently than all of the other LSPs due to
181
204
-- https://github.com/mason-org/mason.nvim/issues/1578?
182
205
vim .lsp .config (' clangd' , {
183
206
cmd = { ' clangd' , ' --background-index' , ' --limit-references=1000' , ' --limit-results=1000' },
184
207
root_markers = { ' .clangd' , ' compile_commands.json' },
208
+ root_dir = function (bufnr , on_dir )
209
+ local fname = vim .api .nvim_buf_get_name (bufnr )
210
+ if is_google3 (fname ) then
211
+ return
212
+ end
213
+ local root_markers = { ' .clangd' , ' compile_commands.json' }
214
+ local root_dirs = vim .fs .find (root_markers , { upward = true , path = fname })
215
+ if # root_dirs == 0 then
216
+ on_dir (vim .fs .dirname (fname ))
217
+ end
218
+ on_dir (vim .fs .dirname (root_dirs [1 ]))
219
+ end ,
185
220
filetypes = { ' c' , ' cpp' , ' cc' },
186
221
})
187
222
vim .lsp .enable ' clangd'
@@ -755,15 +790,6 @@ require('lazy').setup({
755
790
-- So, we create new capabilities with blink.cmp, and then broadcast that to the servers.
756
791
local capabilities = require (' blink.cmp' ).get_lsp_capabilities ()
757
792
758
- -- Enable the following language servers
759
- -- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
760
- --
761
- -- Add any additional override configuration in the following tables. Available keys are:
762
- -- - cmd (table): Override the default command used to start the server
763
- -- - filetypes (table): Override the default list of associated filetypes for the server
764
- -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
765
- -- - settings (table): Override the default settings passed when initializing the server.
766
- -- For example, to see the options for `lua_ls`, you could go to: https://lals.github.io/wiki/settings/
767
793
local servers = {
768
794
-- pyright = {},
769
795
rust_analyzer = {},
@@ -979,11 +1005,7 @@ require('lazy').setup({
979
1005
-- - sr)' - [S]urround [R]eplace [)] [']
980
1006
require (' mini.surround' ).setup ()
981
1007
982
- -- Simple and easy statusline.
983
- -- You could remove this setup call if you don't like it,
984
- -- and try some other statusline plugin
985
1008
local statusline = require ' mini.statusline'
986
- -- set use_icons to true if you have a Nerd Font
987
1009
statusline .setup { use_icons = vim .g .have_nerd_font }
988
1010
989
1011
-- You can configure sections in the statusline by overriding their
@@ -1071,6 +1093,3 @@ require('lazy').setup({
1071
1093
},
1072
1094
},
1073
1095
})
1074
-
1075
- -- The line beneath this is called `modeline`. See `:help modeline`
1076
- -- vim: ts=2 sts=2 sw=2 et
0 commit comments