Compare commits
2 Commits
a89aa52ab8
...
14c4347c9c
Author | SHA1 | Date | |
---|---|---|---|
14c4347c9c | |||
b39610bd69 |
@ -3,7 +3,9 @@ local nvim_lsp = require("lspconfig")
|
|||||||
local configs = require("lspconfig.configs")
|
local configs = require("lspconfig.configs")
|
||||||
configs.ciderlsp = {
|
configs.ciderlsp = {
|
||||||
default_config = {
|
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" },
|
filetypes = { "c", "cpp", "java", "kotlin", "proto", "textproto", "go", "python", "bzl" },
|
||||||
root_dir = nvim_lsp.util.root_pattern("BUILD"),
|
root_dir = nvim_lsp.util.root_pattern("BUILD"),
|
||||||
settings = {},
|
settings = {},
|
||||||
@ -28,6 +30,7 @@ cmp.setup({
|
|||||||
["<C-e>"] = cmp.mapping.close(),
|
["<C-e>"] = cmp.mapping.close(),
|
||||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||||
["<C-m>"] = cmp.mapping.confirm({ select = true }),
|
["<C-m>"] = cmp.mapping.confirm({ select = true }),
|
||||||
|
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_next_item()
|
cmp.select_next_item()
|
||||||
@ -172,7 +175,18 @@ local on_attach = function(client, bufnr)
|
|||||||
vim.api.nvim_command("augroup END")
|
vim.api.nvim_command("augroup END")
|
||||||
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({
|
nvim_lsp.ciderlsp.setup({
|
||||||
capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
capabilities = capabilities,
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
})
|
})
|
||||||
|
107
config/.config/nvim/lua/telescope_config.lua
Normal file
107
config/.config/nvim/lua/telescope_config.lua
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
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 }
|
||||||
|
)
|
||||||
|
|
||||||
|
-- Search using codesearch queries.
|
||||||
|
vim.api.nvim_set_keymap(
|
||||||
|
"n",
|
||||||
|
"<leader>cs",
|
||||||
|
[[<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>cs",
|
||||||
|
[[<cmd>lua require('telescope').extensions.codesearch.find_query{}<CR>]],
|
||||||
|
{ noremap = true, silent = true }
|
||||||
|
)
|
@ -233,7 +233,7 @@ awk -v match_prefix=${match_prefix} ' { for (i = 1; i <= NF; i++) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# CTRL-Q - Paste the selected flags into the command line. Copied from CTRL-T
|
# CTRL-F - Paste the selected flags into the command line. Copied from CTRL-T
|
||||||
# bindings shown here:
|
# bindings shown here:
|
||||||
# https://github.com/junegunn/fzf/blob/master/shell/key-bindings.zsh
|
# https://github.com/junegunn/fzf/blob/master/shell/key-bindings.zsh
|
||||||
__flagsel() {
|
__flagsel() {
|
||||||
@ -270,4 +270,4 @@ fzf-flag-widget() {
|
|||||||
return $ret
|
return $ret
|
||||||
}
|
}
|
||||||
zle -N fzf-flag-widget
|
zle -N fzf-flag-widget
|
||||||
bindkey '^Q' fzf-flag-widget
|
bindkey '^F' fzf-flag-widget
|
||||||
|
@ -2,4 +2,5 @@ lua << EOF
|
|||||||
require 'lspconfig'
|
require 'lspconfig'
|
||||||
require("lsp")
|
require("lsp")
|
||||||
require("diagnostics")
|
require("diagnostics")
|
||||||
|
require("telescope")
|
||||||
EOF
|
EOF
|
||||||
|
@ -163,13 +163,14 @@ endfunction
|
|||||||
|
|
||||||
com! -nargs=? -complete=file Blame :call G4Blame(<f-args>)
|
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.
|
" The buffer n can be replaced by any other unused buffer.
|
||||||
" <c-u> removes the visual range because csearch doesn't support ranges.
|
" <c-u> removes the visual range because csearch doesn't support ranges.
|
||||||
" Removes newlines to allow the entire line search using V-LINE mode.
|
" 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>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>cc :CritiqueUnresolvedComments<space><cr>
|
||||||
nnoremap <leader>s :call CitCObsession()<CR>
|
nnoremap <leader>s :call CitCObsession()<CR>
|
||||||
nnoremap <leader>g :GoogleOutlineWindow<CR>
|
nnoremap <leader>g :GoogleOutlineWindow<CR>
|
||||||
|
@ -3,8 +3,8 @@ lua << EOF
|
|||||||
require('google.comments').setup {
|
require('google.comments').setup {
|
||||||
-- The command for fetching comments, refer to `get_comments.par --help` to
|
-- The command for fetching comments, refer to `get_comments.par --help` to
|
||||||
-- see all the options.
|
-- see all the options.
|
||||||
-- command = {'/google/bin/releases/editor-devtools/get_comments.par', '--full', '--noresolved', '--json', "-x=''"},
|
-- command = {'/google/bin/releases/editor-devtools/get_comments.par', '--nofull', '-u', '--json', "-x=''"},
|
||||||
command = {'/google/bin/releases/editor-devtools/get_comments.par', '--nofull', '-u', '--json', "-x=''"},
|
command = {'/google/bin/releases/editor-devtools/get_comments.par', '--nofull', '--json', '--noresolved', '--cl_comments', '--file_comments', '--unreplied_only'},
|
||||||
-- Define your own icon by `vim.fn.sign_define('ICON_NAME', {text = ' '})`.
|
-- Define your own icon by `vim.fn.sign_define('ICON_NAME', {text = ' '})`.
|
||||||
-- See :help sign_define
|
-- See :help sign_define
|
||||||
-- The sign property passed to setup should be the 'ICON_NAME' in the define
|
-- The sign property passed to setup should be the 'ICON_NAME' in the define
|
||||||
@ -37,4 +37,3 @@ vim.fn.sign_define('COMMENT_ICON', {text = ''})
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
autocmd InsertLeave * :lua require('google.comments').update_signs()
|
autocmd InsertLeave * :lua require('google.comments').update_signs()
|
||||||
autocmd FileType * :lua require('google.comments').fetch_comments()
|
|
||||||
|
@ -2,7 +2,7 @@ let pyxversion = 3
|
|||||||
|
|
||||||
|
|
||||||
" -------- FZF --------
|
" -------- FZF --------
|
||||||
nmap <C-P> :FZF<CR>
|
" nmap <C-P> :FZF<CR>
|
||||||
|
|
||||||
nmap <leader><tab> <plug>(fzf-maps-n)
|
nmap <leader><tab> <plug>(fzf-maps-n)
|
||||||
xmap <leader><tab> <plug>(fzf-maps-x)
|
xmap <leader><tab> <plug>(fzf-maps-x)
|
||||||
|
@ -16,6 +16,10 @@ Plug 'folke/trouble.nvim'
|
|||||||
|
|
||||||
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
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
|
" UI EXTENSIONS
|
||||||
Plug 'ntpeters/vim-better-whitespace' "auto-set tab/space size
|
Plug 'ntpeters/vim-better-whitespace' "auto-set tab/space size
|
||||||
Plug 'junegunn/fzf.vim'
|
Plug 'junegunn/fzf.vim'
|
||||||
|
0
vim/.vim/prefs/telescope.vim
Normal file
0
vim/.vim/prefs/telescope.vim
Normal file
19
vim/.vimrc
19
vim/.vimrc
@ -65,12 +65,12 @@ set foldmethod=syntax
|
|||||||
let g:clipboard = #{
|
let g:clipboard = #{
|
||||||
\ name: 'xsel',
|
\ name: 'xsel',
|
||||||
\ copy: {
|
\ copy: {
|
||||||
\ '+': ['xsel', '--nodetach', '-i', '-b'],
|
\ '+': ['xclip', '--nodetach', '-i', '-b'],
|
||||||
\ '*': ['xsel', '--nodetach', '-i', '-p'],
|
\ '*': ['xclip', '--nodetach', '-i', '-p'],
|
||||||
\ },
|
\ },
|
||||||
\ paste: {
|
\ paste: {
|
||||||
\ '+': ['xsel', '-o', '-b'],
|
\ '+': ['xclip', '-o', '-b'],
|
||||||
\ '*': ['xsel', '-o', '-p'],
|
\ '*': ['xclip', '-o', '-p'],
|
||||||
\ },
|
\ },
|
||||||
\ cache_enabled: 1,
|
\ cache_enabled: 1,
|
||||||
\ }
|
\ }
|
||||||
@ -94,28 +94,27 @@ call plug#begin('~/.vim/plugged')
|
|||||||
source ~/.vim/prefs/golang.vim
|
source ~/.vim/prefs/golang.vim
|
||||||
source ~/.vim/prefs/ultisnips.vim
|
source ~/.vim/prefs/ultisnips.vim
|
||||||
source ~/.vim/prefs/ripgrep.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
|
call plug#end() " required
|
||||||
|
|
||||||
" Require CiderLSP and Diagnostics modules
|
" Require CiderLSP and Diagnostics modules
|
||||||
" IMPORTANT: Must come after plugins are loaded
|
" IMPORTANT: Must come after plugins are loaded
|
||||||
lua << EOF
|
lua << EOF
|
||||||
-- CiderLSP
|
-- CiderLSP
|
||||||
|
vim.lsp.set_log_level("trace")
|
||||||
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||||
|
|
||||||
require 'lspconfig'
|
require 'lspconfig'
|
||||||
require("lsp")
|
require("lsp")
|
||||||
require("diagnostics")
|
require("diagnostics")
|
||||||
require("treesitter")
|
require("treesitter")
|
||||||
|
require("telescope_config")
|
||||||
|
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
source ~/.vim/prefs/cmp.vim
|
source ~/.vim/prefs/cmp.vim
|
||||||
if filereadable(expand("~/.vim/prefs/use_google.vim"))
|
if filereadable(expand("~/.vim/prefs/use_google.vim"))
|
||||||
source ~/.vim/prefs/google_comments.vim
|
source ~/.vim/prefs/google_comments.vim
|
||||||
endif
|
endif
|
||||||
" source ~/.vim/prefs/ale.vim
|
|
||||||
|
|
||||||
filetype plugin on " redundant?
|
filetype plugin on " redundant?
|
||||||
filetype plugin indent on
|
filetype plugin indent on
|
||||||
@ -155,3 +154,7 @@ let $NVIM_TUI_ENABLE_TRUE_COLOR=1
|
|||||||
colorscheme quantum
|
colorscheme quantum
|
||||||
let g:airline_theme='quantum'
|
let g:airline_theme='quantum'
|
||||||
set modifiable
|
set modifiable
|
||||||
|
set omnifunc= completeopt=menuone,noinsert,noselect
|
||||||
|
|
||||||
|
let g:lsp_log_verbose = 1
|
||||||
|
let g:lsp_log_file = expand('~/vim-lsp.log')
|
||||||
|
@ -119,3 +119,4 @@ alias jadep=/google/data/ro/teams/jade/jadep
|
|||||||
alias replace_string=/google/src/head/depot/google3/devtools/scripts/replace_string
|
alias replace_string=/google/src/head/depot/google3/devtools/scripts/replace_string
|
||||||
alias safergcp=/google/bin/releases/safer-gcp/tools/safergcp
|
alias safergcp=/google/bin/releases/safer-gcp/tools/safergcp
|
||||||
alias add_deps_to_usages='/google/src/head/depot/google3/apps/framework/tools/add_deps_to_usages.sh'
|
alias add_deps_to_usages='/google/src/head/depot/google3/apps/framework/tools/add_deps_to_usages.sh'
|
||||||
|
alias plxutil='/google/data/ro/teams/plx/plxutil'
|
||||||
|
16
zsh/.zshrc
16
zsh/.zshrc
@ -248,3 +248,19 @@ source ~/zsh-async/async.zsh
|
|||||||
|
|
||||||
export FZF_DEFAULT_OPTS="--preview 'echo {}' --preview-window down:3:wrap --bind ?:toggle-preview"
|
export FZF_DEFAULT_OPTS="--preview 'echo {}' --preview-window down:3:wrap --bind ?:toggle-preview"
|
||||||
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
|
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
|
||||||
|
|
||||||
|
fixup_ssh_auth_sock() {
|
||||||
|
if [[ -n ${SSH_AUTH_SOCK} && ! -e ${SSH_AUTH_SOCK} ]]
|
||||||
|
then
|
||||||
|
local new_sock=$(echo /tmp/ssh-*/agent.*(=UNom[1]))
|
||||||
|
if [[ -n ${new_sock} ]]
|
||||||
|
then
|
||||||
|
export SSH_AUTH_SOCK=${new_sock}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
if [[ -n ${SSH_AUTH_SOCK} ]]
|
||||||
|
then
|
||||||
|
autoload -U add-zsh-hook
|
||||||
|
add-zsh-hook preexec fixup_ssh_auth_sock
|
||||||
|
fi
|
||||||
|
@ -13,7 +13,7 @@ autoload -Uz add-zsh-hook
|
|||||||
add-zsh-hook chpwd g3path::hook
|
add-zsh-hook chpwd g3path::hook
|
||||||
|
|
||||||
g3path::zle::accept-line () {
|
g3path::zle::accept-line () {
|
||||||
if [[ -n $GOOGLE3_ROOT && ! $BUFFER =~ \\s*(blaze|g4|p4|g4d|add_dep|buildozer|build_cleaner|debug_android_lint|rabbit|hb) ]]; then
|
if [[ -n $GOOGLE3_ROOT && ! $BUFFER =~ \\s*(blaze|g4|p4|g4d|add_dep|buildozer|build_cleaner|debug_android_lint|rabbit|hb|gqui) ]]; then
|
||||||
BUFFER=${BUFFER// \/\// $GOOGLE3_ROOT\/}
|
BUFFER=${BUFFER// \/\// $GOOGLE3_ROOT\/}
|
||||||
fi
|
fi
|
||||||
zle .accept-line
|
zle .accept-line
|
||||||
|
Reference in New Issue
Block a user