New answers tagged

0 votes

How to revert to "close file when buffer closes" behavior in Neovim?

From :help :q :q[uit] :{count}q[uit] *:count_quit* CTRL-W q *CTRL-W_q* CTRL-W CTRL-Q *CTRL-W_CTRL-Q* Without {count}: Quit ...
user avatar
  • 20.9k
2 votes

Open file in new buffer within original vim instance from a terminal buffer

Sorry, I did not see the neovim tag before I wrote and posted. This is for Vim and I have to figure out what to do with it. Delete / move / …. My bad. No idea if this would work in neovim. One could ...
user avatar
  • 360
1 vote

Show command prompt including commands issued before entering neovim

I suggest :suspend or Ctrl-z, which put vim in the background, returning you to the shell from which you launched it. Then use your shell's normal job-control commands to return (e.g., fg).
user avatar
  • 20.9k
7 votes
Accepted

Keep specific parts of a :s command in nvim

Yes and no. Depends a lot on the complexity of the documents. Textile has a lot of various formats for links and Markdown has it's share. Keeping pattern When you do a substitute you can capture parts ...
user avatar
  • 360
0 votes

Vim Autoindent does not work

You're correct that smartindent and autoindent should do what you want, but it might be overruled by the archaic compatible setting. Be sure you're not in vi compatible mode. You want set ...
user avatar
2 votes
Accepted

Disabling a plugin loading when launching Vim from `git commit`

git sets a number of environmental variables when invoked, if they're not already set in the environment. I would just test for one of those and conditionally run the NERDTree commands accordingly. if ...
user avatar
  • 858
0 votes

Prevent buffer loads within Nerdtree

One can use interrupt() to abort event in progress. So for NERDtree one could do something like: autocmd BufWinLeave * if &filetype == 'nerdtree' | call interrupt() | endif BufWinLeave Before a ...
user avatar
  • 360
1 vote

Run autocmd on file close

Read :h BufWinLeave carefully Read :h BufUnload carefully Read :h 'hidden' carefully ... PROFIT
user avatar
  • 15.7k
0 votes
Accepted

How to use cmdline to send key `<ESC>`?

In my case I spent a lot of time trying to go back to terminal-normal mode, and this works: vim.api.nvim_feedkeys('', 't', true) The invisible part in neovim looks like ^\^N. And to make it work as ...
user avatar
  • 751
3 votes
Accepted

How to remove words in a visual selection

Use the special '<,'> markers at the colon prompt to restrict the scope of the command to the visual selection. If you hit : while a visual selection is active, it should prepopulate those for ...
user avatar
  • 166
0 votes

How can I emulate :shell command in Neovim?

It should be possible to attach to a tmux session from the terminal, i.e. :term tmux a. I'm not sure how usable it will be, but it's one way to get a persistent shell from neovim.
user avatar
0 votes

Installing Neovim 0.7 on Ubuntu?

As I haven't yet committed to Neovim, I'm playing with the appimage. You can't get an easier (un) install procedure than with those. If you're unfamiliar with appimages, just: Download the file Put ...
user avatar
  • 166
1 vote
Accepted

Slow down system when open nvim

It looks like that you installed cmp-tabnine somehow. If you don't need it anymore then you can just delete it with the following bash/zsh/fish (whatever shell you're using) command: rm -rf ~/.local/...
user avatar
  • 413
0 votes

How to use -complete=lua for command-completion?

Obviously, this is a Lua variable name (including variables of "function" type). Or, if you prefer, "tab" completes from a keys list of a Lua table you are currently referencing (...
user avatar
  • 15.7k
0 votes

What's the effect of "range" on :lua and :luafile commands?

it's unclear what effect it has It is ignored. Is there some way for the invoked chunk of Lua code to ask what the range was? As an example, command! -range -nargs=1 MyLua \ call v:lua....
user avatar
  • 15.7k
1 vote

Installing Neovim 0.7 on Ubuntu?

You have not mentioned which version/release of Ubuntu you are using. You can find the deb of neovim-0.7 from the neovim release page. I am using it on my debian testing without any issues so far.
user avatar
  • 141
2 votes

Asking for advice for fully committing to leader key keybinds

This does look like a bug in FTerm. As mentioned in the comments, usually in situations like this, normal mode mappings should not apply. This is usually achieved by setting the buftype to terminal. ...
user avatar
  • 901
2 votes

Installing Neovim 0.7 on Ubuntu?

Or you can use the "traditional" Linux way and install homebrew: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew install ...
user avatar
  • 121
1 vote
Accepted

$VIMINIT conflicts for neovim and vim

Both Vim and Neovim will use the same VIMINIT environment variable to set the configuration directory, so setting a global one will apply to both. You have two options: Set it only for vim commands, ...
user avatar
1 vote

How can I echo a message with newlines so it is displayed with line breaks and is available under :messages

You need to split on newlines and run echomsg multiple times; usually it's easiest to create a little wrapper function for this; for example: fun! s:echo(msg) abort for line in a:msg->split('\n')...
user avatar
0 votes
Accepted

Attach to terminal buffer opened with termopen

The solution for me here was to actually switch to just issuing a :term command. This meant I couldn't get a callback when the command finished, but I moved the cleanup work that I wanted to do into ...
user avatar
0 votes

JSX highlighting with Neovim and nvim-treesitter

I was having a similar issue, but I had missed the part where I needed to run :TSInstall typescript :TSInstall javascript :TSInstall tsx
user avatar
1 vote

nvim: How do I insert a luasnip for BufNewFile "_skel"

Of course, this won't work as buffer is active (i.e. has keyboard focus) only between BufEnter and BufLeave events. You can't just put code into a random autocmd and hope for the best. So either catch ...
user avatar
  • 15.7k

Top 50 recent answers are included