More plugins
This commit is contained in:
@ -3,7 +3,9 @@ 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" },
|
||||
cmd = { "/google/bin/releases/cider/ciderlsp/ciderlsp", "--tooltag=nvim-lsp", "--noforward_sync_responses",
|
||||
"--enable_semantic_tokens",
|
||||
"--relay_mode=true", "--hub_addr=blade:languageservices-staging" },
|
||||
filetypes = { "c", "cpp", "java", "kotlin", "proto", "textproto", "go", "python", "bzl" },
|
||||
root_dir = nvim_lsp.util.root_pattern("BUILD"),
|
||||
settings = {},
|
||||
@ -172,7 +174,18 @@ 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
|
||||
nvim_lsp.ciderlsp.setup({
|
||||
capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
117
config/.config/nvim/lua/telescope_config.lua
Normal file
117
config/.config/nvim/lua/telescope_config.lua
Normal file
@ -0,0 +1,117 @@
|
||||
require('telescope').setup {
|
||||
defaults = {
|
||||
-- The vertical layout strategy is good to handle long paths like those in
|
||||
-- google3 repos because you have nearly the full screen to display a file path.
|
||||
-- The caveat is that the preview area is smaller.
|
||||
layout_strategy = 'vertical',
|
||||
-- Common paths in google3 repos are collapsed following the example of Cider
|
||||
-- It is nice to keep this as a user config rather than part of
|
||||
-- telescope-codesearch because it can be reused by other telescope pickers.
|
||||
path_display = function(opts, path)
|
||||
-- Do common substitutions
|
||||
path = path:gsub("^/google/src/cloud/[^/]+/[^/]+/google3/", "google3/", 1)
|
||||
path = path:gsub("^google3/java/com/google/", "g3/j/c/g/", 1)
|
||||
path = path:gsub("^google3/javatests/com/google/", "g3/jt/c/g/", 1)
|
||||
path = path:gsub("^google3/third_party/", "g3/3rdp/", 1)
|
||||
path = path:gsub("^google3/", "g3/", 1)
|
||||
|
||||
-- Do truncation. This allows us to combine our custom display formatter
|
||||
-- with the built-in truncation.
|
||||
-- `truncate` handler in transform_path memoizes computed truncation length in opts.__length.
|
||||
-- Here we are manually propagating this value between new_opts and opts.
|
||||
-- We can make this cleaner and more complicated using metatables :)
|
||||
local new_opts = {
|
||||
path_display = {
|
||||
truncate = true,
|
||||
},
|
||||
__length = opts.__length,
|
||||
}
|
||||
path = require('telescope.utils').transform_path(new_opts, path)
|
||||
opts.__length = new_opts.__length
|
||||
return path
|
||||
end,
|
||||
},
|
||||
extensions = { -- this block is optional, and if omitted, defaults will be used
|
||||
codesearch = {
|
||||
experimental = true -- enable results from google3/experimental
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- These custom mappings let you open telescope-codesearch quickly:
|
||||
-- Fuzzy find files in codesearch.
|
||||
vim.api.nvim_set_keymap('n', '<leader>ss',
|
||||
[[<cmd>lua require('telescope').extensions.codesearch.find_files{}<CR>]],
|
||||
{ noremap = true, silent=true }
|
||||
)
|
||||
|
||||
vim.api.nvim_set_keymap('n', '<C-P>',
|
||||
[[<cmd>lua require('telescope').extensions.codesearch.find_files{}<CR>]],
|
||||
{ noremap = true, silent=true }
|
||||
)
|
||||
|
||||
-- Search using codesearch queries.
|
||||
vim.api.nvim_set_keymap('n', '<leader>sd',
|
||||
[[<cmd>lua require('telescope').extensions.codesearch.find_query{}<CR>]],
|
||||
{ noremap = true, silent=true }
|
||||
)
|
||||
|
||||
-- Search for the word under cursor.
|
||||
vim.api.nvim_set_keymap('n', '<leader>sD',
|
||||
[[<cmd>lua require('telescope').extensions.codesearch.find_query{default_text_expand='<cword>'}<CR>]],
|
||||
{ noremap = true, silent=true }
|
||||
)
|
||||
|
||||
-- Search for a file having word under cursor in its name.
|
||||
vim.api.nvim_set_keymap('n', '<leader>sS',
|
||||
[[<cmd>lua require('telescope').extensions.codesearch.find_files{default_text_expand='<cword>'}<CR>]],
|
||||
{ noremap = true, silent=true }
|
||||
)
|
||||
|
||||
-- Search for text selected in Visual mode.
|
||||
vim.api.nvim_set_keymap('v', '<leader>sd',
|
||||
[[<cmd>lua require('telescope').extensions.codesearch.find_query{}<CR>]],
|
||||
{ noremap = true, silent=true }
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
vim.api.nvim_set_keymap(
|
||||
"n",
|
||||
"<leader>cs",
|
||||
[[<cmd>lua require('telescope').extensions.codesearch.find_files{}<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
|
||||
-- Search using codesearch queries.
|
||||
vim.api.nvim_set_keymap(
|
||||
"n",
|
||||
"<leader>csd",
|
||||
[[<cmd>lua require('telescope').extensions.codesearch.find_query{}<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
|
||||
-- Search for the word under cursor.
|
||||
vim.api.nvim_set_keymap(
|
||||
"n",
|
||||
"<leader>CS",
|
||||
[[<cmd>lua require('telescope').extensions.codesearch.find_query{default_text_expand='<cword>'}<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
|
||||
-- Search for a file having word under cursor in its name.
|
||||
vim.api.nvim_set_keymap(
|
||||
"n",
|
||||
"<leader>csS",
|
||||
[[<cmd>lua require('telescope').extensions.codesearch.find_files{default_text_expand='<cword>'}<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
|
||||
-- Search for text selected in Visual mode.
|
||||
vim.api.nvim_set_keymap(
|
||||
"v",
|
||||
"<leader>csd",
|
||||
[[<cmd>lua require('telescope').extensions.codesearch.find_query{}<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
@ -2,4 +2,5 @@ lua << EOF
|
||||
require 'lspconfig'
|
||||
require("lsp")
|
||||
require("diagnostics")
|
||||
require("telescope")
|
||||
EOF
|
||||
|
@ -163,13 +163,14 @@ endfunction
|
||||
|
||||
com! -nargs=? -complete=file Blame :call G4Blame(<f-args>)
|
||||
|
||||
nnoremap <leader>cs :FzfCs<space>
|
||||
" nnoremap <leader>cs :FzfCs<space>
|
||||
" The buffer n can be replaced by any other unused buffer.
|
||||
" <c-u> removes the visual range because csearch doesn't support ranges.
|
||||
" Removes newlines to allow the entire line search using V-LINE mode.
|
||||
vnoremap <leader>cs "ny:<c-u>FzfCs "<c-r>=substitute(@n, '\n', '', '')<cr>"<cr>
|
||||
" vnoremap <leader>cs "ny:<c-u>FzfCs "<c-r>=substitute(@n, '\n', '', '')<cr>"<cr>
|
||||
nnoremap <leader>csi :CsImporter<cr>
|
||||
nnoremap <leader>CS :FzfCs<Space> <C-r><C-w> <cr>
|
||||
" nnoremap <leader>CS :FzfCs<Space> <C-r><C-w> <cr>
|
||||
|
||||
nnoremap <leader>cc :CritiqueUnresolvedComments<space><cr>
|
||||
nnoremap <leader>s :call CitCObsession()<CR>
|
||||
nnoremap <leader>g :GoogleOutlineWindow<CR>
|
||||
|
@ -2,7 +2,7 @@ let pyxversion = 3
|
||||
|
||||
|
||||
" -------- FZF --------
|
||||
nmap <C-P> :FZF<CR>
|
||||
" nmap <C-P> :FZF<CR>
|
||||
|
||||
nmap <leader><tab> <plug>(fzf-maps-n)
|
||||
xmap <leader><tab> <plug>(fzf-maps-x)
|
||||
|
@ -16,6 +16,10 @@ Plug 'folke/trouble.nvim'
|
||||
|
||||
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
||||
|
||||
Plug 'nvim-lua/plenary.nvim' " lua helpers
|
||||
Plug 'nvim-telescope/telescope.nvim' " actual plugin
|
||||
Plug 'sso://user/vintharas/telescope-codesearch.nvim'
|
||||
|
||||
" UI EXTENSIONS
|
||||
Plug 'ntpeters/vim-better-whitespace' "auto-set tab/space size
|
||||
Plug 'junegunn/fzf.vim'
|
||||
|
0
vim/.vim/prefs/telescope.vim
Normal file
0
vim/.vim/prefs/telescope.vim
Normal file
@ -94,9 +94,6 @@ call plug#begin('~/.vim/plugged')
|
||||
source ~/.vim/prefs/golang.vim
|
||||
source ~/.vim/prefs/ultisnips.vim
|
||||
source ~/.vim/prefs/ripgrep.vim
|
||||
" source ~/.vim/prefs/coc.vim
|
||||
" source ~/.vim/prefs/asynclsp.vim
|
||||
" source ~/.vim/prefs/ycm.vim
|
||||
call plug#end() " required
|
||||
|
||||
" Require CiderLSP and Diagnostics modules
|
||||
@ -109,13 +106,14 @@ lua << EOF
|
||||
require("lsp")
|
||||
require("diagnostics")
|
||||
require("treesitter")
|
||||
require("telescope_config")
|
||||
|
||||
|
||||
EOF
|
||||
source ~/.vim/prefs/cmp.vim
|
||||
if filereadable(expand("~/.vim/prefs/use_google.vim"))
|
||||
source ~/.vim/prefs/google_comments.vim
|
||||
endif
|
||||
" source ~/.vim/prefs/ale.vim
|
||||
|
||||
filetype plugin on " redundant?
|
||||
filetype plugin indent on
|
||||
@ -155,3 +153,4 @@ let $NVIM_TUI_ENABLE_TRUE_COLOR=1
|
||||
colorscheme quantum
|
||||
let g:airline_theme='quantum'
|
||||
set modifiable
|
||||
set omnifunc= completeopt=menuone,noinsert,noselect
|
||||
|
Reference in New Issue
Block a user