Hot answers tagged

30

Set the guifont option in your .gvimrc. See :help guifont and :help setting-guifont. Specifically, you can do something like: set guifont=Consolas:h11 to use 11-point Consolas in gvim on Windows. There are a few other options you can use (each separated with a :), such as :b for bold, although some of these are only available on certain platforms. The :h ...


30

Yes, it is possible. A minimal setup would be: :set filetype=json :syntax on :set foldmethod=syntax


28

When the GUI starts, some settings are reset and then .gvimrc is processed. Consequently, if you want a non-default value for any of those settings, you'll need to set it in a .gvimrc; testing for GUI mode in .vimrc won't work. One such setting is t_vb, the terminal code used for the visual bell; in fact, all terminal optionals are reset to defaults for ...


28

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 Vim to print the line you would need to add to your ~/.gvimrc to make the change permanent: :set guifont? Produces something like the following in the status ...


27

Some features that will only work with gVim: 24-bit color support out of the box (to get the same amount of colors in terminal vim, you have to try a little harder, see this and this). For true italics, the same holds true (see this and this). Note that you should be using a font that supports true italics. Some other more advanced graphical features, such ...


25

I found mlterm, which supports this. Aside from Emacs' built-in terminal (M-x term) this is the only terminal I've found that supports this (I've tried about 15-20 different ones). I've found that mlterm works better than Emacs due to the sceen ratio settings, and you also avoid having to run Vim inside an Emacs session (I'm not even sure that is legally ...


16

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 Pmenu ctermbg=gray guibg=gray For Gvim you only need the guibg part (ctermbg is used when Vim is run in a terminal), but I find it useful to always define both. ...


14

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 tries to be close to a Bash console with standard Linux commands, and of course it is far from being flawless. See the project page of Cygwin. During the ...


13

I have the following in my .vimrc to change font size quickly without changing the font. Works on Windows and GTK. I haven't tested other GUIs. I'm sure I originally copied it from somebody else, but it's been in my rc file so long I don't remember where it came from. if has("unix") function! FontSizePlus () let l:gf_size_whole = matchstr(&...


12

The basic idea could be something like: " Define a list of the fonts you want to use, and the index in the " list of the default font. See :help Lists let g:fc_list = [ \ "DejaVu Sans Mono 9", \ "Source Code Pro 12", \ "GohuFont 11" \ ] let g:fc_current = 0 " Set default font let &guifont = g:fc_list[g:fc_current] function! FontCycle() " ...


11

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 location. The current workaround is to :set guioptions-=r guioptions-=L Update As of patch 8.0.1278, you can also use :set guioptions+=k to prevent Vim from ...


11

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 mounted so you can use Vim inside the shell to edit your files.


10

PuTTY, like other high-color terminals, only supports a fixed color palette of 256 colors. GVIM can use the full 24-bit RGB color space; that's why you see "finer" nuances there. As for attributes, GVIM offers undercurl, which is not present in any terminal, and free mixture of bold (depending on configuration shown with lighter color instead) and italic (...


10

You can paste from any register (including the clipboard) into CtrlP, as explained in :help ctrlp-pasting: <Insert>, *'ctrlp-pasting'* <MiddleMouse> Paste the clipboard content into the prompt. <c-\> Open a console dialog to paste <cword>, <cfile>, the content of ...


10

: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 the number after the ' character in the viminfo option. For example, doing :set viminfo='50 would mean that only 50 old files are remembered. However, this ...


10

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. So not only can you continue to use command line vim, you will get a better version of command line vim along with the GUI. As for SSH editing, I don't believe ...


10

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 scripting languages. You should try to do it this way, as it is easier to update/remove. Edit: Consider switching to Neovim


9

First off, Vim can only display a file in a single font, you can't use multiple fonts at the same time. For gVim, you can use guifont to set this to Font Awesome: set guifont=Font\ Awesome\ 14 Which seems to work fine. For Terminal Vim, you will need to configure your terminal emulator to use Font Awesome. For xterm, this doesn't seem to work, for gnome-...


9

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 "confirm" family (i.e. the 'confirm' option, :confirm command and confirm() function) are GUI-based rather than the console-based ones used by other versions....


8

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 display an error message. However, I could fix this, by using setsid xdg-open which you need to set for the g:netrw :let g:netrw_browsex_viewer="setsid xdg-...


8

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 cursorbound windows (windows that also have this option set) move their cursors to the corresponding line and column. This option is useful for viewing the ...


8

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> Originally <C-l> redraw the screen, with this mapping you first clear the highlighting and then redraw the screen.


8

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: set guifont=Dejavu\ Sans\ Mono\ 12 If you want it to work on both Windows and Linux you can use something like: if has('gui_gtk') set guifont=Dejavu\ ...


8

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 and option (that you could unset) but by a command: :suspend. See :h :suspend Secondly you want to disable the suspension triggered by ctrlz. This is a built-in command, thus you can not "unmap" this key ...


7

For configuration command you've specified gnome2 as your main GUI (--enable-gui=gnome2), are you sure it's the right one? Or maybe gnome2 is not enough to enable GUI, so try to add extra --enable-gui, --with-x parameters. You can also configure so your GUI would be detected automatically by --enable-gui=auto. Also make sure that you have all your ...


7

I have the following defined in my .vimrc file. set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 10 So you can set that up as a mapping like this... nmap <Leader>f :set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 10<CR> Add additional mappings for other fonts.


7

It's definitely not supported in GUI Vim, and I'd be surprised if there were more than handful of terminal emulators that support proportional fonts in the way that you're hoping for: it would break too many of the standard things for which terminals are used. As so many parts of Unix and other command-line environments presume monospaced fonts, this type of ...


7

Cygwin terminal limitations The default Cygwin terminal is based on the Windows console and inherits its limitations (very few colors, no font styles like bold or italic). You can find out how many colors are available to Vim via :set t_Co? For me, that gives a meager 8. To get 256 colors, you need to use a terminal emulator that support high colors, e.g. ...


7

Decrement is <C-x>, not <C-z>. From :help CTRL-Z: CTRL-Z Suspend Vim, like ":stop". Works in Normal and in Visual mode. In Insert and Command-line mode, the CTRL-Z is inserted as a normal character. In Visual mode Vim goes back to Normal ...


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