Neovim

2175 readers
14 users here now

founded 1 year ago
MODERATORS
1
 
 

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.

2
 
 

I'm generally skeptical of the hype around LLMs, but I've been manually working around this broken mapping for years. I don't think I could have found a solution easily just by googling.

3
 
 

🚀 Introducing Nevica: A modular, Vim-based IDE powered by Nix for maximum flexibility and reproducibility. 🔥

Nevica brings together the simplicity of Vim and the power of Nix, creating a fully customizable and reproducible development environment that works seamlessly across any OS that supports Nix—be it Linux, macOS, or even Windows.

Key Features:

•	Nix Integration: With Nix, your development environment is reproducible and consistent across different machines and operating systems.
•	Modular Design: Keep your setup lightweight by enabling only the languages and tools you need, with each language configured in its own module.
•	LSP Support: Full Language Server Protocol integration for autocompletion, real-time error checking, and code navigation.
•	Debugging & Diagnostics: Integrated tools for debugging and diagnosing issues across supported languages.
•	Customizable Flavours: Pre-configured profiles for various programming stacks, helping you set up quickly with the right tools for your workflow.
•	Code Formatting & Syntax Highlighting: Built-in support for consistent code formatting and syntax highlighting.

Why Choose Nevica?

Nevica is the ideal IDE for developers who need a lightweight yet powerful environment. Thanks to Nix, your setup is reproducible and works consistently on any operating system that supports Nix. Whether you’re on Linux, macOS, or Windows, you get the same reliable experience with Nevica.

💻 Try Nevica on GitHub: https://github.com/matteocavestri/nevica

I’d love to hear your feedback! Let’s improve Nevica together. 💬

4
5
4
submitted 1 month ago* (last edited 1 month ago) by IsoSpandy@lemm.ee to c/neovim@programming.dev
 
 

I was recently watching a tsoding stream when he was singing huge praises for the compilation mode in emacs, so I created a plug in to do essentially the same thing in neovim. Feel free to test it and share feedback.

error-jump

6
 
 

Hello, I’m a developer wanting to change from VSCode to Neovim. I’ve been using a Neovim extension for VSCode, so I know how to drive it to some extent.

I work with:

  • Rust
  • Typescript
  • React

I’m happy to use default NVim mostly with:

  • ctags
  • ins-completion
  • netrwtreelisting

I want to keep things really simple and use defaults when reasonable.

I basically just want to know how to set up Rust analyser and (for ts) prettier/eslint.

Questions:

  • Should I use a nvim conf file or lua? I’m happy to learn Lua if it’s recommended.
  • If I need packages for the above functionality, which package manager is best (excuse the imprecise terminology)?
  • Any additional recommendations?

Thank you.

7
8
 
 

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 argued that since employees at my work have an allocated budget for buying proprietary tools, it makes sense if we could spend an equivalent amount on a FOSS alternative. That way the money spent would benefit us all, and since we use the tool to make money we have a responsibility to give back to the FOSS project.

There was a bit of a back-and forth for technical reasons because (at least in Sweden where I live), payments and donations are handled and regulated differently, but they finally made it work.

If you also use Neovim for work, I encourage 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. There's also the official merch store if you would like to support the project that way: https://store.neovim.io/.

9
 
 

I start my coding workspaces in tmux sessions which persist when I log out. If I switch from a wayland session to an x11 session, then my copy and paste functionality in those neovim sessions are broken because it's still trying to use wl-copy. To be more precise:

  1. Start a wayland session.
  2. Open a terminal and start a tmux session.
  3. Open neovim and do some work.
  4. Log out of wayland, log into an X11 environment
  5. Open a terminal and reconnect to the tmux session
  6. "+y broken. clipboard: error invoking wl-copy: Failed to connect to a Wayland server...

Restarting neovim isn't sufficient. I have to restart the entire tmux session or switch back to wayland. Is there some short cut I can take here?

10
 
 

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!

11
 
 

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.

12
 
 

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 each user to ensure that their fork is up-to-date with upstream. Also, it doesn't solve the issue with language servers serving snippets with the same name. I know that for most language servers you can disable snippets, but that doesn't really solve the issue either because you might want some of those snippets.

What I would like is the option to only see one of the snippets listed if there are multiple ones with the same name. Which one would be controlled with a priority list, for example:

  1. If there's a custom user snippet, use that
  2. Otherwise, if there's an LSP snippet, use that
  3. Otherwise, use the one from friendly-snippets

Is this possible to achieve today?

13
26
submitted 3 months ago* (last edited 2 months ago) by sxwpb@lemmy.world to c/neovim@programming.dev
 
 

Hello, I wanted to share a small keymap I made. It lets you inspect unsaved changes in the current file. It uses diff mode, in a vertical split.

To close the diff mode, just press q in the scratch buffer.

vim.keymap.set(
	'n',
	'<M-C-D>',
	function()
		local tmpft = vim.bo.filetype
		vim.cmd.vnew()
		vim.bo.filetype = tmpft
		vim.bo.buftype = 'nofile'
		vim.keymap.set(
			'n',
			'q',
			'<cmd>bw<cr>',
			{ noremap = true, silent = true, buffer = true }
		)
		vim.cmd('silent r#|0d_')
		vim.bo.modifiable = false
		vim.cmd('diffthis|wincmd p|diffthis')
	end,
	{ noremap = true }
)

