diff --git a/vim/.vim/lua/plugin_init.lua b/config/.config/nvim/init.lua similarity index 83% rename from vim/.vim/lua/plugin_init.lua rename to config/.config/nvim/init.lua index d96c3fa..a36ebf0 100644 --- a/vim/.vim/lua/plugin_init.lua +++ b/config/.config/nvim/init.lua @@ -1,3 +1,5 @@ +vim.cmd("source " .. vim.fn.expand("$HOME") .. "/.vimrc") + local use_google = require("utils").use_google local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then @@ -20,3 +22,5 @@ local plugins = { require("lazy").setup(plugins) require("config.clipboard") require("config.zip") + +vim.opt.undodir = vim.fn.expand("$HOME") .. "/.undo/" diff --git a/config/.config/nvim/init.vim b/config/.config/nvim/init.vim deleted file mode 100644 index aea6d95..0000000 --- a/config/.config/nvim/init.vim +++ /dev/null @@ -1 +0,0 @@ -source ~/.vimrc diff --git a/config/.config/nvim/lazy-lock.json b/config/.config/nvim/lazy-lock.json index a59531a..7fa9971 100644 --- a/config/.config/nvim/lazy-lock.json +++ b/config/.config/nvim/lazy-lock.json @@ -1,3 +1,120 @@ { - "lazy.nvim": { "branch": "main", "commit": "56ead98e05bb37a4ec28930a54d836d033cf00f2" } + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, + "LuaSnip": { "branch": "master", "commit": "ce0a05ab4e2839e1c48d072c5236cce846a387bc" }, + "actions-preview.nvim": { "branch": "master", "commit": "9f52a01c374318e91337697ebed51c6fae57f8a4" }, + "aerial.nvim": { "branch": "master", "commit": "fd7fbe36772d7a955815c90ff9b58523bfdb410d" }, + "asyncrun.vim": { "branch": "master", "commit": "78dc9277f2b989553861ee7c35b640112d95e1b5" }, + "auto-session": { "branch": "main", "commit": "021b64ed7d4ac68a37be3ad28d8e1cba5bec582c" }, + "bigfile.nvim": { "branch": "main", "commit": "33eb067e3d7029ac77e081cfe7c45361887a311a" }, + "bufferline.nvim": { "branch": "main", "commit": "5726c4e291224181903e960119a11e20ac677a0a" }, + "cmp-async-path": { "branch": "main", "commit": "9d581eec5acf812316913565c135b0d1ee2c9a71" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-calc": { "branch": "main", "commit": "5947b412da67306c5b68698a02a846760059be2e" }, + "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, + "cmp-cmdline-history": { "branch": "master", "commit": "003573b72d4635ce636234a826fa8c4ba2895ffe" }, + "cmp-emoji": { "branch": "main", "commit": "e8398e2adf512a03bb4e1728ca017ffeac670a9f" }, + "cmp-nerdfont": { "branch": "main", "commit": "e97482344ebed29093015a18c155057adf5c842b" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "cmp-nvim-lsp-document-symbol": { "branch": "main", "commit": "f94f7ba948e32cd302caba1c2ca3f7c697fb4fcf" }, + "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, + "cmp-spell": { "branch": "master", "commit": "694a4e50809d6d645c1ea29015dad0c293f019d6" }, + "cmp-treesitter": { "branch": "master", "commit": "958fcfa0d8ce46d215e19cc3992c542f576c4123" }, + "cmp-under-comparator": { "branch": "master", "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "codeium.nvim": { "branch": "main", "commit": "27d2b1ce8c7ba14dbf6e4504bdea8e5548be5476" }, + "conflict-marker.vim": { "branch": "master", "commit": "62742b2ffe7a433988759c67b5c5a22eff74a14b" }, + "conform.nvim": { "branch": "master", "commit": "02fd64fb3d4b18ec029c0e0683c3dc3ec6d2c5b8" }, + "crates.nvim": { "branch": "main", "commit": "8bf8358ee326d5d8c11dcd7ac0bcc9ff97dbc785" }, + "dashboard-nvim": { "branch": "master", "commit": "ae309606940d26d8c9df8b048a6e136b6bbec478" }, + "debugprint.nvim": { "branch": "main", "commit": "74c01be25b8251f30b130ce0ad3425ecb1bad4da" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, + "dropbar.nvim": { "branch": "master", "commit": "e94f33b5eba0be7e89b2a868d0d1770ba09eb17b" }, + "firenvim": { "branch": "master", "commit": "64f9389b88c8b0c7667d45c171a5f25c42d852fb" }, + "flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" }, + "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, + "gdrama-syntax.vim": { "branch": "main", "commit": "004eda58d6e3ce3d1b46bbf257bd99784c475a0e" }, + "git-conflict.nvim": { "branch": "main", "commit": "4bbfdd92d547d2862a75b4e80afaf30e73f7bbb4" }, + "go.nvim": { "branch": "master", "commit": "c6d5ca26377d01c4de1f7bff1cd62c8b43baa6bc" }, + "grug-far.nvim": { "branch": "main", "commit": "3707c4fb6ac982a1ca013c1b3bffa8e396f775cc" }, + "guihua.lua": { "branch": "master", "commit": "d783191eaa75215beae0c80319fcce5e6b3beeda" }, + "harpoon": { "branch": "harpoon2", "commit": "a84ab829eaf3678b586609888ef52f7779102263" }, + "hlchunk.nvim": { "branch": "main", "commit": "5465dd33ade8676d63f6e8493252283060cd72ca" }, + "java-syntax.vim": { "branch": "master", "commit": "9a3d76a8c6cd7765ba93a7bdd9280594167e3f1b" }, + "kotlin-vim": { "branch": "master", "commit": "53fe045906df8eeb07cb77b078fc93acda6c90b8" }, + "lazy.nvim": { "branch": "main", "commit": "014d1d6d78df4e58f962158e6e00261d8632612c" }, + "lazygit.nvim": { "branch": "main", "commit": "02a7a2789fe9e660ef72bec27df342b15bcca6b7" }, + "leap.nvim": { "branch": "main", "commit": "c6bfb191f1161fbabace1f36f578a20ac6c7642c" }, + "lsp-status.nvim": { "branch": "master", "commit": "54f48eb5017632d81d0fd40112065f1d062d0629" }, + "lsp-timeout.nvim": { "branch": "main", "commit": "6325906730330105a9adc41d0ceb8499b3072e2b" }, + "lsp-virtual-improved.nvim": { "branch": "master", "commit": "79354d877c3e8bd9da0a9757abc3d7443dc01da5" }, + "lsp-zero.nvim": { "branch": "v3.x", "commit": "ab2a3413646fedd77aa0eab4214a6473e62f6a64" }, + "lsp_lines.nvim": { "branch": "main", "commit": "dbfd8e96ec2696e1ceedcd23fd70e842256e3dea" }, + "lsp_signature.nvim": { "branch": "master", "commit": "fc38521ea4d9ec8dbd4c2819ba8126cea743943b" }, + "lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, + "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "8e46de9241d3997927af12196bd8faa0ed08c29a" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "mini.icons": { "branch": "main", "commit": "54686be7d58807906cb2c8c2216e0bf9c044f19a" }, + "mini.notify": { "branch": "main", "commit": "a933dc637b84314976d6482449f9f51ecd02d2b3" }, + "mkdir.nvim": { "branch": "main", "commit": "c55d1dee4f099528a1853b28bb28caa802eba217" }, + "moonfly": { "branch": "master", "commit": "49701afd56b6ad7877dd20a192016f74f518e291" }, + "neo-tree.nvim": { "branch": "main", "commit": "42caaf5c3b7ca346ab278201151bb878006a6031" }, + "neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" }, + "neogen": { "branch": "main", "commit": "37dd095892e3f846418c465852f7b21f81d0f46c" }, + "neoscopes": { "branch": "main", "commit": "d9655aa272f22378c1cfccce2a4e9d53f986e414" }, + "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, + "nvim-cmp": { "branch": "main", "commit": "ca4d3330d386e76967e53b85953c170658255ecb" }, + "nvim-cmp-buffer-lines": { "branch": "master", "commit": "924ccc04dc5c919b6baa05d45818025baa82699a" }, + "nvim-colorizer.lua": { "branch": "master", "commit": "4acf88d31b3a7a1a7f31e9c30bf2b23c6313abdb" }, + "nvim-dap": { "branch": "master", "commit": "580d6e526358afd0e4bba053e68fd59cf581a161" }, + "nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "76d80c3d171224315b61c006502a1e30c213a9ab" }, + "nvim-jdtls": { "branch": "master", "commit": "ece818f909c6414cbad4e1fb240d87e003e10fda" }, + "nvim-lightbulb": { "branch": "master", "commit": "1cae7b7153ae98dcf1b11173a443ac1b6d8e3d49" }, + "nvim-lint": { "branch": "master", "commit": "6b46370d02cd001509a765591a3ffc481b538794" }, + "nvim-lspconfig": { "branch": "master", "commit": "47f236c058f0511702286a21ba53bbf42abbd8a8" }, + "nvim-luapad": { "branch": "master", "commit": "176686eb616a5ada5dfc748f2b5109194bbe8a71" }, + "nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" }, + "nvim-notify": { "branch": "master", "commit": "fbef5d32be8466dd76544a257d3f3dce20082a07" }, + "nvim-scrollbar": { "branch": "main", "commit": "6994eb9f73d5fdc36ee2c8717940e8c853e51a49" }, + "nvim-surround": { "branch": "main", "commit": "9f0cb495f25bff32c936062d85046fbda0c43517" }, + "nvim-treesitter": { "branch": "master", "commit": "894cb3cebbad0535fb4e319ada5d875dbc48d8b9" }, + "omnisharp-extended-lsp.nvim": { "branch": "main", "commit": "4916fa12e5b28d21a1f031f0bdd10aa15a75d85d" }, + "paint.nvim": { "branch": "main", "commit": "ef6f717a8669619ebbd098fb72f85115d64c6c92" }, + "persistence.nvim": { "branch": "main", "commit": "f6aad7dde7fcf54148ccfc5f622c6d5badd0cc3d" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, + "refactoring.nvim": { "branch": "master", "commit": "2db6d378e873de31d18ade549c2edba64ff1c2e3" }, + "rustaceanvim": { "branch": "master", "commit": "bf3d8c7bcbf20a7e7f4af36c2d5390ca6ad43281" }, + "sonokai": { "branch": "master", "commit": "fd42b20963c34dfc1744ac31f6a6efe78f4edad2" }, + "tagalong.vim": { "branch": "main", "commit": "5a2bbf2b1d5b657685a49d48d98a4aa921c1fde3" }, + "telescope-dap.nvim": { "branch": "master", "commit": "783366bd6c1e7fa0a5c59c07db37f49c805a28df" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, + "telescope-import.nvim": { "branch": "main", "commit": "6ccc0ad05b2906e04c5ba415a7f973229efc6dbc" }, + "telescope-recent-files": { "branch": "main", "commit": "3a7a1b9c6b52b6ff7938c59f64c87a05e013dff8" }, + "telescope.nvim": { "branch": "master", "commit": "2eca9ba22002184ac05eddbe47a7fe2d5a384dfc" }, + "text-case.nvim": { "branch": "main", "commit": "e898cfd46fa6cde0e83abb624a16e67d2ffc6457" }, + "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" }, + "tree-sitter-gdscript": { "branch": "master", "commit": "bf39f1b38a234d79940fd8866abb0b132ab51b1e" }, + "trouble.nvim": { "branch": "main", "commit": "46cf952fc115f4c2b98d4e208ed1e2dce08c9bf6" }, + "undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" }, + "vcscommand.vim": { "branch": "master", "commit": "2fb32681361f37533455d20aaa7fc6eb11b0fa4b" }, + "vim-abolish": { "branch": "master", "commit": "dcbfe065297d31823561ba787f51056c147aa682" }, + "vim-bazel": { "branch": "master", "commit": "31b0d5e4f51da1aeb56d65bf505a744e6de405de" }, + "vim-better-whitespace": { "branch": "master", "commit": "86a0579b330b133b8181b8e088943e81c26a809e" }, + "vim-conjoin": { "branch": "master", "commit": "2ea3b8ed994d12bbf255825d973d865621c64860" }, + "vim-floaterm": { "branch": "master", "commit": "4e28c8dd0271e10a5f55142fb6fe9b1599ee6160" }, + "vim-godot": { "branch": "master", "commit": "1c8385789f7f4558bdbbf6e75033b34b4727944b" }, + "vim-illuminate": { "branch": "master", "commit": "5eeb7951fc630682c322e88a9bbdae5c224ff0aa" }, + "vim-maktaba": { "branch": "master", "commit": "fe95bb10f6bb250943a44632107f6a3d76ce5f28" }, + "vim-matchup": { "branch": "master", "commit": "5fb083de1e06fdd134c6ad8d007d4b5576b25ba7" }, + "vim-signify": { "branch": "master", "commit": "8670143f9e12ed1cd3c9b2c54f345cdd9a4baac3" }, + "vim-tmux": { "branch": "master", "commit": "cfe76281efc29890548cf9eedd42ad51c7a1faf0" }, + "vim-tmux-focus-events": { "branch": "master", "commit": "b1330e04ffb95ede8e02b2f7df1f238190c67056" }, + "vim-tmux-navigator": { "branch": "master", "commit": "424b5caa154bff34dc258ee53cec5a8e36cf7ea8" }, + "vim-tmux-syntax": { "branch": "master", "commit": "1b6a6a5beb96fa232c8d35d305f77496b12678a9" }, + "vimux": { "branch": "master", "commit": "7db6b2f79d432ee3820668b1d4625311dbe1d0ad" }, + "which-key.nvim": { "branch": "main", "commit": "9b365a6428a9633e3eeb34dbef1b791511c54f70" }, + "yankwin.vim": { "branch": "master", "commit": "d3e3bbb0f785115c2f24b44ddf12e9378a1c1266" }, + "zen-mode.nvim": { "branch": "main", "commit": "29b292bdc58b76a6c8f294c961a8bf92c5a6ebd6" } } diff --git a/vim/.vim/lua/plugins/neotree.lua b/vim/.vim/lua/plugins/neotree.lua index 6ef0694..ee588df 100644 --- a/vim/.vim/lua/plugins/neotree.lua +++ b/vim/.vim/lua/plugins/neotree.lua @@ -1,16 +1,16 @@ local use_google = require("utils").use_google return { - { - "cmdtree", - dir = "~/cmdtree", - }, + -- { + -- "cmdtree", + -- dir = "~/cmdtree", + -- }, { "nvim-neo-tree/neo-tree.nvim", dependencies = { "nvim-lua/plenary.nvim", "MunifTanjim/nui.nvim", - "~/cmdtree", +-- "~/cmdtree", }, cmd = { "Neotree", @@ -28,7 +28,7 @@ return { "filesystem", "buffers", "git_status", - "cmdtree", + --"cmdtree", -- ...and any additional source }, window = { diff --git a/vim/.vim/lua/plugins/telescope.lua b/vim/.vim/lua/plugins/telescope.lua index c2f21fe..4ce598d 100644 --- a/vim/.vim/lua/plugins/telescope.lua +++ b/vim/.vim/lua/plugins/telescope.lua @@ -4,55 +4,61 @@ local TableConcat = require("utils").TableConcat local scopes = require("neoscopes") _G.find_files = function(search_dirs) - require("telescope.builtin").find_files({ - search_dirs = search_dirs, - }) + require("telescope.builtin").find_files({ + search_dirs = search_dirs, + }) end -- Helper functions to fetch the current scope and set `search_dirs` _G.find_dotfiles = function() - require("telescope.builtin").git_files({ - cwd = vim.fn.expand("$HOME/dotfiles"), - }) + require("telescope.builtin").git_files({ + cwd = vim.fn.expand("$HOME/dotfiles"), + }) end _G.search_cwd = function() - local builtin = require("telescope.builtin") - local utils = require("telescope.utils") - builtin.find_files({ cwd = utils.buffer_dir() }) + local builtin = require("telescope.builtin") + local utils = require("telescope.utils") + builtin.find_files({ cwd = utils.buffer_dir() }) end _G.live_grep = function(search_dirs) - require("telescope.builtin").live_grep({ - search_dirs = search_dirs, - }) + require("telescope.builtin").live_grep({ + search_dirs = search_dirs, + }) +end + +_G.live_grep_cword = function(search_dirs) + require("telescope.builtin").live_grep({ + search_dirs = search_dirs, + }) end local function exe(cmd) - return vim.split(vim.fn.system(cmd), "\n") + return vim.split(vim.fn.system(cmd), "\n") end local function get_visual_selection() - -- Yank current visual selection into the 'v' register - -- - -- Note that this makes no effort to preserve this register - vim.cmd('noau normal! "vy"') + -- Yank current visual selection into the 'v' register + -- + -- Note that this makes no effort to preserve this register + vim.cmd('noau normal! "vy"') - return vim.fn.getreg("v") + return vim.fn.getreg("v") end function fig_modified() - return exe("hg pstatus -ma -n --no-status --template= | sort") + return exe("hg pstatus -ma -n --no-status --template= | sort") end function fig_all_modified() - return exe("hg status -ma -n --rev p4base --no-status --template= | sort") + return exe("hg status -ma -n --rev p4base --no-status --template= | sort") end -- stylua: ignore local keys = { { "e", ":lua search_cwd()", desc = "Find Files in Buffer Directory" }, - { "ts.", ":lua live_grep({vim.fn.getcwd()})", desc = "Search in CWD" }, - { "ts", ':lua live_grep({vim.fn.expand("%%")})', desc = "Search in Buffer Directory" }, + { "ts", require('telescope.builtin').live_grep }, + { "TS", [[lua require('telescope.builtin').live_grep{default_text = vim.fn.expand("")}]], }, { "t.", ":lua find_dotfiles()", desc = "Find Dotfiles" }, { "tc", ":Telescope textcase", desc = "Text case" }, { "tC", ":CritiqueUnresolvedCommentsTelescope", desc = "Critique unresolved comments" }, @@ -62,9 +68,6 @@ local keys = { { "tk", ":Telescope keymaps", desc = "Keymaps" }, { "tn", ":Telescope notify", desc = "Notifications" }, { "tr", ":Telescope resume", desc = "Telescope Resume" }, - -- - -- { "tdc", ":Telescope dap commands" }, - -- { "tdc", ":Telescope dap configurations" }, } if use_google() then @@ -82,144 +85,144 @@ if use_google() then end return { - { - "aznhe21/actions-preview.nvim", - config = function() - require("actions-preview").setup({ - telescope = { - sorting_strategy = "ascending", - layout_strategy = "vertical", - layout_config = { - width = 0.8, - height = 0.9, - prompt_position = "top", - preview_cutoff = 20, - preview_height = function(_, _, max_lines) - return max_lines - 15 - end, - }, - }, - }) - end, - keys = { - { "?", "lua require('actions-preview').code_actions()" }, - }, - }, - { - "smartpde/telescope-recent-files", - config = function() - require("telescope").load_extension("recent_files") - end, - keys = { - { "to", [[lua require('telescope').extensions.recent_files.pick()]] }, - }, - }, - { - "piersolenski/telescope-import.nvim", - dependencies = "nvim-telescope/telescope.nvim", - config = function() - require("telescope").load_extension("import") - end, - keys = function() - if not use_google() then - return { - { "i", ":Telescope import" }, - } - end - end, - }, - { - "nvim-telescope/telescope.nvim", - dependencies = { - "mfussenegger/nvim-dap", - "smartpde/telescope-recent-files", - "rcarriga/nvim-dap-ui", - }, - 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/", "//j/c/g/", 1) - path = path:gsub("^google3/javatests/com/google/", "//jt/c/g/", 1) - path = path:gsub("^google3/third_party/", "//3p/", 1) - path = path:gsub("^google3/", "//", 1) + { + "aznhe21/actions-preview.nvim", + config = function() + require("actions-preview").setup({ + telescope = { + sorting_strategy = "ascending", + layout_strategy = "vertical", + layout_config = { + width = 0.8, + height = 0.9, + prompt_position = "top", + preview_cutoff = 20, + preview_height = function(_, _, max_lines) + return max_lines - 15 + end, + }, + }, + }) + end, + keys = { + { "?", "lua require('actions-preview').code_actions()" }, + }, + }, + { + "smartpde/telescope-recent-files", + config = function() + require("telescope").load_extension("recent_files") + end, + keys = { + { "to", [[lua require('telescope').extensions.recent_files.pick()]] }, + }, + }, + { + "piersolenski/telescope-import.nvim", + dependencies = "nvim-telescope/telescope.nvim", + config = function() + require("telescope").load_extension("import") + end, + keys = function() + if not use_google() then + return { + { "i", ":Telescope import" }, + } + end + end, + }, + { + "nvim-telescope/telescope.nvim", + dependencies = { + "mfussenegger/nvim-dap", + "smartpde/telescope-recent-files", + "rcarriga/nvim-dap-ui", + }, + 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/", "//j/c/g/", 1) + path = path:gsub("^google3/javatests/com/google/", "//jt/c/g/", 1) + path = path:gsub("^google3/third_party/", "//3p/", 1) + path = path:gsub("^google3/", "//", 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, - mappings = { - n = { - [""] = "close", - [""] = "close" - }, - i = { - -- [""] = function(bufnr) - -- require("telescope.actions.set").edit(bufnr, "tab drop") - -- end, - [""] = "close", - [""] = "close", - [""] = "cycle_history_next", - [""] = "cycle_history_prev", - }, - }, - }, - extensions = { - codesearch = { - experimental = true, -- enable results from google3/experimental - }, - recent_files = { - -- This function rewrites all file paths to the current workspace. - -- For example, if w2 is the current workspace, then - -- /google/.../w1/google3/my_file.cc becomes /google/.../w2/google3/my_file.cc, - transform_file_path = function(path) - local neocitc = require("neocitc") - local path_func = neocitc.path_in_current_workspace_or_head - or neocitc.path_in_current_workspace - return path_func(path) - end, - -- This is a useful option to speed up Telescope by avoiding the check - -- for file existence. - stat_files = false, - -- Ignore common patterns that can show up from other google plugins - ignore_patterns = { - "/%.git/COMMIT_EDITING$", - "/%.git/COMMIT_EDITMSG$", - "/%.git/MERGE_MSG$", - "^/tmp/%.pipertmp-", - "/Related_Files$", - "^term:", - ";#toggleterm#", - }, - }, - persisted = {}, - import = { - -- Add imports to the top of the file keeping the cursor in place - insert_at_top = true, - }, - }, - }) - end, - keys = keys, - }, + -- 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, + mappings = { + n = { + [""] = "close", + [""] = "close", + }, + i = { + -- [""] = function(bufnr) + -- require("telescope.actions.set").edit(bufnr, "tab drop") + -- end, + [""] = "close", + [""] = "close", + [""] = "cycle_history_next", + [""] = "cycle_history_prev", + }, + }, + }, + extensions = { + codesearch = { + experimental = true, -- enable results from google3/experimental + }, + recent_files = { + -- This function rewrites all file paths to the current workspace. + -- For example, if w2 is the current workspace, then + -- /google/.../w1/google3/my_file.cc becomes /google/.../w2/google3/my_file.cc, + transform_file_path = function(path) + local neocitc = require("neocitc") + local path_func = neocitc.path_in_current_workspace_or_head + or neocitc.path_in_current_workspace + return path_func(path) + end, + -- This is a useful option to speed up Telescope by avoiding the check + -- for file existence. + stat_files = false, + -- Ignore common patterns that can show up from other google plugins + ignore_patterns = { + "/%.git/COMMIT_EDITING$", + "/%.git/COMMIT_EDITMSG$", + "/%.git/MERGE_MSG$", + "^/tmp/%.pipertmp-", + "/Related_Files$", + "^term:", + ";#toggleterm#", + }, + }, + persisted = {}, + import = { + -- Add imports to the top of the file keeping the cursor in place + insert_at_top = true, + }, + }, + }) + end, + keys = keys, + }, } diff --git a/vim/.vim/prefs/mappings.vim b/vim/.vim/prefs/mappings.vim index 17035c7..9493daa 100644 --- a/vim/.vim/prefs/mappings.vim +++ b/vim/.vim/prefs/mappings.vim @@ -1,5 +1,3 @@ -" DO NOT PLACE PLUGIN RELATED MAPPINGS HERE - " jk is escape -.- inoremap jk @@ -43,63 +41,3 @@ nnoremap / /\v vnoremap / /\v nnoremap ww :call WindowSwap#EasyWindowSwap() - -function! s:createHabitsMappings(keys, message) abort - for key in a:keys - call nvim_set_keymap('n', key, ':call BreakHabitsWindow(' . string(a:message). ')', {'silent': v:true, 'nowait': v:true, 'noremap': v:true}) - endfor -endfunction - -function! BreakHabitsWindow(message) abort - " Define the size of the floating window - let width = 50 - let height = 10 - - " Create the scratch buffer displayed in the floating window - let buf = nvim_create_buf(v:false, v:true) - - " create the lines to draw a box - let horizontal_border = '+' . repeat('-', width - 2) . '+' - let empty_line = '|' . repeat(' ', width - 2) . '|' - let lines = flatten([horizontal_border, map(range(height-2), 'empty_line'), horizontal_border]) - " set the box in the buffer - call nvim_buf_set_lines(buf, 0, -1, v:false, lines) - - " Create the lines for the centered message and put them in the buffer - let offset = 0 - for line in a:message - let start_col = (width - len(line))/2 - let end_col = start_col + len(line) - let current_row = height/2-len(a:message)/2 + offset - let offset = offset + 1 - call nvim_buf_set_text(buf, current_row, start_col, current_row, end_col, [line]) - endfor - - " Set mappings in the buffer to close the window easily - let closingKeys = ['', '', ''] - for closingKey in closingKeys - call nvim_buf_set_keymap(buf, 'n', closingKey, ':close', {'silent': v:true, 'nowait': v:true, 'noremap': v:true}) - endfor - - " Create the floating window - let ui = nvim_list_uis()[0] - let opts = {'relative': 'editor', - \ 'width': width, - \ 'height': height, - \ 'col': (ui.width/2) - (width/2), - \ 'row': (ui.height/2) - (height/2), - \ 'anchor': 'NW', - \ 'style': 'minimal', - \ } - let win = nvim_open_win(buf, 1, opts) - - " Change highlighting - " call nvim_win_set_option(win, 'winhl', 'Normal:ErrorFloat') - - highlight CustomFloatingWindow ctermbg=11 guibg=black ctermfg=10 guifg=red - call nvim_win_set_option(win, 'winhl', 'Normal:CustomFloatingWindow') -endfunction - -" let windowHabitsKeys = [":w"] -" let windowHabitsMessage = ["USE < SPACE SPACE > INSTEAD", "BREAK BAD HABITS"] -" call s:createHabitsMappings(windowHabitsKeys, windowHabitsMessage) diff --git a/vim/.vimrc b/vim/.vimrc index 5ad09f3..16727da 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -63,8 +63,6 @@ map "" set updatetime=100 -lua require('plugin_init') - source ~/.vim/prefs/mappings.vim source ~/.vim/prefs/leader.vim diff --git a/zsh/.aliases.sh b/zsh/.aliases.sh index ff17ba3..e5b7cd3 100644 --- a/zsh/.aliases.sh +++ b/zsh/.aliases.sh @@ -4,6 +4,8 @@ alias grep='grep --colour' alias ls='exa' alias tmux='tmux -2' +alias ..="cd .." +alias vim="nvim" alias cp='cp -iv' # Preferred 'cp' implementation alias mv='mv -iv' # Preferred 'mv' implementation alias mkdir='mkdir -pv' # Preferred 'mkdir' implementation