Skip to main content
98 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,658
67 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
63 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
  • 731
20 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

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
  • 50.1k
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
  • 50.1k
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
12 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
  • 50.1k
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.7k
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

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
  • 16.1k
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
  • 41.2k
9 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
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,287
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
  • 32.2k
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,756
8 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,557
8 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
  • 81
7 votes
Accepted

Read-only (silent) select in Vim

Get rid of mswin.vim that comes activated by default on Windows platforms. Instead of the select-mode, you'll be back in the visual-mode. It's not read-only strictly speaking, but at least it's not ...
Luc Hermitte's user avatar
  • 17.5k
7 votes
Accepted

How to replace a string only if the line starts with another string

Try: :g/^G1 Z/s/F1800/F500/g The :g is the "global" command. It selects lines with a regular expression and then executes a command on it. Here it selects lines that start with G1 Z and then ...
Ralf's user avatar
  • 9,287
7 votes
Accepted

Why can't I type certain non-ASCII letters?

:verbose map does not work for detecting the keybind in insert mode. Since it's while editing, and the relevant mapping is imap or inoremap, :verbose imap/:verbose map! are the two correct options to ...
Zoe's user avatar
  • 712
7 votes
Accepted

How to enable part of my vimrc to only apply in gVim?

You can check if your vim runs in gui: if has("gui_running") colo koehler else colo darkblue endif You can also use gvimrc file (:h gvimrc) instead. The drawback is that you would have ...
Maxim Kim's user avatar
  • 13.6k
7 votes
Accepted

Can you use neovim in a gui like mvim or gvim? (Mac OS X)

There are several GUIs for Neovim because it externalises the user interface elements, so any GUI can draw these in different ways. There's a list that tracks the status of these projects. My ...
Tae's user avatar
  • 2,135
7 votes
Accepted

How to make Vifm use Neovim to open files?

Change set vicmd=vim to set vicmd=nvim in your vifmrc.
Jake Grossman's user avatar
6 votes

How to stop gVim wrapping text at column 80

As per Kenny Evitt's answer, you can find where textwidth is being set using verbose: :verbose set tw? textwidth=78 Last set from c:\Program Files (x86)\Vim\vim74\vimrc_example.vim If you are ...
Ben Aveling's user avatar

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