format and stuff

This commit is contained in:
Christian Nieves
2023-06-23 15:03:45 -05:00
parent 7fff3e8486
commit 2ce85a8584
30 changed files with 1284 additions and 1044 deletions

View File

@ -1,15 +1,15 @@
local M = {}
local notify = require 'notify'
local notify = require("notify")
local lsp_util = vim.lsp.util
function M.code_action_listener()
local context = { diagnostics = vim.lsp.diagnostic.get_line_diagnostics() }
local params = lsp_util.make_range_params()
params.context = context
vim.lsp.buf_request(0, 'textDocument/codeAction', params, function(err, _, result)
notify('codeAction '..result, 'info', {timeout=500})
end)
local context = { diagnostics = vim.lsp.diagnostic.get_line_diagnostics() }
local params = lsp_util.make_range_params()
params.context = context
vim.lsp.buf_request(0, "textDocument/codeAction", params, function(err, _, result)
notify("codeAction " .. result, "info", { timeout = 500 })
end)
end
return M

View File

@ -2,7 +2,7 @@ vim.g.catppuccin_flavour = "macchiato" -- latte, frappe, macchiato, mocha
local colors = require("catppuccin.palettes").get_palette()
require("catppuccin").setup({
flavour = "macchiato",
flavour = "macchiato",
integrations = {
cmp = true,
-- coc_nvim = false,
@ -17,23 +17,23 @@ require("catppuccin").setup({
-- lightspeed = false,
-- lsp_saga = false,
lsp_trouble = true,
mason = true,
markdown = true,
mason = true,
markdown = true,
-- neogit = false,
-- neotest = false,
neotree = true,
neotree = true,
notify = true,
-- nvimtree = true,
-- overseer = false,
-- pounce = false,
symbols_outline = true,
symbols_outline = true,
telescope = true,
treesitter = true,
treesitter_context = false,
treesitter_context = false,
-- ts_rainbow = false,
-- vim_sneak = false,
-- vimwiki = false,
which_key = true,
which_key = true,
-- Special integrations, see https://github.com/catppuccin/nvim#special-integrations
dap = {
@ -60,12 +60,12 @@ require("catppuccin").setup({
},
},
},
custom_highlights = {
Identifier = { fg = colors.lavender },
Statement = { fg = colors.rosewater },
-- Identifier = { fg = colors.sapphire },
Function = { fg = colors.mauve },
},
custom_highlights = {
Identifier = { fg = colors.lavender },
Statement = { fg = colors.rosewater },
-- Identifier = { fg = colors.sapphire },
Function = { fg = colors.mauve },
},
})
vim.api.nvim_command "colorscheme catppuccin"
vim.api.nvim_command("colorscheme catppuccin")

View File

@ -6,50 +6,58 @@ map("n", "<leader>dso", ":lua require'dap'.step_over()<CR>")
map("n", "<leader>di", ":lua require'dap'.repl.open()<CR>")
local on_attach = function(client, bufnr)
require'jdtls.setup'.add_commands()
require'jdtls'.setup_dap()
require'lsp-status'.register_progress()
-- require'lspkind'.init()
-- require'lspsaga'.init_lsp_saga()
require("jdtls.setup").add_commands()
require("jdtls").setup_dap()
require("lsp-status").register_progress()
-- require'lspkind'.init()
-- require'lspsaga'.init_lsp_saga()
-- Kommentary
vim.api.nvim_set_keymap("n", "<leader>/", "<plug>kommentary_line_default", {})
vim.api.nvim_set_keymap("v", "<leader>/", "<plug>kommentary_visual_default", {})
-- Kommentary
vim.api.nvim_set_keymap("n", "<leader>/", "<plug>kommentary_line_default", {})
vim.api.nvim_set_keymap("v", "<leader>/", "<plug>kommentary_visual_default", {})
vim.api.nvim_exec([[
vim.api.nvim_exec(
[[
augroup FormatAutogroup
autocmd!
autocmd BufWritePost *.java FormatWrite
augroup end
]], true)
]],
true
)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
local function buf_set_keymap(...)
vim.api.nvim_buf_set_keymap(bufnr, ...)
end
local function buf_set_option(...)
vim.api.nvim_buf_set_option(bufnr, ...)
end
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
-- Mappings.
local opts = { noremap=true, silent=true }
-- buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
-- buf_set_keymap('n', '<leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
-- buf_set_keymap('n', '<leader>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
-- buf_set_keymap('n', '<leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
-- buf_set_keymap('n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
-- buf_set_keymap('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
-- buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references() && vim.cmd("copen")<CR>', opts)
-- buf_set_keymap('n', '<leader>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
-- buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
-- buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
-- buf_set_keymap('n', '<leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
-- Java specific
-- buf_set_keymap("n", "<leader>di", "<Cmd>lua require'jdtls'.organize_imports()<CR>", opts)
-- buf_set_keymap("n", "<leader>dt", "<Cmd>lua require'jdtls'.test_class()<CR>", opts)
-- buf_set_keymap("n", "<leader>dn", "<Cmd>lua require'jdtls'.test_nearest_method()<CR>", opts)
buf_set_keymap("v", "<leader>de", "<Esc><Cmd>lua require('jdtls').extract_variable(true)<CR>", opts)
buf_set_keymap("n", "<leader>de", "<Cmd>lua require('jdtls').extract_variable()<CR>", opts)
buf_set_keymap("v", "<leader>dm", "<Esc><Cmd>lua require('jdtls').extract_method(true)<CR>", opts)
-- Mappings.
local opts = { noremap = true, silent = true }
-- buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
-- buf_set_keymap('n', '<leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
-- buf_set_keymap('n', '<leader>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
-- buf_set_keymap('n', '<leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
-- buf_set_keymap('n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
-- buf_set_keymap('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
-- buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references() && vim.cmd("copen")<CR>', opts)
-- buf_set_keymap('n', '<leader>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
-- buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
-- buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
-- buf_set_keymap('n', '<leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
-- Java specific
-- buf_set_keymap("n", "<leader>di", "<Cmd>lua require'jdtls'.organize_imports()<CR>", opts)
-- buf_set_keymap("n", "<leader>dt", "<Cmd>lua require'jdtls'.test_class()<CR>", opts)
-- buf_set_keymap("n", "<leader>dn", "<Cmd>lua require'jdtls'.test_nearest_method()<CR>", opts)
buf_set_keymap("v", "<leader>de", "<Esc><Cmd>lua require('jdtls').extract_variable(true)<CR>", opts)
buf_set_keymap("n", "<leader>de", "<Cmd>lua require('jdtls').extract_variable()<CR>", opts)
buf_set_keymap("v", "<leader>dm", "<Esc><Cmd>lua require('jdtls').extract_method(true)<CR>", opts)
vim.api.nvim_exec([[
vim.api.nvim_exec(
[[
hi LspReferenceRead cterm=bold ctermbg=red guibg=LightYellow
hi LspReferenceText cterm=bold ctermbg=red guibg=LightYellow
hi LspReferenceWrite cterm=bold ctermbg=red guibg=LightYellow
@ -58,138 +66,141 @@ local on_attach = function(client, bufnr)
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
augroup END
]], false)
]],
false
)
end
local root_markers = {'gradlew', 'pom.xml','BUILD'}
local root_dir = require('jdtls.setup').find_root(root_markers)
local home = os.getenv('HOME')
local root_markers = { "gradlew", "pom.xml", "BUILD" }
local root_dir = require("jdtls.setup").find_root(root_markers)
local home = os.getenv("HOME")
local capabilities = {
workspace = {
configuration = true
},
textDocument = {
completion = {
completionItem = {
snippetSupport = true
}
}
}
workspace = {
configuration = true,
},
textDocument = {
completion = {
completionItem = {
snippetSupport = true,
},
},
},
}
local workspace_folder = home .. "/.workspace" .. vim.fn.fnamemodify(root_dir, ":p:h:t")
local config = {
flags = {
allow_incremental_sync = true,
};
capabilities = capabilities,
on_attach = on_attach,
flags = {
allow_incremental_sync = true,
},
capabilities = capabilities,
on_attach = on_attach,
}
config.settings = {
['java.format.settings.url'] = home .. "/.config/nvim/language-servers/java-google-formatter.xml",
['java.format.settings.profile'] = "GoogleStyle",
java = {
signatureHelp = { enabled = true };
contentProvider = { preferred = 'fernflower' };
completion = {
favoriteStaticMembers = {
"org.hamcrest.MatcherAssert.assertThat",
"org.hamcrest.Matchers.*",
"org.hamcrest.CoreMatchers.*",
"org.junit.jupiter.api.Assertions.*",
"java.util.Objects.requireNonNull",
"java.util.Objects.requireNonNullElse",
"org.mockito.Mockito.*"
}
};
sources = {
organizeImports = {
starThreshold = 9999;
staticStarThreshold = 9999;
};
};
codeGeneration = {
toString = {
template = "${object.className}{${member.name()}=${member.value}, ${otherMembers}}"
}
};
configuration = {
runtimes = {
{
name = "JavaSE-11",
path = home .. "/.sdkman/candidates/java/11.0.10-open/",
},
{
name = "JavaSE-14",
path = home .. "/.sdkman/candidates/java/14.0.2-open/",
},
{
name = "JavaSE-15",
path = home .. "/.sdkman/candidates/java/15.0.1-open/",
},
}
};
};
["java.format.settings.url"] = home .. "/.config/nvim/language-servers/java-google-formatter.xml",
["java.format.settings.profile"] = "GoogleStyle",
java = {
signatureHelp = { enabled = true },
contentProvider = { preferred = "fernflower" },
completion = {
favoriteStaticMembers = {
"org.hamcrest.MatcherAssert.assertThat",
"org.hamcrest.Matchers.*",
"org.hamcrest.CoreMatchers.*",
"org.junit.jupiter.api.Assertions.*",
"java.util.Objects.requireNonNull",
"java.util.Objects.requireNonNullElse",
"org.mockito.Mockito.*",
},
},
sources = {
organizeImports = {
starThreshold = 9999,
staticStarThreshold = 9999,
},
},
codeGeneration = {
toString = {
template = "${object.className}{${member.name()}=${member.value}, ${otherMembers}}",
},
},
configuration = {
runtimes = {
{
name = "JavaSE-11",
path = home .. "/.sdkman/candidates/java/11.0.10-open/",
},
{
name = "JavaSE-14",
path = home .. "/.sdkman/candidates/java/14.0.2-open/",
},
{
name = "JavaSE-15",
path = home .. "/.sdkman/candidates/java/15.0.1-open/",
},
},
},
},
}
config.cmd = {'javalsp', workspace_folder}
config.cmd = { "javalsp", workspace_folder }
config.on_attach = on_attach
config.on_init = function(client, _)
client.notify('workspace/didChangeConfiguration', { settings = config.settings })
client.notify("workspace/didChangeConfiguration", { settings = config.settings })
end
local extendedClientCapabilities = require'jdtls'.extendedClientCapabilities
local extendedClientCapabilities = require("jdtls").extendedClientCapabilities
extendedClientCapabilities.resolveAdditionalTextEditsSupport = true
config.init_options = {
-- bundles = bundles;
extendedClientCapabilities = extendedClientCapabilities;
-- bundles = bundles;
extendedClientCapabilities = extendedClientCapabilities,
}
-- UI
local finders = require'telescope.finders'
local sorters = require'telescope.sorters'
local actions = require'telescope.actions'
local pickers = require'telescope.pickers'
require('jdtls.ui').pick_one_async = function(items, prompt, label_fn, cb)
local opts = {}
pickers.new(opts, {
prompt_title = prompt,
finder = finders.new_table {
results = items,
entry_maker = function(entry)
return {
value = entry,
display = label_fn(entry),
ordinal = label_fn(entry),
}
end,
},
sorter = sorters.get_generic_fuzzy_sorter(),
attach_mappings = function(prompt_bufnr)
actions.goto_file_selection_edit:replace(function()
local selection = actions.get_selected_entry(prompt_bufnr)
actions.close(prompt_bufnr)
local finders = require("telescope.finders")
local sorters = require("telescope.sorters")
local actions = require("telescope.actions")
local pickers = require("telescope.pickers")
require("jdtls.ui").pick_one_async = function(items, prompt, label_fn, cb)
local opts = {}
pickers
.new(opts, {
prompt_title = prompt,
finder = finders.new_table({
results = items,
entry_maker = function(entry)
return {
value = entry,
display = label_fn(entry),
ordinal = label_fn(entry),
}
end,
}),
sorter = sorters.get_generic_fuzzy_sorter(),
attach_mappings = function(prompt_bufnr)
actions.goto_file_selection_edit:replace(function()
local selection = actions.get_selected_entry(prompt_bufnr)
actions.close(prompt_bufnr)
cb(selection.value)
end)
cb(selection.value)
end)
return true
end,
}):find()
return true
end,
})
:find()
end
local dap = require('dap')
local dap = require("dap")
dap.configurations.java = {
{
type = 'java';
request = 'attach';
name = "Debug (Attach) - Remote";
hostName = "127.0.0.1";
port = 5005;
},
{
type = "java",
request = "attach",
name = "Debug (Attach) - Remote",
hostName = "127.0.0.1",
port = 5005,
},
}
-- Server
require('jdtls').start_or_attach(config)
require("jdtls").start_or_attach(config)

View File

@ -2,32 +2,32 @@ local map = require("utils").map
local use_google = require("utils").use_google
if use_google() then
map("n", "<leader>tm", ":Telescope citc modified<CR>")
map("n", "<leader>tb", ":Telescope file_browser<CR>")
map("n", "<leader>tm", ":Telescope citc modified<CR>")
map("n", "<leader>tb", ":Telescope file_browser<CR>")
-- [F]ig [S]tatus
map('n', '<leader>fs', [[<cmd>lua require('telescope').extensions.fig.status{}<CR>]])
-- [F]ig [S]tatus
map("n", "<leader>fs", [[<cmd>lua require('telescope').extensions.fig.status{}<CR>]])
-- [F]ig [X]l
map('n', '<leader>fx', [[<cmd>lua require('telescope').extensions.fig.xl{}<CR>]])
-- [F]ig [X]l
map("n", "<leader>fx", [[<cmd>lua require('telescope').extensions.fig.xl{}<CR>]])
-- [F]ig [W]hatsout
map('n', '<leader>fw', [[<cmd>lua require('telescope').extensions.fig.status{whatsout=true}<CR>]])
-- [F]ig [W]hatsout
map("n", "<leader>fw", [[<cmd>lua require('telescope').extensions.fig.status{whatsout=true}<CR>]])
-- [F]ig [A]mend
map('n', '<leader>fa', [[<cmd>Hg amend<CR>]])
-- [F]ig [A]mend
map("n", "<leader>fa", [[<cmd>Hg amend<CR>]])
-- [F]ig [A]mend
map('n', '<leader>fe', [[<cmd>Hg evolve<CR>]])
-- [F]ig [A]mend
map("n", "<leader>fe", [[<cmd>Hg evolve<CR>]])
-- [F]ig [N]ext
map('n', '<leader>fn', [[<cmd>Hg next<CR>]])
--
-- [F]ig [P]rev
map('n', '<leader>fp', [[<cmd>Hg prev<CR>]])
--
-- [F]ig [U]pload
map('n', '<leader>fu', [[<cmd>Hg upload tree<CR>]])
-- [F]ig [N]ext
map("n", "<leader>fn", [[<cmd>Hg next<CR>]])
--
-- [F]ig [P]rev
map("n", "<leader>fp", [[<cmd>Hg prev<CR>]])
--
-- [F]ig [U]pload
map("n", "<leader>fu", [[<cmd>Hg upload tree<CR>]])
-- map('n', '<Leader>f', ':Figtree<CR>', { silent = true })
-- map('n', '<Leader>f', ':Figtree<CR>', { silent = true })
end

View File

@ -1,53 +1,59 @@
-- 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,
command = {'/google/bin/releases/editor-devtools/get_comments.par', '--json', '--full', '--noresolved', '--cl_comments', '--file_comments'},
-- 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
-- example above.
sign = 'COMMENT_ICON',
-- Fetch the comments after calling `setup`.
auto_fetch = true,
display = {
-- The width of the comment display window.
width = 50,
-- When showing file paths, use relative paths or not.
relative_path = true,
--- Enable viewing comments through floating window
floating = true,
--- Options used when creating the floating window.
floating_window_options = floating_window_options
},
}
require("google.comments").setup({
-- command = {'/google/bin/releases/editor-devtools/get_comments.par', '--full', '--json', "-x=''"},
-- stubby = true,
command = {
"/google/bin/releases/editor-devtools/get_comments.par",
"--json",
"--full",
"--noresolved",
"--cl_comments",
"--file_comments",
},
-- 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
-- example above.
sign = "COMMENT_ICON",
-- Fetch the comments after calling `setup`.
auto_fetch = true,
display = {
-- The width of the comment display window.
width = 50,
-- When showing file paths, use relative paths or not.
relative_path = true,
--- Enable viewing comments through floating window
floating = true,
--- Options used when creating the floating window.
floating_window_options = floating_window_options,
},
})
function floating_window_options(parent_win_id)
local parent_width = vim.api.nvim_win_get_width(parent_win_id)
local parent_height = vim.api.nvim_win_get_height(parent_win_id)
local parent_width = vim.api.nvim_win_get_width(parent_win_id)
local parent_height = vim.api.nvim_win_get_height(parent_win_id)
return {
relative = 'win',
anchor = 'NW',
width = math.floor(parent_width * 0.5),
height = math.floor(parent_height * 0.3),
row = vim.api.nvim_win_get_cursor(parent_win_id)[1],
col = math.floor(parent_width * 0.25),
border = 'rounded',
}
return {
relative = "win",
anchor = "NW",
width = math.floor(parent_width * 0.5),
height = math.floor(parent_height * 0.3),
row = vim.api.nvim_win_get_cursor(parent_win_id)[1],
col = math.floor(parent_width * 0.25),
border = "rounded",
}
end
local map = require("utils").map
-- here are some mappings you might want:
map('n', ']c', [[<Cmd>GoogleCommentsGotoNextComment<CR>]])
map('n', '[c', [[<Cmd>GoogleCommentsGotoPrevComment<CR>]])
map("n", "]c", [[<Cmd>GoogleCommentsGotoNextComment<CR>]])
map("n", "[c", [[<Cmd>GoogleCommentsGotoPrevComment<CR>]])
map('n', '<Leader>nc', [[<Cmd>GoogleCommentsGotoNextComment<CR>]])
map('n', '<Leader>pc', [[<Cmd>GoogleCommentsGotoPrevComment<CR>]])
map('n', '<Leader>lc', [[<Cmd>GoogleCommentsToggleLineComments<CR>]])
map('n', '<Leader>ac', [[<Cmd>GoogleCommentsToggleAllComments<CR>]])
map('n', '<Leader>fc', [[<Cmd>GoogleCommentsFetchComments<CR>]])
map("n", "<Leader>nc", [[<Cmd>GoogleCommentsGotoNextComment<CR>]])
map("n", "<Leader>pc", [[<Cmd>GoogleCommentsGotoPrevComment<CR>]])
map("n", "<Leader>lc", [[<Cmd>GoogleCommentsToggleLineComments<CR>]])
map("n", "<Leader>ac", [[<Cmd>GoogleCommentsToggleAllComments<CR>]])
map("n", "<Leader>fc", [[<Cmd>GoogleCommentsFetchComments<CR>]])
vim.fn.sign_define('COMMENT_ICON', {text = ''})
vim.fn.sign_define("COMMENT_ICON", { text = "" })

View File

@ -1,13 +1,13 @@
local use_google = require("utils").use_google
local log = require("utils").log
local notify = require 'notify'
local notify = require("notify")
local lsp_status = require('lsp-status')
local lsp_status = require("lsp-status")
lsp_status.register_progress()
require("mason").setup()
require("mason-lspconfig").setup({
ensure_installed = { "lua_ls", "rust_analyzer" }
ensure_installed = { "lua_ls", "rust_analyzer" },
})
-- CiderLSP
@ -16,94 +16,119 @@ vim.opt.completeopt = { "menu", "menuone", "noselect" }
vim.opt.shortmess:append("c")
vim.opt.spell = true
vim.opt.spelllang = { 'en_us' }
vim.opt.spelllang = { "en_us" }
local lspconfig = require("lspconfig")
local configs = require("lspconfig.configs")
if use_google() then
configs.ciderlsp = {
default_config = {
cmd = { "/google/bin/releases/cider/ciderlsp/ciderlsp", "--tooltag=nvim-cmp", "--forward_sync_responses", "--merge_diagnostic_layers" },
filetypes = { "c", "cpp", "java", "kotlin", "objc", "proto", "textproto", "go", "python", "bzl", "typescript"},
root_dir = lspconfig.util.root_pattern("BUILD"),
-- root_dir = function(fname)
-- return string.match(fname, '(/google/src/cloud/[%w_-]+/[%w_-]+/google3/).+$')
-- end;
settings = {},
},
}
configs.ciderlsp = {
default_config = {
cmd = { "/google/bin/releases/cider/ciderlsp/ciderlsp", "--tooltag=nvim-cmp", "--forward_sync_responses" },
filetypes = {
"c",
"cpp",
"java",
"kotlin",
"objc",
"proto",
"textproto",
"go",
"python",
"bzl",
"typescript",
},
root_dir = lspconfig.util.root_pattern("BUILD"),
-- root_dir = function(fname)
-- return string.match(fname, '(/google/src/cloud/[%w_-]+/[%w_-]+/google3/).+$')
-- end;
settings = {},
},
}
configs.analysislsp = {
default_config = {
cmd = { '/google/bin/users/lerm/glint-ale/analysis_lsp/server', '--lint_on_save=false', '--max_qps=10' },
filetypes = { "c", "cpp", "java", "kotlin", "objc", "proto", "textproto", "go", "python", "bzl", "markdown","typescript", "javascript"},
root_dir = lspconfig.util.root_pattern('BUILD'),
-- root_dir = function(fname)
-- return string.match(fname, '(/google/src/cloud/[%w_-]+/[%w_-]+/google3/).+$')
-- end;
settings = {},
},
}
configs.analysislsp = {
default_config = {
cmd = { "/google/bin/users/lerm/glint-ale/analysis_lsp/server", "--lint_on_save=false", "--max_qps=10" },
filetypes = {
"c",
"cpp",
"java",
"kotlin",
"objc",
"proto",
"textproto",
"go",
"python",
"bzl",
"markdown",
"typescript",
"javascript",
},
root_dir = lspconfig.util.root_pattern("BUILD"),
-- root_dir = function(fname)
-- return string.match(fname, '(/google/src/cloud/[%w_-]+/[%w_-]+/google3/).+$')
-- end;
settings = {},
},
}
end
-- 3. Set up CiderLSP
local on_attach = function(client, bufnr)
vim.b['is_cider_lsp_attached'] = 'no'
require('lualine').refresh()
vim.b["is_cider_lsp_attached"] = "no"
require("lualine").refresh()
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
if vim.lsp.formatexpr then -- Neovim v0.6.0+ only.
vim.api.nvim_buf_set_option(bufnr, "formatexpr", "v:lua.vim.lsp.formatexpr")
end
if vim.lsp.tagfunc then
vim.api.nvim_buf_set_option(bufnr, "tagfunc", "v:lua.vim.lsp.tagfunc")
end
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
if vim.lsp.formatexpr then -- Neovim v0.6.0+ only.
vim.api.nvim_buf_set_option(bufnr, "formatexpr", "v:lua.vim.lsp.formatexpr")
end
if vim.lsp.tagfunc then
vim.api.nvim_buf_set_option(bufnr, "tagfunc", "v:lua.vim.lsp.tagfunc")
end
if client.server_capabilities.document_highlight then
vim.api.nvim_command("autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()")
vim.api.nvim_command("autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()")
vim.api.nvim_command("autocmd CursorMoved <buffer> lua vim.lsp.util.buf_clear_references()")
end
if client.server_capabilities.document_highlight then
vim.api.nvim_command("autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()")
vim.api.nvim_command("autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()")
vim.api.nvim_command("autocmd CursorMoved <buffer> lua vim.lsp.util.buf_clear_references()")
end
lsp_status.on_attach(client)
lsp_status.on_attach(client)
local opts = { noremap = true, silent = true }
vim.api.nvim_set_keymap("n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
vim.api.nvim_set_keymap("n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
vim.api.nvim_set_keymap("n", "L", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
vim.api.nvim_set_keymap("n", "g0", "<cmd>lua vim.lsp.buf.document_symbol()<CR>", opts)
vim.api.nvim_set_keymap("n", "gW", "<cmd>lua vim.lsp.buf.workspace_symbol()<CR>", opts)
vim.api.nvim_set_keymap("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
vim.api.nvim_set_keymap("n", "gD", "<cmd>tab split | lua vim.lsp.buf.definition()<CR>", opts)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
vim.api.nvim_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
vim.api.nvim_set_keymap("n", "gI", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
vim.api.nvim_set_keymap("n", "gR", "<cmd>lua vim.lsp.buf.references()<CR>", opts) -- diagnostics controls references
vim.api.nvim_set_keymap("n", "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
vim.api.nvim_set_keymap("i", "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
local opts = { noremap = true, silent = true }
vim.api.nvim_set_keymap("n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
vim.api.nvim_set_keymap("n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
vim.api.nvim_set_keymap("n", "L", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
vim.api.nvim_set_keymap("n", "g0", "<cmd>lua vim.lsp.buf.document_symbol()<CR>", opts)
vim.api.nvim_set_keymap("n", "gW", "<cmd>lua vim.lsp.buf.workspace_symbol()<CR>", opts)
vim.api.nvim_set_keymap("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
vim.api.nvim_set_keymap("n", "gD", "<cmd>tab split | lua vim.lsp.buf.definition()<CR>", opts)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
vim.api.nvim_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
vim.api.nvim_set_keymap("n", "gI", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
vim.api.nvim_set_keymap("n", "gR", "<cmd>lua vim.lsp.buf.references()<CR>", opts) -- diagnostics controls references
vim.api.nvim_set_keymap("n", "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
vim.api.nvim_set_keymap("i", "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
vim.api.nvim_set_keymap("n", "gt", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
vim.api.nvim_set_keymap("n", "gt", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
end
local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
capabilities['codeLens'] = {dynamicRegistration=false}
capabilities.textDocument.publishDiagnostics={
relatedInformation=true,
versionSupport=false,
tagSupport={
valueSet={
1,
2
}
},
codeDescriptionSupport=true,
dataSupport=true,
layeredDiagnostics=true
local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
capabilities["codeLens"] = { dynamicRegistration = false }
capabilities.textDocument.publishDiagnostics = {
relatedInformation = true,
versionSupport = false,
tagSupport = {
valueSet = {
1,
2,
},
},
codeDescriptionSupport = true,
dataSupport = true,
layeredDiagnostics = true,
}
capabilities = vim.tbl_extend('keep', capabilities or {}, lsp_status.capabilities)
capabilities = vim.tbl_extend("keep", capabilities or {}, lsp_status.capabilities)
local runtime_path = vim.split(package.path, ";")
table.insert(runtime_path, "lua/?.lua")
@ -114,208 +139,208 @@ lspkind.init()
local cmp = require("cmp")
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
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)
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
end
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline({ '/', '?' }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = 'buffer', max_item_count = 5 }
}
cmp.setup.cmdline({ "/", "?" }, {
mapping = cmp.mapping.preset.cmdline(),
sources = {
{ name = "buffer", max_item_count = 5 },
},
})
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'nvim_lsp_document_symbol' }
},{
{ name = 'path' }
}, {
{ name = 'cmdline' }
})
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "nvim_lsp_document_symbol" },
}, {
{ name = "path" },
}, {
{ name = "cmdline" },
}),
})
local conditionalSources = {
{ name = "nvim_lua" },
{ name = "nvim_lsp" },
{ name = 'nvim_lsp_signature_help', priority = 5 },
{ name = "path" },
{ name = "treesitter" },
{ name = "crates" },
{ name = "vim_vsnip" },
{ name = "buffer", max_item_count = 5, keyword_length = 5, group_index = 2 },
{
name = 'spell',
option = {
keep_all_entries = false,
enable_in_context = function()
return true
end,
},
},
{ name = "nvim_lua" },
{ name = "nvim_lsp" },
{ name = "nvim_lsp_signature_help", priority = 5 },
{ name = "path" },
{ name = "treesitter" },
{ name = "crates" },
{ name = "vim_vsnip" },
{ name = "buffer", max_item_count = 5, keyword_length = 5, group_index = 2 },
{
name = "spell",
option = {
keep_all_entries = false,
enable_in_context = function()
return true
end,
},
},
}
if use_google() then
require('cmp_nvim_ciderlsp').setup()
require("cmp_nvim_ciderlsp").setup()
local cider_lsp_handlers = {
["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
underline = true,
})
}
local cider_lsp_handlers = {
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
underline = true,
}),
}
cider_lsp_handlers["$/syncResponse"] = function(_, result, ctx)
-- is_cider_lsp_attached has been setup via on_init, but hasn't received
-- sync response yet.
local first_fire = vim.b['is_cider_lsp_attached'] == 'no'
vim.b['is_cider_lsp_attached'] = 'yes'
if first_fire then
notify('CiderLSP attached', 'info', {timeout=500})
require('lualine').refresh()
end
end
cider_lsp_handlers["$/syncResponse"] = function(_, result, ctx)
-- is_cider_lsp_attached has been setup via on_init, but hasn't received
-- sync response yet.
local first_fire = vim.b["is_cider_lsp_attached"] == "no"
vim.b["is_cider_lsp_attached"] = "yes"
if first_fire then
notify("CiderLSP attached", "info", { timeout = 500 })
require("lualine").refresh()
end
end
cider_lsp_handlers["workspace/diagnostic/refresh"] = function(_, result, ctx)
notify('result:'..result, 'info', {timeout=900})
notify('ctx:'..ctx, 'info', {timeout=900})
end
cider_lsp_handlers["workspace/diagnostic/refresh"] = function(_, result, ctx)
notify("result:" .. result, "info", { timeout = 900 })
notify("ctx:" .. ctx, "info", { timeout = 900 })
end
cider_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]
notify({ result.message }, lvl, {
title = 'LSP | ' .. client.name,
timeout = 1000,
keep = function()
return lvl == 'ERROR' or lvl == 'WARN'
end,
})
end
cider_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]
notify({ result.message }, lvl, {
title = "LSP | " .. client.name,
timeout = 1000,
keep = function()
return lvl == "ERROR" or lvl == "WARN"
end,
})
end
capabilities = require('cmp_nvim_ciderlsp').update_capabilities(capabilities)
capabilities.workspace.codeLens = {refreshSupport=true}
capabilities.workspace.diagnostics = {refreshSupport=true}
lspconfig.ciderlsp.setup({
capabilities = capabilities,
on_attach = on_attach,
handlers = cider_lsp_handlers,
})
lspconfig.analysislsp.setup({
capabilities = capabilities,
on_attach = on_attach,
})
table.insert(conditionalSources, { name = 'nvim_ciderlsp', priority = 9 })
table.insert(conditionalSources, { name = 'analysislsp' })
capabilities = require("cmp_nvim_ciderlsp").update_capabilities(capabilities)
capabilities.workspace.codeLens = { refreshSupport = true }
capabilities.workspace.diagnostics = { refreshSupport = true }
lspconfig.ciderlsp.setup({
capabilities = capabilities,
on_attach = on_attach,
handlers = cider_lsp_handlers,
})
lspconfig.analysislsp.setup({
capabilities = capabilities,
on_attach = on_attach,
})
table.insert(conditionalSources, { name = "nvim_ciderlsp", priority = 9 })
table.insert(conditionalSources, { name = "analysislsp" })
else
table.insert(conditionalSources, {name = 'cmp_tabnine'})
table.insert(conditionalSources, { name = "cmp_tabnine" })
end
cmp.setup({
mapping = {
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<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
cmp.select_next_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-expand-or-jump)", "")
elseif has_words_before() then
cmp.complete()
else
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
end
end, { "i", "s" }),
mapping = {
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<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
cmp.select_next_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-expand-or-jump)", "")
elseif has_words_before() then
cmp.complete()
else
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function()
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
feedkey("<Plug>(vsnip-jump-prev)", "")
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function()
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
feedkey("<Plug>(vsnip-jump-prev)", "")
end
end, { "i", "s" }),
["<Up>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-jump-prev)", "")
else
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
end
end),
["<Up>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-jump-prev)", "")
else
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
end
end),
["<Down>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-expand-or-jump)", "")
else
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
end
end),
},
["<Down>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-expand-or-jump)", "")
else
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
end
end),
},
sources = conditionalSources,
sources = conditionalSources,
sorting = {
comparators = {
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
require("cmp-under-comparator").under,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
},
},
sorting = {
comparators = {
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
require "cmp-under-comparator".under,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
},
},
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
formatting = {
format = lspkind.cmp_format({
with_text = true,
maxwidth = 40, -- half max width
menu = {
nvim_ciderlsp = "",
buffer = "",
crates = "📦",
nvim_lsp = "[CiderLSP]",
cmp_tabnine = "[TabNine]",
nvim_lua = "[API]",
path = "[path]",
tmux = "[TMUX]",
vim_vsnip = "[snip]",
},
}),
},
formatting = {
format = lspkind.cmp_format({
with_text = true,
maxwidth = 40, -- half max width
menu = {
nvim_ciderlsp = "",
buffer = "",
crates = "📦",
nvim_lsp = "[CiderLSP]",
cmp_tabnine = "[TabNine]",
nvim_lua = "[API]",
path = "[path]",
tmux = "[TMUX]",
vim_vsnip = "[snip]",
},
}),
},
experimental = {
native_menu = false,
ghost_text = true,
},
experimental = {
native_menu = false,
ghost_text = true,
},
})
vim.cmd([[ augroup CmpZsh au! autocmd Filetype zsh lua require'cmp'.setup.buffer { sources = { { name = "zsh" }, } } augroup END ]])
vim.cmd(
[[ augroup CmpZsh au! autocmd Filetype zsh lua require'cmp'.setup.buffer { sources = { { name = "zsh" }, } } augroup END ]]
)

View File

@ -1,92 +1,100 @@
local split = function (inputstr, sep)
local t={}
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
table.insert(t, str)
end
return t
local split = function(inputstr, sep)
local t = {}
for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do
table.insert(t, str)
end
return t
end
local 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
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
local function isCiderLspAttached()
if vim.b['is_cider_lsp_attached'] then
if vim.b['is_cider_lsp_attached'] == 'yes' then
return ''
else
return 'x'
end
else
return ''
end
if vim.b["is_cider_lsp_attached"] then
if vim.b["is_cider_lsp_attached"] == "yes" then
return ""
else
return "x"
end
else
return ""
end
end
local function getLightbulb()
return require('nvim-lightbulb').get_status_text()
return require("nvim-lightbulb").get_status_text()
end
local function getLGTMs()
local comments = require("google.comments")
local tracker = require("google.comments.tracker")
local dump = require("utils").dump
local comments = require("google.comments")
local tracker = require("google.comments.tracker")
local dump = require("utils").dump
print(dump(tracker.get_all_comments()))
local lgtm = comments.get_lgtms()
local appr = comments.get_approvals()
print("lgtms"..dump(lgtm))
print("approvals"..dump(appr))
return "LGTM:"..table.concat(lgtm, ",").." Approval:"..table.concat(appr, ",")
print(dump(tracker.get_all_comments()))
local lgtm = comments.get_lgtms()
local appr = comments.get_approvals()
print("lgtms" .. dump(lgtm))
print("approvals" .. dump(appr))
return "LGTM:" .. table.concat(lgtm, ",") .. " Approval:" .. table.concat(appr, ",")
end
local lsp_status = require('lsp-status')
local lsp_status = require("lsp-status")
require('lualine').setup {
options = {
theme = 'auto',
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', getCitc, isCiderLspAttached},
lualine_c = {getLightbulb, 'filename'},
lualine_x = {
{ 'diagnostics', sources = {"nvim_lsp"}, symbols = {error = '', warn = '', info = '', hint = ''} },
'encoding',
'filetype'
},
lualine_y = {'searchcount'},
lualine_z = {'location'}
},
tabline = {
lualine_a = {
{
'tabs',
mode = 1,
max_length = (vim.o.columns / 5) * 4,
fmt = function(name, context)
-- Show + if buffer is modified in tab
local buflist = vim.fn.tabpagebuflist(context.tabnr)
local winnr = vim.fn.tabpagewinnr(context.tabnr)
local bufnr = buflist[winnr]
local mod = vim.fn.getbufvar(bufnr, '&mod')
require("lualine").setup({
options = {
theme = "auto",
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
},
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", "diff", getCitc, isCiderLspAttached },
lualine_c = { getLightbulb, "filename" },
lualine_x = {
{
"diagnostics",
sources = { "nvim_lsp" },
symbols = { error = "", warn = "", info = "", hint = "" },
},
"encoding",
"filetype",
},
lualine_y = { "searchcount" },
lualine_z = { "location" },
},
tabline = {
lualine_a = {
{
"tabs",
mode = 1,
max_length = (vim.o.columns / 5) * 4,
fmt = function(name, context)
-- Show + if buffer is modified in tab
local buflist = vim.fn.tabpagebuflist(context.tabnr)
local winnr = vim.fn.tabpagewinnr(context.tabnr)
local bufnr = buflist[winnr]
local mod = vim.fn.getbufvar(bufnr, "&mod")
return name .. (mod == 1 and ' +' or '')
end
},
},
lualine_b = {'branch'},
lualine_c = {'filename'},
lualine_c = {
{ 'diagnostics', sources = {"nvim_lsp", "nvim_workspace_diagnostic"}, symbols = {error = '', warn = '', info = '', hint = ''} },
},
-- lualine_y = { getLGTMs }
},
}
return name .. (mod == 1 and " +" or "")
end,
},
},
lualine_b = { "branch" },
lualine_c = { "filename" },
lualine_c = {
{
"diagnostics",
sources = { "nvim_lsp", "nvim_workspace_diagnostic" },
symbols = { error = "", warn = "", info = "", hint = "" },
},
},
-- lualine_y = { getLGTMs }
},
})

View File

@ -1,7 +1,6 @@
local map = require("utils").map
require("neo-tree").setup({
hijack_netrw_behavior = "open_current"
hijack_netrw_behavior = "open_current",
})
map('n', '<C-n>', ':Neotree filesystem reveal toggle reveal_force_cwd<cr>')
map("n", "<C-n>", ":Neotree filesystem reveal toggle reveal_force_cwd<cr>")

View File

@ -9,7 +9,7 @@ vim.g.NERDSpaceDelims = 1
vim.g.NERDCompactSexyComs = 1
-- Align line-wise comment delimiters flush left instead of following code indentation
vim.g.NERDDefaultAlign = 'left'
vim.g.NERDDefaultAlign = "left"
-- Set a language to use its alternate delimiters by default
vim.g.NERDAltDelims_java = 1

View File

@ -1,4 +1,4 @@
local map = require("utils").map
map('n', '<C-n>', ':NERDTreeToggle<cr>')
map('n', '<C-f>', ':NERDTreeFind<cr>')
map("n", "<C-n>", ":NERDTreeToggle<cr>")
map("n", "<C-f>", ":NERDTreeFind<cr>")

View File

@ -1,25 +1,23 @@
local null_ls = require("null-ls")
local sources = {
-- Catch insensitive, inconsiderate writing.
null_ls.builtins.diagnostics.alex,
-- Catch insensitive, inconsiderate writing.
null_ls.builtins.diagnostics.alex,
-- buildifier is a tool for formatting and linting bazel BUILD, WORKSPACE, and .bzl files.
null_ls.builtins.diagnostics.buildifier,
-- buildifier is a tool for formatting and linting bazel BUILD, WORKSPACE, and .bzl files.
null_ls.builtins.diagnostics.buildifier,
-- Codespell finds common misspellings in text files.
-- null_ls.builtins.diagnostics.codespell,
-- null_ls.builtins.diagnostics.cspell, null_ls.builtins.code_actions.cspell,
-- 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
-- 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,
}
null_ls.setup({
sources = sources,
sources = sources,
})

View File

@ -3,72 +3,72 @@ local map = require("utils").map
local api = require("nvim-tree.api")
local function opts(desc)
return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
function on_attach(bufnr)
vim.keymap.set('n', 'O', api.tree.change_root_to_node, opts('CD'))
vim.keymap.set('n', '?', api.tree.toggle_help, opts('Help'))
vim.keymap.set("n", "O", api.tree.change_root_to_node, opts("CD"))
vim.keymap.set("n", "?", api.tree.toggle_help, opts("Help"))
-- put some default mappings here
vim.keymap.set('n', '<C-e>', api.node.open.replace_tree_buffer, opts('Open: In Place'))
vim.keymap.set('n', '<C-k>', api.node.show_info_popup, opts('Info'))
vim.keymap.set('n', '<C-r>', api.fs.rename_sub, opts('Rename: Omit Filename'))
vim.keymap.set('n', '<C-t>', api.node.open.tab, opts('Open: New Tab'))
vim.keymap.set('n', '<C-v>', api.node.open.vertical, opts('Open: Vertical Split'))
vim.keymap.set('n', '<C-x>', api.node.open.horizontal, opts('Open: Horizontal Split'))
vim.keymap.set('n', '<BS>', api.node.navigate.parent_close, opts('Close Directory'))
vim.keymap.set('n', '<CR>', api.node.open.edit, opts('Open'))
vim.keymap.set('n', '<Tab>', api.node.open.preview, opts('Open Preview'))
vim.keymap.set('n', '>', api.node.navigate.sibling.next, opts('Next Sibling'))
vim.keymap.set('n', '<', api.node.navigate.sibling.prev, opts('Previous Sibling'))
vim.keymap.set('n', '.', api.node.run.cmd, opts('Run Command'))
vim.keymap.set('n', '-', api.tree.change_root_to_parent, opts('Up'))
vim.keymap.set('n', 'a', api.fs.create, opts('Create'))
vim.keymap.set('n', 'bmv', api.marks.bulk.move, opts('Move Bookmarked'))
vim.keymap.set('n', 'B', api.tree.toggle_no_buffer_filter, opts('Toggle No Buffer'))
vim.keymap.set('n', 'c', api.fs.copy.node, opts('Copy'))
-- vim.keymap.set('n', 'C', api.tree.toggle_git_clean_filter, opts('Toggle Git Clean'))
-- vim.keymap.set('n', '[c', api.node.navigate.git.prev, opts('Prev Git'))
-- vim.keymap.set('n', ']c', api.node.navigate.git.next, opts('Next Git'))
vim.keymap.set('n', 'd', api.fs.remove, opts('Delete'))
vim.keymap.set('n', 'D', api.fs.trash, opts('Trash'))
vim.keymap.set('n', 'E', api.tree.expand_all, opts('Expand All'))
vim.keymap.set('n', 'e', api.fs.rename_basename, opts('Rename: Basename'))
vim.keymap.set('n', ']e', api.node.navigate.diagnostics.next, opts('Next Diagnostic'))
vim.keymap.set('n', '[e', api.node.navigate.diagnostics.prev, opts('Prev Diagnostic'))
vim.keymap.set('n', 'F', api.live_filter.clear, opts('Clean Filter'))
vim.keymap.set('n', 'f', api.live_filter.start, opts('Filter'))
vim.keymap.set('n', 'g?', api.tree.toggle_help, opts('Help'))
vim.keymap.set('n', 'gy', api.fs.copy.absolute_path, opts('Copy Absolute Path'))
vim.keymap.set('n', 'H', api.tree.toggle_hidden_filter, opts('Toggle Dotfiles'))
vim.keymap.set('n', 'I', api.tree.toggle_gitignore_filter, opts('Toggle Git Ignore'))
vim.keymap.set('n', 'J', api.node.navigate.sibling.last, opts('Last Sibling'))
vim.keymap.set('n', 'K', api.node.navigate.sibling.first, opts('First Sibling'))
vim.keymap.set('n', 'm', api.marks.toggle, opts('Toggle Bookmark'))
vim.keymap.set('n', 'o', api.node.open.edit, opts('Open'))
-- vim.keymap.set('n', 'O', api.node.open.no_window_picker, opts('Open: No Window Picker'))
vim.keymap.set('n', 'p', api.fs.paste, opts('Paste'))
vim.keymap.set('n', 'P', api.node.navigate.parent, opts('Parent Directory'))
vim.keymap.set('n', 'q', api.tree.close, opts('Close'))
vim.keymap.set('n', 'r', api.fs.rename, opts('Rename'))
vim.keymap.set('n', 'R', api.tree.reload, opts('Refresh'))
vim.keymap.set('n', 's', api.node.run.system, opts('Run System'))
vim.keymap.set('n', 'S', api.tree.search_node, opts('Search'))
vim.keymap.set('n', 'U', api.tree.toggle_custom_filter, opts('Toggle Hidden'))
vim.keymap.set('n', 'W', api.tree.collapse_all, opts('Collapse'))
vim.keymap.set('n', 'x', api.fs.cut, opts('Cut'))
vim.keymap.set('n', 'y', api.fs.copy.filename, opts('Copy Name'))
vim.keymap.set('n', 'Y', api.fs.copy.relative_path, opts('Copy Relative Path'))
-- put some default mappings here
vim.keymap.set("n", "<C-e>", api.node.open.replace_tree_buffer, opts("Open: In Place"))
vim.keymap.set("n", "<C-k>", api.node.show_info_popup, opts("Info"))
vim.keymap.set("n", "<C-r>", api.fs.rename_sub, opts("Rename: Omit Filename"))
vim.keymap.set("n", "<C-t>", api.node.open.tab, opts("Open: New Tab"))
vim.keymap.set("n", "<C-v>", api.node.open.vertical, opts("Open: Vertical Split"))
vim.keymap.set("n", "<C-x>", api.node.open.horizontal, opts("Open: Horizontal Split"))
vim.keymap.set("n", "<BS>", api.node.navigate.parent_close, opts("Close Directory"))
vim.keymap.set("n", "<CR>", api.node.open.edit, opts("Open"))
vim.keymap.set("n", "<Tab>", api.node.open.preview, opts("Open Preview"))
vim.keymap.set("n", ">", api.node.navigate.sibling.next, opts("Next Sibling"))
vim.keymap.set("n", "<", api.node.navigate.sibling.prev, opts("Previous Sibling"))
vim.keymap.set("n", ".", api.node.run.cmd, opts("Run Command"))
vim.keymap.set("n", "-", api.tree.change_root_to_parent, opts("Up"))
vim.keymap.set("n", "a", api.fs.create, opts("Create"))
vim.keymap.set("n", "bmv", api.marks.bulk.move, opts("Move Bookmarked"))
vim.keymap.set("n", "B", api.tree.toggle_no_buffer_filter, opts("Toggle No Buffer"))
vim.keymap.set("n", "c", api.fs.copy.node, opts("Copy"))
-- vim.keymap.set('n', 'C', api.tree.toggle_git_clean_filter, opts('Toggle Git Clean'))
-- vim.keymap.set('n', '[c', api.node.navigate.git.prev, opts('Prev Git'))
-- vim.keymap.set('n', ']c', api.node.navigate.git.next, opts('Next Git'))
vim.keymap.set("n", "d", api.fs.remove, opts("Delete"))
vim.keymap.set("n", "D", api.fs.trash, opts("Trash"))
vim.keymap.set("n", "E", api.tree.expand_all, opts("Expand All"))
vim.keymap.set("n", "e", api.fs.rename_basename, opts("Rename: Basename"))
vim.keymap.set("n", "]e", api.node.navigate.diagnostics.next, opts("Next Diagnostic"))
vim.keymap.set("n", "[e", api.node.navigate.diagnostics.prev, opts("Prev Diagnostic"))
vim.keymap.set("n", "F", api.live_filter.clear, opts("Clean Filter"))
vim.keymap.set("n", "f", api.live_filter.start, opts("Filter"))
vim.keymap.set("n", "g?", api.tree.toggle_help, opts("Help"))
vim.keymap.set("n", "gy", api.fs.copy.absolute_path, opts("Copy Absolute Path"))
vim.keymap.set("n", "H", api.tree.toggle_hidden_filter, opts("Toggle Dotfiles"))
vim.keymap.set("n", "I", api.tree.toggle_gitignore_filter, opts("Toggle Git Ignore"))
vim.keymap.set("n", "J", api.node.navigate.sibling.last, opts("Last Sibling"))
vim.keymap.set("n", "K", api.node.navigate.sibling.first, opts("First Sibling"))
vim.keymap.set("n", "m", api.marks.toggle, opts("Toggle Bookmark"))
vim.keymap.set("n", "o", api.node.open.edit, opts("Open"))
-- vim.keymap.set('n', 'O', api.node.open.no_window_picker, opts('Open: No Window Picker'))
vim.keymap.set("n", "p", api.fs.paste, opts("Paste"))
vim.keymap.set("n", "P", api.node.navigate.parent, opts("Parent Directory"))
vim.keymap.set("n", "q", api.tree.close, opts("Close"))
vim.keymap.set("n", "r", api.fs.rename, opts("Rename"))
vim.keymap.set("n", "R", api.tree.reload, opts("Refresh"))
vim.keymap.set("n", "s", api.node.run.system, opts("Run System"))
vim.keymap.set("n", "S", api.tree.search_node, opts("Search"))
vim.keymap.set("n", "U", api.tree.toggle_custom_filter, opts("Toggle Hidden"))
vim.keymap.set("n", "W", api.tree.collapse_all, opts("Collapse"))
vim.keymap.set("n", "x", api.fs.cut, opts("Cut"))
vim.keymap.set("n", "y", api.fs.copy.filename, opts("Copy Name"))
vim.keymap.set("n", "Y", api.fs.copy.relative_path, opts("Copy Relative Path"))
end
require("nvim-tree").setup({
on_attach = on_attach,
update_focused_file = {
enable = true,
update_root = false,
ignore_list = {},
},
on_attach = on_attach,
update_focused_file = {
enable = true,
update_root = false,
ignore_list = {},
},
})
map("n", "<C-T>", ":NvimTreeToggle<CR>")

View File

@ -1,28 +1,28 @@
require('nvim-treesitter.configs').setup {
-- A list of parser names, or "all"
-- ensure_installed = { "c", "lua", "vim", "java", "kotlin"},
ensure_installed = "all",
require("nvim-treesitter.configs").setup({
-- A list of parser names, or "all"
-- ensure_installed = { "c", "lua", "vim", "java", "kotlin"},
ensure_installed = "all",
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
highlight = {
-- `false` will disable the whole extension
enable = true,
indent = {
enable = true
},
-- disable = {"java"},
--
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
-- additional_vim_regex_highlighting = true,
additional_vim_regex_highlighting = {"java"},
},
-- rainbow = {
-- enable = true,
-- extended_mode = true,
-- }
}
highlight = {
-- `false` will disable the whole extension
enable = true,
indent = {
enable = true,
},
-- disable = {"java"},
--
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
-- additional_vim_regex_highlighting = true,
additional_vim_regex_highlighting = { "java" },
},
-- rainbow = {
-- enable = true,
-- extended_mode = true,
-- }
})

View File

@ -1,2 +1,2 @@
vim.keymap.set('n', '<leader>y', require('osc52').copy_operator, {expr = true})
vim.keymap.set('v', '<leader>y', require('osc52').copy_visual)
vim.keymap.set("n", "<leader>y", require("osc52").copy_operator, { expr = true })
vim.keymap.set("v", "<leader>y", require("osc52").copy_visual)

View File

@ -1,4 +1,4 @@
require('refactoring').setup({})
require("refactoring").setup({})
-- load refactoring Telescope extension
require("telescope").load_extension("refactoring")
@ -12,15 +12,55 @@ vim.api.nvim_set_keymap(
)
-- Remaps for the refactoring operations currently offered by the plugin
vim.api.nvim_set_keymap("v", "<leader>rx", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function')<CR>]], {noremap = true, silent = true, expr = false})
vim.api.nvim_set_keymap("v", "<leader>rxf", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function To File')<CR>]], {noremap = true, silent = true, expr = false})
vim.api.nvim_set_keymap("v", "<leader>rxv", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Variable')<CR>]], {noremap = true, silent = true, expr = false})
vim.api.nvim_set_keymap("v", "<leader>ri", [[ <Esc><Cmd>lua require('refactoring').refactor('Inline Variable')<CR>]], {noremap = true, silent = true, expr = false})
vim.api.nvim_set_keymap(
"v",
"<leader>rx",
[[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function')<CR>]],
{ noremap = true, silent = true, expr = false }
)
vim.api.nvim_set_keymap(
"v",
"<leader>rxf",
[[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function To File')<CR>]],
{ noremap = true, silent = true, expr = false }
)
vim.api.nvim_set_keymap(
"v",
"<leader>rxv",
[[ <Esc><Cmd>lua require('refactoring').refactor('Extract Variable')<CR>]],
{ noremap = true, silent = true, expr = false }
)
vim.api.nvim_set_keymap(
"v",
"<leader>ri",
[[ <Esc><Cmd>lua require('refactoring').refactor('Inline Variable')<CR>]],
{ noremap = true, silent = true, expr = false }
)
-- Extract block doesn't need visual mode
vim.api.nvim_set_keymap("n", "<leader>rxb", [[ <Cmd>lua require('refactoring').refactor('Extract Block')<CR>]], {noremap = true, silent = true, expr = false})
vim.api.nvim_set_keymap("n", "<leader>rxbf", [[ <Cmd>lua require('refactoring').refactor('Extract Block To File')<CR>]], {noremap = true, silent = true, expr = false})
vim.api.nvim_set_keymap(
"n",
"<leader>rxb",
[[ <Cmd>lua require('refactoring').refactor('Extract Block')<CR>]],
{ noremap = true, silent = true, expr = false }
)
vim.api.nvim_set_keymap(
"n",
"<leader>rxbf",
[[ <Cmd>lua require('refactoring').refactor('Extract Block To File')<CR>]],
{ noremap = true, silent = true, expr = false }
)
-- Inline variable can also pick up the identifier currently under the cursor without visual mode
vim.api.nvim_set_keymap("n", "<leader>ri", [[ <Cmd>lua require('refactoring').refactor('Inline Variable')<CR>]], {noremap = true, silent = true, expr = false})
vim.api.nvim_set_keymap("n", "<leader>rx", [[ <Cmd>lua require('refactoring').refactor('Extract Variable')<CR>]], {noremap = true, silent = true, expr = false})
vim.api.nvim_set_keymap(
"n",
"<leader>ri",
[[ <Cmd>lua require('refactoring').refactor('Inline Variable')<CR>]],
{ noremap = true, silent = true, expr = false }
)
vim.api.nvim_set_keymap(
"n",
"<leader>rx",
[[ <Cmd>lua require('refactoring').refactor('Extract Variable')<CR>]],
{ noremap = true, silent = true, expr = false }
)

View File

@ -1,8 +0,0 @@
local map = require("utils").map
-- vim.g.signify_vcs_cmds = {
-- hg = 'hg cat %f -r p4base',
-- }
map('n', ']d', '<plug>(signify-next-hunk)')
map('n', '[d', '<plug>(signify-prev-hunk)')

View File

@ -1,23 +1,21 @@
require("symbols-outline").setup(
{
show_relative_numbers = true,
keymaps = { -- These keymaps can be a string or a table for multiple keys
-- close = {"<Esc>", "q"},
goto_location = "<Cr>",
-- focus_location = "o",
hover_symbol = "<C-space>",
toggle_preview = "L",
-- rename_symbol = "r",
-- code_actions = "a",
-- fold = "h",
-- unfold = "l",
fold_all = "H",
unfold_all = "L",
fold_reset = "R",
},
}
)
require("symbols-outline").setup({
show_relative_numbers = true,
keymaps = { -- These keymaps can be a string or a table for multiple keys
-- close = {"<Esc>", "q"},
goto_location = "<Cr>",
-- focus_location = "o",
hover_symbol = "<C-space>",
toggle_preview = "L",
-- rename_symbol = "r",
-- code_actions = "a",
-- fold = "h",
-- unfold = "l",
fold_all = "H",
unfold_all = "L",
fold_reset = "R",
},
})
local map = require("utils").map
map('n', '<leader>so', ':SymbolsOutline<cr>')
map("n", "<leader>so", ":SymbolsOutline<cr>")

View File

@ -1,7 +1,7 @@
local home = vim.fn.expand("~/zettelkasten")
require('telekasten').setup({
home = home,
require("telekasten").setup({
home = home,
})
vim.cmd([[

View File

@ -1,20 +1,20 @@
vim.diagnostic.config({
virtual_lines = true,
virtual_text = false,
severity_sort = true,
virtual_lines = true,
virtual_text = false,
severity_sort = true,
})
-- Diagnostics
require("trouble").setup({
signs = {
-- icons / text used for a diagnostic
error = '',
warning = '',
hint = '',
information = '',
other = "?﫠",
},
use_diagnostic_signs = false, -- enabling this will use the signs defined in your lsp client
signs = {
-- icons / text used for a diagnostic
error = "",
warning = "",
hint = "",
information = "",
other = "?﫠",
},
use_diagnostic_signs = false, -- enabling this will use the signs defined in your lsp client
})
-- Mappings

View File

@ -1,5 +1,5 @@
require("which-key").setup {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
require("which-key").setup({
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
})

View File

@ -3,18 +3,17 @@ local use_google = require("utils").use_google
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
package.path = package.path .. ';' .. vim.env.HOME .. "/.vim/lua/?.lua"
package.path = package.path .. ";" .. vim.env.HOME .. "/.vim/lua/?.lua"
require("lazy").setup("plugins")

View File

@ -1,314 +1,327 @@
local use_google = require("utils").use_google
return
{
-- Pretty symbols
'kyazdani42/nvim-web-devicons',
return {
-- Pretty symbols
"kyazdani42/nvim-web-devicons",
'jghauser/mkdir.nvim',
'will133/vim-dirdiff',
'renerocksai/calendar-vim',
'google/vim-searchindex',
-- 'apalmer1377/factorus',
'hrsh7th/vim-vsnip',
'kosayoda/nvim-lightbulb',
'tpope/vim-surround',
'ntpeters/vim-better-whitespace',
'junegunn/fzf.vim',
'nathanaelkane/vim-indent-guides',
'tversteeg/registers.nvim',
'jremmen/vim-ripgrep',
'nvim-lua/plenary.nvim',
"jghauser/mkdir.nvim",
"will133/vim-dirdiff",
"renerocksai/calendar-vim",
"google/vim-searchindex",
-- 'apalmer1377/factorus',
"hrsh7th/vim-vsnip",
"kosayoda/nvim-lightbulb",
"tpope/vim-surround",
"ntpeters/vim-better-whitespace",
"junegunn/fzf.vim",
"nathanaelkane/vim-indent-guides",
"tversteeg/registers.nvim",
"jremmen/vim-ripgrep",
"nvim-lua/plenary.nvim",
{
'preservim/nerdcommenter',
init = function()
require("config.nerdcommenter")
end,
keys = {
{ "<leader>c<Space>", ":call nerdcommenter#Comment(0, 'toggle')<CR>" },
{ "<leader>c<Space>", ":call nerdcommenter#Comment(0, 'toggle')<CR>", mode='v' },
{
"preservim/nerdcommenter",
init = function()
require("config.nerdcommenter")
end,
keys = {
{ "<leader>c<Space>", ":call nerdcommenter#Comment(0, 'toggle')<CR>" },
{ "<leader>c<Space>", ":call nerdcommenter#Comment(0, 'toggle')<CR>", mode = "v" },
{ "<leader>cS", ":call nerdcommenter#Comment(0, 'sexy')<CR>" },
{ "<leader>cS", ":call nerdcommenter#Comment(0, 'sexy')<CR>", mode='v' },
{ "<leader>cS", ":call nerdcommenter#Comment(0, 'sexy')<CR>" },
{ "<leader>cS", ":call nerdcommenter#Comment(0, 'sexy')<CR>", mode = "v" },
{ "<leader>c$", ":call nerdcommenter#Comment(0, 'ToEOL')<CR>" },
{ "<leader>c$", ":call nerdcommenter#Comment(0, 'ToEOL')<CR>", mode='v' },
}
},
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
config = function()
require("config.nvim-treesitter")
end,
lazy = false,
},
{ "<leader>c$", ":call nerdcommenter#Comment(0, 'ToEOL')<CR>" },
{ "<leader>c$", ":call nerdcommenter#Comment(0, 'ToEOL')<CR>", mode = "v" },
},
},
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
require("config.nvim-treesitter")
end,
lazy = false,
},
{
"nvim-neo-tree/neo-tree.nvim",
branch = "v2.x",
config = function()
require("config.neotree")
end,
dependencies = {
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
},
keys = {
{ "<C-n>", ":Neotree filesystem reveal toggle reveal_force_cwd<cr>", desc = "Open NeoTree" },
},
},
{
"nvim-neo-tree/neo-tree.nvim",
branch = "v2.x",
config = function()
require("config.neotree")
end,
dependencies = {
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
},
keys = {
{ "<C-n>", ":Neotree filesystem reveal toggle reveal_force_cwd<cr>", desc = "Open NeoTree" },
},
},
-- Undo tree
{
'mbbill/undotree',
cmd = 'UndotreeToggle',
config = function()
vim.g.undotree_SetFocusWhenToggle = 1
end
},
-- Undo tree
{
"mbbill/undotree",
cmd = "UndotreeToggle",
config = function()
vim.g.undotree_SetFocusWhenToggle = 1
end,
},
{
'renerocksai/telekasten.nvim',
config = function()
require("config.telekasten")
end,
keys = {
{ "<leader>zf", ":lua require('telekasten').find_notes()<CR>", desc = "Find Notes" },
},
},
{ 'ray-x/go.nvim',ft='go' },
{ 'ray-x/guihua.lua',ft='go' },
{
"renerocksai/telekasten.nvim",
config = function()
require("config.telekasten")
end,
keys = {
{ "<leader>zf", ":lua require('telekasten').find_notes()<CR>", desc = "Find Notes" },
},
},
{ "ray-x/go.nvim", ft = "go" },
{ "ray-x/guihua.lua", ft = "go" },
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
'nvim-lua/lsp-status.nvim',
'VonHeikemen/lsp-zero.nvim',
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"nvim-lua/lsp-status.nvim",
"VonHeikemen/lsp-zero.nvim",
-- Completion and linting
{
'hrsh7th/nvim-cmp',
event = "VimEnter",
-- Completion and linting
{
"hrsh7th/nvim-cmp",
event = "VimEnter",
dependencies = {
'onsails/lspkind.nvim',
'neovim/nvim-lspconfig',
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-buffer',
'lukas-reineke/cmp-under-comparator',
'hrsh7th/cmp-cmdline',
'f3fora/cmp-spell',
'hrsh7th/cmp-nvim-lsp-document-symbol',
'hrsh7th/cmp-nvim-lsp-signature-help',
'hrsh7th/cmp-nvim-lua',
'hrsh7th/cmp-path',
'hrsh7th/cmp-vsnip',
'ray-x/cmp-treesitter',
},
config = function()
require("config.lsp")
end
},
{
"tzachar/cmp-tabnine", build = "./install.sh",
event = 'InsertEnter',
cond = not use_google(),
},
{
'ErichDonGubler/lsp_lines.nvim',
event = "VimEnter",
keys = {
{ "<leader>l", function() require("lsp_lines").toggle() end, desc = "Toggle LSP Lines" },
},
},
{
'jose-elias-alvarez/null-ls.nvim',
event = "VimEnter",
config = function()
require("config.null-ls")
end
},
dependencies = {
"onsails/lspkind.nvim",
"neovim/nvim-lspconfig",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"lukas-reineke/cmp-under-comparator",
"hrsh7th/cmp-cmdline",
"f3fora/cmp-spell",
"hrsh7th/cmp-nvim-lsp-document-symbol",
"hrsh7th/cmp-nvim-lsp-signature-help",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-path",
"hrsh7th/cmp-vsnip",
"ray-x/cmp-treesitter",
},
config = function()
require("config.lsp")
end,
},
{
"tzachar/cmp-tabnine",
build = "./install.sh",
event = "InsertEnter",
cond = not use_google(),
},
{
"ErichDonGubler/lsp_lines.nvim",
event = "VimEnter",
keys = {
{
"<leader>l",
function()
require("lsp_lines").toggle()
end,
desc = "Toggle LSP Lines",
},
},
},
{
"jose-elias-alvarez/null-ls.nvim",
event = "VimEnter",
config = function()
require("config.null-ls")
end,
},
{
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
config = function()
require("config.telescope")
end,
dependencies = {
"telescope_codesearch",
"telescope_citc",
"telescope_fig",
'nvim-telescope/telescope-file-browser.nvim',
},
keys = {
{ '<leader>tb', ":Telescope file_buffers", desc = '[T]elescope [B]uffers' } ,
{ '<leader>tf', [[:lua require "telescope".extensions.file_browser.file_browser{}<cr>]], desc = '[T]elescope [F]iles' },
{ '<leader>th', [[:lua require('telescope.builtin').help_tags<cr>]], desc = '[T]elescope [H]elp' },
{ '<leader>tw', [[:lua require('telescope.builtin').grep_string<cr>]], desc = '[T]elescope current [W]ord' },
{ '<leader>tg', [[:lua require('telescope.builtin').live_grep<cr>]], desc = '[T]elescope by [G]rep' },
-- Google mappings
{ '<C-P>', [[:lua require('telescope').extensions.codesearch.find_files{}<CR>]],'n', { noremap = true, silent=true }},
{ '<C-Space>', [[:lua require('telescope').extensions.codesearch.find_query{}<CR>]], { noremap = true, silent = true }},
{ '<leader>cs', [[:lua require('telescope').extensions.codesearch.find_query{}<CR>]], { noremap = true, silent = true }},
{ '<leader>cs', [[:lua require('telescope').extensions.codesearch.find_query{}<CR>]], mode='v', { noremap = true, silent = true }},
{ '<leader>CS', [[:lua require('telescope').extensions.codesearch.find_query{default_text_expand='<cword>'}<CR>]], { noremap = true, silent = true } },
},
},
-- Rust
{
"saecki/crates.nvim",
ft = "rust",
version = "v0.3.0",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("crates").setup()
end,
},
-- Rust
{
'saecki/crates.nvim',
ft = 'rust',
version = 'v0.3.0',
dependencies = { 'nvim-lua/plenary.nvim' },
config = function()
require('crates').setup()
end
},
{ "simrat39/rust-tools.nvim", ft = "rust" },
{'simrat39/rust-tools.nvim', ft = 'rust'},
{
"folke/trouble.nvim",
event = "VimEnter",
config = function()
require("config.trouble")
end,
},
{
'folke/trouble.nvim',
event = "VimEnter",
config = function()
require("config.trouble")
end,
},
{
"ThePrimeagen/refactoring.nvim",
dependencies = {
{ "nvim-lua/plenary.nvim" },
{ "nvim-treesitter/nvim-treesitter" },
},
config = function()
require("config.refactoring")
end,
keys = {
-- remap to open the Telescope refactoring menu in visual mode
{
"<leader>rr",
"<Esc><cmd>lua require('telescope').extensions.refactoring.refactors()<CR>",
{ noremap = true },
},
{
'ThePrimeagen/refactoring.nvim',
dependencies = {
{"nvim-lua/plenary.nvim"},
{"nvim-treesitter/nvim-treesitter"}
},
config = function()
require("config.refactoring")
end,
keys = {
-- remap to open the Telescope refactoring menu in visual mode
{"<leader>rr", "<Esc><cmd>lua require('telescope').extensions.refactoring.refactors()<CR>", { noremap = true }},
-- Remaps for the refactoring operations currently offered by the plugin
{
"<leader>rx",
[[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function')<CR>]],
mode = "v",
{ noremap = true, silent = true, expr = false },
},
{
"<leader>rxf",
[[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function To File')<CR>]],
mode = "v",
{ noremap = true, silent = true, expr = false },
},
{
"<leader>rxv",
[[ <Esc><Cmd>lua require('refactoring').refactor('Extract Variable')<CR>]],
mode = "v",
{ noremap = true, silent = true, expr = false },
},
{
"<leader>ri",
[[ <Esc><Cmd>lua require('refactoring').refactor('Inline Variable')<CR>]],
mode = "v",
{ noremap = true, silent = true, expr = false },
},
-- Remaps for the refactoring operations currently offered by the plugin
{ "<leader>rx", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function')<CR>]], mode ="v", {noremap = true, silent = true, expr = false}},
{ "<leader>rxf", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function To File')<CR>]],mode ="v", {noremap = true, silent = true, expr = false}},
{ "<leader>rxv", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Variable')<CR>]], mode ="v" , {noremap = true, silent = true, expr = false}},
{ "<leader>ri", [[ <Esc><Cmd>lua require('refactoring').refactor('Inline Variable')<CR>]], mode ="v", {noremap = true, silent = true, expr = false}},
-- Extract block doesn't need visual mode
{
"<leader>rxb",
[[ <Cmd>lua require('refactoring').refactor('Extract Block')<CR>]],
{ noremap = true, silent = true, expr = false },
},
{
"<leader>rxbf",
[[ <Cmd>lua require('refactoring').refactor('Extract Block To File')<CR>]],
{ noremap = true, silent = true, expr = false },
},
-- Extract block doesn't need visual mode
{ "<leader>rxb", [[ <Cmd>lua require('refactoring').refactor('Extract Block')<CR>]], {noremap = true, silent = true, expr = false}},
{ "<leader>rxbf", [[ <Cmd>lua require('refactoring').refactor('Extract Block To File')<CR>]], {noremap = true, silent = true, expr = false}},
-- Inline variable can also pick up the identifier currently under the cursor without visual mode
{
"<leader>ri",
[[ <Cmd>lua require('refactoring').refactor('Inline Variable')<CR>]],
{ noremap = true, silent = true, expr = false },
},
{
"<leader>rx",
[[ <Cmd>lua require('refactoring').refactor('Extract Variable')<CR>]],
{ noremap = true, silent = true, expr = false },
},
},
},
{ "andymass/vim-matchup", event = "VimEnter" },
-- Inline variable can also pick up the identifier currently under the cursor without visual mode
{ "<leader>ri", [[ <Cmd>lua require('refactoring').refactor('Inline Variable')<CR>]], {noremap = true, silent = true, expr = false}},
{ "<leader>rx", [[ <Cmd>lua require('refactoring').refactor('Extract Variable')<CR>]], {noremap = true, silent = true, expr = false}},
}
},
{'andymass/vim-matchup', event = 'VimEnter'},
{
"simrat39/symbols-outline.nvim",
config = function()
require("config.symbols-outline")
end,
},
{
"petertriho/nvim-scrollbar",
config = function()
require("scrollbar").setup()
end,
lazy = false,
},
{ 'simrat39/symbols-outline.nvim',
config = function()
require("config.symbols-outline")
end
},
{
'petertriho/nvim-scrollbar',
config = function()
require("scrollbar").setup()
end,
lazy = false,
},
{
"rmagatti/auto-session",
config = function()
require("auto-session").setup({
log_level = "error",
-- auto_session_suppress_dirs = { "~/", "~/Downloads", "/", os.getenv("HOME")},
})
end,
},
{
'rmagatti/auto-session',
config = function()
require("auto-session").setup {
log_level = "error",
auto_session_suppress_dirs = { "~/", "~/Downloads", "/", os.getenv("HOME")},
}
end
},
{
"ipod825/libp.nvim",
config = function()
require("libp").setup()
end,
},
{
"ipod825/libp.nvim",
config = function()
require("libp").setup()
end,
},
{
"nvim-lualine/lualine.nvim",
lazy = false,
config = function()
require("config.lualine")
end,
},
{
"rcarriga/nvim-notify",
config = function()
require("config.notify")
end,
},
{
"catppuccin/nvim",
name = "catppuccin",
lazy = false, -- make sure we load this during startup if it is your main colorscheme
priority = 1000, -- make sure to load this before all the other start plugins
config = function()
require("config.catppuccin")
end,
},
{
"ojroques/nvim-osc52",
config = function()
require("config.oscyank")
end,
},
{
'nvim-lualine/lualine.nvim',
lazy = false,
config = function()
require("config.lualine")
end
},
{
'rcarriga/nvim-notify',
config = function()
require("config.notify")
end
},
-- mine
{
"squk/java-syntax.vim",
lazy = false,
},
{
"catppuccin/nvim",
name = "catppuccin",
lazy = false, -- make sure we load this during startup if it is your main colorscheme
priority = 1000, -- make sure to load this before all the other start plugins
config = function()
require("config.catppuccin")
end
},
{
'ojroques/nvim-osc52',
config = function()
require("config.oscyank")
end
},
-- mine
{
'squk/java-syntax.vim',
lazy = false,
},
{
"folke/which-key.nvim",
config = function()
require("config.whichkey")
end
},
{ 'junegunn/fzf', build = ":call fzf#install()" },
{ 'udalov/kotlin-vim', ft='kotin' },
{
'wesQ3/vim-windowswap',
init = function()
vim.g.windowswap_map_keys = 0
end,
},
{ 'vim-scripts/vcscommand.vim' },
{
'mhinz/vim-signify',
config= function()
require('config.signify')
end
},
{
'j-hui/fidget.nvim',
init = function() require("fidget").setup() end
},
{
"iamcco/markdown-preview.nvim",
build = "cd app && npm install",
init = function()
vim.g.mkdp_filetypes = { "markdown" }
end,
ft = { "markdown" }
},
{
"folke/which-key.nvim",
config = function()
require("config.whichkey")
end,
},
{ "junegunn/fzf", build = ":call fzf#install()" },
{ "udalov/kotlin-vim", ft = "kotin" },
{
"wesQ3/vim-windowswap",
init = function()
vim.g.windowswap_map_keys = 0
end,
},
{ "vim-scripts/vcscommand.vim" },
{
"mhinz/vim-signify",
event = "VimEnter",
keys = {
{ "]d", "<plug>(signify-next-hunk)" },
{ "[d", "<plug>(signify-prev-hunk)" },
},
},
{
"iamcco/markdown-preview.nvim",
build = "cd app && npm install",
init = function()
vim.g.mkdp_filetypes = { "markdown" }
end,
ft = { "markdown" },
},
}

View File

@ -0,0 +1,39 @@
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,
},
-- 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

@ -1,16 +1,16 @@
return {
-- Git
{
'lewis6991/gitsigns.nvim',
dependencies = 'nvim-lua/plenary.nvim',
event = 'User ActuallyEditing',
},
{
'akinsho/git-conflict.nvim',
version = '*',
config = function()
require('git-conflict').setup()
end,
},
{ 'rhysd/conflict-marker.vim' }
-- Git
{
"lewis6991/gitsigns.nvim",
dependencies = "nvim-lua/plenary.nvim",
event = "User ActuallyEditing",
},
{
"akinsho/git-conflict.nvim",
version = "*",
config = function()
require("git-conflict").setup()
end,
},
{ "rhysd/conflict-marker.vim" },
}

View File

@ -36,10 +36,17 @@ if use_google() then
goog("gtimporter"),
goog("blaze"),
goog("buganizer"),
goog("relatedfiles"),
goog("g4"),
goog("outline-window"),
goog("fzf-query"),
{
name = "relatedfiles",
dir = "/usr/share/vim/google/relatedfiles",
dependencies = { "maktaba", "glaive" },
config = function()
vim.cmd([[ Glaive relatedfiles plugin[mappings] ]])
end
},
{
name = "codefmt",
dir = "/usr/share/vim/google/codefmt",

View File

@ -0,0 +1,103 @@
return {
"nvim-telescope/telescope.nvim",
branch = "0.1.x",
config = function()
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
file_browser = {
-- disables netrw and use telescope-file-browser in its place
hijack_netrw = false,
},
codesearch = {
experimental = true, -- enable results from google3/experimental
},
},
})
require("telescope").load_extension("file_browser")
end,
dependencies = {
"telescope_codesearch",
"telescope_citc",
"telescope_fig",
"nvim-telescope/telescope-file-browser.nvim",
},
keys = {
{
"<leader>fb",
":Telescope file_browser path=%:p:h select_buffer=true<CR>",
{ noremap = true },
desc = "[F]ile [B]rowser",
},
{
"<leader>tf",
":Telescope file_browser",
{ noremap = true },
desc = "[T]elescope [F]ilebrowser",
},
{ "<leader>tb", ":Telescope file_buffers", desc = "[T]elescope [B]uffers" },
{ "<leader>th", [[:lua require('telescope.builtin').help_tags<cr>]], desc = "[T]elescope [H]elp" },
{ "<leader>tw", [[:lua require('telescope.builtin').grep_string<cr>]], desc = "[T]elescope current [W]ord" },
{ "<leader>tg", [[:lua require('telescope.builtin').live_grep<cr>]], desc = "[T]elescope by [G]rep" },
-- Google mappings
{
"<C-P>",
[[:lua require('telescope').extensions.codesearch.find_files{}<CR>]],
"n",
{ noremap = true, silent = true },
},
{
"<C-Space>",
[[:lua require('telescope').extensions.codesearch.find_query{}<CR>]],
{ noremap = true, silent = true },
},
{
"<leader>cs",
[[:lua require('telescope').extensions.codesearch.find_query{}<CR>]],
{ noremap = true, silent = true },
},
{
"<leader>cs",
[[:lua require('telescope').extensions.codesearch.find_query{}<CR>]],
mode = "v",
{ noremap = true, silent = true },
},
{
"<leader>CS",
[[:lua require('telescope').extensions.codesearch.find_query{default_text_expand='<cword>'}<CR>]],
{ noremap = true, silent = true },
},
},
}