From afd1089debc391d8329c9495102e2e679dcaa030 Mon Sep 17 00:00:00 2001 From: Christian Nieves Date: Wed, 6 Dec 2023 00:07:58 +0000 Subject: [PATCH] signify keymaps --- config/.config/nvim/lazy-lock.json | 44 +++++++++++++++--------- vim/.vim/lua/config/lsp-google.lua | 4 +-- vim/.vim/lua/plugins/base.lua | 8 ----- vim/.vim/lua/plugins/google.lua | 4 +++ vim/.vim/lua/plugins/lsp.lua | 17 +--------- vim/.vim/lua/plugins/lsp_lines.lua | 13 +++++-- vim/.vim/lua/plugins/signify.lua | 54 ++++++++++++++++++++++++++++++ zsh/.bash_profile.google | 1 + zsh/.zshrc | 1 + 9 files changed, 102 insertions(+), 44 deletions(-) create mode 100644 vim/.vim/lua/plugins/signify.lua diff --git a/config/.config/nvim/lazy-lock.json b/config/.config/nvim/lazy-lock.json index a7ffb03..4d230ea 100644 --- a/config/.config/nvim/lazy-lock.json +++ b/config/.config/nvim/lazy-lock.json @@ -6,7 +6,7 @@ "asyncrun.vim": { "branch": "master", "commit": "61cc3081963a12048e00e89f8cedc8bd1cb83b8c" }, "auto-session": { "branch": "main", "commit": "3eb26b949e1b90798e84926848551046e2eb0721" }, "bufferline.nvim": { "branch": "main", "commit": "6ecd37e0fa8b156099daedd2191130e083fb1490" }, - "catppuccin": { "branch": "main", "commit": "a8dfb969e76d1a0752d98b5347be9ffb9bca9592" }, + "catppuccin": { "branch": "main", "commit": "919d1f786338ebeced798afbf28cd085cd54542a" }, "ciderlsp-nvim": { "branch": "main", "commit": "f4929e4e00c1136eb88fe685ffe8a9eb7c86dcd9" }, "clyde.vim": { "branch": "master", "commit": "368691fe856c09b0d064f34b35c856ddb196b391" }, "cmp-async-path": { "branch": "main", "commit": "d8229a93d7b71f22c66ca35ac9e6c6cd850ec61d" }, @@ -15,6 +15,7 @@ "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, "cmp-cmdline-history": { "branch": "master", "commit": "003573b72d4635ce636234a826fa8c4ba2895ffe" }, "cmp-emoji": { "branch": "main", "commit": "19075c36d5820253d32e2478b6aaf3734aeaafa0" }, + "cmp-nerdfont": { "branch": "main", "commit": "a3b7c0cadb7bd389f513eecda376d4c6bec90003" }, "cmp-nvim-ciderlsp": { "branch": "main", "commit": "e1b0015a0c090e20d1cbb34e5639e6dd145d3f3e" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-nvim-lsp-document-symbol": { "branch": "main", "commit": "f0f53f704c08ea501f9d222b23491b0d354644b0" }, @@ -26,16 +27,17 @@ "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "conflict-marker.vim": { "branch": "master", "commit": "11a4d42244755505b66b15cd4496a150432eb5e3" }, "crates.nvim": { "branch": "main", "commit": "1dffccc0a95f656ebe00cacb4de282473430c5a1" }, - "debugprint.nvim": { "branch": "main", "commit": "95f0ef6d4f804df8d5790a2cbb91aa78f8f4877d" }, + "debugprint.nvim": { "branch": "main", "commit": "661eea1d6f8237097ae372578fbe7458d690a3ac" }, "firenvim": { "branch": "master", "commit": "138424db463e6c0e862a05166a4ccc781cd7c19d" }, - "formatter.nvim": { "branch": "master", "commit": "91651e6afaf6f73b0ffb8b433c06cd4e06f90403" }, - "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, - "fzf": { "branch": "master", "commit": "952b6af4454ed55626d78e3845c6b5b640ac831d" }, + "formatter.nvim": { "branch": "master", "commit": "cb4778b8432f1ae86dae4634c0b611cb269a4c2f" }, + "friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" }, + "fzf": { "branch": "master", "commit": "cd6788a2bbb37622979c147225593e9badd5b48c" }, "fzf.vim": { "branch": "master", "commit": "1e054c1d075d87903647db9320116d360eb8b024" }, "git-conflict.nvim": { "branch": "main", "commit": "4e0191c9a0ae05d7fbdcdc7f15cd358f56d23bfb" }, - "gitsigns.nvim": { "branch": "main", "commit": "0ccd5fb2316b3f8d8b2f775bc31cae7bc6a77a55" }, - "go.nvim": { "branch": "master", "commit": "da48e6155d69a5602ae3b494ecbda9cda438c0a9" }, + "gitsigns.nvim": { "branch": "main", "commit": "6ef8c54fb526bf3a0bc4efb0b2fe8e6d9a7daed2" }, + "go.nvim": { "branch": "master", "commit": "7b7c20029a817ef51f6b498388488e9850fe45ac" }, "guihua.lua": { "branch": "master", "commit": "cd68996069abedffcd677ca7eee3a660b79e5b32" }, + "harpoon": { "branch": "harpoon2", "commit": "581da797f9d66485f841525af596255270c2bcf5" }, "hg": { "branch": "main", "commit": "1c4bdf80174ec840ba76c4dc7032c4313db62199" }, "java-syntax.vim": { "branch": "master", "commit": "9a3d76a8c6cd7765ba93a7bdd9280594167e3f1b" }, "kanagawa.nvim": { "branch": "master", "commit": "c19b9023842697ec92caf72cd3599f7dd7be4456" }, @@ -51,33 +53,40 @@ "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, "luasnip-google.nvim": { "branch": "main", "commit": "5fd7feb144de0ecea837618c9c9e1bbecc0e3243" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "ab640b38ca9fa50d25d2d249b6606b9456b628d5" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "4eb8e15e3c0757303d4c6dea64d2981fc679e990" }, "mason.nvim": { "branch": "main", "commit": "41e75af1f578e55ba050c863587cffde3556ffa6" }, "mellifluous.nvim": { "branch": "main", "commit": "b0e7d7753331c181633dbaf11b23633c0f72341d" }, "mini.splitjoin": { "branch": "main", "commit": "2b4ade24c1d46ce98801b74fc84241d7b676f9f4" }, "mkdir.nvim": { "branch": "main", "commit": "c55d1dee4f099528a1853b28bb28caa802eba217" }, "neo-tree-diagnostics.nvim": { "branch": "main", "commit": "483019d251c31acd14102bc279f938f98d9a3de6" }, "neo-tree.nvim": { "branch": "v2.x", "commit": "80dc74d081823649809f78370fa5b204aa9a853a" }, - "neodev.nvim": { "branch": "main", "commit": "f972d7e6cd21b691199565cfe3e6487e774a4e8f" }, + "neodev.nvim": { "branch": "main", "commit": "1676d2c24186fc30005317e0306d20c639b2351b" }, "neoscopes": { "branch": "main", "commit": "470dff042004b93c10d262e8b0ad7bf6f703f86f" }, <<<<<<< HEAD "neovim-ayu": { "branch": "master", "commit": "76dbf939b38e03ac5f9bd711ab3e434999f715c8" }, "neovim-throttle-debounce": { "branch": "main", "commit": "5247b097df15016ab31db672b77ec4938bb9cbfd" }, +<<<<<<< HEAD "nui.nvim": { "branch": "main", "commit": "c0c8e347ceac53030f5c1ece1c5a5b6a17a25b32" }, ======= "nui.nvim": { "branch": "main", "commit": "257dccc43b4badc735978f0791d216f7d665b75a" }, >>>>>>> 4c8f5e4 (personal themes) +======= + "nui.nvim": { "branch": "main", "commit": "257dccc43b4badc735978f0791d216f7d665b75a" }, + "nvgoog": { "branch": "main", "commit": "6812863edf5b1f921d6821bee7ec3221cd56606c" }, +>>>>>>> 7da9665 (signify keymaps) "nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" }, "nvim-cmp-buffer-lines": { "branch": "master", "commit": "924ccc04dc5c919b6baa05d45818025baa82699a" }, - "nvim-dap": { "branch": "master", "commit": "e154fdb6d70b3765d71f296e718b29d8b7026a63" }, + "nvim-dap": { "branch": "master", "commit": "13ce59d4852be2bb3cd4967947985cb0ceaff460" }, "nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" }, + "nvim-jdtls": { "branch": "master", "commit": "66b5ace68a5d1c45fdfb1afa8d847e87af2aa1f8" }, "nvim-lightbulb": { "branch": "master", "commit": "8f00b89dd1b1dbde16872bee5fbcee2e58c9b8e9" }, - "nvim-lint": { "branch": "master", "commit": "3a7c15331a57ba40a56f00f29173700af853fa03" }, - "nvim-lspconfig": { "branch": "master", "commit": "addad5176dbbe8bcc82ef91c51c5f1bf6629ec2d" }, + "nvim-lint": { "branch": "master", "commit": "6f589cb93560581dc2a3b9693658afe865e5649e" }, + "nvim-lspconfig": { "branch": "master", "commit": "694aaec65733e2d54d393abf80e526f86726c988" }, "nvim-luapad": { "branch": "master", "commit": "a5b3d6aa1fe5fe75e6124927392a9d3a60a0ecce" }, "nvim-notify": { "branch": "master", "commit": "e4a2022f4fec2d5ebc79afa612f96d8b11c627b3" }, "nvim-scrollbar": { "branch": "main", "commit": "35f99d559041c7c0eff3a41f9093581ceea534e8" }, "nvim-surround": { "branch": "main", "commit": "18016d6af52edc9f1c794dcf6665a26a2962d2ee" }, +<<<<<<< HEAD <<<<<<< HEAD "nvim-treesitter": { "branch": "master", "commit": "7da3cb6323d1e1fbfc4d7dc05cac74946458b8a0" }, "nvim-treesitter-context": { "branch": "master", "commit": "bf4d15ee4e96ff5201f16a4ed14443670662eb90" }, @@ -87,9 +96,14 @@ "nvim-treesitter-context": { "branch": "master", "commit": "bf4d15ee4e96ff5201f16a4ed14443670662eb90" }, "nvim-web-devicons": { "branch": "master", "commit": "7b1c4a8743e71627beb4e00d0a225247ab6eb2f7" }, >>>>>>> 4c8f5e4 (personal themes) +======= + "nvim-treesitter": { "branch": "master", "commit": "80a16deb5146a3eb4648effccda1ab9f45e43e76" }, + "nvim-treesitter-context": { "branch": "master", "commit": "bf4d15ee4e96ff5201f16a4ed14443670662eb90" }, + "nvim-web-devicons": { "branch": "master", "commit": "5efb8bd06841f91f97c90e16de85e96d57e9c862" }, +>>>>>>> 7da9665 (signify keymaps) "omnisharp-extended-lsp.nvim": { "branch": "main", "commit": "53edfb413a54c9e55dcddc9e9fa4977a897e4425" }, "onedark.nvim": { "branch": "main", "commit": "b5161f0c631571640485be5d1c059cab82c86872" }, - "plenary.nvim": { "branch": "master", "commit": "50012918b2fc8357b87cff2a7f7f0446e47da174" }, + "plenary.nvim": { "branch": "master", "commit": "55d9fe89e33efd26f532ef20223e5f9430c8b0c0" }, "refactoring.nvim": { "branch": "master", "commit": "156532476deb10b1b2a32cb38e1078b3f9951c42" }, "registers.nvim": { "branch": "main", "commit": "7a16c6e6fe96f3c9c8bb55b95047d745dd34ca4d" }, "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, @@ -97,7 +111,7 @@ "tabular": { "branch": "master", "commit": "339091ac4dd1f17e225fe7d57b48aff55f99b23a" }, "tagalong.vim": { "branch": "main", "commit": "5a2bbf2b1d5b657685a49d48d98a4aa921c1fde3" }, "telescope-dap.nvim": { "branch": "master", "commit": "4e2d5efb92062f0b865fe59b200b5ed7793833bf" }, - "telescope.nvim": { "branch": "master", "commit": "18774ec7929c8a8003a91e9e1f69f6c32258bbfe" }, + "telescope.nvim": { "branch": "master", "commit": "84c5a71d825b6687a55aed6f41e98b92fd8e5454" }, "telescope_citc": { "branch": "main", "commit": "d6421d5bfe058915ece0daec55e488f8ea05f207" }, "telescope_codesearch": { "branch": "main", "commit": "a26077ad3c68cf897ae1c31da903d6516ebb9c92" }, "telescope_fig": { "branch": "main", "commit": "f6122fe82417ebeaddb9343cfd5584f62a4b8df8" }, @@ -112,7 +126,7 @@ "vim-floaterm": { "branch": "master", "commit": "3f01a623376957437f9376327637491b74719e38" }, "vim-imp": { "branch": "main", "commit": "770c65e23e9d13b76126bfee3715a6345adf518e" }, "vim-maktaba": { "branch": "master", "commit": "fe95bb10f6bb250943a44632107f6a3d76ce5f28" }, - "vim-matchup": { "branch": "master", "commit": "d30b72d20f01478a8486f15a57c89fe3177373db" }, + "vim-matchup": { "branch": "master", "commit": "269f9bea87e20a01438085eb13df539929a12727" }, "vim-ripgrep": { "branch": "master", "commit": "2bb2425387b449a0cd65a54ceb85e123d7a320b8" }, "vim-searchindex": { "branch": "master", "commit": "b0788c8213210b3bd23b62847dd5a9ebbe4ad648" }, "vim-signify": { "branch": "master", "commit": "7d538b77a5a8806e344b057f8846f6d0c035efa9" }, diff --git a/vim/.vim/lua/config/lsp-google.lua b/vim/.vim/lua/config/lsp-google.lua index 6d7c20a..107d6d2 100644 --- a/vim/.vim/lua/config/lsp-google.lua +++ b/vim/.vim/lua/config/lsp-google.lua @@ -26,7 +26,7 @@ function M.setup(capabilities) "bzl", "typescript", }, - root_dir = lspconfig.util.root_pattern("google3/*BUILD"), + root_dir = lspconfig.util.root_pattern("BUILD"), settings = {}, }, } @@ -54,7 +54,7 @@ function M.setup(capabilities) "typescript", "javascript", }, - root_dir = lspconfig.util.root_pattern("google3/*BUILD"), + root_dir = lspconfig.util.root_pattern("BUILD"), settings = {}, }, } diff --git a/vim/.vim/lua/plugins/base.lua b/vim/.vim/lua/plugins/base.lua index 387facb..57863d3 100644 --- a/vim/.vim/lua/plugins/base.lua +++ b/vim/.vim/lua/plugins/base.lua @@ -90,14 +90,6 @@ return { require("libp").setup() end, }, - { - "mhinz/vim-signify", - event = "VimEnter", - keys = { - { "]d", "(signify-next-hunk)" }, - { "[d", "(signify-prev-hunk)" }, - }, - }, { "iamcco/markdown-preview.nvim", build = "cd app && npm install", diff --git a/vim/.vim/lua/plugins/google.lua b/vim/.vim/lua/plugins/google.lua index a443cdf..c8106b4 100644 --- a/vim/.vim/lua/plugins/google.lua +++ b/vim/.vim/lua/plugins/google.lua @@ -13,6 +13,10 @@ if not use_google() then return {} end return { + { url = "sso://user/fentanes/nvgoog" }, + -- Prevent long sessions from losing cwd + -- Load google paths like //google/* with `gf` + { import = "nvgoog.google.misc" }, { name = "maktaba", dir = "/usr/share/vim/google/maktaba", diff --git a/vim/.vim/lua/plugins/lsp.lua b/vim/.vim/lua/plugins/lsp.lua index 9901632..189babe 100644 --- a/vim/.vim/lua/plugins/lsp.lua +++ b/vim/.vim/lua/plugins/lsp.lua @@ -61,23 +61,8 @@ return { 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, - documentSymbol = true, - } - capabilities = vim.tbl_extend("keep", capabilities or {}, lsp_status.capabilities) + local lspconfig = require("lspconfig") local configs = require("lspconfig.configs") require("config.lsp-google").setup(capabilities) diff --git a/vim/.vim/lua/plugins/lsp_lines.lua b/vim/.vim/lua/plugins/lsp_lines.lua index 30b0d28..75b9493 100644 --- a/vim/.vim/lua/plugins/lsp_lines.lua +++ b/vim/.vim/lua/plugins/lsp_lines.lua @@ -17,15 +17,22 @@ return { require("lsp_lines").setup() - vim.diagnostic.config({ virtual_text = false }) - vim.diagnostic.config({ virtual_lines = { highlight_whole_line = false, only_current_line = false } }) + vim.schedule(function() + vim.diagnostic.config({ + virtual_text = true, + virtual_lines = { highlight_whole_line = false, only_current_line = true }, + }) + end) end, keys = { { "l", function() local new_value = not vim.diagnostic.config().virtual_lines.only_current_line - vim.diagnostic.config({ virtual_lines = { only_current_line = new_value } }) + vim.diagnostic.config({ + virtual_text = not new_value, + virtual_lines = { only_current_line = new_value }, + }) return new_value end, desc = "Toggle LSP Lines", diff --git a/vim/.vim/lua/plugins/signify.lua b/vim/.vim/lua/plugins/signify.lua new file mode 100644 index 0000000..feab0cc --- /dev/null +++ b/vim/.vim/lua/plugins/signify.lua @@ -0,0 +1,54 @@ +local use_google = require("utils").use_google + +local function setup_mercurial(hg_cmd) + local git_cmd = "git diff --no-color --no-ext-diff -U0 -- %f" + local rcs_cmd = "rcsdiff -U0 %f 2>%n" + local svn_cmd = "svn diff --diff-cmd %d -x -U0 -- %f" + vim.cmd(string.format( + [[ +let g:signify_vcs_cmds = { + \ 'git': '%s', + \ 'hg': '%s', + \ 'rcs': '%s', + \ 'svn': '%s', + \ } + ]], + git_cmd, + hg_cmd, + rcs_cmd, + svn_cmd + )) +end + +_G.signify_dtup = function() + setup_mercurial('hg diff -r ".^" %f') + vim.cmd([[:SignifyRefresh]]) +end + +_G.signify_dtp4 = function() + setup_mercurial('hg diff -r "p4base" %f') + vim.cmd([[:SignifyRefresh]]) +end + +_G.signify_dtex = function() + setup_mercurial('hg diff -r "exported(.)" %f') + vim.cmd([[:SignifyRefresh]]) +end + +return { + "mhinz/vim-signify", + event = "VimEnter", + keys = { + { "]d", "(signify-next-hunk)" }, + { "[d", "(signify-prev-hunk)" }, + { "sd", ":SignifyDiff" }, + { "sup", ":lua signify_dtup()" }, + { "sex", ":lua signify_dtex()" }, + { "sp4", ":lua signify_dtp4()" }, + }, + config = function() + vim.g.signify_vcs_list = { "hg", "git" } + -- vim.g.signify_sign_change = "*" + vim.g.signify_sign_delete = "-" + end, +} diff --git a/zsh/.bash_profile.google b/zsh/.bash_profile.google index 20d0319..8205da3 100644 --- a/zsh/.bash_profile.google +++ b/zsh/.bash_profile.google @@ -202,5 +202,6 @@ bdoctor_modules() { } alias bisect=/google/data/ro/teams/tetralight/bin/bisect alias copybara='/google/bin/releases/copybara/public/copybara/copybara' +source /etc/bash_completion.d/g4d complete -D -C /google/data/ro/users/sk/skaushik/www/public-tools/flagpick -o bashdefault -o default diff --git a/zsh/.zshrc b/zsh/.zshrc index b2536b5..edd9359 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -6,6 +6,7 @@ setopt SHARE_HISTORY setopt HIST_REDUCE_BLANKS setopt HIST_FIND_NO_DUPS setopt HIST_IGNORE_SPACE +setopt interactivecomments # recognize comment char if [ -f ${HOME}/.zplug/init.zsh ]; then source ${HOME}/.zplug/init.zsh