Skip to main content

New answers tagged

0 votes

How do I remove the delay when using a key remapped to `k`?

There is Dvorak support in an optional plugin distributed with Vim (:edit $VIMRUNTIME/macros/README.txt): The following have been moved to an optional package. Add the command to your vimrc file to ...
D. Ben Knoble's user avatar
  • 26.6k
0 votes

What does this command do?

Let's break it down: (getline(v:lnum)=~@/) ? 0 : (getline(v:lnum-1)=~@/)\\|\\|(getline(v:lnum+1)=~@/) ? 1 : 2 That ...
romainl's user avatar
  • 41.2k
1 vote
Accepted

How do I remove the delay when using a key remapped to `k`?

In standard Neovim the c key command is the command for change c. It wait for a move (or a text objet) to determine what to change, switching to operation pending mode. LazyVim comes with which-key....
Vivian De Smedt's user avatar
3 votes
Accepted

How do I swap surround's spacing for opening vs. closing delimeters?

You can use iwb as an alias for iw): ysiwb Same for iwB versus iw}, and iwr versus iw]. FWIW, iwb and iwB are inspired by ib and iB, which also exist in Vim itself. They are not strictly equivalent ...
romainl's user avatar
  • 41.2k
1 vote

How do I swap surround's spacing for opening vs. closing delimeters?

Using the tip in :help surround-customizing, we can do let g:surround_{char2nr('(')} = "(\r)" let g:surround_{char2nr(')')} = "( \r )" I haven't tested how this plays with the yS ...
D. Ben Knoble's user avatar
  • 26.6k
0 votes
Accepted

How do I start a search with the currently selected text?

I would do in Lua: vim.api.nvim_set_keymap("v", "/", '"vy/<C-r>v', { noremap=true}) Or its equivalent in Vimscript (for init.vim): vnoremap / "vy/<C-r>v ...
Vivian De Smedt's user avatar
2 votes
Accepted

How to hide keybinds in which-key.nvim depending on buffer type?

I believe the problem is that your register your which-key buffer mappings globally. Instead of having the register call of the buffer mapping in vimrc they should probably be in the ~/.config/nvim/...
Vivian De Smedt's user avatar
1 vote
Accepted

How to get default Generic Keywords autocomplete functionality when LSP is in use?

If your LSP bridge overrides the Ctrl+n and Ctrl+p (with Coc you can configure the keys) and don't include the standard Neovim completion (Coc merges the two completions in the same menu) you could ...
Vivian De Smedt's user avatar
0 votes

How to get default Generic Keywords autocomplete functionality when LSP is in use?

One possible solution, which seem to work is to remap the original Ctrl + n to another key sequence. I remapped it to Ctrl + J inoremap <C-j> <C-n> It seems to preserve the original ...
d.k's user avatar
  • 696
0 votes

Neovim configuration to join lines with BACKSPACE

The first behavior (joining with the next line) can be achieved by having eol as part of the backspace option. The second behavior (joining with the previous line) can be achieved by having start as ...
Vivian De Smedt's user avatar
3 votes

Is there a reliable way to know whether a keybinding is already in use?

You can use :help maparg() to get information on a specific mapping (or abbreviation) and :help maplist() to get a list of all mappings (or abbreviations). Both can be used to condition a mapping. For ...
romainl's user avatar
  • 41.2k
2 votes

Is there a reliable way to know whether a keybinding is already in use?

If it is not loaded there no ways since Vim has no information about the plugin. But if it is you can get a list of all the mapping for a given prefix with the map command. e.g.: The following command ...
Vivian De Smedt's user avatar
0 votes

How can you create a vim mapping with a description

Since you mention neovim it has a native way to bind keys with a description, if you define it in the lua config file (init.lua), rather than the vimscript one (vimrc). Example: vim.keymap.set('n', ',...
miyalys's user avatar
  • 101
0 votes

<CR> behavior unexpectedly changed in normal mode

Ok, I think I figured it out. With the help of vim --clean and :h CR I was able to verify that my old behavior is indeed what the default is. In :h CR I noticed that C-M by default maps to the same ...
Daniel Baulig's user avatar
0 votes

Any commands to switch to the window on the far left or right?

:wincmd can take a count, and even $ is accepted. As such, :$wincmd l/$wincmd j and :$wincmd j/k seem to be a good start. From there any mapping where you combine them should do. e.g. :nnoremap <...
Luc Hermitte's user avatar
  • 17.5k
0 votes

Any commands to switch to the window on the far left or right?

In Vim, you often prepend a count to your commands. This is no exception. Use <C-W>2h to move two windows to the left, giving your bottom left window focus. You can also click the respective ...
Friedrich's user avatar
  • 2,215

Top 50 recent answers are included