lambdalisue / vim-suda

🥪 An alternative sudo.vim for Vim and Neovim, limited support sudo in Windows
MIT License
713 stars 27 forks source link

Problems with suda_smart_edit if it's set after the plugin loaded. [[SOLVED]] #68

Closed sus-domesticus closed 8 months ago

sus-domesticus commented 8 months ago

I use neovim with lazy.nvim and I initially installed suda.vim like this: { "lambdalisue/suda.vim" } .
When I tried to use the suda_smart_edit functionality by adding vim.g.suda_smart_edit = 1 to my ~/.config/nvim/after/plugin folder the plugin didn't work.

Then I realized I had to set vim.g.suda_smart_edit before loading the plugin so I changed my installation to this:

{
    "lambdalisue/suda.vim",
    init = function()
        vim.g.suda_smart_edit = 1
    end
}

TL; DR

Set the suda_smart_edit global variable before loading suda.vim if you want smart edit functionality.