From e981a24069a0fd37ce9358c7d60347fa6452215a Mon Sep 17 00:00:00 2001 From: huyjaky Date: Wed, 31 Jul 2024 14:54:26 +0700 Subject: [PATCH] astro-nvim-v3 - distant api --- lazy-lock.json | 3 +- lua/plugins/code-runner.lua | 1 - lua/plugins/disabled.lua | 2 +- lua/plugins/distant.lua | 21 +++++++++ lua/plugins/editor.lua | 54 +++++++++++----------- lua/plugins/indent-scope.lua | 89 ++++++++++++++++++++++++++++++++++++ 6 files changed, 140 insertions(+), 30 deletions(-) create mode 100644 lua/plugins/distant.lua create mode 100644 lua/plugins/indent-scope.lua diff --git a/lazy-lock.json b/lazy-lock.json index a8d1f9f..083c828 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -21,12 +21,12 @@ "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "code_runner.nvim": { "branch": "main", "commit": "6c5bfe44a6c7523350cd706e6b3b8101166eed99" }, "cyberdream.nvim": { "branch": "main", "commit": "fb68c9184afe80ed7b88a62f475b14b848a0645d" }, + "distant.nvim": { "branch": "v0.3", "commit": "823267cf3b77cf9a7ae28454926eabc18fec1ba0" }, "dressing.nvim": { "branch": "master", "commit": "71349f24c6e07b39f33600985843c289ca735308" }, "duplicate.nvim": { "branch": "main", "commit": "ab057af7872c44e6fbd48df9b03983c8e67c50a7" }, "flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" }, "friendly-snippets": { "branch": "main", "commit": "00ebcaa159e817150bd83bfe2d51fa3b3377d5c4" }, "gitsigns.nvim": { "branch": "main", "commit": "0b04035bb7b3c83e999b9676e2fb46fd0aa9f910" }, - "grapple.nvim": { "branch": "main", "commit": "7aedc261b05a6c030397c4bc26416efbe746ebf1" }, "grug-far.nvim": { "branch": "main", "commit": "23f26dc09c6d61d574c92b4077598501dbe9aa06" }, "guess-indent.nvim": { "branch": "main", "commit": "6cd61f7a600bb756e558627cd2e740302c58e32d" }, "heirline.nvim": { "branch": "master", "commit": "0d797435e54645a5f98bad7ad6046aac1ef95c1e" }, @@ -46,6 +46,7 @@ "mini.ai": { "branch": "main", "commit": "45587078f323eaf41b9f701bbc04f8d1ab008979" }, "mini.bufremove": { "branch": "main", "commit": "e6044aa28e61d4dd9ec86194d6f81743eced0c1c" }, "mini.icons": { "branch": "main", "commit": "352a25dce86c41ab9fe854dd37f60c36ea7048df" }, + "mini.indentscope": { "branch": "main", "commit": "1222393d9c5e8d92b913ccab6701a7164b21781c" }, "mini.move": { "branch": "main", "commit": "cde3747eec9bb3941296e6fa1d874e0da5a10256" }, "mini.surround": { "branch": "main", "commit": "57caca9525cec0ea771a67326b0ee637d056078a" }, "multiple-cursors.nvim": { "branch": "main", "commit": "2f5e786c43aa9c0fc34b295cfcc9bfbacef8e926" }, diff --git a/lua/plugins/code-runner.lua b/lua/plugins/code-runner.lua index 39e3bb6..1b4370a 100644 --- a/lua/plugins/code-runner.lua +++ b/lua/plugins/code-runner.lua @@ -19,7 +19,6 @@ return { }, }, keys = { - { "r", ":RunCode", mode = "n", noremap = true, silent = false, desc = "Run code" }, { "rf", ":RunFile", mode = "n", noremap = true, silent = false, desc = "Run file" }, { "rft", ":RunFile tab", mode = "n", noremap = true, silent = false, desc = "Run file in new tab" }, diff --git a/lua/plugins/disabled.lua b/lua/plugins/disabled.lua index 1d60bab..0e022e1 100644 --- a/lua/plugins/disabled.lua +++ b/lua/plugins/disabled.lua @@ -1,7 +1,7 @@ -- Plugins to disable return { { "nvim-neo-tree/neo-tree.nvim", enabled = true }, - { "lukas-reineke/indent-blankline.nvim", enabled = false}, + { "lukas-reineke/indent-blankline.nvim", enabled = true}, { "s1n7ax/nvim-window-picker", enabled = false }, { "akinsho/toggleterm.nvim", enabled = false }, { "NvChad/nvim-colorizer.lua", enabled = false }, diff --git a/lua/plugins/distant.lua b/lua/plugins/distant.lua new file mode 100644 index 0000000..0eb9dbf --- /dev/null +++ b/lua/plugins/distant.lua @@ -0,0 +1,21 @@ +-- if true then return {} end + +return { + "chipsenkbeil/distant.nvim", + branch = "v0.3", + event = "VimEnter", + cmd = { + "DistantLaunch", + "DistantOpen", + "DistantConnect", + "DistantInstall", + "DistantMetadata", + "DistantShell", + "DistantShell", + "DistantSystemInfo", + "DistantClientVersion", + "DistantSessionInfo", + "DistantCopy", + }, + config = function() require("distant"):setup() end, +} diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua index fb4de8b..3f58690 100644 --- a/lua/plugins/editor.lua +++ b/lua/plugins/editor.lua @@ -31,31 +31,31 @@ return { end, }, -- File tagging and navigation - { - "cbochs/grapple.nvim", - dependencies = { - "nvim-lua/plenary.nvim", - { - "AstroNvim/astrocore", - opts = function(_, opts) - opts.mappings.n[""] = { desc = require("astroui").get_icon("Grapple", 1, true) .. "Grapple" } - end, - }, - }, - opts = { - scope = "git_branch", - }, - cmd = { "Grapple" }, - keys = { - { "a", "Grapple tag", desc = "Add tag to file" }, - { "d", "Grapple untag", desc = "Delete tag from file" }, - { "e", "Grapple toggle_tags", desc = "Select from tags" }, - { "s", "Grapple toggle_scopes", desc = "Select a project scope" }, - { "x", "Grapple reset", desc = "Clear tags" }, - { "", "Grapple cycle forward", desc = "Select next tag" }, - { "", "Grapple cycle backward", desc = "Select previous tag" }, - }, - }, + -- { + -- "cbochs/grapple.nvim", + -- dependencies = { + -- "nvim-lua/plenary.nvim", + -- { + -- "AstroNvim/astrocore", + -- opts = function(_, opts) + -- opts.mappings.n[""] = { desc = require("astroui").get_icon("Grapple", 1, true) .. "Grapple" } + -- end, + -- }, + -- }, + -- opts = { + -- scope = "git_branch", + -- }, + -- cmd = { "Grapple" }, + -- keys = { + -- { "a", "Grapple tag", desc = "Add tag to file" }, + -- { "d", "Grapple untag", desc = "Delete tag from file" }, + -- { "e", "Grapple toggle_tags", desc = "Select from tags" }, + -- { "s", "Grapple toggle_scopes", desc = "Select a project scope" }, + -- { "x", "Grapple reset", desc = "Clear tags" }, + -- { "", "Grapple cycle forward", desc = "Select next tag" }, + -- { "", "Grapple cycle backward", desc = "Select previous tag" }, + -- }, + -- }, -- Better escape support -- { -- "max397574/better-escape.nvim", @@ -84,14 +84,14 @@ return { delay = 25, }, indent = { - enable = true, + enable = false, use_treesitter = true, chars = { "│", }, }, blank = { - enable = true, + enable = false, chars = { " ", }, diff --git a/lua/plugins/indent-scope.lua b/lua/plugins/indent-scope.lua new file mode 100644 index 0000000..f134693 --- /dev/null +++ b/lua/plugins/indent-scope.lua @@ -0,0 +1,89 @@ +local ignore_filetypes = { + "aerial", + "alpha", + "dashboard", + "help", + "lazy", + "mason", + "neo-tree", + "NvimTree", + "neogitstatus", + "notify", + "startify", + "toggleterm", + "Trouble", +} +local ignore_buftypes = { + "nofile", + "prompt", + "quickfix", + "terminal", +} +local char = "||" + + +return { + "echasnovski/mini.indentscope", + event = "User AstroFile", + opts = function() + return { + options = { try_as_border = true }, + symbol = require("astrocore").plugin_opts("indent-blankline.nvim").context_char or char, + } + end, + dependencies = { + { "lukas-reineke/indent-blankline.nvim", optional = true, opts = { scope = { enabled = false } } }, + { + "AstroNvim/astrocore", + opts = { + autocmds = { + mini_indentscope = { + { + event = "FileType", + desc = "Disable indentscope for certain filetypes", + callback = function(event) + if vim.b[event.buf].miniindentscope_disable == nil then + local filetype = vim.bo[event.buf].filetype + local blankline_opts = require("astrocore").plugin_opts "indent-blankline.nvim" + if vim.tbl_contains(blankline_opts.filetype_exclude or ignore_filetypes, filetype) then + vim.b[event.buf].miniindentscope_disable = true + end + end + end, + }, + { + event = "BufWinEnter", + desc = "Disable indentscope for certain buftypes", + callback = function(event) + if vim.b[event.buf].miniindentscope_disable == nil then + local buftype = vim.bo[event.buf].buftype + local blankline_opts = require("astrocore").plugin_opts "indent-blankline.nvim" + if vim.tbl_contains(blankline_opts.buftype_exclude or ignore_buftypes, buftype) then + vim.b[event.buf].miniindentscope_disable = true + end + end + end, + }, + { + event = "TermOpen", + desc = "Disable indentscope for terminals", + callback = function(event) + if vim.b[event.buf].miniindentscope_disable == nil then + vim.b[event.buf].miniindentscope_disable = true + end + end, + }, + }, + }, + }, + }, + }, + -- specs = { + -- { + -- "catppuccin", + -- optional = true, + -- ---@type CatppuccinOptions + -- opts = { integrations = { mini = true } }, + -- }, + -- }, +}