Hot answers tagged

6

I’m assuming all the things to change are the same. If not, I would probably proceed with either multiples of the steps below, or combine all the patterns into a single substitute pattern. So, not really what you asked for, but: *cgn Breakdown: *: start a search for the word under the cursor (g* if you don’t want the word boundaries) cchange gn the next ...


4

There are several approaches: Open the file As others have explained, unless the author doesn't follow conventions, the function scope1#scope2#...#scopen#funcname() is supposed to be defined in {rtp}/autoload/scope1/scope2/.../scopen.vim file. Where {rtp} designates any directory in 'runtimepath' list option. This option is usually automatically handled ...


4

With tpope’s scriptease, you can do :Vedit autoload/plug.vim (with completion) to get to the file, but you still have to know that plug# signifies a function in the plug « namespace » of the autoload system. (Note: not all plugin authors respect this. Some create functions foo#bar in plugin/foo.vim, which is seriously misleading! The function is neither ...


3

The ALE plug-in requires Vim 8 or NeoVim 0.2.0+. If you open a file in the Vim command-line with Ale loaded (vim /path/to/file.py or similar), it will produce an error like the one below: ALE requires NeoVim >= 0.2.0 or Vim 8 with +timers +job +channel I suggest you install a more recent version of Vim or NeoVim to get Ale to work. You might also want to ...


3

This is a :h autoload function, it's name is a hint on where it's defined. plug is the name of this script (without .vim), it's parent directory is some_runtimepath/autoload . You already know it's vim-plug, so goto ~/.vim/plugged/autoload, you should see plug.vim there. You can also use directory with autoload, for example : a#b#c#d#foo#bar is a function ...


2

I use argdo in this answer, same rule applies to bufdo, windo , ... . Don't use argdo undo argdo undo failes in these conditions: Some buffers remain unchanged after last argdo, might caused by 0 pattern match, execute undo on them is a mistake, it will undo changes made by older argdo. An error occurs during your last argdo, when an error occurs, argdo ...


2

Most plug-ins that take text objects usually include a version of their mappings that works in Visual mode. That also includes vim-sandwich. So one option is to use Visual mode to select the region you want to wrap with quotes and then use the sa mapping on those. For example, you can use f,lvt] to visually select the /api/static/2_lion.wav part that comes ...


2

Looks like you need a library plugin that other plugins can depend on. So far the best way to have library plugins is through autoload plugin files. These files are lazily loaded, they are loaded on demand. EDIT: IOW, the following will be enough " library plugin: autoload/colorname.vim let g:colornames#red = 'rouge' " client plugin let red = g:...


2

One way would be to press * when your cursor is on the word you want to replace, phrase in this case, which will search for that word (very useful in general!) It will use \<phrase\> as the pattern: the \> are word boundaries (similar to \b in Perl-style regexps) so that it won't match phrases. You can then use :%s//sentence/g; to replace phrase ...


2

You have a few options, though some depend on plugin-authors to follow best-practices. vim --noplugin is kind of a nuclear option. You can combine with -Nu NONE or other -u options to get varying levels of "just my config" (though, if you put config files in ~/.vim/plugin/ like me, this will disable those too) let g:loaded_<plugin> = 1: most ...


2

I've used undotree for a while without any real issues.


2

I still haven't found the perfect solution, but one that works for me reasonably well: by using vim-slime (which is written in only vimscript). In my config-file (~/.config/nvim/init.vim or ~/.vimrc), I'm using the following line(s): let g:slime_target = "neovim" "let g:slime_target = "vimterminal" "let g:slime_target = "...


1

That's an interesting question! To my knowledge, there is no option to do so. I think it's better to let the user chose his own mapping to avoid collisions. This is the reason why some plugins use <Plug> for their features (see :help using-<Plug>). I am happy to see that you are keen on plugins (they are really useful), but I suggest you to not ...


1

Check out the asyncomplete plug-in. It will automatically show the autocomplete popup menu as you start typing. This plug-in only provides the base for completion and depends on add-ons to implement specific types of completion. So you will also need asyncomplete-clang for C/C++. (The asyncomplete-clang add-on says "NOT READY FOR GENERAL USE!", so ...


1

You might like UltiSnips. It's a bit complex (but you could say most snippet plug-ins are), but you can find screen casts covering UltiSnips to help you get started with it. You'll probably want to use the snippets from honza/vim-snippets together with UltiSnips (in fact, the UltiSnips quick start instructions mention them specifically.) They should cover a ...


1

There are Vim plug-ins that emulate the "multiple cursors" feature from other editors such as Sublime or VS Code, for example, mg979/vim-visual-multi (successor to the now deprecated terryma/vim-multiple-cursors.) But since these plug-ins need to use Vim highlighting features to emulate multiple selections and they typically need to re-implement ...


1

If you wrap your :runtime in an :exec you should be able to use your Vim variable. let vimrc_customization='aaa' :exec 'runtime vimrc.d/vimrc.' . vimrc_customization


1

I would not suggest to use vimball installation if you plan to update/remove plugin later. If you don't want to use plugin managers (all of them are git based afaik) just download plugin source files and put them into ~/.vim/pack/plugins/start/ folder. (Assuming you have not that old vim with packages support :h packages). Or if you have git installed you ...


1

The issue was with the "restore-view" plugin. Disabling it solved the issue. I was only using it for saving my folds. That can be achieved my using :mkview and :loadview.


1

I guess all bracketing plugins have this behaviour for brackets at least. This is the case of lh-brackets for instance. And it's quite easy to extend to anything else. The important part is CR+ESC+O, O is what will ensure a correct indent. See this related answer on SO: https://stackoverflow.com/questions/35708395/how-to-move-opening-curly-braces-to-a-new-...


1

OK, I had packadd vim-rails in an ftplugin/ruby.vim file. Apparently this causes problems. Placing directly in ~/.vimrc file fixed the problem.


1

Well, such sort of questions tends to be too vague. But here are a couple of thoughts. If it's solely "for private use", I could even consider modifying $VIMRUNTIME/rgb.txt. Sure, it feels dirty, but if no one else can see it then why the hell is not? You can simply use global variables, as it's "for private use" only. Declare them in your vimrc and they ...


1

I think building on your logic @dedowsdi one could then do argdo if &modified | earlier | endif I can see how one could have several wrapper functions written around this, that's great!


1

The v:lua interface was only introduced to NeoVim in PR #11338, which has a milestone of 0.5, so it looks like it's not generally available in released versions of NeoVim just yet. (NeoVim 0.5 is still in Beta as of early May 2020.) You should use the luaeval() Vimscript function to evaluate a Lua expression (such as a function call) and use the returned ...


Only top voted, non community-wiki answers of a minimum length are eligible