Neovim

496 readers
1 users here now

Neovim is a modal text editor forked off of Vim in 2014. Being modal means that you do not simply type text on screen, but the behavior and functionality of the editor changes entirely depending on the mode.

The most common and most used mode, the "normal mode" for Neovim is to essentially turn your keyboard in to hotkeys with which you can navigate and manipulate text. Several modes exist, but two other most common ones are "insert mode" where you type in text directly as if it was a traditional text editor, and "visual mode" where you select text.

Neovim seeks to enable further community participation in its development and to make drastic changes without turning it in to something that is "not Vim". Neovim also seeks to enable embedding the editor within GUI applications.

The Neovim logo by Jason Long is licensed under the Creative Commons Attribution 3.0 Unported License.

founded 3 years ago
MODERATORS
26
 
 

So, I've been using nvim on macos for almost two months and didn't have issues, but after the last update I'm seeing this:

Error detected while processing BufReadPost Autocommands for "*":
Error executing lua callback: ...ocal/Cellar/neovim/0.9.1/share/nvim/runtime/filetype.lua:21: Error executing lua: ...ocal/Cellar/neovim/0.9.1/shar
e/nvim/runtime/filetype.lua:22: BufReadPost Autocommands for "*"..FileType Autocommands for "*": Vim(append):Error executing lua callback: vim/load
er.lua:0: EACCES: permission denied: /Users/clmbmb/.cache/nvim/luac/%Users%clmbmb%.local%share%nvim%lazy%null-ls.nvim%lua%null-ls%rpc.luac
...

This happens (for now) only when trying to open .lua files.

From what I gather there's something related to some filesystem security flags in macos. I'm new to macos, so I have no idea what happens.

Any hints/solutions to this?

27
10
submitted 11 months ago by rjooske to c/[email protected]
 
 

Is there a way to avoid opening a nested neovim instance inside a terminal buffer and instead open it as a new buffer inside the already running instance? I'm thinking something like what Fugitive does, but more general and that works for any shell commands.

28
3
submitted 11 months ago* (last edited 11 months ago) by [email protected] to c/[email protected]
 
 

Hi everyone long time vim/neovim user, currently for my latex I have in ~/.config/nvim/after/ftplugin.lua the following line:

vim.opt_local.makeprg="pdflatex -output-format pdf -output-directory /tmp %"

I am now working in a latex project that has a makefile, is it possible to create something in the lines of:

if ! makefile_exists then
  vim.opt_local.makeprg="pdflatex -output-format pdf -output-directory /tmp %"
end

Ended up with this and it seems to work fine:

~/.config/nvim/after/ftplugin/tex.lua

local makefile_exists = vim.fs.find('makefile', {
  upward = true,
  stop = vim.uv.os_homedir(),
  path = vim.fs.dirname(vim.api.nvim_buf_get_name(0)),
})

if #makefile_exists == 0 then
	vim.opt_local.makeprg = "pdflatex -output-format pdf -output-directory /tmp %"
end
29
3
submitted 11 months ago* (last edited 11 months ago) by Agility0971 to c/[email protected]
 
 

I'm using NvChad and in ~/.config/nvim/lua/core/mappings.lua there is a keybinding for LSP code action:

  ["<leader>ca"] = {
    function()
      vim.lsp.buf.code_action()
      -- TODO: write buffer to file
    end,
    "LSP code action",
},

this keybinding applies the code action, but does not write to file. I want to write changes to file as soon as I've applied the code action.

How can I use the documentation at https://neovim.io/doc/ to find the correct function? I've tried looking for a write() function but I could not find anything I can call from lua.

30
 
 

We got TWiN back! No RSS for now but good to see someone stepping in and keep to project alive.

31
 
 

out of curiousity, since I feel like most of the time I touch any vi derivative it’s because I need a text editor on a command line, not because I really really wanna use it

32
 
 

So, I've been a Neovim user for a few years now. I started as most of you (I assume) with vim, and just kept on using and expanding that config file over the years.

I only recently realized there's quite a split between the Vim and Neovim plugins and that the Neovim community is pushing Lua as a better development platform. From what I can see, some users are switching their configs from Vimscript to Lua. To be honest all I know about Lua is that it means moon in Portuguese...

