Skip to main content
16 votes
Accepted

What is the best way to re-factor a variable name in vim?

You can just use the usual workflow search and replace: /original cwreplaced n.n. You can take also advantage of the gn motion: /original<CR> cgnreplaced<ESC> ..... cgn will change the ...
nobe4's user avatar
  • 16.1k
12 votes

Is it possible to have vim auto-complete function names, variables, etc. when using it to program?

In insert mode, type the first couple of characters of a word, then press: Ctrl-N to insert the next matching word; or Ctrl-P to insert the previous matching word. This is particularly useful when ...
surendra nath's user avatar
9 votes

How can I integrate gdb with Vim?

Vim 8.1 adds debugger integration, see :help terminal-debug. The summary is that you run :packadd termdebug :Termdebug myprogram And then you can set breakpoints either in the gdb buffer using b ...
thakis's user avatar
  • 261
9 votes

How to get intelligent C++ auto-completion?

One option (what I currently use) I don't use YouCompleteMe anymore. coc-clangd is much better and simpler. Today I use coc.nvim + coc-clangd instead. Another option (what I used to use) YouCompleteMe ...
oblitum's user avatar
  • 276
8 votes

How can I integrate gdb with Vim?

GDB edit command Opens an editor on the current line using the command: $EDITOR +<current-line> <current-file> The default editor is ex, but vim also understands the +<current-line&...
Ciro Santilli OurBigBook.com's user avatar
8 votes

How to find plugin vimscript function definition?

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}...
Luc Hermitte's user avatar
  • 17.5k
7 votes
Accepted

IDE-like inline diff highlighting in Vim

You can do this with the vim-gitgutter plugin. If you're not using git, then Signify has a similar feature. After installing vim-gitgutter, you can switch the highlighting on and off with the ...
Rich's user avatar
  • 32.2k
7 votes

What is the best way to re-factor a variable name in vim?

You can use a substitute: :%s/original/replaced/g Will substitute across the entire file (%) original by replaced. And will replace multiple occurrences on the same line g. If you are not confident ...
nobe4's user avatar
  • 16.1k
6 votes

comprehensive list of keys bindings for IdeaVim (PhpStorm vim emulator)

The documentation does suck. I have no idea why they would leave it languishing so much. Other than the links already posted, the other command to be aware of is :actionlist which will list all of ...
Collin Peters's user avatar
5 votes

How can I integrate gdb with Vim?

Although not technically vim. cgdb is a curses version of gdb with vim-like keybindings. It's been my goto debugger for years: https://cgdb.github.io/
ericcurtin's user avatar
5 votes

How to avoid to press ENTER twice, when compiling with :make inside Vim?

Based on the previous answer suggesting the use of silent I made the following :Vmake command with a small modification to redraw the screen: :command! Vmake silent w | silent make | unsilent redraw!...
antts's user avatar
  • 51
5 votes

Test python function from within editor

Not really a "Vim answer", but writing a unit test and running the unit test(s) for the current file is probably the best way to do this. Specifically for Python you can use doctests: import ...
Martin Tournoij's user avatar
5 votes

What are the benefits of using Vi or Vim over IDEs and other text editors?

The question is pretty much the answer already. But let's explain this. I use my favourite IntelliJ Idea, Notepad++, occasionally Visual Code as it depends whether I program in Java, React or do some ...
Matt's user avatar
  • 20.9k
4 votes
Accepted

What are the benefits of using Vi or Vim over IDEs and other text editors?

This question is a bit too broad and opinion based, but I'll still write an answer here (rather than essentially do the same in comments.) A lot of the hype around Vi/Vim is on its modal interface, ...
filbranden's user avatar
  • 29k
4 votes

How to find plugin vimscript function definition?

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 ...
D. Ben Knoble's user avatar
  • 26.6k
4 votes
Accepted

Function argument editing

