Compare commits

...

5 Commits

Author SHA1 Message Date
e3c702a55d boop 2023-08-04 18:16:46 +00:00
a23d3e359a bump 2023-08-03 02:14:05 +00:00
52de0f9163 formater 2023-08-01 23:08:02 +00:00
d40aad6717 stuff idk 2023-07-28 19:43:17 +00:00
7586fdd3a4 meep 2023-07-19 19:21:00 -05:00
13 changed files with 173 additions and 209 deletions

View File

@ -23,6 +23,7 @@
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
"conflict-marker.vim": { "branch": "master", "commit": "11a4d42244755505b66b15cd4496a150432eb5e3" },
"crates.nvim": { "branch": "main", "commit": "1dffccc0a95f656ebe00cacb4de282473430c5a1" },
"formatter.nvim": { "branch": "master", "commit": "9bf2e7e294b00bac87c6123c889828ee08dc9b46" },
"friendly-snippets": { "branch": "main", "commit": "ea84a710262cb2c286d439070bad37d36fd3db25" },
"fzf": { "branch": "master", "commit": "3c09c77269d848f5e7dd8f350a90e8d7ed760845" },
"fzf.vim": { "branch": "master", "commit": "e0d131d95364edf940a70127fcb5748b86e6955e" },
@ -52,6 +53,7 @@
"null-ls.nvim": { "branch": "main", "commit": "db09b6c691def0038c456551e4e2772186449f35" },
"nvim-cmp": { "branch": "main", "commit": "c4e491a87eeacf0408902c32f031d802c7eafce8" },
"nvim-lightbulb": { "branch": "master", "commit": "6166029a136afd56cf23384fc31e8ba203a6e102" },
"nvim-lint": { "branch": "master", "commit": "4744fc04c3a869c9eaa137fec13d992aea7da7ee" },
"nvim-lspconfig": { "branch": "master", "commit": "447443a2404adc323ad2efc7c0a346a904ce694c" },
"nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" },
"nvim-osc52": { "branch": "main", "commit": "3e96035d62290183fe7a11418db2b254fcfcaee3" },

View File

