English 中文(简体)
• 防止卢阿的冲积活动
原标题:prevent nvim unwanted TextChanged events in lua

i use vim-auto-save for vim and autosave.nvim 仅限在<代码>上节省费用 插入“Leave<>/code>,但插入“方式”,即:在薄膜内穿透{},(][,插入一条新线,使原始材料自动节省文件,并且使用:autocmd TextChanged,Text 改变 I <buffer> silence noautocmd in my vimrc andtries to application the same to init. lua using vim.cmd:vim.cmd("autocmd TextChanged,Text 改变 I <buffer> silence noautocmd”,但这只是t工作

问题回答

I use this plugin for autosaving in nvim. This works well. You can add these lines in your plugin config file for auto saving in normal mode and after text change event.

{
    enabled = true,
    execution_message = {
        message = function()
            return ("AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"))
        end,
        dim = 0.18, 
    },
    trigger_events = {"InsertLeave", "TextChanged"}, 
    condition = function(buf)
        local fn = vim.fn
        local utils = require("auto-save.utils.data")

        if
            fn.getbufvar(buf, "&modifiable") == 1 and
            utils.not_in(fn.getbufvar(buf, "&filetype"), {}) then
            return true
        end
        return false 
    end,
    write_all_buffers = false,  
    debounce_delay = 135,
    callbacks = { 
        enabling = nil, 
        disabling = nil,
        before_asserting_save = nil,
        before_saving = nil,
        after_saving = nil, 
    }
}

这是本金的缺省组合,认为 yourself是你想要的。





相关问题
Autoupdate VIM Plugins?

Is it possible to update vim plugins automatically?

how to unindent in vim without leaving edit mode?

I m writing a lot of python code recently, and i used the tab-to-space mode in vim. I was just wondering how would i unindent in vim without leaving edit mode for example after i finished if...: block....

Scrolling inside Vim in Mac s Terminal

I ve been googling around trying to figure out if it s possible to use my mouse wheel to scroll while inside Vim in Mac s Terminal, with no luck. It seems as if only X11 or iTerm support this. Before ...

Vim - Deleting XML Comments

How do I delete comments in XML? If the opening and the closing comment tags are on the same line, I use :g/^<!--.*-->$/d to delete the comment. How to delete the comments that are spread ...

Limiting a match in vim to certain filetypes?

I have the following in my .vimrc to highlight lines longer than 80 chars: highlight OverLength ctermbg=red ctermfg=white guibg=#592929 match OverLength /\%81v.*/ This works quite well. However, the ...

Profiling Vim startup time

I’ve got a lot of plugins enabled when using Vim – I have collected plugins over the years. I’m a bit fed up with how long Vim takes to start now, so I’d like to profile its startup and see which of ...

热门标签