I am working on Ubuntu and using vim to make C files. I want to make the entire text in the editor bold. How can I do that without installing any plugin? I am not looking to make specific words bold. I am using a black background. Colors in bold would make the editor look really good.
-
are you running vim in a terminal or a gui version?– pb2qOct 17, 2012 at 16:31
-
I believe you should configure the terminal, not vim. Hence 1) asking what terminal do you use? 2) seconding the request to move the question to superuser.– ZyXOct 17, 2012 at 20:05
-
@Zyx: I use the bash terminal– Parth ShahOct 18, 2012 at 2:25
-
@ParthShah No, bash is the shell and not a terminal. “Terminal” here is a short of “terminal emulator”: GUI application you use.– ZyXOct 18, 2012 at 3:06
5 Answers
You can use the :match
command to apply a highlight to a given regular expression.
For gVim:
:highlight MyGroup gui=bold
:match MyGroup /./
For terminal:
:highlight MyGroup cterm=bold
:match MyGroup /./
The correct answer was given to me by one of the users @akira in one of the comments. I am just sharing it.. You can change the font only in GVim. Vim uses the fonts that you are using in the shell. So if you happen to be reading this and have the same requirement the best thing would be to change the settings of your shell such that it displays fonts in bold. I believe this is the best method.
-
Also, note that a font has different files for its styles, so just downloading "SomeFont.ttf" does not mean you download all styles, but most likely only "Regular". All desired font styles need to be installed separately.– SidOfcMar 25, 2020 at 12:28
You can make bold some elements of C file. For example
:highlight Comment gui=bold
will make comments in C files bold for GVim. For console Vim it will be
:highlight Comment cterm=bold
Unfortunately, I do not know other way to make all text bold except for making it bold for each highlight group (cComment
, cNumber
, etc.).
For Gvim only: Change the font to bold using(Monospace in this example)
:set guifont=Monospace\ Bold\ 11
Put it in your .gvimrc
if you want to do it every time.
Adjust your terminal emulator's settings to make your fonts bold.
On a tty
console, run:
$ sudo dpkg-reconfigure console-setup
and then adjust settings from there.
Note: You cannot do this in xterm.