@ -1,6 +1,19 @@
local use_google = require("utils").use_google
return {
-- {
-- "rcarriga/nvim-notify",
-- config = function()
-- local colors = require("catppuccin.palettes").get_palette()
-- require("notify").setup({
-- background_colour = colors.base,
-- fps = 10, -- default 30
-- stages = "slide", -- default fade_in_slide_out
-- timeout = 5000, -- default 5000
-- })
-- vim.notify = require("notify")
-- end,
-- },
-- Pretty symbols
{
"nvim-tree/nvim-web-devicons",

View File

@ -8,10 +8,6 @@ local has_words_before = function()
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local feedkey = function(key, mode)
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
end
return {
{
"tzachar/cmp-tabnine",
@ -29,6 +25,7 @@ return {
dependencies = {
"f3fora/cmp-spell",
"hrsh7th/cmp-buffer",
"amarakon/nvim-cmp-buffer-lines",
"hrsh7th/cmp-calc",
"onsails/lspkind.nvim",
"hrsh7th/cmp-cmdline",
@ -37,41 +34,37 @@ return {
"hrsh7th/cmp-nvim-lsp-document-symbol",
"hrsh7th/cmp-nvim-lsp-signature-help",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-path",
"FelipeLema/cmp-async-path",
"lukas-reineke/cmp-under-comparator",
"ray-x/cmp-treesitter",
},
config = function()
vim.opt.shortmess:append("c")
vim.opt.completeopt = { "menu", "menuone", "noselect" }
local cmp = require("cmp")
local conditionalSources = cmp.config.sources({
{ name = "nvim_lsp", priority = 6 },
{ name = "nvim_lsp_signature_help", priority = 6 },
{ name = "luasnip", priority = 7 },
{ name = "nvim_lsp", priority = 8 },
{ name = "treesitter", priority = 7 },
{ name = "nvim_lsp_signature_help" },
{ name = "luasnip" },
{ name = "calc" },
{ name = "crates" },
{ name = "nvim_lua" },
{ name = "emoji" },
{ name = "path" },
{ name = "treesitter" },
{
name = "spell",
option = {
keep_all_entries = false,
enable_in_context = function()
return true
end,
},
},
{ name = "buffer", max_item_count = 5, keyword_length = 5 },
{ name = "async_path" },
{ name = "spell" },
{ name = "buffer", option = { keyword_pattern = [[\k\+]] }, priority = 1 },
-- { name = "buffer-lines" },
})
if use_google() then
require("cmp_nvim_ciderlsp").setup()
table.insert(conditionalSources, { name = "analysislsp" })
table.insert(conditionalSources, { name = "nvim_ciderlsp", priority = 8 })
table.insert(conditionalSources, { name = "analysislsp", priority = 5 })
table.insert(conditionalSources, { name = "nvim_ciderlsp", priority = 9 })
else
table.insert(conditionalSources, { name = "cmp_tabnine" })
table.insert(conditionalSources, { name = "cmp_tabnine", priority = 9 })
end
local lspkind = require("lspkind")
@ -81,8 +74,9 @@ return {
cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "nvim_lsp_document_symbol" },
{ name = "buffer", max_item_count = 5 },
{ name = "nvim_lsp_document_symbol", priority = 3 },
{ name = "treesitter", priority = 2 },
{ name = "buffer", option = { keyword_pattern = [[\k\+]] }, priority = 1 },
}),
})
@ -90,8 +84,9 @@ return {
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "path", priority = 9 },
{ name = "cmdline" },
{ name = "async_path", priority = 9 },
{ name = "treesitter", priority = 7 },
{ name = "cmdline", priority = 8 },
}),
})
@ -101,7 +96,6 @@ return {
["<C-u>"] = cmp.mapping.scroll_docs(4),
["<C-e>"] = cmp.mapping.close(),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<C-m>"] = cmp.mapping.confirm({ select = true }),
["<CR>"] = cmp.mapping.confirm({ select = true }),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
@ -136,11 +130,12 @@ return {
end),
},
preselect = cmp.PreselectMode.None,
sources = conditionalSources,
sorting = {
comparators = {
-- cmp.config.compare.priority,
cmp.config.compare.priority,
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
@ -160,21 +155,8 @@ return {
formatting = {
format = lspkind.cmp_format({
with_text = true,
-- mode = "symbol_text",
-- before = function(entry, vim_item)
-- if entry.source.name == "nvim_ciderlsp" then
-- if entry.completion_item.is_multiline then
-- -- multi-line specific formatting here
-- vim_item.menu = "  "
-- else
-- vim_item.menu = ""
-- end
-- end
-- return vim_item
-- end,
maxwidth = 50, -- half max width
-- maxwidth = 50, -- half max width
menu = {
nvim_ciderlsp = "",
buffer = "",
@ -183,13 +165,13 @@ return {
nvim_lua = "",
luasnip = "[LuaSnip]",
cmp_tabnine = "[TabNine]",
path = "[path]",
async_path = "[async_path]",
tmux = "[TMUX]",
},
}),
},
experimental = {
native_menu = false,
ghost_text = true,
},
})

View File

@ -0,0 +1,92 @@
return {
"mhartington/formatter.nvim",
config = function()
-- Utilities for creating configurations
local util = require("formatter.util")
-- Provides the Format, FormatWrite, FormatLock, and FormatWriteLock commands
require("formatter").setup({
-- Enable or disable logging
logging = true,
-- Set the log level
log_level = vim.log.levels.WARN,
-- All formatter configurations are opt-in
filetype = {
-- Formatter configurations for filetype "lua" go here
-- and will be executed in order
lua = {
-- "formatter.filetypes.lua" defines default configurations for the
-- "lua" filetype
-- require("formatter.filetypes.lua").stylua,
-- You can also define your own configuration
function()
-- Supports conditional formatting
if util.get_current_buffer_file_name() == "special.lua" then
return nil
end
-- Full specification of configurations is down below and in Vim help
-- files
return {
exe = "stylua",
args = {
"--search-parent-directories",
"--stdin-filepath",
util.escape_path(util.get_current_buffer_file_path()),
"--",
"-",
},
stdin = true,
}
end,
},
html = {
require("formatter.defaults").prettier,
},
xml = {
function()
return {
exe = "tidy",
args = {
"-quiet",
"-xml",
"--wrap yes",
"--indent yes",
"--indent-spaces 2",
"--indent-attributes yes",
"--sort-attributes alpha",
"--wrap-attributes yes",
"--vertical-space yes",
"--tidy-mark no",
},
stdin = true,
try_node_modules = true,
}
end,
},
-- java = {
-- function()
-- return {
-- exe = "google-java-format",
-- }
-- end,
-- },
-- Use the special "*" filetype for defining formatter configurations on
-- any filetype
["*"] = {
-- "formatter.filetypes.any" defines default configurations for any
-- filetype
require("formatter.filetypes.any").remove_trailing_whitespace,
},
},
})
vim.cmd([[
augroup FormatAutogroup
autocmd!
autocmd BufWritePost * FormatWrite
augroup END
]])
end,
}

View File

@ -137,16 +137,18 @@ return {
-- Here are all the options and their default values:
require("google.comments").setup({
-- command = {'/google/bin/releases/editor-devtools/get_comments.par', '--full', '--json', "-x=''"},
-- stubby = true,
stubby = true,
-- command = {
-- "/google/bin/releases/editor-devtools/get_comments.par",
-- "--json",
-- "--full",
-- "--noresolved",
-- "--cl_comments",
-- "--file_comments",
-- },
command = {
"/google/bin/releases/editor-devtools/get_comments.par",
"--json",
"--full",
"--noresolved",
"--cl_comments",
"--file_comments",
'stubby --output_json call blade:codereview-rpc CodereviewRpcService.GetComments "changelist_number: $(/google/data/ro/teams/fig/bin/vcstool pending-change-number)"',
},
-- command = {'stubby --output_json call blade:codereview-rpc CodereviewRpcService.GetComments "changelist_number: $(/google/data/ro/teams/fig/bin/vcstool pending-change-number)"'},
-- Define your own icon by `vim.fn.sign_define('ICON_NAME', {text = ' '})`.
-- See :help sign_define
-- The sign property passed to setup should be the 'ICON_NAME' in the define

View File

@ -0,0 +1,10 @@
return {
"mfussenegger/nvim-lint",
config = function()
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
callback = function()
require("lint").try_lint()
end,
})
end,
}

View File

@ -33,21 +33,11 @@ return {
local lsp_status = require("lsp-status")
lsp_status.register_progress()
-- CiderLSP
vim.opt.completeopt = { "menu", "menuone", "noselect" }
-- Don't show the dumb matching stuff
vim.opt.shortmess:append("c")
vim.opt.spell = true
vim.opt.spelllang = { "en_us" }
vim.lsp.handlers["window/showMessage"] = function(_, result, ctx)
local client = vim.lsp.get_client_by_id(ctx.client_id)
local lvl = ({
"ERROR",
"WARN",
"INFO",
"DEBUG",
})[result.type]
local lvl = ({ "ERROR", "WARN", "INFO", "DEBUG" })[result.type]
notify({ result.message }, lvl, {
title = "LSP | " .. client.name,
timeout = 1000,
@ -57,34 +47,12 @@ return {
})
end
configs.ast_grep = {
default_config = {
cmd = { "sg", "lsp" },
offset_encoding = "utf-8",
filetypes = {
"c",
"cpp",
"java",
"kotlin",
"objc",
"proto",
"textproto",
"go",
"python",
"bzl",
"typescript",
},
single_file_support = true,
root_dir = lspconfig.util.root_pattern("BUILD", ".git", "sgconfig.yml"),
},
}
if use_google() then
configs.ciderlsp = {
default_config = {
cmd = {
"/google/bin/releases/cider/ciderlsp/ciderlsp",
"--tooltag=nvim-cmp",
"--tooltag=nvim-lsp",
"--forward_sync_responses",
},
offset_encoding = "utf-8",
@ -101,10 +69,7 @@ return {
"bzl",
"typescript",
},
-- required for proto generated files jump
root_dir = function(fname)
return string.match(fname, "(/google/src/cloud/[%w_-]+/[%w_-]+/google3/).+$")
end,
root_dir = lspconfig.util.root_pattern("google3/*BUILD"),
settings = {},
},
}
@ -132,9 +97,7 @@ return {
"typescript",
"javascript",
},
root_dir = function(fname)
return string.match(fname, "(/google/src/cloud/[%w_-]+/[%w_-]+/google3/).+$")
end,
root_dir = lspconfig.util.root_pattern("google3/*BUILD"),
settings = {},
},
}
@ -154,7 +117,7 @@ return {
},
codeDescriptionSupport = true,
dataSupport = true,
layeredDiagnostics = true,
-- layeredDiagnostics = true,
}
capabilities = vim.tbl_extend("keep", capabilities or {}, lsp_status.capabilities)
@ -199,20 +162,21 @@ return {
require("lualine").refresh()
end
end
require("cmp_nvim_ciderlsp").setup({
multiline_summary_symbol = "",
})
capabilities = require("cmp_nvim_ciderlsp").update_capabilities(capabilities)
capabilities.workspace.codeLens = { refreshSupport = true }
capabilities.workspace.diagnostics = { refreshSupport = true }
lspconfig.analysislsp.setup({
capabilities = capabilities,
})
lspconfig.ciderlsp.setup({
capabilities = capabilities,
on_attach = cider_on_attach,
handlers = cider_lsp_handlers,
})
lspconfig.analysislsp.setup({
capabilities = capabilities,
})
end
end,
},

View File

@ -5,12 +5,14 @@ return {
config = function()
vim.diagnostic.config({
virtual_lines = { only_current_line = true },
-- virtual_lines = true,
-- update_in_insert = true,
update_in_insert = true,
virtual_text = false,
})
require("lsp_lines").setup()
require("lsp_lines").toggle()
end,
keys = {
{

View File

@ -1,93 +0,0 @@
return {
"jose-elias-alvarez/null-ls.nvim",
event = "VimEnter",
config = function()
local null_ls = require("null-ls")
local use_google = require("utils").use_google
local TableConcat = require("utils").TableConcat
local sources = {
-- *
null_ls.builtins.formatting.trim_whitespace,
-- Catch insensitive, inconsiderate writing.
null_ls.builtins.diagnostics.alex,
-- Codespell finds common misspellings in text files.
null_ls.builtins.diagnostics.codespell,
-- null_ls.builtins.diagnostics.cspell, null_ls.builtins.code_actions.cspell,
-- An English prose linter. Can fix some issues via code actions.
null_ls.builtins.code_actions.proselint,
-- Reformats Java source code according to Google Java Style.
null_ls.builtins.formatting.google_java_format,
-- XML
-- null_ls.builtins.diagnostics.tidy,
-- null_ls.builtins.formatting.xmlformat,
-- null_ls.builtins.formatting.xq,
-- null_ls.builtins.formatting.xmllint.with({ extra_args = { "--pretty", "2" } }),
null_ls.builtins.formatting.tidy.with({
filetypes = { "xml" },
args = {
"-xml",
"-quiet",
"-wrap",
"--tidy-mark",
"no",
"--indent",
"yes",
"--indent-spaces",
"2",
"--indent-attributes",
"yes",
"--sort-attributes",
"alpha",
"--wrap-attributes",
"yes",
"--vertical-space",
"yes",
"-",
},
}),
null_ls.builtins.formatting.stylua,
}
if not use_google then
TableConcat(sources, {
-- Bazel
null_ls.builtins.diagnostics.buildifier,
null_ls.builtins.formatting.buildifier,
-- Golang
null_ls.builtins.diagnostics.golangci_lint,
null_ls.builtins.formatting.gofmt,
null_ls.builtins.formatting.goimports_reviser,
-- Misc
null_ls.builtins.formatting.htmlbeautifier,
null_ls.builtins.formatting.jq,
null_ls.builtins.formatting.mdformat,
})
end
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
null_ls.setup({
on_init = function(new_client, _)
new_client.offset_encoding = "utf-8"
end,
sources = sources,
-- you can reuse a shared lspconfig on_attach callback here
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ async = false })
end,
})
end
end,
})
end,
}

View File

@ -1,13 +0,0 @@
return {
"rcarriga/nvim-notify",
config = function()
local colors = require("catppuccin.palettes").get_palette()
require("notify").setup({
background_colour = colors.base,
fps = 10, -- default 30
stages = "slide", -- default fade_in_slide_out
timeout = 5000, -- default 5000
})
vim.notify = require("notify")
end,
}

View File

@ -72,10 +72,9 @@ set scrolloff=3 " Minumum lines to keep above and below cursor
" \ },
" \ cache_enabled: 1,
" \ }
set shortmess=A
set shortmess=A " disable swap
set shortmess+=O
set modifiable
set omnifunc= completeopt=menuone,noinsert,noselect
set updatetime=100

View File

@ -49,6 +49,7 @@ export FZF_CS_PREVIEW_HIGHLIGHT="\x1b[38;2;248;248;248m\x1b[48;2;81;85;89m"
source ~/g3path.zsh
source /etc/bash_completion.d/hgd
source /google/bin/releases/gmscore-tools/cli/prod/setup_prod_gms.sh
alias acid=/google/bin/releases/mobile-devx-platform/acid/acid
alias apido='/google/data/ro/teams/oneplatform/apido'
alias bugs=/google/data/rw/users/mk/mkannan/www/bin/bugs

View File

@ -271,3 +271,6 @@ export PATH="$HOME/.local/bin:$PATH"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# Setup go/hi #!>>HI<<!#
source /etc/bash.bashrc.d/shell_history_forwarder.sh #!>>HI<<!#