Hot answers tagged

93 votes
Accepted

How to fold text in a JSON file?

Yes, it is possible. A minimal setup would be: :set filetype=json :syntax on :set foldmethod=syntax
grodzik's user avatar
  • 4,488
64 votes
Accepted

Is there any way to change the popup menu color?

You can use the following highlight groups: Pmenu – normal item PmenuSel – selected item PmenuSbar – scrollbar PmenuThumb – thumb of the scrollbar For example to set a grey background: :highlight ...
Martin Tournoij's user avatar
61 votes

How can I change the font size in gVim?

If you want to simply change the font size in a running GVim instance, type: :set guifont=* A window should pop up letting you set font size as well as pick a new font if desired. You can then ask ...
pkout's user avatar
  • 711
21 votes

how to install vim with python support for debian strech

It looks like I'm a bit late, but I'll leave this here for future visitors also struggling with this. $ sudo apt install vim-nox This is the Vim package in Debian Stretch that adds support for ...
Baruch Spinoza's user avatar
20 votes
Accepted

How to adjust gVim to my HiDPI display scaling on Windows 10?

I'm on Windows 10, update 1909, and I've resolved this by overriding high DPI settings for gVim to System(Enhanced). Setting GUI font size did not help. Right click on gVim icon -> Properties -> ...
wl2776's user avatar
  • 360
15 votes
Accepted

Browse oldfiles list length

:browse oldfiles and :oldfiles read from the viminfo file, so changing the maximum number of previously edited files to be remembered in the 'viminfo' option should work. You can do this by changing ...
EvergreenTree's user avatar
14 votes
Accepted

How can I get gVim on Windows to behave as on Linux?

When I have to work on Windows (which is more often than I would like), I use Cygwin to get a terminal a little less crappy than the original Windows command line. Cygwin provides an environment which ...
statox's user avatar
  • 49k
14 votes
Accepted

Disable Ctrl-Z in normal mode

So there are several things that you need to understand: Firstly you can't use :unset suspend and that is normal. Suspending Vim is not controlled by an option (that you could unset) but by a command:...
statox's user avatar
  • 49k
13 votes
Accepted

How do I stop my window from moving when using vsplit?

This happens because when vertical splitting the window, vim needs to add a vertical scrollbar, which causes vim to recalculate the visual size and eventually makes vim jump to a different screen ...
Christian Brabandt's user avatar
12 votes
Accepted

Paste from clipboard into CtrlP input in GVim

You can paste from any register (including the clipboard) into CtrlP, as explained in :help ctrlp-pasting: <Insert>, *'ctrlp-pasting'* <...
mMontu's user avatar
  • 6,570
12 votes

How can I get gVim on Windows to behave as on Linux?

As of Windows 10 Anniversary Update, you can use the Bash on Ubuntu terminal to run a Linux subsystem where you can apt install anything you're used to inside Ubuntu. Your Windows file system is ...
Chad Gilbert's user avatar
11 votes
Accepted

Can I make gvim not use graphical dialog box for ':set confirm'?

That's a good question actually: I had never thought of this before but I added this setting now that I searched for it :-) From :h gui-w32-dialogs: 6.1 Dialogs The dialogs displayed by the "...
statox's user avatar
  • 49k
11 votes

How to adjust gVim to my HiDPI display scaling on Windows 10?

On Windows, the configuration file of gVim is named: _vimrc It is placed in the installation directory, the default being: C:\Program Files (x86)\Vim To edit the file you first need to launch some ...
Vlastimil Burián's user avatar
11 votes
Accepted

Search multiple keywords in a sentence that are not in the right order as in the search pattern

A little known plugin that comes with Vim distributed is the LogiPat plugin. This plugin is distributed with Vim by default and should also be active by default. In your case I would try to use the ...
Christian Brabandt's user avatar
10 votes

How can I change the font size in gVim?

Apparently, the way to write the font settings are quite platform-dependent. What worked for me (gVim in MX Linux 17, an XFCE Debian-based Linux distribution): Determine the current font settings in ...
bli's user avatar
  • 201
10 votes
Accepted

How to clear previous search highlight in vim?

