From 601fcafd3138081be3d1fe00213487d066a2bdc1 Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Wed, 6 Dec 2023 22:49:28 +0800 Subject: [PATCH] fix: autosave.nvim & yazi --- .../desktop/neovim/astronvim_user/init.lua | 65 ++++++++++++++++--- home/linux/desktop/media.nix | 3 +- 2 files changed, 57 insertions(+), 11 deletions(-) diff --git a/home/base/desktop/neovim/astronvim_user/init.lua b/home/base/desktop/neovim/astronvim_user/init.lua index cbf11d75..22c3d17a 100644 --- a/home/base/desktop/neovim/astronvim_user/init.lua +++ b/home/base/desktop/neovim/astronvim_user/init.lua @@ -73,16 +73,36 @@ return { }, { - "0x00-ketsu/autosave.nvim", + "akinsho/toggleterm.nvim", opts = function(_, opts) + -- custom shell with all neovim's exra packags accessible + opts.shell = "nvim-nushell" end, }, { - "akinsho/toggleterm.nvim", - opts = function(_, opts) - -- custom shell with all neovim's exra packags accessible - opts.shell = "nvim-nushell"; + "0x00-ketsu/autosave.nvim", + -- autosave.nvim should be loaded immediately. + -- it enable itself in the `config` function. + lazy = false, + -- config is executed when the plugin loads. + config = function() + require("autosave").setup({ + enable = true, + prompt_style = 'notify', + prompt_message = function() + return "Auto saved at " .. vim.fn.strftime("%H:%M:%S") + end, + events = { "InsertLeave", "TextChanged" }, + conditions = { + exists = true, + modifiable = true, + filename_is_not = {}, + filetype_is_not = {}, + }, + write_all_buffers = false, + debounce_delay = 135, + }) end, }, @@ -117,11 +137,36 @@ return { } end, keys = { - { "y", "(YankyYank)", mode = { "n", "x" }, desc = "Yank text" }, - { "p", "(YankyPutAfter)", mode = { "n", "x" }, desc = "Put yanked text after cursor" }, - { "P", "(YankyPutBefore)", mode = { "n", "x" }, desc = "Put yanked text before cursor" }, - { "gp", "(YankyGPutAfter)", mode = { "n", "x" }, desc = "Put yanked text after selection" }, - { "gP", "(YankyGPutBefore)", mode = { "n", "x" }, desc = "Put yanked text before selection" }, + { + "y", + "(YankyYank)", + mode = { "n", "x" }, + desc = "Yank text", + }, + { + "p", + "(YankyPutAfter)", + mode = { "n", "x" }, + desc = "Put yanked text after cursor", + }, + { + "P", + "(YankyPutBefore)", + mode = { "n", "x" }, + desc = "Put yanked text before cursor", + }, + { + "gp", + "(YankyGPutAfter)", + mode = { "n", "x" }, + desc = "Put yanked text after selection", + }, + { + "gP", + "(YankyGPutBefore)", + mode = { "n", "x" }, + desc = "Put yanked text before selection", + }, { "[y", "(YankyCycleForward)", desc = "Cycle forward through yank history" }, { "]y", "(YankyCycleBackward)", desc = "Cycle backward through yank history" }, { "]p", "(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" }, diff --git a/home/linux/desktop/media.nix b/home/linux/desktop/media.nix index 84b45211..00bcc3a3 100644 --- a/home/linux/desktop/media.nix +++ b/home/linux/desktop/media.nix @@ -39,8 +39,9 @@ yazi = { enable = true; package = pkgs-unstable.yazi; - enableNushellIntegration = true; enableBashIntegration = true; + # TODO: nushellIntegration is broken on release-23.11, wait for master's fix to be released + enableNushellIntegration = false; }; };