diff --git a/config/.config/nvim/lua/lsp.lua b/config/.config/nvim/lua/lsp.lua deleted file mode 100644 index fb4635f..0000000 --- a/config/.config/nvim/lua/lsp.lua +++ /dev/null @@ -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 = { - [""] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.scroll_docs(4), - [""] = cmp.mapping.close(), - [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), - [""] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif vim.fn["vsnip#available"](1) == 1 then - feedkey("(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 ``. - end - end, { "i", "s" }), - - [""] = cmp.mapping(function() - if cmp.visible() then - cmp.select_prev_item() - elseif vim.fn["vsnip#jumpable"](-1) == 1 then - feedkey("(vsnip-jump-prev)", "") - end - end, { "i", "s" }), - - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif vim.fn["vsnip#available"](1) == 1 then - feedkey("(vsnip-jump-prev)", "") - else - fallback() -- The fallback function sends a already mapped key. In this case, it's probably ``. - end - end), - - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif vim.fn["vsnip#available"](1) == 1 then - feedkey("(vsnip-expand-or-jump)", "") - else - fallback() -- The fallback function sends a already mapped key. In this case, it's probably ``. - 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", "rn", "lua vim.lsp.buf.rename()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "ca", "lua vim.lsp.buf.code_action()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "L", "lua vim.lsp.buf.hover()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "g0", "lua vim.lsp.buf.document_symbol()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gW", "lua vim.lsp.buf.workspace_symbol()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "lua vim.lsp.buf.definition()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "tab split | lua vim.lsp.buf.definition()", opts) - -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "lua vim.lsp.buf.declaration()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "lua vim.lsp.buf.implementation()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "n", "grf", "lua vim.lsp.buf.references()", opts) -- diagnostics controls references - vim.api.nvim_buf_set_keymap(bufnr, "n", "", "lua vim.lsp.buf.signature_help()", opts) - vim.api.nvim_buf_set_keymap(bufnr, "i", "", "lua vim.lsp.buf.signature_help()", opts) - - vim.api.nvim_buf_set_keymap(bufnr, "n", "gt", "lua vim.lsp.buf.type_definition()", 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 lua vim.lsp.buf.document_highlight()") - vim.api.nvim_command("autocmd CursorHoldI lua vim.lsp.buf.document_highlight()") - vim.api.nvim_command("autocmd CursorMoved 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, -}) diff --git a/vim/.vim/lua/catppuccin-config.lua b/vim/.vim/lua/catppuccin-config.lua new file mode 100644 index 0000000..ea6c596 --- /dev/null +++ b/vim/.vim/lua/catppuccin-config.lua @@ -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 = {}, +}) diff --git a/config/.config/nvim/lua/code_action_utils.lua b/vim/.vim/lua/code_action_utils.lua similarity index 100% rename from config/.config/nvim/lua/code_action_utils.lua rename to vim/.vim/lua/code_action_utils.lua diff --git a/config/.config/nvim/lua/diagnostics.lua b/vim/.vim/lua/diagnostics.lua similarity index 97% rename from config/.config/nvim/lua/diagnostics.lua rename to vim/.vim/lua/diagnostics.lua index e069355..62228d9 100644 --- a/config/.config/nvim/lua/diagnostics.lua +++ b/vim/.vim/lua/diagnostics.lua @@ -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 diff --git a/vim/.vim/lua/lsp.lua b/vim/.vim/lua/lsp.lua new file mode 100644 index 0000000..cc3e5f0 --- /dev/null +++ b/vim/.vim/lua/lsp.lua @@ -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 = { + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.close(), + [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif vim.fn["vsnip#available"](1) == 1 then + feedkey("(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 ``. + end + end, { "i", "s" }), + + [""] = cmp.mapping(function() + if cmp.visible() then + cmp.select_prev_item() + elseif vim.fn["vsnip#jumpable"](-1) == 1 then + feedkey("(vsnip-jump-prev)", "") + end + end, { "i", "s" }), + + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif vim.fn["vsnip#available"](1) == 1 then + feedkey("(vsnip-jump-prev)", "") + else + fallback() -- The fallback function sends a already mapped key. In this case, it's probably ``. + end + end), + + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif vim.fn["vsnip#available"](1) == 1 then + feedkey("(vsnip-expand-or-jump)", "") + else + fallback() -- The fallback function sends a already mapped key. In this case, it's probably ``. + 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", "rn", "lua vim.lsp.buf.rename()", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "ca", "lua vim.lsp.buf.code_action()", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "L", "lua vim.lsp.buf.hover()", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "g0", "lua vim.lsp.buf.document_symbol()", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gW", "lua vim.lsp.buf.workspace_symbol()", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "lua vim.lsp.buf.definition()", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "tab split | lua vim.lsp.buf.definition()", opts) + -- vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "lua vim.lsp.buf.declaration()", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "gi", "lua vim.lsp.buf.implementation()", opts) + vim.api.nvim_buf_set_keymap(bufnr, "n", "grf", "lua vim.lsp.buf.references()", opts) -- diagnostics controls references + vim.api.nvim_buf_set_keymap(bufnr, "n", "", "lua vim.lsp.buf.signature_help()", opts) + vim.api.nvim_buf_set_keymap(bufnr, "i", "", "lua vim.lsp.buf.signature_help()", opts) + + vim.api.nvim_buf_set_keymap(bufnr, "n", "gt", "lua vim.lsp.buf.type_definition()", 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 lua vim.lsp.buf.document_highlight()") + vim.api.nvim_command("autocmd CursorHoldI lua vim.lsp.buf.document_highlight()") + vim.api.nvim_command("autocmd CursorMoved 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, +}) diff --git a/vim/.vim/lua/lualine_config.lua b/vim/.vim/lua/lualine_config.lua new file mode 100644 index 0000000..3c635af --- /dev/null +++ b/vim/.vim/lua/lualine_config.lua @@ -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 = {} +} diff --git a/vim/.vim/lua/notify_config.lua b/vim/.vim/lua/notify_config.lua new file mode 100644 index 0000000..1c9794f --- /dev/null +++ b/vim/.vim/lua/notify_config.lua @@ -0,0 +1,4 @@ +local colors = require("catppuccin.palettes").get_palette() +require("notify").setup({ + background_colour = colors.base, +}) diff --git a/vim/.vim/lua/plugins.lua b/vim/.vim/lua/plugins.lua new file mode 100644 index 0000000..c9be8de --- /dev/null +++ b/vim/.vim/lua/plugins.lua @@ -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{} diff --git a/vim/.vim/lua/symbols-outline-config.lua b/vim/.vim/lua/symbols-outline-config.lua new file mode 100644 index 0000000..89ef680 --- /dev/null +++ b/vim/.vim/lua/symbols-outline-config.lua @@ -0,0 +1,4 @@ +require("symbols-outline").setup() + +local map = require("utils").map +map('n', 'so', ':SymbolsOutline') diff --git a/config/.config/nvim/lua/telescope_config.lua b/vim/.vim/lua/telescope_config.lua similarity index 94% rename from config/.config/nvim/lua/telescope_config.lua rename to vim/.vim/lua/telescope_config.lua index 4e84e14..ad9458a 100644 --- a/config/.config/nvim/lua/telescope_config.lua +++ b/vim/.vim/lua/telescope_config.lua @@ -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', '', +map('n', '', [[lua require('telescope').extensions.codesearch.find_files{}]], { noremap = true, silent=true } ) -- Search using codesearch queries. -vim.api.nvim_set_keymap( +map( "n", "cs", [[lua require('telescope').extensions.codesearch.find_query{}]], @@ -53,7 +55,7 @@ vim.api.nvim_set_keymap( ) -- -- Search for files using codesearch queries. -vim.api.nvim_set_keymap( +map( "n", "cf", [[lua require('telescope').extensions.codesearch.find_files{}]], @@ -61,7 +63,7 @@ vim.api.nvim_set_keymap( ) -- Search for the word under cursor. -vim.api.nvim_set_keymap( +map( "n", "CS", [[lua require('telescope').extensions.codesearch.find_query{default_text_expand=''}]], @@ -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", "CF", [[lua require('telescope').extensions.codesearch.find_files{default_text_expand=''}]], @@ -77,7 +79,7 @@ vim.api.nvim_set_keymap( ) -- Search for text selected in Visual mode. -vim.api.nvim_set_keymap( +map( "v", "cs", [[lua require('telescope').extensions.codesearch.find_query{}]], @@ -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", "cf", [[lua require('telescope').extensions.codesearch.find_files{}]], { noremap = true, silent = true } ) + +map("n", +"ps", +[[:Telescope find_files find_command=hg,pstatus,-ma,-n,--template=]]) diff --git a/config/.config/nvim/lua/treesitter.lua b/vim/.vim/lua/treesitter.lua similarity index 100% rename from config/.config/nvim/lua/treesitter.lua rename to vim/.vim/lua/treesitter.lua diff --git a/vim/.vim/lua/utils.lua b/vim/.vim/lua/utils.lua new file mode 100644 index 0000000..5dfc8ca --- /dev/null +++ b/vim/.vim/lua/utils.lua @@ -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 diff --git a/vim/.vim/plugged/asyncrun.vim b/vim/.vim/plugged/asyncrun.vim index 7ee75ae..eae766d 160000 --- a/vim/.vim/plugged/asyncrun.vim +++ b/vim/.vim/plugged/asyncrun.vim @@ -1 +1 @@ -Subproject commit 7ee75ae20c7d556f1febb6d1a5961e48766c9c0b +Subproject commit eae766d218671754f3a48adc6b3ad7bf2bac0696 diff --git a/vim/.vim/plugged/catppuccin b/vim/.vim/plugged/catppuccin new file mode 160000 index 0000000..d5f8176 --- /dev/null +++ b/vim/.vim/plugged/catppuccin @@ -0,0 +1 @@ +Subproject commit d5f8176232d91c50265f01674d99bf0ab4e79273 diff --git a/vim/.vim/plugged/cmp-nvim-lsp b/vim/.vim/plugged/cmp-nvim-lsp index affe808..3cf38d9 160000 --- a/vim/.vim/plugged/cmp-nvim-lsp +++ b/vim/.vim/plugged/cmp-nvim-lsp @@ -1 +1 @@ -Subproject commit affe808a5c56b71630f17aa7c38e15c59fd648a8 +Subproject commit 3cf38d9c957e95c397b66f91967758b31be4abe6 diff --git a/vim/.vim/plugged/cmp-path b/vim/.vim/plugged/cmp-path index 447c87c..91ff86c 160000 --- a/vim/.vim/plugged/cmp-path +++ b/vim/.vim/plugged/cmp-path @@ -1 +1 @@ -Subproject commit 447c87cdd6e6d6a1d2488b1d43108bfa217f56e1 +Subproject commit 91ff86cd9c29299a64f968ebb45846c485725f23 diff --git a/vim/.vim/plugged/cmp-vsnip b/vim/.vim/plugged/cmp-vsnip index 0abfa18..1ae05c6 160000 --- a/vim/.vim/plugged/cmp-vsnip +++ b/vim/.vim/plugged/cmp-vsnip @@ -1 +1 @@ -Subproject commit 0abfa1860f5e095a07c477da940cfcb0d273b700 +Subproject commit 1ae05c6c867d9ad44bce811056e861e0d5c531cb diff --git a/vim/.vim/plugged/fidget.nvim b/vim/.vim/plugged/fidget.nvim new file mode 160000 index 0000000..1097a86 --- /dev/null +++ b/vim/.vim/plugged/fidget.nvim @@ -0,0 +1 @@ +Subproject commit 1097a86db8ba38e390850dc4035a03ed234a4673 diff --git a/vim/.vim/plugged/google-comments b/vim/.vim/plugged/google-comments index 95d63cd..ad50cd3 160000 --- a/vim/.vim/plugged/google-comments +++ b/vim/.vim/plugged/google-comments @@ -1 +1 @@ -Subproject commit 95d63cd2cf663436838db2c55e39592d319278cb +Subproject commit ad50cd3c71a7553c92a966dba6a03232a81e3812 diff --git a/vim/.vim/plugged/lualine.nvim b/vim/.vim/plugged/lualine.nvim new file mode 160000 index 0000000..edca2b0 --- /dev/null +++ b/vim/.vim/plugged/lualine.nvim @@ -0,0 +1 @@ +Subproject commit edca2b03c724f22bdc310eee1587b1523f31ec7c diff --git a/vim/.vim/plugged/nerdcommenter b/vim/.vim/plugged/nerdcommenter index 2a0a05f..fe74a1b 160000 --- a/vim/.vim/plugged/nerdcommenter +++ b/vim/.vim/plugged/nerdcommenter @@ -1 +1 @@ -Subproject commit 2a0a05ff983aa62d74ba868aadf89deb93dd5454 +Subproject commit fe74a1b890701eb5f196e9639b2147d5f126d9ae diff --git a/vim/.vim/plugged/nord-vim b/vim/.vim/plugged/nord-vim index bc0f057..0748955 160000 --- a/vim/.vim/plugged/nord-vim +++ b/vim/.vim/plugged/nord-vim @@ -1 +1 @@ -Subproject commit bc0f057162491e9228207d74bd88b5efe875316e +Subproject commit 0748955e9e8d9770b44f2bec8456189430b37d9d diff --git a/vim/.vim/plugged/nvim-cmp b/vim/.vim/plugged/nvim-cmp index 2427d06..e94d348 160000 --- a/vim/.vim/plugged/nvim-cmp +++ b/vim/.vim/plugged/nvim-cmp @@ -1 +1 @@ -Subproject commit 2427d06b6508489547cd30b6e86b1c75df363411 +Subproject commit e94d3489311f941788756953df23ca84f83eec95 diff --git a/vim/.vim/plugged/nvim-lspconfig b/vim/.vim/plugged/nvim-lspconfig index dc4dac8..2dd9e06 160000 --- a/vim/.vim/plugged/nvim-lspconfig +++ b/vim/.vim/plugged/nvim-lspconfig @@ -1 +1 @@ -Subproject commit dc4dac8fcb57cfd1cde0c04a28f3f9f3c51b4cf0 +Subproject commit 2dd9e060f21eecd403736bef07ec83b73341d955 diff --git a/vim/.vim/plugged/nvim-notify b/vim/.vim/plugged/nvim-notify new file mode 160000 index 0000000..5e8d494 --- /dev/null +++ b/vim/.vim/plugged/nvim-notify @@ -0,0 +1 @@ +Subproject commit 5e8d4942976bbc45e3adb8f4beb81964a79cfd02 diff --git a/vim/.vim/plugged/nvim-treesitter b/vim/.vim/plugged/nvim-treesitter index 0289160..9279bfe 160000 --- a/vim/.vim/plugged/nvim-treesitter +++ b/vim/.vim/plugged/nvim-treesitter @@ -1 +1 @@ -Subproject commit 0289160c963fac1d0330966a798acacf85a43a88 +Subproject commit 9279bfea5ea7d40a6671cfb415a63c2298545d71 diff --git a/vim/.vim/plugged/nvim-web-devicons b/vim/.vim/plugged/nvim-web-devicons index 9697285..9061e2d 160000 --- a/vim/.vim/plugged/nvim-web-devicons +++ b/vim/.vim/plugged/nvim-web-devicons @@ -1 +1 @@ -Subproject commit 969728506c0175644a1d448f55e311ccdada7eaf +Subproject commit 9061e2d355ecaa2b588b71a35e7a11358a7e51e1 diff --git a/vim/.vim/plugged/onedark.vim b/vim/.vim/plugged/onedark.vim index 1fe54f2..b6b5ffe 160000 --- a/vim/.vim/plugged/onedark.vim +++ b/vim/.vim/plugged/onedark.vim @@ -1 +1 @@ -Subproject commit 1fe54f212f09a03c2b5e277f0fe5b7b9d0b0a4ed +Subproject commit b6b5ffe31a195a3077338d7a506b905e4a51590f diff --git a/vim/.vim/plugged/plenary.nvim b/vim/.vim/plugged/plenary.nvim index 62dc2a7..4b7e520 160000 --- a/vim/.vim/plugged/plenary.nvim +++ b/vim/.vim/plugged/plenary.nvim @@ -1 +1 @@ -Subproject commit 62dc2a7acd2fb2581871a36c1743b29e26c60390 +Subproject commit 4b7e52044bbb84242158d977a50c4cbcd85070c7 diff --git a/vim/.vim/plugged/registers.nvim b/vim/.vim/plugged/registers.nvim index 23f9efc..a87a7c5 160000 --- a/vim/.vim/plugged/registers.nvim +++ b/vim/.vim/plugged/registers.nvim @@ -1 +1 @@ -Subproject commit 23f9efc71cc7aa42a44df8a2f20f6812f6c54abf +Subproject commit a87a7c57dc4c133166fb98bc7c2eded9826ff402 diff --git a/vim/.vim/plugged/symbols-outline.nvim b/vim/.vim/plugged/symbols-outline.nvim new file mode 160000 index 0000000..6a3ed24 --- /dev/null +++ b/vim/.vim/plugged/symbols-outline.nvim @@ -0,0 +1 @@ +Subproject commit 6a3ed24c5631da7a5d418bced57c16b32af7747c diff --git a/vim/.vim/plugged/telescope.nvim b/vim/.vim/plugged/telescope.nvim index 30e2dc5..f174a03 160000 --- a/vim/.vim/plugged/telescope.nvim +++ b/vim/.vim/plugged/telescope.nvim @@ -1 +1 @@ -Subproject commit 30e2dc5232d0dd63709ef8b44a5d6184005e8602 +Subproject commit f174a0367b4fc7cb17710d867e25ea792311c418 diff --git a/vim/.vim/plugged/trouble.nvim b/vim/.vim/plugged/trouble.nvim index 929315e..ed65f84 160000 --- a/vim/.vim/plugged/trouble.nvim +++ b/vim/.vim/plugged/trouble.nvim @@ -1 +1 @@ -Subproject commit 929315ea5f146f1ce0e784c76c943ece6f36d786 +Subproject commit ed65f84abc4a1e5d8f368d7e02601fc0357ea15e diff --git a/vim/.vim/plugged/ultisnips b/vim/.vim/plugged/ultisnips index 1914ef2..e99fdf1 160000 --- a/vim/.vim/plugged/ultisnips +++ b/vim/.vim/plugged/ultisnips @@ -1 +1 @@ -Subproject commit 1914ef242a5b6fc095abc4b2c7702d6697c69324 +Subproject commit e99fdf15cd55a4a8e0cb0a80a6810c1867a5c401 diff --git a/vim/.vim/plugged/undotree b/vim/.vim/plugged/undotree index bf76bf2..bd60cb5 160000 --- a/vim/.vim/plugged/undotree +++ b/vim/.vim/plugged/undotree @@ -1 +1 @@ -Subproject commit bf76bf2d1a097cda024699738286fa81fb6529ac +Subproject commit bd60cb564e3c3220b35293679669bb77af5f389d diff --git a/vim/.vim/plugged/vim-airline b/vim/.vim/plugged/vim-airline deleted file mode 160000 index 78abec3..0000000 --- a/vim/.vim/plugged/vim-airline +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 78abec3b83b5fb1bef51fcdddbcbebd7d4293685 diff --git a/vim/.vim/plugged/vim-snippets b/vim/.vim/plugged/vim-snippets index faaa499..b47c2e3 160000 --- a/vim/.vim/plugged/vim-snippets +++ b/vim/.vim/plugged/vim-snippets @@ -1 +1 @@ -Subproject commit faaa499189c4ee3fe13860e675e2370d55e3e5dd +Subproject commit b47c2e37237875185d170f32cac67af5ab72f22d diff --git a/vim/.vim/plugged/vim-tmux-navigator b/vim/.vim/plugged/vim-tmux-navigator index afb45a5..bd4c38b 160000 --- a/vim/.vim/plugged/vim-tmux-navigator +++ b/vim/.vim/plugged/vim-tmux-navigator @@ -1 +1 @@ -Subproject commit afb45a55b452b9238159047ce7c6e161bd4a9907 +Subproject commit bd4c38be5b4882991494cf77c0601a55bc45eebf diff --git a/vim/.vim/plugged/vim-vsnip b/vim/.vim/plugged/vim-vsnip index 8f199ef..7de8a71 160000 --- a/vim/.vim/plugged/vim-vsnip +++ b/vim/.vim/plugged/vim-vsnip @@ -1 +1 @@ -Subproject commit 8f199ef690ed26dcbb8973d9a6760d1332449ac9 +Subproject commit 7de8a71e5d6e39a05e259f9ad4dba5e0aee8bbba diff --git a/vim/.vim/prefs/google.vim b/vim/.vim/prefs/google.vim index 4afbb49..4d4cb3e 100644 --- a/vim/.vim/prefs/google.vim +++ b/vim/.vim/prefs/google.vim @@ -174,7 +174,6 @@ com! -nargs=? -complete=file Blame :call G4Blame() nnoremap cc :CritiqueUnresolvedComments nnoremap s :call CitCObsession() -nnoremap g :GoogleOutlineWindow " nnoremap ps :PiperSelectActiveFiles nnoremap ps :FzfHgFiles diff --git a/vim/.vim/prefs/leader.vim b/vim/.vim/prefs/leader.vim index 0fc61ed..f7c880d 100644 --- a/vim/.vim/prefs/leader.vim +++ b/vim/.vim/prefs/leader.vim @@ -115,3 +115,13 @@ nmap e :e %% vnoremap p "_dP nnoremap rp :VimuxOpenRunner :VimuxRunCommand '!!' :call VimuxSendKeys("Enter") + +"Showing highlight groups +" nmap sp :call SynStack() +nmap shg :call SynStack() +function! SynStack() + if !exists("*synstack") + return + endif + echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') +endfunc diff --git a/vim/.vim/prefs/plugins.vim b/vim/.vim/prefs/plugins.vim index 47b1eb4..818c13b 100644 --- a/vim/.vim/prefs/plugins.vim +++ b/vim/.vim/prefs/plugins.vim @@ -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' diff --git a/vim/.vimrc b/vim/.vimrc index 9f31853..3638837 100644 --- a/vim/.vimrc +++ b/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