New answers tagged

2 votes

How do I add a custom LSP to `nvim-lspconfig`?

You must do something like this (this example is for a different LSP, please adapt accordingly): require('lspconfig.configs').templ = { default_config = { cmd = {"templ", "lsp&...
fiatjaf's user avatar
  • 123
1 vote

How can I edit a file in real-time?

Pretty trivial augroup foobar | au! autocmd TextChanged ?* update augroup end You could also catch TextChangedI event but that would be overkill, IMO.
Matt's user avatar
  • 20.1k
1 vote
Accepted

What are the differences in use case between tabs and buffer in Neovim?

windows Within a tab you can split the viewport in windows to see multiple buffers at the same time. Plugin use also windows within a tab to let you: Browse your files (e.g.: nvim-tree) or Browse ...
Vivian De Smedt's user avatar
4 votes
Accepted

How can I prevent the present working directory to sync between tabs in Neovim?

The relevant commands are documented at :h current-directory. Basically, you should use :lcd and/or :tcd instead of :cd.
Matt's user avatar
  • 20.1k
0 votes

How can I go to the definition (gD) in a new tab?

I believe you don't have the distinction declaration and definition in typescript like you have it in C or C++. myfile.h // declaration int myfunction(int a, char *name); myfile.c // definition int ...
Vivian De Smedt's user avatar
0 votes

How can I make Neovim kill ongoing processes when I quit?

When you are running the Docker Command via vim , you should check the action when quitting the terminal. Consider these & use which-ever works for your Case : :term ++kill=kill .... :term ++...
Prem's user avatar
  • 206
1 vote
Accepted

How can I ignore default filetype indenting?

You can do: ~/.config/nvim/indent/tex.lua as: vim.o.indentexpr="" Remark on version prior to 9.3: ~/.config/indent/tex.lua is executed after $VIMRUNTIME/indent/tex.vim Where ~/.config/...
Vivian De Smedt's user avatar
0 votes

How to exclude filetype in autocmd using Neovim's Lua API?

Ok, so I came up with a workaround, which I'm not entirely satisfied with, since it doesn't make my intentions as clear. But it does now behave as I want it to. The workaround is to wrap the vim.wo ...
Jethro Cao's user avatar
1 vote

Neovim v0.9.2 Treesitter Update: Repeated Parser Installation Issue and Permissions Problem

I found the point, it's in conflict with Packer, that I had installed before - WARNING found existing packages at `/Users/lai/.local/share/nvim/site/pack/packer` So I deleted the folder /Users/lai/....
Lai32290's user avatar
  • 245
1 vote

I've switched to nvim and init.lua, which pulls in onedark colorscheme. How can I add a custom rule?

If the syntax file already matches the /**/ comment in the string, you only need to add a highlight for it. Check the syntax group (e.g., using zS from scriptease or synstax#UnderCursor() from ...
D. Ben Knoble's user avatar
  • 24.6k
3 votes

How do you pass options to a lua plugin?

require'nvim-gpt'.setup { no_default_keymaps = true, } is the correct way. It is not dependent on the plugin manager. (my mistake was elsewhere, calling this setup function accidentally from two ...
TamaMcGlinn's user avatar
0 votes

How can I ignore default filetype indenting?

Type :help user-manual Type /indenting See section 30.3 Automatic indenting Press K to follow the link Read the text Find the commands filetype indent off, let b:did_indent=1 etc.etc. Upd. As for vim....
Matt's user avatar
  • 20.1k
0 votes

Can not remap command using mapleader and keymap

I would do: lua vim.keymap.set("n", "<leader>pv", '<cmd>:Ex<cr>', { remap = false })
Vivian De Smedt's user avatar
0 votes

How to achieve a vertical split with tabs on left?

I think you’ve misunderstood tabs and windows. Vim contains tabs. Tabs contain windows. Windows display (parts of) buffers. Knowing this, we see that to have a window containing tabs is impossible. ...
D. Ben Knoble's user avatar
  • 24.6k
0 votes

Unable to use Nvim-dap with codelldb

I use this configuration in rust, maybe it'll help you local dap = require('dap') local mason_registry = require("mason-registry") local codelldb_root = mason_registry.get_package("...
Neptali Piña's user avatar
0 votes

How to achieve a vertical split with tabs on left?

Each tab takes the full screen. But each tab can be split in Windows both vertically and horizontally using the commands: :vsplit :split To achieve the layout you want I would use one tab and three ...
Vivian De Smedt's user avatar
0 votes

Neovim: external C++ Library Header file parsing not working

Solved it by installing llvm from brew, Paying attention to the caveats, added the following in bashrc (or similar): export LDFLAGS="-L/opt/homebrew/opt/llvm/lib" export CPPFLAGS="-I/...
vishalpaudel's user avatar
0 votes

How can I make Neovim kill ongoing processes when I quit?

Docker containers don’t run in terminals. They run in the background. The docker CLI orchestrates this. But there is no association between terminal and running containers. So it’s not clear how this ...
D. Ben Knoble's user avatar
  • 24.6k
0 votes

Setup Telescope to save and close all buffers, when opening a new file

When using telescope to find files, I close all buffers other than unsaved or current buffer: command! BufOnly execute '%bdelete|edit #|normal `"' "close other buffers (silent! to try-catch ...
Zhouxing Fang's user avatar
1 vote
Accepted

Question about LuaSnip

You are mixing up 2 ways , or rather 2 functions , here. It is true : ... Unfortunately there were some breaking changes in LuaSnip ... : Snippets are now added via `ls.add_snippets` instead of with ...
Prem's user avatar
  • 206
1 vote

Neovim Markdown toggling bold keybind

I usually use surround.vim for this. You could do nmap <buffer> <your keys> ysiw* nmap <buffer> <more keys> ds* In ~/.vim/after/ftplugin/markdown.vim or equivalent. Make sure ...
D. Ben Knoble's user avatar
  • 24.6k
1 vote
Accepted

VimTeX omnicompletion for bibliography

Thanks to @D.Ben Knoble I fixed it. As I said in the comment, the omnicompletion for bibliography used to work without the \addbibresource{path/to/bib_file}, now it you have to have it in the files to ...
enrico223's user avatar
0 votes

How to share config between Vim and Neovim

If you want to share ~/.vimrc between vim and neovim without a neovim config file you can define $VIMINIT in your .bashrc or .zshrc file: export VIMINIT='let $MYVIMRC="$HOME/.vimrc" | source ...
Dev's user avatar
  • 1
0 votes

vim.keymap.set issue

You mapping look good. But you have mapped against <leader>n which is by default: \n Unless you have define: g:mapleader. You can know the value of g:mapleader by running the following Neovim ...
Vivian De Smedt's user avatar
1 vote

Resize a vertical split to just fit the max width of the file contents

I would do: function! GetMaxLength() let i = 1 let maxlength = 0 while i <= line('$') let l = len(getline(i)) if l > maxlength let maxlength = l endif let i = i + 1 ...
Vivian De Smedt's user avatar
0 votes

Cannot make vim-markdown conceal the formatted text

I don't think Neovim loads lua file from nvim\after. If you want your setting to apply specifically to the markdown file type I would create a markdown.vim file within: ~/.config/nvim/after/ftplugin ...
Vivian De Smedt's user avatar
0 votes

Separating adjacent folds created with foldexpr

Solved, turns out I'm just stupid because <n and >n work fine. If anyone else has a similar issue, this code worked for me and can probably be adapted into a one-line expression pretty easily: ...
Sneez's user avatar
  • 1
0 votes
Accepted

Neovim/Lua: How to use vim.keymap.set with vim.v.count

For you particular case I would do: vim.keymap.set("n", "<leader>o", 'o<Esc>') If you type 3leadero it will translate into: 3oEsc which is doing what you want to do (...
Vivian De Smedt's user avatar
2 votes
Accepted

Error wihle reading ShaDa file

It looks like your shada file is corrupted. The file should be located into ~\nvim-data\shada\main.shada I would propose to: Stop Neovim Delete the shada file Restart Neovim
Vivian De Smedt's user avatar
2 votes
Accepted

How can I debug a nerd font not working on Windows + Neovim?

nvim.exe If you run the console version of Neovim (nvim.exe) then the font used is the font of the console you are using (e.g. cmd.exe) To control the font you have to configure it in your console. ...
Vivian De Smedt's user avatar
1 vote
Accepted

What is the syntax to use character classes inside Vim regex bracket expression?

You are right the character atom (e.g.: \s, \S, \d, ...) cannot be part of a collection ([]) To get the reference in the doc you can look for the NOTE in the section: :help collection: NOTE: The other ...
Vivian De Smedt's user avatar
-1 votes

How to load formatter.nvim with lazy.nvim?

Have you tried using :FormatWrite?
Luca Fedrizzi's user avatar
2 votes
Accepted

How to map Ctrl-Delete?

I would do: nnoremap <C-Del> dw inoremap <C-Del> <C-o>dw
Vivian De Smedt's user avatar
0 votes

Can I go to the implementation in the c project with lsp?

Adding this here for clang users who also want neovim LSP go-to functions to work on C projects built with CMake. You can have CMake generate a compile_commands.json as follows: cmake -...
111---'s user avatar
  • 101
1 vote

Portable Neovim. How to change default data folder? How to avoid registry entries?

The Windows environment variable %APPDATA% contains the path to a folder (%USERPROFILE%\Appdata\Roaming) intended for application specific data in a Windows domain environment (Windows computer ...
anon's user avatar
  • 11
0 votes

An unknown element "" was received / sending commands to Powershell

-- Set up the shell to be powershell vim.o.shell = 'powershell.exe' vim.o.shellxquote = '' vim.o.shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command ' vim.o.shellquote = '' vim.o....
Niklas Lundberg's user avatar
1 vote

jump to definition goes to import statement rather than actual file defintion

running :lua =vim.lsp.get_active_clients() made me realize that the only language server attached was copilot! So after some online searching I installed the mason language server package manager, ...
abbood's user avatar
  • 633
0 votes

Get motion used within operatorfunction?

You should be using the '[ and '] marks to get the boundaries of the motion. The "line"/"block"/"char" passed to the operatorfunc is used to know where to take full lines ...
WIP's user avatar
  • 101
1 vote

How do I ShaDon't?

For those looking for the same answer but in Lua. You can set in your init.lua file: vim.opt.shadafile = "NONE"
Sofa44's user avatar
  • 11
0 votes
Accepted

Is there an autocmd event that triggers when a command becomes available?

I don’t use nvim-lsp, but if you look at the source, you’ll see that you should be able to set config.settings.python.pythonPath the same as you do with the rest of your configuration. Besides that, ...
burnsac's user avatar
  • 16
0 votes

How to range format with nvim 0.9.0?

If you have lsp connected to your current buffer, then you can use a keybinding like this: vim.keymap.set("v", "<leader>F", vim.lsp.buf.format, { noremap = true, silent = ...
Merajul Arefin Pial's user avatar
1 vote
Accepted

Neovim paste without overwriting register w/ Lua

I believe you should do: vim.api.nvim_set_keymap('v', 'p', 'pgvy', { noremap = true }) The first argument is the mode: n for Normal (equivalent to nnoremap) v for Visual (equivalent to vnoremap) ...
Vivian De Smedt's user avatar
0 votes

Exclude empty lines when copying

The Solution to your Problem is not to remove the empty lines , which may cause Problems later. The Solution is to indent the syntactic empty lines to the Correct level. Eg , when your Python Script ...
Prem's user avatar
  • 206
0 votes

Error: ...cker/start/lsp-zero.nvim/lua/lsp-zero/nvim-cmp-setup.lua:12: attempt to index field 'SelectBehavior' (a nil value)

For me, it happened because I just recently updated my plugins (including nvim-cmp). They changed the parameters that went into cmp.select_prev_item() and cmp.select_next_item() ...or maybe I mistyped ...
daniel tumaini's user avatar
0 votes
Accepted

How to do fuzzy live grep on git files?

You will need to use my branch on both: https://github.com/eyalk11/ripgrep/tree/filelist and https://github.com/eyalk11/leaderf/tree/filelist filelist is an option I added to both leaderf rg and rg ...
eyal karni's user avatar
  • 1,016
0 votes

How can I easily configure my neovim to provide a vs code like javascript, html & CSS autocomplete, intellisence & highlighting

Frame Challenge I know you said Android, so I'm assuming VS Code isn't an option, but it sounds like you'd be happier with a computer and VS Code… Vim in general is going to require a learning ...
D. Ben Knoble's user avatar
  • 24.6k

Top 50 recent answers are included