What about %%xvi,<esc>p from (almost (*)) anywhere within a function call, with my omap-param.vim. The first % goes to the embedded open parenthesis. The second % to the closing ). I delete it,...
Luc Hermitte's user avatar
  • 17.5k
4 votes

What is the best way to re-factor a variable name in vim?

I'd like to add another option. You can do /original and then do :%s//replacement. (Use /c at the end if you want confirmation). Although you are pressing 3 more keys, this has an advantage over ...
nmercado86's user avatar
4 votes

Is it possible to have vim auto-complete function names, variables, etc. when using it to program?

CoC, the Conqueror of Completion also deserves a mention. It is very advanced, comparable to VSCode's Intellisense, with extensions tailored to each language. It works with Vim 8 and with Neovim. ...
joeytwiddle's user avatar
  • 3,652
3 votes

How can I interact with a SQLite or MySQL database?

Even though I agree with @Vitor's comment saying that Vim is not meant to interact with a database, here is another solution: Tim Pope recently released vim-dadbod that he calls "a more modern ...
statox's user avatar
  • 50.1k
3 votes

How to find plugin vimscript function definition?

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 ...
dedowsdi's user avatar
  • 6,288
3 votes
Accepted

How to detect IntelliJ/IdeaVim in vimrc?

Things have evolved quite a bit since this was posted and there is apparently now support for vimscript parsing. I'll update this once I learn the details. In the meantime, see other answers. ...
B Layer's user avatar
  • 20k
3 votes

How to set a shortcut to run make in Vim and show the output

<Ctrl-M> is equivalent to <CR> First of all, please note that <Ctrl-M> is equivalent to <CR> which you might not use in normal mode and therefore is ok for you. If you use the ...
Hotschke's user avatar
  • 4,790
2 votes
Accepted

How to set a shortcut to run make in Vim and show the output

When you want to map to a key sequence that contains | you have to be careful. See :help map_bar. You should probably use this mapping: noremap <C-m> :make<BAR>copen<CR>
Lucas's user avatar
  • 1,629
2 votes
Accepted

Integration (or emulation) of Vim with NetBeans or Eclipse

I've had great luck recently with Eclim, an Eclipse plugin that gives you vim windows. I sometimes find myself still just using Vim by itself, but it does give you the best of both worlds, sort of. I'...
Tim's user avatar
  • 436
2 votes

How to detect IntelliJ/IdeaVim in vimrc?

Since IdeaVim 1.8.0 you can use the following condition: has("ide"). This works because IdeaVim supports VimScript for several years since 1.7.0. Wrap the lines you want to make conditional ...
Vladimir Parfinenko's user avatar
2 votes

Is it possible to make Vim give me suggestions based on the libraries that I have on my system?

With an appropriately set include/includeexpr and path, you can complete identifiers from included files (among other things). As the name suggests, this was originally used for C, but it’s applicable ...
D. Ben Knoble's user avatar
  • 26.6k
2 votes
Accepted

Modify syntax highlighting dynamically

As far as I know :h text-properties were designed with this in mind. The main use for text properties is to highlight text. This can be seen as a replacement for syntax highlighting. Instead of ...
Maxim Kim's user avatar
  • 13.6k
2 votes

Vim workflow for projects on remote machines

sshfs is a handy utility that allows one to locally mount a remote project, solving the problem. Granted, it's not as elegant as the plugins actually just working seamlessly on remote files.
possumtech's user avatar
1 vote

How to Start vim with splits open

Once you have vim how you like it, it's possible to save the session (so any files you have open, the arrangement of splits you have etc.). See :help mksession Basically, you can just do: :mksession! ...
mattb's user avatar
  • 1,141
1 vote

Automatically place closing curly brace on new line

If using Coc - formatOnType should be enabled and special i-keybinding set, details here https://github.com/neoclide/coc-pairs/issues/13 If not - https://github.com/jiangmiao/auto-pairs
vatosarmat's user avatar

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