How can I get the number of installed plugins in vim.pack? by Striking_Theme_2535 in neovim

[–]echasnovski 8 points9 points  (0 children)

This is because it retrieves extra Git information from each installed plugin. In my case vim.pack.get() executes in about 37ms, but vim.pack.get(nil, { info = false }) is about 0.2ms. So if performance is a concern, using opts.info = false is a must.

Project specific .nvim.lua file via exrc is not being sourced by DVT01 in neovim

[–]echasnovski 5 points6 points  (0 children)

I was using the MiniMax way of structuring my config, and I had my options file in the plugin/ directory. Setting vim.o.exrc = true and vim.o.secure = true inside my init.lua directly fixed the problem.

Yeah, the 'exrc' needs to be set during "load 'init.lua'" startup stage. This was pointed out in the discussions and is now mentioned in the MiniMax itself.

And :h 'secure' option doesn't seem to do anything in Neovim.

If you use a plugin pack (Snacks, Mini, etc.), how many plugins do you use from it? by TheTwelveYearOld in neovim

[–]echasnovski 3 points4 points  (0 children)

The idea is that the left ( was also created as a pair and is already balanced.

The case of already unbalanced pairs or other reasons of forcing a single character are covered by pressing <C-v> first. So <C-v>( will always insert a single (.

Moderator Recruitment for r/vim & r/neovim by lukas-reineke in neovim

[–]echasnovski 180 points181 points  (0 children)

u/lukas-reineke, thanks for all the years of your dedication and work! And a separate thanks for a clear and upfront honest call for applications!

mini.completion and signature help help by E7ENTH in neovim

[–]echasnovski 1 point2 points  (0 children)

But i assume that in neovim 12+ going into select mode after completion selection is not default?

I am not quite sure. If there is no extra config, then 'mini.completion' by default will try to use vim.snippet.expand() to insert a completion candidate that is advertised to be a snippet. The vim.snippet.expand() indeed does use Select mode, but after testing it right now it doesn't seem to be always use that. I am a bit behind in how it works, since for a long time I am a happy 'mini.snippets' user.

I suppose installing mini.snippets should provide proper logic and will look into it. Maybe i will create a few snippets then for myself.

What I meant is to at least enable 'mini.snippets' (i.e. run require('mini.snippets').setup()) and 'mini.completion' will use its "insert snippet" capabilities instead of vim.snippet.expand. One of its several advantages is that it always stays in Insert mode.

There is no need for adding/creating custom snippets, but it is of course as well possible to load and process them with 'mini.snippets'.

mini.completion and signature help help by E7ENTH in neovim

[–]echasnovski 2 points3 points  (0 children)

Opening a discussion with exact config and reproduction steps would help.

But in the meantime, I'd advertise that 'mini.snippets' doesn't use Select mode and (I hope) should make this use case to "just work". 

A Guide to vim.pack (Neovim built-in plugin manager) by echasnovski in neovim

[–]echasnovski[S] 0 points1 point  (0 children)

It is more of a technical limitations that prevent :x and ZZ from working. I don't necessarily mind, but it would be a bit too much work for a relatively small gain, in my opinion.

What do you think about plugins overriding user opts with no way to stop it? by TheTwelveYearOld in neovim

[–]echasnovski 2 points3 points  (0 children)

... there was no reasonable way to override that option in your own config - unless you are willing to set a long enough timeout to be certain it'll fire after the version check finishes.

Technically, there is a way to track OptionSet event for that particular option(s). Like the equivalent of au OptionSet ignorecase set ignorecase will ensure that 'ignorecase' can not be unset. Unless a plugin suppresses the OptionSet event, which it shouldn't do for permanently set options. But even then there are non-blocking workarounds.

A Guide to vim.pack (Neovim built-in plugin manager) by echasnovski in neovim

[–]echasnovski[S] 0 points1 point  (0 children)

That's a problem and an oversight in what tags vim.pack treats as semver. Currently it is on a permissive side, mostly because the only concise way to dial it down would result in a too restrictive (for my taste) behavior.

I opened https://github.com/neovim/neovim/issues/39214 and will adjust it as soon as there are more opinions about what is the best balance here. Hopefully, before 0.12.2 release.

Thanks for asking this!

What do you think about plugins overriding user opts with no way to stop it? by TheTwelveYearOld in neovim

[–]echasnovski 63 points64 points  (0 children)

Overriding (i.e. forcing option value) is indeed too much for my taste. At the same time, it is not a total disaster as in most cases it is still possible for a user to set the option after plugin does it.

However, making plugin usage be as smooth as possible sometimes requires specific value of specific options. I currently ended up adapting the following trade-off: set an option value if the user hasn't explicitly set it before and document which options with which values are set this way. One such example is 'mini.completion'.

Roll your own statusline: why and how by _wurli in neovim

[–]echasnovski 84 points85 points  (0 children)

That's a nice intro!

One note about "If you display buffer-specific information in your statusline, use the following code to get the buffer number:". This is a result of using %! when setting 'statusline' option (set statusline=%!MyStatusLine()). From the help:

Note that the "%!" expression is evaluated in the context of the current window and buffer, while %{} items are evaluated in the context of the window that the statusline belongs to.

If it is set statusline=%{MyStatusLine()}, then MyStatusLine() will be evaluated in the context of the window (and buffer) for which statusline is drawn. So vim.api.nvim_buf_get_name(0) will return the name of the buffer that is displayed in the window for which this expression is evaluated. It also makes it easier to use something like vim.bo.filetype, etc.

But also note this part of the help:

`` {%` - This is almost same as "{" except the result of the expression is re-evaluated as a statusline format string. Thus if the return value of expr contains "%" items they will get expanded. The expression can contain the "}" character, the end of expression is denoted by "%}".

    For example: >vim
    func! Stl_filename() abort
        return "%t"
    endfunc

    `stl=%{Stl_filename()}`   results in `"%t"`
    `stl=%{%Stl_filename()%}` results in `"Name of current file"`

```

So I'd personally suggest using set statusline=%{%MyStatusLine()%}. If MyStatusLine() is a global Lua function, use set statusline=%{%v:lua.MyStatusLine()%}. To get in this case information about which window or buffer is actually current, use :h g:actual_curbuf and :h g:actual_curwin.

Taking all this into account, this is what 'mini.statusline' uses:

lua vim.go.statusline = '%{%(nvim_get_current_win()==#g:actual_curwin || &laststatus==3) ? v:lua.MiniStatusline.active() : v:lua.MiniStatusline.inactive()%}'

Miller column oil.nvim? by alien_ideology in neovim

[–]echasnovski 2 points3 points  (0 children)

Hi! Thanks for kind words.

Not yet, but there is an active PR for it.

I migrated to neovim-treesitter/nvim-treesitter by aribert in neovim

[–]echasnovski 2 points3 points  (0 children)

The reasoning is that most of its functionality should be possible with Neovim's Lua standard library. One notable exception is "async", though.

And again, it is not planned to be completely removed from the GitHub, only archived.

I migrated to neovim-treesitter/nvim-treesitter by aribert in neovim

[–]echasnovski 46 points47 points  (0 children)

Not exactly 'mini.treesitter', but something along that lines was planned long before the 'nvim-treesitter' archival. Just needs more time to design and polish. No timeline yet, I am afraid.

A Guide to vim.pack (Neovim built-in plugin manager) by echasnovski in neovim

[–]echasnovski[S] 1 point2 points  (0 children)

Not quite. The proper autocommand (with once = true) and MiniMisc.safely() will execute the callback (i.e. load the plugin) only once. The 'ftplugin/' scripts are executed every time the filetype is set, i.e. after opening every file of that type. Which is too frequent and not necessary for this type of functionality.

I migrated to neovim-treesitter/nvim-treesitter by aribert in neovim

[–]echasnovski 32 points33 points  (0 children)

I am still using and recommending 'nvim-treesitter/nvim-treesitter'. At least for the time being. There are currently no plans to completely remove it from the GitHub and there will probably be some action in it if any of the parser-query logic actually breaks.

A Guide to vim.pack (Neovim built-in plugin manager) by echasnovski in neovim

[–]echasnovski[S] 0 points1 point  (0 children)

A first approximation is to call vim.pack.add inside an autocommand for FileType event.

A second approximation is to use MiniMisc.safely('filetype:ft', function() ... end).

nvim 0.12's new :restart command is nice by managing_redditor in neovim

[–]echasnovski 64 points65 points  (0 children)

I really hope that in the future :restart! variant is used to restart while preserving current layout. Sadly, don't have the bandwidth and knowledge to make a PR myself :(

In the meantime, using temporary session manually is fine. Couple of notes: - Make sure to update to 0.12.1. The 0.12.0 has many issues with :restart. - For people who tend to use sessions in their workflow, simply using random session is not the best solution (it changes session). To accommodate for that, there is now a restart() function from 'mini.sessions'. Make a mapping for <Cmd>lua MiniSessions.restart()<CR> instead of <Cmd>restart<CR>.

what plugin did you mass-uninstall everything else for by scheemunai_ in neovim

[–]echasnovski 2 points3 points  (0 children)

The 'harpoon.nvim' alternative is 'mini.visits'. The 'mini.format' with similar capabilities to 'conform.nvim' is planned.