New answers tagged

1 vote

I can't get haskell-tools working in LazyVim

Here is what I did to have haskell-tools running on my LazyVim system: Install ghc Install the Haskell Language Server Add the following haskell-tools.lua in: ~/.config/nvim/lua/plugins folder ...
Vivian De Smedt's user avatar
0 votes

Preventing cursor from indenting after a previously indented line

Indentation for python is set with set indentexpr, if you have: filetype plugin indent on in your configuration, then upon opening python file your indentexpr would be set to python#GetIndent(v:lnum) ...
Maxim Kim's user avatar
  • 13.1k
2 votes

Error while reading ShaDa file

The command :wshada! will forcefully overwrite the shada file, which should fix this issue. Note that this will overwrite data that neovim persists between restarts such as command line history. See :...
Aren's user avatar
  • 21
0 votes

Conditional Key Mapping in Neovim Based on File Type

The standard way to do this is to define buffer mapping in the filetype configuration. I would have a ~/.config/nvim/after/ftplugin/js.lua file with the following content: vim.api.nvim_set_keymap('n', ...
Vivian De Smedt's user avatar
1 vote
Accepted

Can I jump to implementation in a C project with coc-clangd?

In order to be able to find the implementation clangd need to find a compile_commands.json that contains the compilation instruction of the modules (.cpp, .c file) that contains the implementation. I ...
Vivian De Smedt's user avatar
0 votes

Neovim is looking for configs in current directory, how do I fix this?

The error was that my lazy.lua was in my C:\Users\{username}\AppData\Local\nvim\lua folder. However, you need to create a config folder inside your lua folder and put lazy.lua inside that config ...
Hello's user avatar
  • 21
1 vote

From a Neovim extension, how to detect project root?

Is there a Vim function that would be shorter? In vim, you can use findfile or finddir. Find .git directory upwards: let gitDir = finddir('.git', expand("%:p") . ";") if !empty(...
Maxim Kim's user avatar
  • 13.1k
0 votes

Error running notification service

The error comes from a plugin folke/noice.nvim. Uninstall the plugin and re-install it. This worked for me. OR delete the file util.lua in ~/.local/share/nvim/lazy/nvim-notify/lua/notify/stages/util....
Debasish Barai's user avatar
1 vote

keybindings that change mode: cannot use keybindings on the new mode

The key code is actually remap and not noremap. I would define it like this: local opts = { remap = false } local ll = "<leader>i" opts["desc"] = "Send visual lines&...
Vivian De Smedt's user avatar
1 vote

Text randomly shown in italics after being sent to a REPL with iron.nvim

It was iron.nvim's highlights, which are italics by default. To work around the bug and disable highlights, use: highlight=false
robertspierre's user avatar
1 vote
Accepted

<C-w>= doesn't work

Ctrl w= resizes all the windows (aka splits) that don't have the following options winfixheight and/or winfixwidth set. The following script should resize all the window to "equal" height ...
Vivian De Smedt's user avatar
1 vote

Redraw cursor at absolute top or bottom while keeping scrolloff

Based on great feedback and some really good inspiration from Rich, I have put together a working solution for this and I love it. local function scrolloff_should_reenable() if vim.w.orig_scrolloff =...
theherk's user avatar
  • 121
0 votes

How to force the Read-only mode?

I've aliased the less.sh script that ships with vim to vless. It does what you're asking for. alias vless='/usr/local/share/vim/vim91/macros/less.sh'
MDeBusk's user avatar
  • 394
1 vote

Omnifunc doesn't trigger after a few uses

The problem is with another part of my config which runs filetype detect in an autocmd. The fix was to simply not source it. This is the answer given by seandewar filetype detection will set ft=c as ...
YJH16120's user avatar
  • 135
0 votes

Long file name overrides other items in statusline

I think you have a couple of options: use a {maxwid} to limit %F (like %.50F) don't use %F :) FWIW, in my own statusline I have a "short" and "long" version. function! s:...
D. Ben Knoble's user avatar
  • 25.8k
1 vote

Why is neovim on the Debian repository so old?

While adding links to your Question, I noticed that the release you mention is on the testing and unstable channels. A newer release is in experimental. Debian I believe generally emphasizes stability ...
D. Ben Knoble's user avatar
  • 25.8k
0 votes

Remembering folds across sessions but in Lua

I would use the zM command: local folds_augroup = vim.api.nvim_create_augroup("Folds", { clear=true }) vim.api.nvim_create_autocmd("BufWritePost", { group = folds_augroup, ...
Vivian De Smedt's user avatar
1 vote
Accepted

AstroNvim in diff mode: navigating to next difference

There is no option indeed (I believe because ]c is a standard functionality and that are no added mapping has been introduced) but the command do work (at least for me).
Vivian De Smedt's user avatar
0 votes

Cannot switch tabs when in terminal tab

In nvim, I personally use Ctrl-PageUp and Ctrl-PageDown to switch between tabs, so prefixing Ctrl-\ Ctrl-N to Ctrl-PageUp and Ctrl-PageDown in remap works well: tnoremap <C-PageUp> <C-\>&...
Stefan's user avatar
  • 1
0 votes
Accepted

Creation of a short document description for programming languages in a pop-up window like vscode?

I changed my lsp-server from pyright to jedi_language_server and it works now.
mohamadi_arch's user avatar
2 votes
Accepted

Insert Mode Arrow Keys

I would do: vim.api.nvim_set_keymap("i", "<Up>", "<C-o>gk", {}) vim.api.nvim_set_keymap("i", "<Down>", "<C-o>gj", {}...
Vivian De Smedt's user avatar
0 votes

Creation of a short document description for programming languages in a pop-up window like vscode?

I would have a look to the following two plugins that could somehow fit the bill: lsp_signature goto-preview
Vivian De Smedt's user avatar
1 vote
Accepted

How can I force a reload on a previously require'd module?

I would do: lua package.loaded.XXX = nil lua require("XXX") More information on What is a way to reload lua scripts during run-time?
Vivian De Smedt's user avatar
0 votes

Best way to keybind subsequent substitutions in visual mode

I would probably write xnoremap <leader>q :substitute/^\(.*\)$/\=empty(submatch(1)) ? '>' : printf('> _%s_', submatch(1))<enter> " or xnoremap <leader>q :substitute/^/> ...
D. Ben Knoble's user avatar
  • 25.8k
2 votes
Accepted

Best way to keybind subsequent substitutions in visual mode

To avoid the double '<,'> problem the old way is to add <C-u> at the start of the mapping: vim.api.nvim_set_keymap( "v", "<Leader>q", ":<C-u>'<...
Vivian De Smedt's user avatar
1 vote

Best way to keybind subsequent substitutions in visual mode

The point is that Vim switches from mode to mode as it reads buttons. No matter if they come from keyboard or mapping. So you only start from Visual mode. But then you get into cmdline, then into ...
Matt's user avatar
  • 20.6k
2 votes
Accepted

Neovim interpolation gives E15 "Invalid Expression"

String interpolation are supported in Vim 9.0 but not in Neovim 0.9.5 It seems to have been implemented on September 2019 on Vim (see issue #4491) but not merged yet in Neovim 0.9.5 But it works fine ...
Vivian De Smedt's user avatar
0 votes

Send keys to a terminal buffer

I had been wanting to do the same thing. Your question helped so much! I wrote a super small plugin that does just this: https://gist.github.com/cowlicks/5d70685346bf341a71f26e564b795a76
cowlicks's user avatar
  • 101
0 votes

How to show and use Quick actions/Context action in Neovim?

In Vim, "QuickFix" seems to refer to the old way of fixing code, which involves navigating a list of errors spat out by the compiler after you run :make. I think you want "Code Actions&...
realh's user avatar
  • 161
0 votes

E576: Failed to parse ShaDa file: extra bytes in msgpack string at position 3

I'm not sure I got this error for the same reason, but I found a simple solution; remove this file: ~/.local/share/nvim/shada/main.shada
Lee's user avatar
  • 101
2 votes
Accepted

mapping <C-x><C-s> to save file in commandline mode

One risk with the mapping: cnoremap <C-x><C-s> :w<cr> is that that it assume that the command line is empty. If your command line is not empty it will merge the two. E.g. if the ...
Vivian De Smedt's user avatar
1 vote
Accepted

Exit Nterm and term quick

If you are in Normal mode you can do :q or simply ZZ as for a normal window. If you are in Terminal mode you can switch to Normal mode with Ctrl \Ctrl n and then :q or ZZ To simplify that you can add ...
Vivian De Smedt's user avatar
1 vote
Accepted

lazy.nvim: Upgrade plugins from command line

From the docs at https://github.com/folke/lazy.nvim: $ nvim --headless "+Lazy! sync" +qa
StevieD's user avatar
  • 1,472
1 vote

Backspace mapping not working

" with autopair :verbose imap <BS> i <BS> *@v:lua.MPairs.autopairs_bs() Last set from Lua i <BS> * x Last set from Lua :verbose imap <Enter> i <CR> * <Lua ...
TuberKk Coolio's user avatar
0 votes
Accepted

Backspace mapping not working

From your comments it seems to me that the <BS> key is remapped at the buffer level by: nvim-autopairs nvim-cmp To validate my hypothesis I would deactivate these two plugins and verify that ...
Vivian De Smedt's user avatar
1 vote
Accepted

Does NvChad hijack the ; key?

Yes is does override the vanilla Vim mapping for ;. You can use the :NvCheatsheet command to look at the NvChad default mapping. The ; had been remapped to the command execution (the : in vanilla Vim)...
Vivian De Smedt's user avatar
0 votes

How to improve CMP performance?

-- create a treshhold for big files local preferred_sources = { { name = "luasnip" }, { name = "nvim_lsp" }, { name = "nvim_lua" }, { name = "path&...
SergioAraujo's user avatar
  • 1,165
1 vote
Accepted

What are providers about?

Vim can embed other languages. It allows plugin author to write code in another language than VimScript. If you don't plan to use plugins that are written in these languages you don't need these ...
Vivian De Smedt's user avatar
0 votes

lazy.nvim: Upgrade plugins from command line

I would do: nvim -c "Lazy update" -c "sleep 120" -c "qa" Or using cmd Windows argument passing: nvim -c "Lazy update" -c "sleep 120" -c "call ...
Vivian De Smedt's user avatar
1 vote

What are the differences between built-in terminals in Neovim and Vim?

In recent version of Neovim and Vim both are pretty similar. Differences that I'm aware off is that: Windows management: Vim creates an horizontal split for the terminal buffer vs. Neovim reuse the ...
Vivian De Smedt's user avatar

Top 50 recent answers are included