edit: I discovered that this functionality is actually documented in the help pages (:h :DiffOrig). It’s basically the same action but bound to a command

14
 
 

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!

15
 
 

What issues or frustrations have you encountered in trying to use and set up Neovim in Windows 11?

I'm currently writing up my experience with installing, setting up, and using Neovim in Windows and would like to hear from others that have tried the same. What was annoying, difficult, or impossible in your experience?

16
 
 

Is there some intuitive menu mode that is simple to initiate? The packaged setup with dnf on F40 only has the colon help menu enabled. I don't care about mouse Luddites or the remarkableness of people with total recall. I need something like gedit level tools to just work without Planck scale resolution help, or learning career to make a useful hobby tool that is free from stalkerware nonsense like an electron based IDE.

17
18
 
 

Based on answers to the following question:

Which development environments did you use regularly over the past year, and which do you want to work with over the next year? Please check all that apply.

Neovim is the most admired code editor in the 2024 Stacked Overflow Developer Survey

Source: https://survey.stackoverflow.co/2024/technology#admired-and-desired-new-collab-tools-desire-admire

19
 
 

It's broader than a Neovim specific mapping, I've changed the system keyboard mapping of <Caps Lock> to <Esc> and <F9> to <Caps Lock>.

I think mapping <Caps Lock> to <Esc> isn't uncommon for Neovim users. But I like having <Caps Lock> available for non Neovim purposes.

20
21
 
 

Difftastic is a diff tool that uses treesitter parsing to compare code AST nodes instead of comparing lines. After following the instructions for use with git I'm seeing some very nice diffs when I run git diff or run git show --ext-diff. I thought it would be nice to get the same output for hunk diffs in the fugitive status window, and in fugitive buffers in general (which use the git filetype). But I haven't seen any easy way to do it. Has anyone got a setup like this?

I can run a command in neovim like :Git show --ext-diff to get difftastic output in a buffer. I'm thinking maybe I can set up fugitive to use the --ext-diff flag by default, or set up some aliases. But there is no syntax highlighting for the difftastic outputs since the ANSI color codes that difftastic uses in interactive terminal output don't work in neovim, and the syntax highlighting for the git filetype assumes standard diff output which is not compatible with difftastic output. For me losing colors is not a worthwhile trade for the otherwise more readable diff output.

My best idea right now is to set up a new filetype called difftastic, and write a new treesitter grammar or syntax plugin for it. Then set up some kind of neovim configuration to feed output from difftastic into buffers with the new filetype.

There is an open neovim issue discussing adding syntax-aware diffs directly to neovim, but that doesn't seem to have gone anywhere.

22
 
 

setting it up like this implements the nvim-web-devicons API, so many plugins that depend on that work with mini.icons too!

	require('mini.icons').setup()
	MiniIcons.mock_nvim_web_devicons()
23
 
 

Not mine but this is a great plugin for customising the native LSP inlay hints. Hope some of you also find it helpful.

This is related to an earlier post I made, asking if there was a way to move the native LSP hints to the end of a line rather than appearing within the line. Found exactly what I was looking for with this plugin!

24
57
submitted 4 months ago* (last edited 4 months ago) by gkpy@feddit.org to c/neovim@programming.dev
25
 
 

My new design direction for neovim is "you just sat down in a homie's spaceship and have no idea what any of the buttons do" -- you can see how I did it here with tabby.nvim: https://github.com/Garoth/Configs/blob/da354cd98241dc7582718a9082226fab99403e4a/nvim/init.vim#L752

I'm an oldschool vim guy, so a lot of my plugin tastes lean towards the ancient. Telescope?? Nah I had that figured out with fzf.vim many years ago, and it's stupid fast. Harpoon? Nah, I have marks, permanent undo and location memory, alternate files, fast search. Plus I love using fzf in my terminal so it all blends together so well. I still use vim-plug, it's pretty much perfect, and have no interest in lazy or whatever the new flavor-of-the-year package manager is

Neovide continues to be what I believe is the future of neovim. The performance is best in class, probably theoretically better than even terminals can achieve (since rendering can be done much more selectively, understanding vim concepts like floating windows and such, which have compositing in neovide). The idea of "progressive improvements" in a GUI rather than trying to make something totally different is a great call. In the future, they are likely to implement a new age of image rendering too, which would be aware of z-index layering (so you could have a floating window on top of an image -- current image-in-terminal approaches just put the image on top)

Airline -- well, this is in the category of "if it aint broke dont fix" -- Airline has been in development for like 11 years and has 2700+ commits, 17k+ stars on github. I mean, this is a ridiculous history, that's more work than most projects on github, just for a statusline. I don't tend to chase trends or replace vim code with lua - who cares - vimscript is stable and reliable

Shoutout to the Maple Mono font -- with a lot of amazing ligatures that I didn't have before, super cozy. Demo recorded on an 7 year old samsung chromebook running Wayland/Pipewire Arch with a dualcore cpu, 4gb of ram, 14nm intel integrated graphics, and a 32gb harddrive. Linux is so cool, being able to do that. The ending was... not on purpose lmao

view more: next ›