Compare commits
3 Commits
4418786b75
...
21837e0336
Author | SHA1 | Date | |
---|---|---|---|
21837e0336 | |||
450dd13e5b | |||
27ea228fe1 |
@ -1,190 +0,0 @@
|
||||
-- 1. Configure CiderLSP
|
||||
local nvim_lsp = require("lspconfig")
|
||||
local configs = require("lspconfig.configs")
|
||||
configs.ciderlsp = {
|
||||
default_config = {
|
||||
cmd = { "/google/bin/releases/cider/ciderlsp/ciderlsp", "--tooltag=nvim-lsp", "--noforward_sync_responses", "--enable_semantic_tokens", "--relay_mode=true", "--hub_addr=blade:languageservices-staging" ,"--enable_document_highlight"},
|
||||
-- cmd = {'/google/bin/releases/cider/ciderlsp/ciderlsp', '--forward_sync_responses', '--enable_document_highlight'};
|
||||
filetypes = { "c", "cpp", "java", "kotlin", "proto", "textproto", "go", "python", "bzl" },
|
||||
root_dir = nvim_lsp.util.root_pattern("BUILD"),
|
||||
settings = {},
|
||||
},
|
||||
}
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
-- 2. Configure CMP
|
||||
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
|
||||
-- Don't show the dumb matching stuff
|
||||
vim.opt.shortmess:append("c")
|
||||
|
||||
local lspkind = require("lspkind")
|
||||
lspkind.init()
|
||||
|
||||
local cmp = require("cmp")
|
||||
|
||||
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" }),
|
||||
|
||||
["<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),
|
||||
|
||||
["<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 = {
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "path" },
|
||||
{ name = "vim_vsnip" },
|
||||
{ name = 'nvim_ciderlsp', priority = 9 },
|
||||
{ name = "buffer", keyword_length = 5 },
|
||||
},
|
||||
|
||||
sorting = {
|
||||
comparators = {
|
||||
cmp.config.compare.offset,
|
||||
cmp.config.compare.exact,
|
||||
cmp.config.compare.score,
|
||||
|
||||
function(entry1, entry2)
|
||||
local _, entry1_under = entry1.completion_item.label:find("^_+")
|
||||
local _, entry2_under = entry2.completion_item.label:find("^_+")
|
||||
entry1_under = entry1_under or 0
|
||||
entry2_under = entry2_under or 0
|
||||
if entry1_under > entry2_under then
|
||||
return false
|
||||
elseif entry1_under < entry2_under then
|
||||
return true
|
||||
end
|
||||
end,
|
||||
|
||||
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,
|
||||
},
|
||||
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
with_text = true,
|
||||
maxwidth = 40, -- half max width
|
||||
menu = {
|
||||
nvim_ciderlsp = "[🤖]",
|
||||
buffer = "[buffer]",
|
||||
nvim_lsp = "[CiderLSP]",
|
||||
nvim_lua = "[API]",
|
||||
path = "[path]",
|
||||
vim_vsnip = "[snip]",
|
||||
},
|
||||
}),
|
||||
},
|
||||
|
||||
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
|
||||
]])
|
||||
|
||||
-- 3. Set up CiderLSP
|
||||
local on_attach = function(client, bufnr)
|
||||
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
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "L", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "g0", "<cmd>lua vim.lsp.buf.document_symbol()<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gW", "<cmd>lua vim.lsp.buf.workspace_symbol()<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "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_buf_set_keymap(bufnr, "n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "grf", "<cmd>lua vim.lsp.buf.references()<CR>", opts) -- diagnostics controls references
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "i", "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gt", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
|
||||
|
||||
vim.api.nvim_command("augroup LSP")
|
||||
vim.api.nvim_command("autocmd!")
|
||||
if client.resolved_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
|
||||
vim.api.nvim_command("augroup END")
|
||||
end
|
||||
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
capabilities = require('cmp_nvim_ciderlsp').update_capabilities(capabilities)
|
||||
|
||||
nvim_lsp.ciderlsp.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
@ -5,15 +5,17 @@ sleep=5
|
||||
alive_interval=10
|
||||
host=baggins.c.googlers.com
|
||||
|
||||
# Tunnel ADB so locally connected devices work on cloudtop.
|
||||
SSH_OPTS="-YXC -R 5037:localhost:5037 -oServerAliveInterval=$alive_interval"
|
||||
|
||||
tmux_cmd="gcertstatus || gcert; tmuxinator dev"
|
||||
initial_cloudtop_command="gcertstatus || gcert; tmuxinator dev"
|
||||
initial_client_command="gcertstatus || gcert"
|
||||
|
||||
gcertstatus || gcert
|
||||
eval $inital_client_command
|
||||
|
||||
# Just keep reconnecting upon failure
|
||||
while [ 1 ]; do
|
||||
ssh $host -t $SSH_OPTS "$tmux_cmd"
|
||||
ssh $host -t $SSH_OPTS "$initial_cloudtop_command"
|
||||
|
||||
# Don't reconnect if disconnection not due to error (i.e., user detached)
|
||||
if [ $? -eq 0 ]; then break; fi
|
||||
|
87
vim/.vim/lua/catppuccin-config.lua
Normal file
87
vim/.vim/lua/catppuccin-config.lua
Normal file
@ -0,0 +1,87 @@
|
||||
require("catppuccin").setup({
|
||||
compile_path = vim.fn.stdpath("cache") .. "/catppuccin",
|
||||
transparent_background = false,
|
||||
term_colors = false,
|
||||
dim_inactive = {
|
||||
enabled = false,
|
||||
shade = "dark",
|
||||
percentage = 0.15,
|
||||
},
|
||||
styles = {
|
||||
comments = { "italic" },
|
||||
conditionals = { "italic" },
|
||||
loops = {},
|
||||
functions = {},
|
||||
keywords = {},
|
||||
strings = {},
|
||||
variables = {},
|
||||
numbers = {},
|
||||
booleans = {},
|
||||
properties = {},
|
||||
types = {},
|
||||
operators = {},
|
||||
},
|
||||
integrations = {
|
||||
cmp = true,
|
||||
-- coc_nvim = false,
|
||||
dashboard = true,
|
||||
-- fern = false,
|
||||
fidget = true,
|
||||
gitgutter = true,
|
||||
gitsigns = true,
|
||||
-- hop = false,
|
||||
-- illuminate = false,
|
||||
-- leap = false,
|
||||
-- lightspeed = false,
|
||||
-- lsp_saga = false,
|
||||
lsp_trouble = true,
|
||||
-- mason = true,
|
||||
-- markdown = true,
|
||||
-- neogit = false,
|
||||
-- neotest = false,
|
||||
-- neotree = false,
|
||||
notify = true,
|
||||
-- nvimtree = true,
|
||||
-- overseer = false,
|
||||
-- pounce = false,
|
||||
symbols_outline = true,
|
||||
telescope = true,
|
||||
treesitter = true,
|
||||
-- treesitter_context = false,
|
||||
-- ts_rainbow = false,
|
||||
-- vim_sneak = false,
|
||||
-- vimwiki = false,
|
||||
-- which_key = false,
|
||||
|
||||
-- Special integrations, see https://github.com/catppuccin/nvim#special-integrations
|
||||
dap = {
|
||||
enabled = false,
|
||||
enable_ui = false,
|
||||
},
|
||||
indent_blankline = {
|
||||
enabled = true,
|
||||
colored_indent_levels = false,
|
||||
},
|
||||
native_lsp = {
|
||||
enabled = true,
|
||||
virtual_text = {
|
||||
errors = { "italic" },
|
||||
hints = { "italic" },
|
||||
warnings = { "italic" },
|
||||
information = { "italic" },
|
||||
},
|
||||
underlines = {
|
||||
errors = { "underline" },
|
||||
hints = { "underline" },
|
||||
warnings = { "underline" },
|
||||
information = { "underline" },
|
||||
},
|
||||
},
|
||||
navic = {
|
||||
enabled = false,
|
||||
custom_bg = "NONE",
|
||||
},
|
||||
},
|
||||
color_overrides = {},
|
||||
custom_highlights = {},
|
||||
})
|
@ -38,10 +38,10 @@ require("trouble").setup({
|
||||
auto_jump = { "lsp_definitions" }, -- for the given modes, automatically jump if there is only a single result
|
||||
signs = {
|
||||
-- icons / text used for a diagnostic
|
||||
error = "",
|
||||
warning = "",
|
||||
hint = "",
|
||||
information = "",
|
||||
error = ' ',
|
||||
warning = ' ',
|
||||
hint = ' ',
|
||||
information = ' ',
|
||||
other = "",
|
||||
},
|
||||
use_diagnostic_signs = false, -- enabling this will use the signs defined in your lsp client
|
235
vim/.vim/lua/lsp.lua
Normal file
235
vim/.vim/lua/lsp.lua
Normal file
@ -0,0 +1,235 @@
|
||||
-- 1. Configure CiderLSP
|
||||
local nvim_lsp = require("lspconfig")
|
||||
local configs = require("lspconfig.configs")
|
||||
configs.ciderlsp = {
|
||||
default_config = {
|
||||
cmd = { "/google/bin/releases/cider/ciderlsp/ciderlsp", "--tooltag=nvim-lsp", "--forward_sync_responses", "--enable_semantic_tokens", "--relay_mode=true", "--hub_addr=blade:languageservices-staging" ,"--enable_document_highlight"},
|
||||
-- cmd = {'/google/bin/releases/cider/ciderlsp/ciderlsp', '--forward_sync_responses', '--enable_document_highlight'};
|
||||
filetypes = { "c", "cpp", "java", "kotlin", "proto", "textproto", "go", "python", "bzl" },
|
||||
root_dir = nvim_lsp.util.root_pattern("BUILD"),
|
||||
settings = {},
|
||||
},
|
||||
}
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
-- 2. Configure CMP
|
||||
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
|
||||
-- Don't show the dumb matching stuff
|
||||
vim.opt.shortmess:append("c")
|
||||
|
||||
local lspkind = require("lspkind")
|
||||
lspkind.init()
|
||||
|
||||
local cmp = require("cmp")
|
||||
|
||||
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" }),
|
||||
|
||||
["<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),
|
||||
|
||||
["<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 = {
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "path" },
|
||||
{ name = "vim_vsnip" },
|
||||
{ name = 'nvim_ciderlsp', priority = 9 },
|
||||
{ name = "buffer", keyword_length = 5 },
|
||||
},
|
||||
|
||||
sorting = {
|
||||
comparators = {
|
||||
cmp.config.compare.offset,
|
||||
cmp.config.compare.exact,
|
||||
cmp.config.compare.score,
|
||||
|
||||
function(entry1, entry2)
|
||||
local _, entry1_under = entry1.completion_item.label:find("^_+")
|
||||
local _, entry2_under = entry2.completion_item.label:find("^_+")
|
||||
entry1_under = entry1_under or 0
|
||||
entry2_under = entry2_under or 0
|
||||
if entry1_under > entry2_under then
|
||||
return false
|
||||
elseif entry1_under < entry2_under then
|
||||
return true
|
||||
end
|
||||
end,
|
||||
|
||||
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,
|
||||
},
|
||||
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
with_text = true,
|
||||
maxwidth = 40, -- half max width
|
||||
menu = {
|
||||
nvim_ciderlsp = "[🤖]",
|
||||
buffer = "[buffer]",
|
||||
nvim_lsp = "[CiderLSP]",
|
||||
nvim_lua = "[API]",
|
||||
path = "[path]",
|
||||
vim_vsnip = "[snip]",
|
||||
},
|
||||
}),
|
||||
},
|
||||
|
||||
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
|
||||
]])
|
||||
|
||||
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
|
||||
require('notify')('CiderLSP attached', 'info', {timeout=150})
|
||||
require('lualine').refresh()
|
||||
end
|
||||
end
|
||||
|
||||
cider_lsp_handlers["workspace/diagnostic/refresh"] = function(_, result, ctx)
|
||||
VPrint('result:')
|
||||
VPrint(result)
|
||||
VPrint('ctx:')
|
||||
VPrint(ctx)
|
||||
end
|
||||
|
||||
-- 3. Set up CiderLSP
|
||||
local on_attach = function(client, bufnr)
|
||||
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
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "L", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "g0", "<cmd>lua vim.lsp.buf.document_symbol()<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gW", "<cmd>lua vim.lsp.buf.workspace_symbol()<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "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_buf_set_keymap(bufnr, "n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "grf", "<cmd>lua vim.lsp.buf.references()<CR>", opts) -- diagnostics controls references
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "i", "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||
|
||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gt", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
|
||||
|
||||
vim.api.nvim_command("augroup LSP")
|
||||
vim.api.nvim_command("autocmd!")
|
||||
if client.resolved_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
|
||||
vim.api.nvim_command("augroup END")
|
||||
end
|
||||
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
capabilities = require('cmp_nvim_ciderlsp').update_capabilities(capabilities)
|
||||
capabilities['codeLens'] = {dynamicRegistration=false}
|
||||
-- capabilities.workspace.codeLens = {refreshSupport=true}
|
||||
-- capabilities.workspace.diagnostics = {refreshSupport=true}
|
||||
capabilities.textDocument.publishDiagnostics={
|
||||
relatedInformation=true,
|
||||
versionSupport=false,
|
||||
tagSupport={
|
||||
valueSet={
|
||||
1,
|
||||
2
|
||||
}
|
||||
},
|
||||
codeDescriptionSupport=true,
|
||||
dataSupport=true,
|
||||
--layeredDiagnostics=true
|
||||
}
|
||||
|
||||
nvim_lsp.ciderlsp.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
handlers = cider_lsp_handlers,
|
||||
})
|
77
vim/.vim/lua/lualine_config.lua
Normal file
77
vim/.vim/lua/lualine_config.lua
Normal file
@ -0,0 +1,77 @@
|
||||
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 getWords()
|
||||
return tostring(vim.fn.wordcount().words)
|
||||
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
|
||||
end
|
||||
function isCiderLspAttached()
|
||||
if vim.b['is_cider_lsp_attached'] then
|
||||
if vim.b['is_cider_lsp_attached'] == 'yes' then
|
||||
return '✓'
|
||||
else
|
||||
return 'CiderLSP loading..'
|
||||
end
|
||||
else
|
||||
return ''
|
||||
end
|
||||
end
|
||||
local function getLightbulb()
|
||||
return require('nvim-lightbulb').get_status_text()
|
||||
end
|
||||
|
||||
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 = {'filename', {"aerial", depth=-1}, getLightbulb},
|
||||
lualine_x = {'filetype'},
|
||||
lualine_x = {
|
||||
{ 'diagnostics', sources = {"nvim_lsp"}, symbols = {error = ' ', warn = ' ', info = ' ', hint = ' '} },
|
||||
'encoding',
|
||||
'filetype'
|
||||
},
|
||||
lualine_y = {},
|
||||
lualine_z = {'location'}
|
||||
},
|
||||
-- default
|
||||
-- sections = {
|
||||
-- lualine_a = {'mode'},
|
||||
-- lualine_b = {'branch', 'diff', 'diagnostics'},
|
||||
-- lualine_c = {'filename'},
|
||||
-- lualine_x = {'encoding', 'fileformat', 'filetype'},
|
||||
-- lualine_y = {'progress'},
|
||||
-- lualine_z = {'location'}
|
||||
-- },
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
-- lualine_c = {'filename'},
|
||||
lualine_x = {'location'},
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
-- tabline = {},
|
||||
-- winbar = {},
|
||||
-- inactive_winbar = {},
|
||||
-- extensions = {}
|
||||
}
|
4
vim/.vim/lua/notify_config.lua
Normal file
4
vim/.vim/lua/notify_config.lua
Normal file
@ -0,0 +1,4 @@
|
||||
local colors = require("catppuccin.palettes").get_palette()
|
||||
require("notify").setup({
|
||||
background_colour = colors.base,
|
||||
})
|
18
vim/.vim/lua/plugins.lua
Normal file
18
vim/.vim/lua/plugins.lua
Normal file
@ -0,0 +1,18 @@
|
||||
-- Require CiderLSP and Diagnostics modules
|
||||
-- IMPORTANT: Must come after plugins are loaded
|
||||
|
||||
-- CiderLSP
|
||||
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
|
||||
require 'lspconfig'
|
||||
|
||||
require("lsp")
|
||||
require("diagnostics")
|
||||
require("treesitter")
|
||||
require("telescope_config")
|
||||
require("lualine_config")
|
||||
require("notify_config")
|
||||
require("catppuccin-config")
|
||||
require("symbols-outline-config")
|
||||
|
||||
require "fidget".setup{}
|
4
vim/.vim/lua/symbols-outline-config.lua
Normal file
4
vim/.vim/lua/symbols-outline-config.lua
Normal file
@ -0,0 +1,4 @@
|
||||
require("symbols-outline").setup()
|
||||
|
||||
local map = require("utils").map
|
||||
map('n', '<leader>so', ':SymbolsOutline<cr>')
|
@ -38,14 +38,16 @@ require('telescope').setup {
|
||||
}
|
||||
}
|
||||
|
||||
local map = require("utils").map
|
||||
|
||||
-- These custom mappings let you open telescope-codesearch quickly:
|
||||
vim.api.nvim_set_keymap('n', '<C-P>',
|
||||
map('n', '<C-P>',
|
||||
[[<cmd>lua require('telescope').extensions.codesearch.find_files{}<CR>]],
|
||||
{ noremap = true, silent=true }
|
||||
)
|
||||
|
||||
-- Search using codesearch queries.
|
||||
vim.api.nvim_set_keymap(
|
||||
map(
|
||||
"n",
|
||||
"<leader>cs",
|
||||
[[<cmd>lua require('telescope').extensions.codesearch.find_query{}<CR>]],
|
||||
@ -53,7 +55,7 @@ vim.api.nvim_set_keymap(
|
||||
)
|
||||
--
|
||||
-- Search for files using codesearch queries.
|
||||
vim.api.nvim_set_keymap(
|
||||
map(
|
||||
"n",
|
||||
"<leader>cf",
|
||||
[[<cmd>lua require('telescope').extensions.codesearch.find_files{}<CR>]],
|
||||
@ -61,7 +63,7 @@ vim.api.nvim_set_keymap(
|
||||
)
|
||||
|
||||
-- Search for the word under cursor.
|
||||
vim.api.nvim_set_keymap(
|
||||
map(
|
||||
"n",
|
||||
"<leader>CS",
|
||||
[[<cmd>lua require('telescope').extensions.codesearch.find_query{default_text_expand='<cword>'}<CR>]],
|
||||
@ -69,7 +71,7 @@ vim.api.nvim_set_keymap(
|
||||
)
|
||||
|
||||
-- Search for a file having word under cursor in its name.
|
||||
vim.api.nvim_set_keymap(
|
||||
map(
|
||||
"n",
|
||||
"<leader>CF",
|
||||
[[<cmd>lua require('telescope').extensions.codesearch.find_files{default_text_expand='<cword>'}<CR>]],
|
||||
@ -77,7 +79,7 @@ vim.api.nvim_set_keymap(
|
||||
)
|
||||
|
||||
-- Search for text selected in Visual mode.
|
||||
vim.api.nvim_set_keymap(
|
||||
map(
|
||||
"v",
|
||||
"<leader>cs",
|
||||
[[<cmd>lua require('telescope').extensions.codesearch.find_query{}<CR>]],
|
||||
@ -85,9 +87,13 @@ vim.api.nvim_set_keymap(
|
||||
)
|
||||
|
||||
-- Search for file having text selected in Visual mode.
|
||||
vim.api.nvim_set_keymap(
|
||||
map(
|
||||
"v",
|
||||
"<leader>cf",
|
||||
[[<cmd>lua require('telescope').extensions.codesearch.find_files{}<CR>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
|
||||
map("n",
|
||||
"<leader>ps",
|
||||
[[:Telescope find_files find_command=hg,pstatus,-ma,-n,--template=<CR>]])
|
11
vim/.vim/lua/utils.lua
Normal file
11
vim/.vim/lua/utils.lua
Normal file
@ -0,0 +1,11 @@
|
||||
local M = {}
|
||||
|
||||
function M.map(mode, lhs, rhs, opts)
|
||||
local options = { noremap = true }
|
||||
if opts then
|
||||
options = vim.tbl_extend("force", options, opts)
|
||||
end
|
||||
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||
end
|
||||
|
||||
return M
|
Submodule vim/.vim/plugged/asyncrun.vim updated: 7ee75ae20c...eae766d218
1
vim/.vim/plugged/catppuccin
Submodule
1
vim/.vim/plugged/catppuccin
Submodule
Submodule vim/.vim/plugged/catppuccin added at d5f8176232
Submodule vim/.vim/plugged/cmp-nvim-lsp updated: affe808a5c...3cf38d9c95
Submodule vim/.vim/plugged/cmp-path updated: 447c87cdd6...91ff86cd9c
Submodule vim/.vim/plugged/cmp-vsnip updated: 0abfa1860f...1ae05c6c86
1
vim/.vim/plugged/fidget.nvim
Submodule
1
vim/.vim/plugged/fidget.nvim
Submodule
Submodule vim/.vim/plugged/fidget.nvim added at 1097a86db8
Submodule vim/.vim/plugged/google-comments updated: 95d63cd2cf...ad50cd3c71
1
vim/.vim/plugged/lualine.nvim
Submodule
1
vim/.vim/plugged/lualine.nvim
Submodule
Submodule vim/.vim/plugged/lualine.nvim added at edca2b03c7
Submodule vim/.vim/plugged/nerdcommenter updated: 2a0a05ff98...fe74a1b890
Submodule vim/.vim/plugged/nord-vim updated: bc0f057162...0748955e9e
Submodule vim/.vim/plugged/nvim-cmp updated: 2427d06b65...e94d348931
Submodule vim/.vim/plugged/nvim-lspconfig updated: dc4dac8fcb...2dd9e060f2
1
vim/.vim/plugged/nvim-notify
Submodule
1
vim/.vim/plugged/nvim-notify
Submodule
Submodule vim/.vim/plugged/nvim-notify added at 5e8d494297
Submodule vim/.vim/plugged/nvim-treesitter updated: 0289160c96...9279bfea5e
Submodule vim/.vim/plugged/nvim-web-devicons updated: 969728506c...9061e2d355
Submodule vim/.vim/plugged/onedark.vim updated: 1fe54f212f...b6b5ffe31a
Submodule vim/.vim/plugged/plenary.nvim updated: 62dc2a7acd...4b7e52044b
Submodule vim/.vim/plugged/registers.nvim updated: 23f9efc71c...a87a7c57dc
1
vim/.vim/plugged/symbols-outline.nvim
Submodule
1
vim/.vim/plugged/symbols-outline.nvim
Submodule
Submodule vim/.vim/plugged/symbols-outline.nvim added at 6a3ed24c56
Submodule vim/.vim/plugged/telescope.nvim updated: 30e2dc5232...f174a0367b
Submodule vim/.vim/plugged/trouble.nvim updated: 929315ea5f...ed65f84abc
Submodule vim/.vim/plugged/ultisnips updated: 1914ef242a...e99fdf15cd
Submodule vim/.vim/plugged/undotree updated: bf76bf2d1a...bd60cb564e
Submodule vim/.vim/plugged/vim-airline deleted from 78abec3b83
Submodule vim/.vim/plugged/vim-snippets updated: faaa499189...b47c2e3723
Submodule vim/.vim/plugged/vim-tmux-navigator updated: afb45a55b4...bd4c38be5b
Submodule vim/.vim/plugged/vim-vsnip updated: 8f199ef690...7de8a71e5d
@ -174,7 +174,6 @@ com! -nargs=? -complete=file Blame :call G4Blame(<f-args>)
|
||||
|
||||
nnoremap <leader>cc :CritiqueUnresolvedComments<space><cr>
|
||||
nnoremap <leader>s :call CitCObsession()<CR>
|
||||
nnoremap <leader>g :GoogleOutlineWindow<CR>
|
||||
|
||||
" nnoremap <leader>ps :PiperSelectActiveFiles<CR>
|
||||
nnoremap <leader>ps :FzfHgFiles<CR>
|
||||
|
@ -115,3 +115,13 @@ nmap <leader>e :e %%
|
||||
vnoremap <leader>p "_dP
|
||||
|
||||
nnoremap <leader>rp :VimuxOpenRunner<cr> :VimuxRunCommand '!!'<cr> :call VimuxSendKeys("Enter")<cr>
|
||||
|
||||
"Showing highlight groups
|
||||
" nmap <leader>sp :call <SID>SynStack()<CR>
|
||||
nmap <leader>shg :call <SID>SynStack()<CR>
|
||||
function! <SID>SynStack()
|
||||
if !exists("*synstack")
|
||||
return
|
||||
endif
|
||||
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
|
||||
endfunc
|
||||
|
@ -13,6 +13,8 @@ Plug 'hrsh7th/nvim-cmp'
|
||||
Plug 'hrsh7th/vim-vsnip'
|
||||
Plug 'neovim/nvim-lspconfig'
|
||||
Plug 'onsails/lspkind.nvim'
|
||||
Plug 'j-hui/fidget.nvim'
|
||||
Plug 'simrat39/symbols-outline.nvim'
|
||||
" required only for diagnostics
|
||||
Plug 'folke/trouble.nvim'
|
||||
|
||||
@ -26,8 +28,10 @@ Plug 'sso://user/vintharas/telescope-codesearch.nvim'
|
||||
Plug 'ntpeters/vim-better-whitespace' "auto-set tab/space size
|
||||
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
||||
Plug 'junegunn/fzf.vim'
|
||||
Plug 'vim-airline/vim-airline' " ...
|
||||
Plug 'vim-airline/vim-airline-themes'
|
||||
Plug 'nvim-lualine/lualine.nvim'
|
||||
Plug 'rcarriga/nvim-notify'
|
||||
" Plug 'vim-airline/vim-airline' " ...
|
||||
" Plug 'vim-airline/vim-airline-themes'
|
||||
Plug 'nathanaelkane/vim-indent-guides'
|
||||
Plug 'Konfekt/vim-scratchpad'
|
||||
Plug 'guns/xterm-color-table.vim'
|
||||
@ -109,6 +113,7 @@ Plug 'junegunn/vim-easy-align'
|
||||
Plug 'tommcdo/vim-exchange'
|
||||
|
||||
" THEMES
|
||||
Plug 'catppuccin/nvim', { 'as': 'catppuccin' }
|
||||
Plug 'altercation/vim-colors-solarized'
|
||||
Plug 'vim-airline/vim-airline-themes'
|
||||
Plug 'jdkanani/vim-material-theme'
|
||||
|
20
vim/.vimrc
20
vim/.vimrc
@ -2,6 +2,7 @@ set nocompatible " be iMproved, required
|
||||
|
||||
let mapleader="," " BEST LEADER OF ALL TIME (BLOT)
|
||||
filetype off " required
|
||||
set rtp+=~/.vim
|
||||
set rtp+=~/.vim/after
|
||||
|
||||
set directory=/tmp
|
||||
@ -98,19 +99,8 @@ call plug#begin('~/.vim/plugged')
|
||||
source ~/.vim/prefs/airline.vim
|
||||
call plug#end() " required
|
||||
|
||||
" Require CiderLSP and Diagnostics modules
|
||||
" IMPORTANT: Must come after plugins are loaded
|
||||
lua << EOF
|
||||
-- CiderLSP
|
||||
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
lua require("plugins")
|
||||
|
||||
require 'lspconfig'
|
||||
require("lsp")
|
||||
require("diagnostics")
|
||||
require("treesitter")
|
||||
require("telescope_config")
|
||||
|
||||
EOF
|
||||
if filereadable(expand("~/use_google"))
|
||||
source ~/.vim/prefs/cmp.vim
|
||||
source ~/.vim/prefs/imp.vim
|
||||
@ -152,8 +142,12 @@ if (has("termguicolors"))
|
||||
endif
|
||||
set background=dark
|
||||
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
|
||||
colorscheme quantum
|
||||
|
||||
" colorscheme quantum
|
||||
let g:catppuccin_flavour = "macchiato" " latte, frappe, macchiato, mocha
|
||||
colorscheme catppuccin
|
||||
let g:airline_theme='quantum'
|
||||
|
||||
set modifiable
|
||||
set omnifunc= completeopt=menuone,noinsert,noselect
|
||||
|
||||
|
Reference in New Issue
Block a user