New answers tagged neovim
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&...
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.
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 ...
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.
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 ...
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 ++...
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/...
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 ...
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/....
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 ...
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 ...
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....
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 })
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. ...
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("...
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 ...
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/...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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
...
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 ...
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:
...
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 (...
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
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. ...
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 ...
-1
votes
2
votes
Accepted
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 -...
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 ...
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....
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, ...
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 ...
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"
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, ...
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 = ...
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)
...
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 ...
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 ...
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 ...
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 ...
Top 50 recent answers are included
Related Tags
neovim × 1533vimrc × 157
vimscript × 121
lua × 118
key-bindings × 109
lsp × 84
terminal × 75
colorscheme × 49
autocmd × 48
syntax-highlighting × 40
plugin-coc × 37
vimscript-lua × 36
command-line × 35
microsoft-windows × 33
terminal-buffer × 32
buffers × 30
plugin × 29
cut-copy-paste × 28
vim-windows × 28
autocompletion × 26
neovim-qt × 26
gvim × 24
highlight × 23
insert-mode × 22
functions × 22