I want to write c++ using vim in Ubuntu, and I want to color it.

Asked 2 years ago, Updated 2 years ago, 64 views

I would like to write a program using vim in Ubuntu. You can search by vim c++ color scheme to see the color settings, but the important vim is not even installed yet.
What commands should I enter to apply colors?

vim ubuntu

2022-09-30 17:27

3 Answers

First,
Install vim with sudo apt-get install vim.
Next, to color the syntax in the program (syntax highlight), do the following:

(1) Open the vimrc file (vim's configuration file) with the following command: The vim configuration file is the vimrc file in the home directory.


vim through /.vimrc

(2) Open file
syntax on
Add

(3) Enter normal mode (press Esc), enter :w, save in Enter, and run the command as :source~/.vimrc in normal mode and reload vimrc

I think the steps (1) to (3) will start coloring.


2022-09-30 17:27

 sudo apt-get install vim 

How about


2022-09-30 17:27

The apt-get command to install Vim is

 sudo apt-get install vim

But then the clipboard is not available yet.In addition,

 sudo apt-get install vim-gtk

You can do it.See this question.

Edit ~/.vimrc and add:

syntax on

The next time vim boots up, it will be colored.

Also, after adding colorscheme X to .vimrc, you can select a color scheme.For example,

color scheme eventing

You can find a list of color schemes in ls-l/usr/share/vim/vim__/colors.(__ is the version number of the vim you installed.)


2022-09-30 17:27

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.