Should I too? What would the advantages be? What would the disadvantages be? For those who did switch, why did you switch and what was your experience? For those who didn't why did you not?

p.s. review (roast) my dotfiles

edit: thank you all for your input! I will consider slowly switching to lua by modifying only some parts of the config as some of you suggested.

33
 
 

I’ve tried all the surround plugins but what I really want is just the simple flow of: make a selection -> press “, ( etc to surround. Is that not possible with vim?

34
 
 

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?

35
 
 

I am rewriting my ancient vim config into Lua with nvim. I am using Mason to grab lsp language servers and for the most part it works great!

I have this in my remaps so I can <leader>f to format the current file (still need to figure out formatting on save too, but I can't for the life of me get Markdown formatting working.

vim.keymap.set("n", "<leader>f", function()
	vim.lsp.buf.format()
end)

I have markdownlint, marksman, prettier, and prettierd all installed wth Mason (though I haven't written any keymaps or configs for them). Any idea how I can format my Markdown? I write in it all day every day so it's gonna help a ton if I can get it working. Secondly any ideas how I can do the same mapping for the formatting on save? Still pretty new to Lua.

36
 
 

Hey guys, I'm following the tutorial above, and in his video he doesn't do anything specific to show hidden files, but it works for him. My .config/nvim/after/plugin/telescope.lua file looks like this: I've looked up solutions but they all use a different syntax, and none work for me. Any idea how I can make the find_files command also show hidden files by using this syntax? Thanks!

37
 
 

This is a very simple thing but it can be useful for folks who are still using mostly arrow keys. It finally clicked for me when I started using Tridactyl for Firefox :)

Most of the time you need down and up motions so you rest your index finger on J and middle finger on K. J looks little bit like a down arrow (mnemonics jown and kup don't seem very intuitive to me). So now you have the main arrow keys assigned to your fingers. Naturally you rest your ring finger on the L key and when you occasionally need to move left just move your index finger to the H key.

38
 
 

Hello !

In my day to day work I often have to write small snippets to illustrate ticket tech strategy.

I was wondering if you guys knew a cool way to have quick scratchpad where I could manipulate the snippet, format it, and have minimal syntax coloration.

This is usually handled by LSP, but sometimes having a full lsp running is not practical, with all the overhead of typescript config for example.

Main formats are JSON, typescript and soon Rust.

Cheers

39
 
 

i currently use Iosevka Nerd Font.

the cancel icon (X) looks too big and i want to change it to lowercase (x). i looked through the nvim-web-devicons readme and i also tried printing out all the available icons there

i.e.

local devicons = require("nvim-web-devicons").get_icons()
for _, value in pairs(devicons) do
	for i, v in pairs(value) do
		print(i .. "==>" .. v .. "\n")
	end
end

but i couldnt find an icon with a name that matches X or cancel. what can i do to override this and replace with a custom one?

[edit] i use barbar.nvim for buffers btw.

i just tried akinsho/bufferline and the cancel icon looked normal. i suppose this is a barbar issue

[edit]:

okay turns out it was a barbar issue. just had to read through the README.md properly haha.

M.config = function()
	require("barbar").setup({
		icons = {
			button = "x", -- customize it to anything 
		},
	})
end

40
 
 

Hi, I’m new to neovim so there’s a decent chance this is just a rookie mistake. I wanted to make an autocmd to remap F5 to running the (python) file. I found a stack overflow post on how to do this (https://stackoverflow.com/questions/18948491/running-python-code-in-vim ) but that was for vim. I tried my best to translate if for neovim using some other tutorials I found (and doing my best at understanding docs), what I came up with is this:

local api = vim.api
local RunFile = api.nvim_create_augroup("RunFile", { clear = true })

api.nvim_create_autocmd(
    "FileType",
    {
        callback = "map <buffer> <F5> :w<cr>:exec '!python3' shellescape(@%, 1)<cr>",
        pattern = "python",
        group = RunFile,
    }
)

however when I include the file in my init.lua, not only does it not work (the autocmd doesn’t even show up when looking in :au FileType, let alone run) it also makes the text a boring white and when I try to format, it gives the error [LSP] Format request failed, no matching language servers. while I definitely do have the language server (it works when the autocmd file is not included in init.lua). I’m probably just making some simple mistakes, but I cannot for the life of me find what I’m doing wrong. Does anyone here have any suggestions? For the record, I use lsp zero and treesitter

41
 
 

Zeioth has created a fantastic plugin for those of you looking to make Neovim more like an IDE. Run the open command, tell it to build, have it compile, execute, and output your code in a really nice looking way all inside neovim.

It's still pretty early but this is looking promising. It's already very customizable with support for a few languages, with more in the works.

Give it a look: https://github.com/Zeioth/Compiler.nvim

42
 
 

I've been absolutely loving treesitter. It's come a long way and it's been absolutely great for things like folds, motions, highlights of course. Now that I've finally gotten familiar with writing my own queries I can extend the existing plugins. As an example I've added folds to blocks of multiple consecutive comments in JS and Ruby.

What are some of your favorites?

43
28
submitted 1 year ago* (last edited 1 year ago) by lung to c/[email protected]
 
 

Hey guys, I'm currently one of the active members the neovim reddit (hugelung), and I'm in full support of migrating to lemmy. I was hoping to be modded here, and helping migrate content / roll people over

44
17
Weekly dotfile review? (sh.itjust.works)
submitted 1 year ago* (last edited 1 year ago) by [email protected] to c/[email protected]
 
 

What does everyone think about doing a weekly dotfile review thread like r/neovim does.

I personally really like to see different neovim configurations that other people have made.

Edit: my config

Edit 2: I also think that if we are to do these, they should be done on the weekends, since that is the time when people aren't busy with their jobs or school.

45
 
 

Am I the only one who struggle with cmp comparators? I can't make any setup to work like I want it to work.

Like come on, diagramIds is literally on the line above ...

The comparators aren't even documented: https://github.com/hrsh7th/nvim-cmp/issues/883

This is the closest thing I could find to usefull: https://github.com/hrsh7th/nvim-cmp/issues/183 but it didn't help either

How did you manage to cope with this? Is there some reasonable setup for cmp comparators?

46
 
 

Hey all, just a heads up that https://github.com/neovim/neovim/discussions has been reopened in the light of the r***it situation.

47
 
 

Just wondering: how would you characterize the general feel of the different nvim flavours: LazyVim, Chad, Astro, etc.? I'm not thinking functionality, which plugins are included, etc., but the way they feel when one uses them.

I tried out a whole bunch of them, as per Elijah Manor's excellent video about config switching (https://www.youtube.com/watch?v=LkHjJlSgKZY)

I figured out LazyVim is trying its best not to look and feel like vim, with modal windows and fancy graphics and all. I didn't like that. I can't remember why I left Astro behind, but I finally settled on Chad, which at first I disliked because of the name, but eventually I figured out that that was the flavour for me: so many things just worked as expected, and there were so many times when I looked up something, and went: "Hm! That was quite smart, actually!"

So that's where I'm at – and purely for "feel" reasons. So: convince me: what am I missing when I don't use bundle B or config C?

48
 
 

Hey all. I recently made the jump to using neovim as my full-time editor of choice using a modified version of LazyVim. I'm looking for a plugin that shows Markdown preview (preferably within a buffer and not by opening a browser page, if that's possible). This is primarily for taking notes at work, although I don't need the most heavyweight note taking app (for that I usually use Notion, which unfortunately doesn't seem to have a read-write neovim plugin). Do you have any recommendations?

49
 
 

e.g. the builtin live_grep function. Particularly if it has to open a buffer, the cursor is just on line 1, not the line I selected in Telescope. I think it might be to do with folding?

Just wondering if anyone else had this and knew a fix?

50
 
 

The r***it neovim community is fab and taking part in the go-dark outage protest. I think open source communities are better served by open not for profit, decentralized community-apps like this. The corporaate ones always go bad in the end. Reddit and Github both allowed their data to feed the big tech power grab that is LLMs.

view more: ‹ prev next ›