Neovim

2197 readers
1 users here now

founded 2 years ago
MODERATORS
1
5
Released nluarepl 1.0.0 (social.fussenegger.pro)
submitted 5 days ago by [email protected] to c/neovim
 
 

Released nluarepl 1.0.0

A Lua REPL for #neovim based on the debug adapter protocol.

See https://github.com/mfussenegger/nluarepl for more information and demos

@neovim

2
5
submitted 1 week ago* (last edited 1 week ago) by [email protected] to c/neovim
 
 

I need some advice how to handle project-specific plugin configuration for Neovim. My paid software gig involves work for several different client projects which are basically structured like this:

~/work-clientA
  - repoA1
  - repoA2
~/work-clientB
  - repoB1
  - repoB2
~/work-clientC
...

I manage the different environments using direnv.

What I struggle with is overriding/extending the config for Neovim plugins for each environment.

let's say for example clientA uses a self-hosted GitLab instance which requires me to override the lazy.nvim config for some Git-related plugins. How could I achieve this?

I looked into exrc. afaict this would require duplicating any client-specific configuration for each new repository. Instead what I would like is something like ~/work-clientA/init.lua which would then be sourced automatically for each project (repo) inside work-clientA.

3
 
 

Honestly... everybody should try out neovim for at least a week. I mean like... fully commit to it.

It's just amazing how fast and light on resource usage it is, compared to vscode.

For reference: I just opened qmk_firmware which has a shit load of clang code and files. Guess what, neovim doesn't even break a sweat, while vscode almost burns my CPU.

4
 
 

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.

5
 
 

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.

6
 
 

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.

7
 
 

🚀 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. 💬

8
9
4
submitted 2 months ago* (last edited 2 months ago) by [email protected] to c/neovim
 
 

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

10
 
 

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.

11
12
 
 

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/.

13
 
 

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?

14
 
 

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!

15
 
 

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.

16
 
 

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?

17
26
submitted 4 months ago* (last edited 3 months ago) by [email protected] to c/neovim
 
 

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

18
 
 

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!

19
 
 

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?

20
 
 

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.

21
21
NVIM 0.10.1 (github.com)
submitted 4 months ago by mac to c/neovim
22
 
 

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

23
 
 

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.

24
25
 
 

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.

view more: next ›