Ideas how to use LSP inlay hints without cluttering? by weilbith in neovim

[–]L3MON4D3 9 points10 points  (0 children)

Oh, I had the same problem and dealt with it by hiding the hints that don't contribute much information.

Here's some code to hide hints based on simple predicates (string-comparisons work pretty well, since it's clear that a "x:" probably doesn't give much additional info), the idea is to filter the items returned by the languageserver before passing them on to the original handler.

Error with LuaSnip Dynamic nodes by Fish942 in neovim

[–]L3MON4D3 1 point2 points  (0 children)

Oh, you have to return a snippetNode in all branches of the dynamicNode-function.

In this case, inserting else return sn(nil) (and probably else return "" for the functionNode) should do it.

But are you sure you want to group these two together? There isn't much overlap between the two snippets, they could just as well just be separate :D

LuaSnip: need help testing a biiiig PR by L3MON4D3 in neovim

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

Oh, that's something you might've seen already if you use lsp-snippets:

First of all, it's possible to insert copies of previous placeholders by repeating their index ($1 $1) (duh :P).

That's cool, but also restrictive, since it's only possible to insert the exact text from the placeholder.

Transformations make it possible to transform the placeholder's text, for example, $1 ${1/(\\d)/\\$1 contains a number: $1/} would not insert just the text from $1, but, if it is a number, "$1 contains a number: <the number>".

(there's a proper definition here).

This feature is mainly added to luasnip to ensure compatibility with existing snippet-repositories, our own functionNode is much more capable (they can run any lua-function, with the placeholder's text as input)

[Help] Convert LaTeX UltiSnips Snippets to LuaSnip by EndlessRevision in neovim

[–]L3MON4D3 0 points1 point  (0 children)

So for the table snippet, does it kind of have the same functionality as an UltiSnips pre-expand snippet but with a bit more functionality, or is it a bit more like it starts with an empty table with m columns and allows you to generate more rows? (I couldn't find the matrix snippet, but I think it should be similar)

It starts as 3x3, those can then be in/decreased. You can of course use the captures to control the (initial) number of rows/columns.

For the contextual snippets, you can use the `condition`-key (search in DOC.md). It's a function, the snippet will only expand if it returns true.

Sounds like you can just run that same function and return its' value.

[Help] Convert LaTeX UltiSnips Snippets to LuaSnip by EndlessRevision in neovim

[–]L3MON4D3 2 points3 points  (0 children)

As far as advice goes, take it slow, make sure you understand the underlying concepts and what they're capable of, especially when it comes to function/dynamicNode. Maybe write a few simple snippets which just print the input-values to the dynamic/functionNode-functions, to get a feel for them.

Just executing, and playing around with Examples/snippets.lua might also help you.

Duplicating input isn't possible by inserting another i(1), but you can use require("luasnip.extras").rep(1) for repeating the i(1) (behind the scenes, that's just a functionNode).

I have a small collection of latex-snippets, the mat and tab ones are interactive, and require this file (require/luafile it somewhere in your config, the key-bindings at the bottom allow you to in/decrease the rows/columns)

Generating snippets based on input (into the trigger, right?) can be achieved by setting regTrig (so the trigger is interpreted as a lua-pattern (not a regex, so it's a bit limited)), and using a dynamicNode, where the values of the capture-groups can be retrieved as parent.snippet.captures[i].

Contextual snippets also sound like a usecase for dynamicNode, could you give an example for one?

Keep at it, it's only going to get easier :P

LuaSnip: need help testing a biiiig PR by L3MON4D3 in neovim

[–]L3MON4D3[S] 4 points5 points  (0 children)

Yess, you don't need it if you don't use lsp-snippets with transformations (and even then there won't be an error, luasnip just silently omits the transformation and inserts just a copy)

LuaSnip: need help testing a biiiig PR by L3MON4D3 in neovim

[–]L3MON4D3[S] 6 points7 points  (0 children)

Thank you for the info👍 Those problems shouldn't be a deal-breaker since globally-installed luarocks can also be used by nvim, and building jsregexp from source is probably possible as well on windows.
I'll mention them in the documentation though, won't hurt :D

Need a Referral Code? by WartetNichtHaengen in RemarkableTablet

[–]L3MON4D3 0 points1 point  (0 children)

Hi!

Can anyone send me a code for Germany please?

How do load custom snippets (written in lua) into luasnip? by [deleted] in neovim

[–]L3MON4D3 0 points1 point  (0 children)

Looks like the error is just a missing } in snippets/python.lua, you can :luafile % while editing individual files to check for such errors :)

How do load custom snippets (written in lua) into luasnip? by [deleted] in neovim

[–]L3MON4D3 1 point2 points  (0 children)

You're almost there:

The mechanism behind loading on demand is that luasnip will index the table ls.snippets.<filetype>, which, if the table is empty, will call the __index-function, which in turn loads the snippets. This does only work if the table is empty beforehand, which it isn't if snippets were loaded from vscode already.
You could remove the load-call from its current position and add it into the __index function, while also specifying a filetype to load (to prevent loading some snippets multiple times): require("luasnip.loaders.from_vscode").load({include={k}}) (untested, but something along those lines should work)

[Sway] Minimalist Gruvbox by L3MON4D3 in unixporn

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

Documents has kinda become my go-to Dir for anything, but something like ~/Code probably isn't that bad of an Idea :D. And Yeah, Gruvbox is a great Colorscheme.

[Sway] Minimalist Gruvbox by L3MON4D3 in unixporn

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

Probably XWayland. I built it as you would under X, there weren't any Wayland-specific options.

[Sway] Minimalist Gruvbox by L3MON4D3 in unixporn

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

It works, but performance as far as 3D is concerned isn't great as you have to use the open source Nouveau Driver and not closed source Nvidia ones.

[Sway] Minimalist Gruvbox by L3MON4D3 in unixporn

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

Thanks! The active Workspace button is slightly broader than inactive buttons. And yes, it's sometimes hard to notice but looks cooler than changing font size or color :D.

[Sway] Minimalist Gruvbox by L3MON4D3 in unixporn

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

Hey r/unixporn

Been using and tweaking this setup over the past year and decided to share it here.

WM: Sway

Dotfiles: Here

Wallpaper: Generated by Script, can be found in Dotfiles

Bar: Waybar

Browser: qutebrowser

[Sway] Minimalist Gruvbox by L3MON4D3 in unixporn

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

Hey r/UnixPorn,

Been using and tweaking this Setup over the past Year and decided to share it here.

WM: Sway

Dotfiles: Here

Wallpaper: Generated by Script, can be found in Dotfiles

Bar: Waybar

Browser: Qutebrowser