diff --git a/config/.config/nvim/lazy-lock.json b/config/.config/nvim/lazy-lock.json index 9ee90cf..0c607ce 100644 --- a/config/.config/nvim/lazy-lock.json +++ b/config/.config/nvim/lazy-lock.json @@ -3,11 +3,11 @@ "asyncrun.vim": { "branch": "master", "commit": "7191d0c30dd105e5d7f897b9a6ee19cabe734466" }, "auto-session": { "branch": "main", "commit": "21033c6815f249a7839c3a85fc8a6b44d74925c9" }, "calendar-vim": { "branch": "master", "commit": "a7e73e02c92566bf427b2a1d6a61a8f23542cc21" }, - "catppuccin": { "branch": "main", "commit": "ad6305594737e16155c41c176c611e865c26bb6d" }, + "catppuccin": { "branch": "main", "commit": "506a4aa13443e0104ea49b99947cc09488d0791d" }, "ciderlsp_nvim": { "branch": "main", "commit": "7007e1881eb421a4d6f7ef1f31e973f7cc0b4d8d" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-nvim-lsp-document-symbol": { "branch": "main", "commit": "f0f53f704c08ea501f9d222b23491b0d354644b0" }, "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, @@ -20,44 +20,43 @@ "cmp_nvim_ciderlsp": { "branch": "main", "commit": "e1b0015a0c090e20d1cbb34e5639e6dd145d3f3e" }, "conflict-marker.vim": { "branch": "master", "commit": "11a4d42244755505b66b15cd4496a150432eb5e3" }, "crates.nvim": { "branch": "main", "commit": "1dffccc0a95f656ebe00cacb4de282473430c5a1" }, - "factorus": { "branch": "master", "commit": "19816e370df82fe96ca96856cf2be4d1c82302da" }, - "fidget.nvim": { "branch": "main", "commit": "f1c375ba68839eaa4a65efdf2aa078c0da0548fe" }, - "fzf": { "branch": "master", "commit": "d471067e3f46f64e6401d1c5717424535fe4c96c" }, + "formatter.nvim": { "branch": "master", "commit": "fa4f2729cc2909db599169f22d8e55632d4c8d59" }, + "fzf": { "branch": "master", "commit": "01302d097c39c3429de65424c6adb75fcac82187" }, "fzf.vim": { "branch": "master", "commit": "1dcdb21db618055134cd611f4f5918f6d00a5df0" }, "git-conflict.nvim": { "branch": "main", "commit": "8d962d83cae924a314965f738ed1e05a4000d682" }, - "gitsigns.nvim": { "branch": "main", "commit": "f1c5aa10509e8e109f449499b69567191d25320f" }, - "go.nvim": { "branch": "master", "commit": "a8095eb334495caec3099b717cc7f5b1fbc3e628" }, + "gitsigns.nvim": { "branch": "main", "commit": "a36bc3360d584d39b4fb076d855c4180842d4444" }, + "go.nvim": { "branch": "master", "commit": "97b76f3188c64d4dacfc17c7c1543f775a3fb8e8" }, "google_comments": { "branch": "main", "commit": "ad50cd3c71a7553c92a966dba6a03232a81e3812" }, "guihua.lua": { "branch": "master", "commit": "ab8b1f09603cc268770efd057115035dc6cfa83d" }, "hg": { "branch": "main", "commit": "1c4bdf80174ec840ba76c4dc7032c4313db62199" }, "java-syntax.vim": { "branch": "master", "commit": "9a3d76a8c6cd7765ba93a7bdd9280594167e3f1b" }, "kotlin-vim": { "branch": "master", "commit": "53fe045906df8eeb07cb77b078fc93acda6c90b8" }, - "lazy.nvim": { "branch": "main", "commit": "10d4371745f88837c78c8daab00c5be6e48abea4" }, + "lazy.nvim": { "branch": "main", "commit": "b7043f2983d7aead78ca902f3f2053907081859a" }, "libp.nvim": { "branch": "main", "commit": "636b1748e92f66022c1763f32b2ded6b8606eda5" }, "lsp-status.nvim": { "branch": "master", "commit": "54f48eb5017632d81d0fd40112065f1d062d0629" }, - "lsp-zero.nvim": { "branch": "v2.x", "commit": "cf38e6034f2d776ebd16304a334b79543d1ffa60" }, + "lsp-zero.nvim": { "branch": "v2.x", "commit": "52582fc91efb40ee347c20570ff7d32849ef4a89" }, "lsp_lines.nvim": { "branch": "main", "commit": "3b57922d2d79762e6baedaf9d66d8ba71f822816" }, "lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" }, "lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" }, "markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "d381fcb78d7a562c3244e1c8f76406954649db36" }, - "mason.nvim": { "branch": "main", "commit": "4be1226f48bc2011024110f37b17f5ee468df58f" }, + "mason.nvim": { "branch": "main", "commit": "664c987c3b14d2262a4e580f993a3e5045baded0" }, "mkdir.nvim": { "branch": "main", "commit": "c55d1dee4f099528a1853b28bb28caa802eba217" }, - "neo-tree.nvim": { "branch": "v2.x", "commit": "d883632bf8f92f1d5abea4a9c28fb2f90aa795aa" }, + "neo-tree.nvim": { "branch": "v2.x", "commit": "8324fd52f7880bf17142f56b45f544d64eff5ac9" }, "nerdcommenter": { "branch": "master", "commit": "b0b09ea46c9f0509556257bd8b838b40f493d6a0" }, - "nui.nvim": { "branch": "main", "commit": "e916f67b6bae1d290efa7c824ae4e04023cdfb20" }, - "null-ls.nvim": { "branch": "main", "commit": "a138b14099e9623832027ea12b4631ddd2a49256" }, - "nvim-cmp": { "branch": "main", "commit": "b8c2a62b3bd3827aa059b43be3dd4b5c45037d65" }, + "nui.nvim": { "branch": "main", "commit": "d146966a423e60699b084eeb28489fe3b6427599" }, + "null-ls.nvim": { "branch": "main", "commit": "bbaf5a96913aa92281f154b08732be2f57021c45" }, + "nvim-cmp": { "branch": "main", "commit": "e1f1b40790a8cb7e64091fb12cc5ffe350363aa0" }, "nvim-lightbulb": { "branch": "master", "commit": "ca5b44a8efffb5fec1963ccd21f25ec04cc778b7" }, - "nvim-lspconfig": { "branch": "master", "commit": "295c646488d5baa63c6c4da68fe61171b9257375" }, + "nvim-lspconfig": { "branch": "master", "commit": "b6b34b9acf84949f0ac1c00747765e62b81fb38d" }, "nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" }, "nvim-osc52": { "branch": "main", "commit": "3e96035d62290183fe7a11418db2b254fcfcaee3" }, "nvim-scrollbar": { "branch": "main", "commit": "35f99d559041c7c0eff3a41f9093581ceea534e8" }, - "nvim-treesitter": { "branch": "master", "commit": "5822a8c6886f0238a315b57e5e96acdd74d04448" }, - "nvim-web-devicons": { "branch": "master", "commit": "2a125024a137677930efcfdf720f205504c97268" }, + "nvim-treesitter": { "branch": "master", "commit": "f26596386f31d5bd74b85b7d1ab0fd90c5b98608" }, + "nvim-web-devicons": { "branch": "master", "commit": "14b3a5ba63b82b60cde98d0a40319d80f25e8301" }, "nvim_figtree": { "branch": "main", "commit": "9bc3025f46e34732382da1019e256a9d8bec1e55" }, "plenary.nvim": { "branch": "master", "commit": "36aaceb6e93addd20b1b18f94d86aecc552f30c4" }, - "refactoring.nvim": { "branch": "master", "commit": "08bcc40638cd4debd5184f934971858e1c5acff4" }, + "refactoring.nvim": { "branch": "master", "commit": "9f28801ed1803306ddbe5b8058849da412a90648" }, "registers.nvim": { "branch": "main", "commit": "2ab8372bb837f05fae6b43091f10a0b725d113ca" }, "rust-tools.nvim": { "branch": "master", "commit": "71d2cf67b5ed120a0e31b2c8adb210dd2834242f" }, "symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" }, @@ -67,14 +66,14 @@ "telescope_citc": { "branch": "main", "commit": "d6421d5bfe058915ece0daec55e488f8ea05f207" }, "telescope_codesearch": { "branch": "main", "commit": "a26077ad3c68cf897ae1c31da903d6516ebb9c92" }, "telescope_fig": { "branch": "main", "commit": "90150e1aa368b49a5125689b3a6da573a99e2bda" }, - "trouble.nvim": { "branch": "main", "commit": "2af0dd9767526410c88c628f1cbfcb6cf22dd683" }, + "trouble.nvim": { "branch": "main", "commit": "a3372bd2ba3a91882a6e54ed35da13a441d7c167" }, "undotree": { "branch": "master", "commit": "485f01efde4e22cb1ce547b9e8c9238f36566f21" }, "vcscommand.vim": { "branch": "master", "commit": "2fb32681361f37533455d20aaa7fc6eb11b0fa4b" }, "vim-better-whitespace": { "branch": "master", "commit": "1b22dc57a2751c7afbc6025a7da39b7c22db635d" }, "vim-dirdiff": { "branch": "master", "commit": "84bc8999fde4b3c2d8b228b560278ab30c7ea4c9" }, "vim-imp": { "branch": "main", "commit": "394e926ce62010443731f3923031e5afa1279f3e" }, "vim-indent-guides": { "branch": "master", "commit": "a1e1390c0136e63e813d051de2003bf0ee18ae30" }, - "vim-matchup": { "branch": "master", "commit": "3625e099b09bff2db5f04082cb09ba679525980c" }, + "vim-matchup": { "branch": "master", "commit": "3a17944bfa3942da805a381750a1be4b314c64d2" }, "vim-ripgrep": { "branch": "master", "commit": "2bb2425387b449a0cd65a54ceb85e123d7a320b8" }, "vim-searchindex": { "branch": "master", "commit": "b0788c8213210b3bd23b62847dd5a9ebbe4ad648" }, "vim-signify": { "branch": "master", "commit": "7d538b77a5a8806e344b057f8846f6d0c035efa9" }, @@ -87,5 +86,5 @@ "vim-vsnip": { "branch": "master", "commit": "7753ba9c10429c29d25abfd11b4c60b76718c438" }, "vim-windowswap": { "branch": "master", "commit": "15db3f697aa1fa696d99fcdc920c90cd2cec855e" }, "vimux": { "branch": "master", "commit": "616fcb4799674a7a809b14ca2dc155bb6ba25788" }, - "which-key.nvim": { "branch": "main", "commit": "e271c28118998c93a14d189af3395812a1aa646c" } + "which-key.nvim": { "branch": "main", "commit": "d871f2b664afd5aed3dc1d1573bef2fb24ce0484" } } \ No newline at end of file diff --git a/vim/.vim/lua/code_action_utils.lua b/vim/.vim/lua/code_action_utils.lua index 3b04ceb..53a73c0 100644 --- a/vim/.vim/lua/code_action_utils.lua +++ b/vim/.vim/lua/code_action_utils.lua @@ -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 diff --git a/vim/.vim/lua/config/catppuccin.lua b/vim/.vim/lua/config/catppuccin.lua index b7a2325..0335adc 100644 --- a/vim/.vim/lua/config/catppuccin.lua +++ b/vim/.vim/lua/config/catppuccin.lua @@ -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") diff --git a/vim/.vim/lua/config/dap.lua b/vim/.vim/lua/config/dap.lua index c3c0ad2..9ffb38b 100644 --- a/vim/.vim/lua/config/dap.lua +++ b/vim/.vim/lua/config/dap.lua @@ -6,50 +6,58 @@ map("n", "dso", ":lua require'dap'.step_over()") map("n", "di", ":lua require'dap'.repl.open()") 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", "/", "kommentary_line_default", {}) - vim.api.nvim_set_keymap("v", "/", "kommentary_visual_default", {}) + -- Kommentary + vim.api.nvim_set_keymap("n", "/", "kommentary_line_default", {}) + vim.api.nvim_set_keymap("v", "/", "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', '', 'lua vim.lsp.buf.signature_help()', opts) - -- buf_set_keymap('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) - -- buf_set_keymap('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) - -- buf_set_keymap('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) - -- buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) - -- buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) - -- buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references() && vim.cmd("copen")', opts) - -- buf_set_keymap('n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) - -- buf_set_keymap('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', opts) - -- buf_set_keymap('n', ']d', 'lua vim.lsp.diagnostic.goto_next()', opts) - -- buf_set_keymap('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()', opts) - -- Java specific - -- buf_set_keymap("n", "di", "lua require'jdtls'.organize_imports()", opts) - -- buf_set_keymap("n", "dt", "lua require'jdtls'.test_class()", opts) - -- buf_set_keymap("n", "dn", "lua require'jdtls'.test_nearest_method()", opts) - buf_set_keymap("v", "de", "lua require('jdtls').extract_variable(true)", opts) - buf_set_keymap("n", "de", "lua require('jdtls').extract_variable()", opts) - buf_set_keymap("v", "dm", "lua require('jdtls').extract_method(true)", opts) + -- Mappings. + local opts = { noremap = true, silent = true } + -- buf_set_keymap('n', '', 'lua vim.lsp.buf.signature_help()', opts) + -- buf_set_keymap('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) + -- buf_set_keymap('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) + -- buf_set_keymap('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) + -- buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) + -- buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) + -- buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references() && vim.cmd("copen")', opts) + -- buf_set_keymap('n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) + -- buf_set_keymap('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', opts) + -- buf_set_keymap('n', ']d', 'lua vim.lsp.diagnostic.goto_next()', opts) + -- buf_set_keymap('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()', opts) + -- Java specific + -- buf_set_keymap("n", "di", "lua require'jdtls'.organize_imports()", opts) + -- buf_set_keymap("n", "dt", "lua require'jdtls'.test_class()", opts) + -- buf_set_keymap("n", "dn", "lua require'jdtls'.test_nearest_method()", opts) + buf_set_keymap("v", "de", "lua require('jdtls').extract_variable(true)", opts) + buf_set_keymap("n", "de", "lua require('jdtls').extract_variable()", opts) + buf_set_keymap("v", "dm", "lua require('jdtls').extract_method(true)", 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 lua vim.lsp.buf.document_highlight() autocmd CursorMoved 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) diff --git a/vim/.vim/lua/config/fig.lua b/vim/.vim/lua/config/fig.lua index 9911871..cca501c 100644 --- a/vim/.vim/lua/config/fig.lua +++ b/vim/.vim/lua/config/fig.lua @@ -2,32 +2,32 @@ local map = require("utils").map local use_google = require("utils").use_google if use_google() then - map("n", "tm", ":Telescope citc modified") - map("n", "tb", ":Telescope file_browser") + map("n", "tm", ":Telescope citc modified") + map("n", "tb", ":Telescope file_browser") - -- [F]ig [S]tatus - map('n', 'fs', [[lua require('telescope').extensions.fig.status{}]]) + -- [F]ig [S]tatus + map("n", "fs", [[lua require('telescope').extensions.fig.status{}]]) - -- [F]ig [X]l - map('n', 'fx', [[lua require('telescope').extensions.fig.xl{}]]) + -- [F]ig [X]l + map("n", "fx", [[lua require('telescope').extensions.fig.xl{}]]) - -- [F]ig [W]hatsout - map('n', 'fw', [[lua require('telescope').extensions.fig.status{whatsout=true}]]) + -- [F]ig [W]hatsout + map("n", "fw", [[lua require('telescope').extensions.fig.status{whatsout=true}]]) - -- [F]ig [A]mend - map('n', 'fa', [[Hg amend]]) + -- [F]ig [A]mend + map("n", "fa", [[Hg amend]]) - -- [F]ig [A]mend - map('n', 'fe', [[Hg evolve]]) + -- [F]ig [A]mend + map("n", "fe", [[Hg evolve]]) - -- [F]ig [N]ext - map('n', 'fn', [[Hg next]]) - -- - -- [F]ig [P]rev - map('n', 'fp', [[Hg prev]]) - -- - -- [F]ig [U]pload - map('n', 'fu', [[Hg upload tree]]) + -- [F]ig [N]ext + map("n", "fn", [[Hg next]]) + -- + -- [F]ig [P]rev + map("n", "fp", [[Hg prev]]) + -- + -- [F]ig [U]pload + map("n", "fu", [[Hg upload tree]]) - -- map('n', 'f', ':Figtree', { silent = true }) + -- map('n', 'f', ':Figtree', { silent = true }) end diff --git a/vim/.vim/lua/config/google-comments.lua b/vim/.vim/lua/config/google-comments.lua index 25f6029..b6a513e 100644 --- a/vim/.vim/lua/config/google-comments.lua +++ b/vim/.vim/lua/config/google-comments.lua @@ -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', [[GoogleCommentsGotoNextComment]]) -map('n', '[c', [[GoogleCommentsGotoPrevComment]]) +map("n", "]c", [[GoogleCommentsGotoNextComment]]) +map("n", "[c", [[GoogleCommentsGotoPrevComment]]) -map('n', 'nc', [[GoogleCommentsGotoNextComment]]) -map('n', 'pc', [[GoogleCommentsGotoPrevComment]]) -map('n', 'lc', [[GoogleCommentsToggleLineComments]]) -map('n', 'ac', [[GoogleCommentsToggleAllComments]]) -map('n', 'fc', [[GoogleCommentsFetchComments]]) +map("n", "nc", [[GoogleCommentsGotoNextComment]]) +map("n", "pc", [[GoogleCommentsGotoPrevComment]]) +map("n", "lc", [[GoogleCommentsToggleLineComments]]) +map("n", "ac", [[GoogleCommentsToggleAllComments]]) +map("n", "fc", [[GoogleCommentsFetchComments]]) -vim.fn.sign_define('COMMENT_ICON', {text = ''}) +vim.fn.sign_define("COMMENT_ICON", { text = "" }) diff --git a/vim/.vim/lua/config/lsp.lua b/vim/.vim/lua/config/lsp.lua index 9f514c6..0497712 100644 --- a/vim/.vim/lua/config/lsp.lua +++ b/vim/.vim/lua/config/lsp.lua @@ -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 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 + if client.server_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 - lsp_status.on_attach(client) + lsp_status.on_attach(client) - local opts = { noremap = true, silent = true } - vim.api.nvim_set_keymap("n", "rn", "lua vim.lsp.buf.rename()", opts) - vim.api.nvim_set_keymap("n", "ca", "lua vim.lsp.buf.code_action()", opts) - vim.api.nvim_set_keymap("n", "L", "lua vim.lsp.buf.hover()", opts) - vim.api.nvim_set_keymap("n", "g0", "lua vim.lsp.buf.document_symbol()", opts) - vim.api.nvim_set_keymap("n", "gW", "lua vim.lsp.buf.workspace_symbol()", opts) - vim.api.nvim_set_keymap("n", "gd", "lua vim.lsp.buf.definition()", opts) - vim.api.nvim_set_keymap("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_set_keymap("n", "gi", "lua vim.lsp.buf.implementation()", opts) - vim.api.nvim_set_keymap("n", "gI", "lua vim.lsp.buf.implementation()", opts) - vim.api.nvim_set_keymap("n", "gR", "lua vim.lsp.buf.references()", opts) -- diagnostics controls references - vim.api.nvim_set_keymap("n", "", "lua vim.lsp.buf.signature_help()", opts) - vim.api.nvim_set_keymap("i", "", "lua vim.lsp.buf.signature_help()", opts) + local opts = { noremap = true, silent = true } + vim.api.nvim_set_keymap("n", "rn", "lua vim.lsp.buf.rename()", opts) + vim.api.nvim_set_keymap("n", "ca", "lua vim.lsp.buf.code_action()", opts) + vim.api.nvim_set_keymap("n", "L", "lua vim.lsp.buf.hover()", opts) + vim.api.nvim_set_keymap("n", "g0", "lua vim.lsp.buf.document_symbol()", opts) + vim.api.nvim_set_keymap("n", "gW", "lua vim.lsp.buf.workspace_symbol()", opts) + vim.api.nvim_set_keymap("n", "gd", "lua vim.lsp.buf.definition()", opts) + vim.api.nvim_set_keymap("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_set_keymap("n", "gi", "lua vim.lsp.buf.implementation()", opts) + vim.api.nvim_set_keymap("n", "gI", "lua vim.lsp.buf.implementation()", opts) + vim.api.nvim_set_keymap("n", "gR", "lua vim.lsp.buf.references()", opts) -- diagnostics controls references + vim.api.nvim_set_keymap("n", "", "lua vim.lsp.buf.signature_help()", opts) + vim.api.nvim_set_keymap("i", "", "lua vim.lsp.buf.signature_help()", opts) - vim.api.nvim_set_keymap("n", "gt", "lua vim.lsp.buf.type_definition()", opts) + vim.api.nvim_set_keymap("n", "gt", "lua vim.lsp.buf.type_definition()", 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 = { - [""] = 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" }), + 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() + 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_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), - }, + [""] = 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 = 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 ]] +) diff --git a/vim/.vim/lua/config/lualine.lua b/vim/.vim/lua/config/lualine.lua index 0108494..519ebfc 100644 --- a/vim/.vim/lua/config/lualine.lua +++ b/vim/.vim/lua/config/lualine.lua @@ -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 } + }, +}) diff --git a/vim/.vim/lua/config/neotree.lua b/vim/.vim/lua/config/neotree.lua index 4476b38..71b5fc0 100644 --- a/vim/.vim/lua/config/neotree.lua +++ b/vim/.vim/lua/config/neotree.lua @@ -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', '', ':Neotree filesystem reveal toggle reveal_force_cwd') +map("n", "", ":Neotree filesystem reveal toggle reveal_force_cwd") diff --git a/vim/.vim/lua/config/nerdcommenter.lua b/vim/.vim/lua/config/nerdcommenter.lua index 22169ea..c24d0a8 100644 --- a/vim/.vim/lua/config/nerdcommenter.lua +++ b/vim/.vim/lua/config/nerdcommenter.lua @@ -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 diff --git a/vim/.vim/lua/config/nerdtree.lua b/vim/.vim/lua/config/nerdtree.lua index 41197ba..34fce4f 100644 --- a/vim/.vim/lua/config/nerdtree.lua +++ b/vim/.vim/lua/config/nerdtree.lua @@ -1,4 +1,4 @@ local map = require("utils").map -map('n', '', ':NERDTreeToggle') -map('n', '', ':NERDTreeFind') +map("n", "", ":NERDTreeToggle") +map("n", "", ":NERDTreeFind") diff --git a/vim/.vim/lua/config/null-ls.lua b/vim/.vim/lua/config/null-ls.lua index b6a3879..96f6413 100644 --- a/vim/.vim/lua/config/null-ls.lua +++ b/vim/.vim/lua/config/null-ls.lua @@ -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, }) diff --git a/vim/.vim/lua/config/nvim-tree.lua b/vim/.vim/lua/config/nvim-tree.lua index 10d7816..5df7738 100644 --- a/vim/.vim/lua/config/nvim-tree.lua +++ b/vim/.vim/lua/config/nvim-tree.lua @@ -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', '', api.node.open.replace_tree_buffer, opts('Open: In Place')) - vim.keymap.set('n', '', api.node.show_info_popup, opts('Info')) - vim.keymap.set('n', '', api.fs.rename_sub, opts('Rename: Omit Filename')) - vim.keymap.set('n', '', api.node.open.tab, opts('Open: New Tab')) - vim.keymap.set('n', '', api.node.open.vertical, opts('Open: Vertical Split')) - vim.keymap.set('n', '', api.node.open.horizontal, opts('Open: Horizontal Split')) - vim.keymap.set('n', '', api.node.navigate.parent_close, opts('Close Directory')) - vim.keymap.set('n', '', api.node.open.edit, opts('Open')) - vim.keymap.set('n', '', 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", "", api.node.open.replace_tree_buffer, opts("Open: In Place")) + vim.keymap.set("n", "", api.node.show_info_popup, opts("Info")) + vim.keymap.set("n", "", api.fs.rename_sub, opts("Rename: Omit Filename")) + vim.keymap.set("n", "", api.node.open.tab, opts("Open: New Tab")) + vim.keymap.set("n", "", api.node.open.vertical, opts("Open: Vertical Split")) + vim.keymap.set("n", "", api.node.open.horizontal, opts("Open: Horizontal Split")) + vim.keymap.set("n", "", api.node.navigate.parent_close, opts("Close Directory")) + vim.keymap.set("n", "", api.node.open.edit, opts("Open")) + vim.keymap.set("n", "", 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", "", ":NvimTreeToggle") diff --git a/vim/.vim/lua/config/nvim-treesitter.lua b/vim/.vim/lua/config/nvim-treesitter.lua index efdffcf..11d279e 100644 --- a/vim/.vim/lua/config/nvim-treesitter.lua +++ b/vim/.vim/lua/config/nvim-treesitter.lua @@ -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, + -- } +}) diff --git a/vim/.vim/lua/config/oscyank.lua b/vim/.vim/lua/config/oscyank.lua index 1fe185d..41d954f 100644 --- a/vim/.vim/lua/config/oscyank.lua +++ b/vim/.vim/lua/config/oscyank.lua @@ -1,2 +1,2 @@ -vim.keymap.set('n', 'y', require('osc52').copy_operator, {expr = true}) -vim.keymap.set('v', 'y', require('osc52').copy_visual) +vim.keymap.set("n", "y", require("osc52").copy_operator, { expr = true }) +vim.keymap.set("v", "y", require("osc52").copy_visual) diff --git a/vim/.vim/lua/config/refactoring.lua b/vim/.vim/lua/config/refactoring.lua index a4cfd89..e6fb745 100644 --- a/vim/.vim/lua/config/refactoring.lua +++ b/vim/.vim/lua/config/refactoring.lua @@ -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", "rx", [[ lua require('refactoring').refactor('Extract Function')]], {noremap = true, silent = true, expr = false}) -vim.api.nvim_set_keymap("v", "rxf", [[ lua require('refactoring').refactor('Extract Function To File')]], {noremap = true, silent = true, expr = false}) -vim.api.nvim_set_keymap("v", "rxv", [[ lua require('refactoring').refactor('Extract Variable')]], {noremap = true, silent = true, expr = false}) -vim.api.nvim_set_keymap("v", "ri", [[ lua require('refactoring').refactor('Inline Variable')]], {noremap = true, silent = true, expr = false}) +vim.api.nvim_set_keymap( + "v", + "rx", + [[ lua require('refactoring').refactor('Extract Function')]], + { noremap = true, silent = true, expr = false } +) +vim.api.nvim_set_keymap( + "v", + "rxf", + [[ lua require('refactoring').refactor('Extract Function To File')]], + { noremap = true, silent = true, expr = false } +) +vim.api.nvim_set_keymap( + "v", + "rxv", + [[ lua require('refactoring').refactor('Extract Variable')]], + { noremap = true, silent = true, expr = false } +) +vim.api.nvim_set_keymap( + "v", + "ri", + [[ lua require('refactoring').refactor('Inline Variable')]], + { noremap = true, silent = true, expr = false } +) -- Extract block doesn't need visual mode -vim.api.nvim_set_keymap("n", "rxb", [[ lua require('refactoring').refactor('Extract Block')]], {noremap = true, silent = true, expr = false}) -vim.api.nvim_set_keymap("n", "rxbf", [[ lua require('refactoring').refactor('Extract Block To File')]], {noremap = true, silent = true, expr = false}) +vim.api.nvim_set_keymap( + "n", + "rxb", + [[ lua require('refactoring').refactor('Extract Block')]], + { noremap = true, silent = true, expr = false } +) +vim.api.nvim_set_keymap( + "n", + "rxbf", + [[ lua require('refactoring').refactor('Extract Block To File')]], + { 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", "ri", [[ lua require('refactoring').refactor('Inline Variable')]], {noremap = true, silent = true, expr = false}) -vim.api.nvim_set_keymap("n", "rx", [[ lua require('refactoring').refactor('Extract Variable')]], {noremap = true, silent = true, expr = false}) +vim.api.nvim_set_keymap( + "n", + "ri", + [[ lua require('refactoring').refactor('Inline Variable')]], + { noremap = true, silent = true, expr = false } +) +vim.api.nvim_set_keymap( + "n", + "rx", + [[ lua require('refactoring').refactor('Extract Variable')]], + { noremap = true, silent = true, expr = false } +) diff --git a/vim/.vim/lua/config/signify.lua b/vim/.vim/lua/config/signify.lua deleted file mode 100644 index 5e01b04..0000000 --- a/vim/.vim/lua/config/signify.lua +++ /dev/null @@ -1,8 +0,0 @@ -local map = require("utils").map - --- vim.g.signify_vcs_cmds = { --- hg = 'hg cat %f -r p4base', --- } - -map('n', ']d', '(signify-next-hunk)') -map('n', '[d', '(signify-prev-hunk)') diff --git a/vim/.vim/lua/config/symbols-outline.lua b/vim/.vim/lua/config/symbols-outline.lua index 3ee942f..49ed6ed 100644 --- a/vim/.vim/lua/config/symbols-outline.lua +++ b/vim/.vim/lua/config/symbols-outline.lua @@ -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 = {"", "q"}, - goto_location = "", - -- focus_location = "o", - hover_symbol = "", - 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 = {"", "q"}, + goto_location = "", + -- focus_location = "o", + hover_symbol = "", + 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', 'so', ':SymbolsOutline') +map("n", "so", ":SymbolsOutline") diff --git a/vim/.vim/lua/config/telekasten.lua b/vim/.vim/lua/config/telekasten.lua index fbe7800..c6baaa5 100644 --- a/vim/.vim/lua/config/telekasten.lua +++ b/vim/.vim/lua/config/telekasten.lua @@ -1,7 +1,7 @@ local home = vim.fn.expand("~/zettelkasten") -require('telekasten').setup({ - home = home, +require("telekasten").setup({ + home = home, }) vim.cmd([[ diff --git a/vim/.vim/lua/config/trouble.lua b/vim/.vim/lua/config/trouble.lua index 717eda6..49cd1fe 100644 --- a/vim/.vim/lua/config/trouble.lua +++ b/vim/.vim/lua/config/trouble.lua @@ -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 diff --git a/vim/.vim/lua/config/whichkey.lua b/vim/.vim/lua/config/whichkey.lua index e1b07e6..15619ca 100644 --- a/vim/.vim/lua/config/whichkey.lua +++ b/vim/.vim/lua/config/whichkey.lua @@ -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 +}) diff --git a/vim/.vim/lua/plugin_init.lua b/vim/.vim/lua/plugin_init.lua index 5734901..4291cf5 100644 --- a/vim/.vim/lua/plugin_init.lua +++ b/vim/.vim/lua/plugin_init.lua @@ -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") - diff --git a/vim/.vim/lua/plugins/base.lua b/vim/.vim/lua/plugins/base.lua index dd109b8..ceca58a 100644 --- a/vim/.vim/lua/plugins/base.lua +++ b/vim/.vim/lua/plugins/base.lua @@ -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 = { - { "c", ":call nerdcommenter#Comment(0, 'toggle')" }, - { "c", ":call nerdcommenter#Comment(0, 'toggle')", mode='v' }, + { + "preservim/nerdcommenter", + init = function() + require("config.nerdcommenter") + end, + keys = { + { "c", ":call nerdcommenter#Comment(0, 'toggle')" }, + { "c", ":call nerdcommenter#Comment(0, 'toggle')", mode = "v" }, - { "cS", ":call nerdcommenter#Comment(0, 'sexy')" }, - { "cS", ":call nerdcommenter#Comment(0, 'sexy')", mode='v' }, + { "cS", ":call nerdcommenter#Comment(0, 'sexy')" }, + { "cS", ":call nerdcommenter#Comment(0, 'sexy')", mode = "v" }, - { "c$", ":call nerdcommenter#Comment(0, 'ToEOL')" }, - { "c$", ":call nerdcommenter#Comment(0, 'ToEOL')", mode='v' }, - } - }, - { - 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', - config = function() - require("config.nvim-treesitter") - end, - lazy = false, - }, + { "c$", ":call nerdcommenter#Comment(0, 'ToEOL')" }, + { "c$", ":call nerdcommenter#Comment(0, 'ToEOL')", 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 = { - { "", ":Neotree filesystem reveal toggle reveal_force_cwd", 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 = { + { "", ":Neotree filesystem reveal toggle reveal_force_cwd", 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 = { - { "zf", ":lua require('telekasten').find_notes()", 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 = { + { "zf", ":lua require('telekasten').find_notes()", 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 = { - { "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 = { + { + "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 = { - { 'tb', ":Telescope file_buffers", desc = '[T]elescope [B]uffers' } , - { 'tf', [[:lua require "telescope".extensions.file_browser.file_browser{}]], desc = '[T]elescope [F]iles' }, - { 'th', [[:lua require('telescope.builtin').help_tags]], desc = '[T]elescope [H]elp' }, - { 'tw', [[:lua require('telescope.builtin').grep_string]], desc = '[T]elescope current [W]ord' }, - { 'tg', [[:lua require('telescope.builtin').live_grep]], desc = '[T]elescope by [G]rep' }, - -- Google mappings - { '', [[:lua require('telescope').extensions.codesearch.find_files{}]],'n', { noremap = true, silent=true }}, - { '', [[:lua require('telescope').extensions.codesearch.find_query{}]], { noremap = true, silent = true }}, - { 'cs', [[:lua require('telescope').extensions.codesearch.find_query{}]], { noremap = true, silent = true }}, - { 'cs', [[:lua require('telescope').extensions.codesearch.find_query{}]], mode='v', { noremap = true, silent = true }}, - { 'CS', [[:lua require('telescope').extensions.codesearch.find_query{default_text_expand=''}]], { 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 + { + "rr", + "lua require('telescope').extensions.refactoring.refactors()", + { 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 - {"rr", "lua require('telescope').extensions.refactoring.refactors()", { noremap = true }}, + -- Remaps for the refactoring operations currently offered by the plugin + { + "rx", + [[ lua require('refactoring').refactor('Extract Function')]], + mode = "v", + { noremap = true, silent = true, expr = false }, + }, + { + "rxf", + [[ lua require('refactoring').refactor('Extract Function To File')]], + mode = "v", + { noremap = true, silent = true, expr = false }, + }, + { + "rxv", + [[ lua require('refactoring').refactor('Extract Variable')]], + mode = "v", + { noremap = true, silent = true, expr = false }, + }, + { + "ri", + [[ lua require('refactoring').refactor('Inline Variable')]], + mode = "v", + { noremap = true, silent = true, expr = false }, + }, - -- Remaps for the refactoring operations currently offered by the plugin - { "rx", [[ lua require('refactoring').refactor('Extract Function')]], mode ="v", {noremap = true, silent = true, expr = false}}, - { "rxf", [[ lua require('refactoring').refactor('Extract Function To File')]],mode ="v", {noremap = true, silent = true, expr = false}}, - { "rxv", [[ lua require('refactoring').refactor('Extract Variable')]], mode ="v" , {noremap = true, silent = true, expr = false}}, - { "ri", [[ lua require('refactoring').refactor('Inline Variable')]], mode ="v", {noremap = true, silent = true, expr = false}}, + -- Extract block doesn't need visual mode + { + "rxb", + [[ lua require('refactoring').refactor('Extract Block')]], + { noremap = true, silent = true, expr = false }, + }, + { + "rxbf", + [[ lua require('refactoring').refactor('Extract Block To File')]], + { noremap = true, silent = true, expr = false }, + }, - -- Extract block doesn't need visual mode - { "rxb", [[ lua require('refactoring').refactor('Extract Block')]], {noremap = true, silent = true, expr = false}}, - { "rxbf", [[ lua require('refactoring').refactor('Extract Block To File')]], {noremap = true, silent = true, expr = false}}, + -- Inline variable can also pick up the identifier currently under the cursor without visual mode + { + "ri", + [[ lua require('refactoring').refactor('Inline Variable')]], + { noremap = true, silent = true, expr = false }, + }, + { + "rx", + [[ lua require('refactoring').refactor('Extract Variable')]], + { 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 - { "ri", [[ lua require('refactoring').refactor('Inline Variable')]], {noremap = true, silent = true, expr = false}}, - { "rx", [[ lua require('refactoring').refactor('Extract Variable')]], {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", "(signify-next-hunk)" }, + { "[d", "(signify-prev-hunk)" }, + }, + }, + { + "iamcco/markdown-preview.nvim", + build = "cd app && npm install", + init = function() + vim.g.mkdp_filetypes = { "markdown" } + end, + ft = { "markdown" }, + }, } diff --git a/vim/.vim/lua/plugins/formatter.lua b/vim/.vim/lua/plugins/formatter.lua new file mode 100644 index 0000000..7515c08 --- /dev/null +++ b/vim/.vim/lua/plugins/formatter.lua @@ -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, +} diff --git a/vim/.vim/lua/plugins/git.lua b/vim/.vim/lua/plugins/git.lua index dfb6781..d5ada31 100644 --- a/vim/.vim/lua/plugins/git.lua +++ b/vim/.vim/lua/plugins/git.lua @@ -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" }, } diff --git a/vim/.vim/lua/plugins/google.lua b/vim/.vim/lua/plugins/google.lua index 3e2327f..994537d 100644 --- a/vim/.vim/lua/plugins/google.lua +++ b/vim/.vim/lua/plugins/google.lua @@ -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", diff --git a/vim/.vim/lua/plugins/telescope.lua b/vim/.vim/lua/plugins/telescope.lua new file mode 100644 index 0000000..8acdcd5 --- /dev/null +++ b/vim/.vim/lua/plugins/telescope.lua @@ -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 = { + { + "fb", + ":Telescope file_browser path=%:p:h select_buffer=true", + { noremap = true }, + desc = "[F]ile [B]rowser", + }, + { + "tf", + ":Telescope file_browser", + { noremap = true }, + desc = "[T]elescope [F]ilebrowser", + }, + { "tb", ":Telescope file_buffers", desc = "[T]elescope [B]uffers" }, + { "th", [[:lua require('telescope.builtin').help_tags]], desc = "[T]elescope [H]elp" }, + { "tw", [[:lua require('telescope.builtin').grep_string]], desc = "[T]elescope current [W]ord" }, + { "tg", [[:lua require('telescope.builtin').live_grep]], desc = "[T]elescope by [G]rep" }, + + -- Google mappings + { + "", + [[:lua require('telescope').extensions.codesearch.find_files{}]], + "n", + { noremap = true, silent = true }, + }, + { + "", + [[:lua require('telescope').extensions.codesearch.find_query{}]], + { noremap = true, silent = true }, + }, + { + "cs", + [[:lua require('telescope').extensions.codesearch.find_query{}]], + { noremap = true, silent = true }, + }, + { + "cs", + [[:lua require('telescope').extensions.codesearch.find_query{}]], + mode = "v", + { noremap = true, silent = true }, + }, + { + "CS", + [[:lua require('telescope').extensions.codesearch.find_query{default_text_expand=''}]], + { noremap = true, silent = true }, + }, + }, +} diff --git a/vim/.vim/prefs/leader.vim b/vim/.vim/prefs/leader.vim index 82d3a15..fc9d116 100644 --- a/vim/.vim/prefs/leader.vim +++ b/vim/.vim/prefs/leader.vim @@ -112,5 +112,5 @@ function! CopyYank() abort endfunction " autocmd TextYankPost * call CopyYank() -noremap y call CopyYank() -vnoremap y call CopyYank() +noremap y :call CopyYank() +vnoremap y :call CopyYank() diff --git a/zsh/.bash_profile b/zsh/.bash_profile index 9de89fa..bef220d 100644 --- a/zsh/.bash_profile +++ b/zsh/.bash_profile @@ -7,6 +7,8 @@ export PATH=$PATH:$GOPATH/bin export GO111MODULE=auto export CLOUDSDK_PYTHON=python2 +export PATH=$PATH:$HOME/.cargo/bin + export PATH="/opt/local/bin:/opt/local/sbin:$PATH" HISTCONTROL=ignoreboth diff --git a/zsh/.bash_profile.google b/zsh/.bash_profile.google index 72e43be..296cb57 100644 --- a/zsh/.bash_profile.google +++ b/zsh/.bash_profile.google @@ -9,6 +9,7 @@ export XAUTHORITY=~/.Xauthority export GOROOT=/usr/lib/google-golang export PATH=$GOROOT/bin:$PATH export JAVA_HOME=$(readlink -ne /usr/local/buildtools/java/jdk) +export CARGO_NET_GIT_FETCH_WITH_CLI=true source /google/bin/releases/knock/knock.sh function gcert() {