Skip Navigation
InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)MA
Posts
12
Comments
17
Joined
2 yr. ago
Neovim @programming.dev
mawkler @lemmy.ml

New plugin jsx-element.nvim: JSX/TSX text-objects and motions

Hi! I built this small plugin that adds JSX/TSX text-objects and motions using Treesitter: jsx-element.nvim. I was surprised that it (to my knowledge) doesn't exist yet.

From the README:

Use ]t/[t to go to the next/previous JSX/TSX element.

Use it/at to use JSX/TSX elements as text-objects. For example dit for "delete inside tag". This works with self-closing elements:

 undefined
    
<Checkbox value="checkedA" />
          ╰───── it ─────╯
╰─────────── at ────────────╯

  

It also works with paired elements:

 undefined
    
<Button variant="text">This is a button</Button>
                       ╰───── it ─────╯
╰───────────────────── at ─────────────────────╯

  
Neovim @programming.dev
mawkler @lemmy.ml

TIL about o_CTRL-V

I've been using Neovim for about eight years, but I knever knew about :help o_CTRL-V until today. It lets you perform a command over a column.

I had the code below and wanted to remove all trailing colons:

 undefined
    
foo:
bar:
baz:
faz:

  

What I meant to do was to do was (with the cursor on the first line) $<C-v>3jd to visually select all colons and then delete them. But I accidentally did $d<C-v>3j, which, to my surprise, did the same thing.

I did know about :help o_V, which lets you turn a characterwise operation like di{ into a line-wise one by doing dVi{. But it never occurred to me that I could do the same thing with <C-v>.

Neovim @programming.dev
mawkler @lemmy.ml

New plugin: hml.nvim

By default in Neovim, H/M/L jump to the highest, middle, and lowest line in the current visible window. If you have scrolloff set, it can be dificult to tell exactly which lines they correspond to. I made this plugin to visually guide you.

Neovim @programming.dev
mawkler @lemmy.ml

I've gotten my work to pay a "Neovim subscription" for two years

I posted about this on Reddit a year ago, and I figured write about it again:

Like most companies, the one I work for will happilly pay for any employee's license to a proprietary IDE without batting an eye. Therefore, I argued that I should be able to spend that budget on a donation to an open source tool that I use daily instead. After a lot of back and forth I finally got them to donate an amount that would correspond to what they would pay for a yearly subscription to a proprietary tool to Neovim.

Do you use Neovim at work? If so, I urge you to do the same thing! That way the core team can continue to deliver awesome new features to the editor we all love. Here's a link to where you can donate.

I now got my work to pay a $400 yearly "Neovim subscription" for the second time.

To those wondering how I did it, I basically just argue

Neovim @programming.dev
mawkler @lemmy.ml

New plugin: refjump.nvim - jump to next/previous LSP reference with ]r/[r

Hi! I've created refjump.nvim which is a plugin that lets you use ]r/[r to jump to the next/previous LSP reference in the current buffer for the item under the cursor.

The plugin also automatically integrates with demicolon.nvim if you have it installed, which I recently posted about. This means that you can also repeat the jumps forward/backward with ;/,.

Here's a video showing it in action.

Enjoy!

Neovim @programming.dev
mawkler @lemmy.ml

PSA: demicolon.nvim now lets you create custom keymaps

demicolon.nvim is a plugin that lets you use ;/, to repeat more jumps than just t/T/f/F like diagnostic jumps with ]d/[d and treesitter text-object jumps like ]f/[f to next/previous function.

Now you can also easily make your own custom jumps repeatable with ;/,. For example, I've now made gitsigns.nvim's ]c/[c repeatable out of the box with demicolon.nvim. Here's the implementation if you're curious. For more information see the custom jumps section in the README.

Neovim @programming.dev
mawkler @lemmy.ml

Is there a solution to duplicated snippets yet?

When using LuaSnip together with nvim-cmp and a snippet library like friendly-snippets or luasnip-snippets you get a lot of duplicated snippets. That's because the language server also servers snippets. Also, you might want to create your own custom snippet that happens to share the name of a snippet that already exists.

For example, with the setup mention above, let's say that I also have a custom fn snippet for Rust files. When I type fn, nvim-cmp suggests three snippets: one from rust-analyzer, one from friendly-snippets and my custom one.

The solution to overriding friendly-snippets with your custom ones suggested in this open LuaSnip issue is to create your own fork of friendly-snippets. However, this is not ideal because it adds a lot of extra work to ea

Neovim @programming.dev
mawkler @lemmy.ml

demicolon.nvim: overload ; and , keys to also repeat jumps to diagnostics and text-objects

Hi everyone! I've created a new Neovim plugin: demicolon.nvim. It lets you use ; and , keys to not only repeat t/T/f/F motions, but also to repeat diagnostic motions like ]w (jump to next warning) as well as jumps to nvim-treesitter-textobjects like ]f (jump to next function).

Video previewing it in action.

That's all. Have a great day!

Rust Programming @lemmy.ml
mawkler @lemmy.ml

I've created a CLI tool to download Rust web books as EPUB

cross-posted from: https://lemmy.ml/post/17090149

Hi! I've created a CLI tool for downloading Rust web books (like The Rust Programming Language) as EPUB, so that you can easily read them on your e-book reader. The tool is heavily based on this gist and a lot of proompting.

Check it out here: https://github.com/mawkler/rust-book-to-epub

Rust @programming.dev
mawkler @lemmy.ml

I've created a CLI tool to download Rust web books as EPUB

Hi! I've created a CLI tool for downloading Rust web books (like The Rust Programming Language) as EPUB, so that you can easily read them on your e-book reader. The tool is heavily based on this gist and a lot of proompting.

Check it out here: https://github.com/mawkler/rust-book-to-epub

Neovim @sopuli.xyz
mawkler @lemmy.ml

PSA: modicator.nvim now has lualine.nvim support out of the box

Hi! My plugin modicator.nvim now has support for lualine.nvim out of the box.

Modicator is a plugin that changes the color of the cursor's line number based on the Vim mode, just like statusline plugins like lualine do.

The lualine integration only gets loaded if the plugin gets detected, so it should have no effect on your startup time.

  • I would recommend just learning the default surround behavior since it's more versatile. For example surround -> text-object -> character, siw) (surround word in parentheses) can be repeated with . (dot).

  • It should be noted that as long as you're on Neovim you can still keep your VimScript plugins and your VimScript config and gradually start using Lua plugins and Lua scripting. You don't need to do a complete rewrite over night.

    There's no real downside to switching to Neovim. It's basically a superset of Vim, only with better defaults and more capabilities that you can opt-in to if you'd like (Treesitter, native LSP client, Lua, etc.).

  • Neovim @sopuli.xyz
    mawkler @lemmy.ml

    How does textidote compare to ltex-ls?

    I saw that null-ls.nvim just added textidote support. Textidote seems to be a spelling/grammar checker that wraps LanguageTool, just like ltex-ls. Does anyone know how they compare?