You can look in the doc at :h nohl: When there is a previous search pattern, highlight all its matches. A useful mapping is the following: nnoremap <C-l> :nohl<CR><C-L> ...
statox's user avatar
  • 49k
10 votes
Accepted

Can I still use console vim if I install a GUI version?

Yes. Vim-gnome does install gvim, but it also installs a much more feature-filled version of command line vim, including Perl, Python, Ruby, and TCL scripting, system-clipboard, newer patches, etc. ...
DJMcMayhem's user avatar
  • 17.3k
10 votes

gvim window looks bad

The problem is probably that you don't have the Consolas font installed and that Vim defaults to an ugly default font. Try using a different font, for example this should work on most Linux systems: ...
Martin Tournoij's user avatar
9 votes
Accepted

`gx` not opening url in gvim but works in terminal

I just tried this on a debian with XFCE desktop environment and I can reproduce the issue. Turns out, that gvim calls xdg-open URL to open the URL, but unfortunately, this did not return anything or ...
Christian Brabandt's user avatar
9 votes
Accepted

Why are my windows scrolling together?

As suggested by Christian Brabandt in the comments, this was caused by the 'cursorbind' setting. :help 'cursorbind': When this option is set, as the cursor in the current window moves other ...
9 votes
Accepted

Copy a word and paste the same word at multiple places in Vim

You should use the register 0. It contains the last yanked text. By default, c, d, y use the unnamed register "" to store all modified text. But the numbered registers "0 contains the previously ...
nobe4's user avatar
  • 15.8k
9 votes
Accepted

How to save color scheme in gVim between sessions?

In Vim, settings are saved across sessions by writing them in an init script called vimrc. On Windows, that vimrc is supposed to be at: $HOME\_vimrc or (if HOME is not defined): C:\Users\yourlogin\...
romainl's user avatar
  • 38.3k
9 votes
Accepted

Why does setting runtimepath do nothing?

In this case the double quote " starts a comment. After removing the comment you have: set rtp+= While double (or single) quotes are normally used to enclose strings, the syntax for setting options ...
Ralf's user avatar
  • 9,037
9 votes
Accepted

What is 'dnd' or 'DnD'?

It stands for "drag'n'drop". See :help quote_~: The read-only "~ register stores the dropped text from the last drag'n'drop operation. When something has been dropped onto Vim, the &...
Rich's user avatar
  • 30.9k
8 votes

Strange behavior of <ctrl-j> remapping

Due to legacy reasons, vim generally treats key events as a terminal emulator would treat them, even in "GUI" versions (e.g. gvim). A terminal emulator would produce e.g. the byte 0x08 for Ctrl-H, ...
FireFly's user avatar
  • 181
8 votes
Accepted

Remapping Ctrl-(h j k l) to move between windows

You almost had it. Try: noremap <C-h> <C-w>h noremap <C-j> <C-w>j noremap <C-k> <C-w>k noremap <C-l> <C-w>l You can also add the inoremap if you want ...
Tumbler41's user avatar
  • 7,666
8 votes

How to use WSL's bash shell as default terminal of gvim/windows 10?

GVim is a 32-bit application and WSL must run on 64 bit. On Windows 10 you can use GVim with WSL if you add the following to your vimrc file: if has("win32") set shell=C:\Windows\Sysnative\wsl....
jtourlamain's user avatar
7 votes

Vim jump between words and stop at end of line

Use e key - it moves cursor to the end of a word-object. See :h word-motions for more movement keys.
grodzik's user avatar
  • 4,488
7 votes
Accepted

Change a font in Vim/GVim in a simple way

Reading the 'guifont' option is useful here. I do understand your frustrations with this option however. It seems that how you set the 'guifont' setting, is dependent on the OS. On macOS, you set '...
akshay's user avatar
  • 6,387
7 votes

How do I make "Edit with Vim" open Vim instead of gVim on windows?

I did this by changing the registry key in [HKEY_LOCAL_MACHINE\SOFTWARE\Vim\Gvim] "Edit with Vim" opens gVim: path=C:\Program Files\Vim\vim74\gvim.exe "Edit with Vim" opens Vim: path=C:\Program ...
Sphen's user avatar
  • 71

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