New answers tagged

2

This is a bug. Try :set icm= :s/one/sub :s/two/~ And it starts working even if set icm& back later. I would be nice if someone raise an issue on Neovim github ASAP.


1

I finally found a solution: In the view() function, in place of the vim.cmd(":edit catalog.txt") line: local file_path = vim.api.nvim_get_runtime_file("myPlugin/lua/catalog.txt", false)[1] vim.api.nvim_command("$read" .. file_path) The nvim_get_runtime_file({name}, {all}) function takes a pattern of the files to search for and ...


0

Found the problem. The approach was correct, it was just a syntax issue: autocmd TermOpen * call TerminalSettings(). I was missing the asterisk. My current config is now: " Terminal Buffer function! TerminalSettings() setlocal nonumber normal a endfunction augroup terminal autocmd! autocmd TermOpen * call TerminalSettings() augroup END ...


0

I have written an article on dev.to about accessing v:oldfiles entries, here is the function to access oldfiles outside of vim: function old(){ [[ -f /tmp/oldfiles.txt ]] && \rm /tmp/oldfiles.txt vim -c 'redir >> /tmp/oldfiles.txt | silent oldfiles | redir end | q' local fname FILES=() for i in $(awk '!/man:/ {print $2}' /...


1

For vimscript: xnoremap KEYS :call MultiLineSend()<CR> function MultiLineSend() range " lastline first, so that we don't change where firstline is execute a:lastline "put =')'" execute a:firstline "put! ='('" " lines have changed, so adjust the offsets execute printf('%s,%s TREPLSendSelection', a:firstline, a:...


0

Actual this works (from the official doc: https://neovim.io/doc/user/lua.html): vim.opt.listchars = { space = '_', tab = '>~' } In my case I got to add (init.lua or outsourced file for global-lua-settings) vim.opt.listchars = {eol = '↵'} vim.opt.list = true


2

Remove set smartindent from your configuration. Excerpt from the :h 'smartindent' When typing '#' as the first character in a new line, the indent for that line is removed, the '#' is put in the first column. The indent is restored for the next line. If you don't want this, use this mapping: ":inoremap # X^H#", ...


0

I just resolved this using NeoVIm by the way: vim.keymap.set({'n', 't'}, '<M-Tab>', function () if (vim.api.nvim_win_get_config(0).relative ~= '') then vim.api.nvim_input('<ESC>') end require('FTerm').toggle() end, NOREF_NOERR_TRUNC)


0

Try also do the same for EndOfBuffer: :hi EndOfBuffer guibg=NONE ctermbg=NONE`


0

Check out some related questions: https://vi.stackexchange.com/search?q=%5Bfiletype-c%2B%2B%5D+g%2B%2B, https://vi.stackexchange.com/search?q=%5Bfiletype-c%2B%2B%5D+compile A short answer: prefer to use :make to build and probably :terminal or :! to run the program, all of which you can bind maps to. But if you insist on this particular setup: :help cmdline-...


1

In Neovim, you can install plugins into ~/.config/nvim/pack/FOOBAR/start/ (replacing FOOBAR with any directory name you choose), similarly to how you can use Vim 8.0's native support for packages. Alternatively, you can also install plugins into ~/.local/share/nvim/site/pack/FOOBAR/start/ (replacing FOOBAR with any directory name you choose). To find the ...


2

Beware that Vim popup is "modal". It can have a border and other stuff while omitting normal editing capabilities. That makes it to behave much like "a popup menu" and not a regular window. While in Neovim it's "normal floating window" that can edit the text but has no builtin support for "menu mode". So there's a big ...


1

See :h 'viewdir' and :set viewdir? This is the same option for both Vim and Neovim, but Neovim has different default settings.


0

I found that the url https://github.com/neovim/neovim/releases/latest automatically redirects to the latest version URL. So I wrote a script that extracts the version and downloads the assets. As long as the neovim team doesn't modify their repo paths, it should keep working: nvim_latest_version=$(curl -s https://github.com/neovim/neovim/releases/latest | ...


0

You have an OS window and you have a vim window. A normal instance of vim can't live in 2 different OS windows. However, two clients attached to the same server can live in different OS windows. So... start vim as a server: :help --servername. And then open 2 OS windows up, and attach them to this server as a client. Maybe this will work for you. You'll need ...


0

Simply use vim.api.nvim_exec() (or vim.cmd() if your NeoVim version still doesn't have it) to run Vimscript commands from Lua. vim.api.nvim_exec('language en_US') That should do it.


1

One other option is to use the expression register = together with the macro replay operator @. When you type @=, Vim will let you enter a Vimscript expression (i.e. a string) and will execute that string as a macro. You can pass @= a count and it will repeat the execution {count} times. In your case, start with, say, 7@= (to run it seven times), then in the ...


0

You could accomplish that with a mapping that stores the count (for example, in a buffer-local, script-local or even global variable) and start recording a macro (say qa), and then a second mapping for ] that stops recording the macro and executes it the number of times passed as the count (minus one, since the recording itself also counts!) In short: ...


1

I believe that I found the solution for my issue. I noticed this issue in the Neovim repo about the !locale options in Neovim. I checked mine and I had the following: :!locale [No write since last change] LANG="en_IL.UTF-8" LC_COLLATE="C" LC_CTYPE="UTF-8" LC_MESSAGES="C" LC_MONETARY="C" LC_NUMERIC="C&...


2

This is embarrassing. My problem was a Mac problem. I had a very old version of iterm2 lying around in some "stuff" directory. I was launching it with Command-Space iterm which pointed to the old version instead of the new. I have removed the old version. With the new version of iterm2, neovim works fine. It would still be interesting to know why ...


1

I just found that NeoVim provides some functions to do so easily: local cur_win = vim.api.nvim_get_current_win() -- do your windo, for example: vim.cmd("windo if &buftype != 'nofile' | let g:non_float_total += 1 | endif") vim.api.nvim_set_current_win(cur_win) And since my problem was originally asked in context of Vim before edit(yeah, it's ...


2

This turned out to be an issue with the way that the completion sources are structured. Pathogen is not able to load them. I resolved the issue by switching to packer.


0

While the guide is not explicit about it, those configuration snippets are meant to be added to the main NeoVim configuration file, at ~/.config/nvim/init.vim, and not in a per-filetype file for Rust. In particular, vim-plug configuration (the Plug statements) only work in init.vim (or the .vimrc file for Vim), since plug-ins are loaded in startup right ...


1

Any of :normal! ^ (or 0, or $) the functions setpos, cursor, or setcursorcharpos should do it. OTOH, on the : line you need things like <C-b> and <C-e> (see :help cmdline-editing), or press <C-f> and use normal motions.


Top 50 recent answers are included