[LINUX] Script within 10 lines (2.vimrc)

[For beginners] Script within 10 lines (2. description of vimrc)

If you use various libraries with python, I thought, "You can do a little thing with a little code, and you can make a little script with a little 5 steps, which is convenient." So I just listed python and other commands. I may come up with this, but I will post a 10-step script on an irregular basis.

As ** 2nd **, I would like to post the minimum .vimrc that can be done in 3 minutes. </ font> It's not python, but I think vimrc is also a scripting language. Since the infrastructure such as terminal and server settings and operation may be the minimum rather than vim, it is necessary to remember the original vi, and even in programming, when you want to use vim to edit the config of the development environment I think there are still more. </ font>

In recent years, the Linux integrated environment has evolved, and I think the attached editor is easy and convenient. There is also an IDE in the development environment, and I think that the IDE is the mainstream for programming, but in my case, in addition to the description of the config, a little script description such as "Write sql in the editor and paste it?" May be used for. Especially in the case of SQL, I think that it often takes time to input in a standard environment.

vim is also deep, and the description of vi and vim configuration files can be said to be a built-in scripting language. </ font> If you dig deeper, it seems that there are control syntax etc. and it is difficult, but depending on the distribution, you may be able to use it conveniently at the time of installation. In some Linux distributions, the vi entity is useful, but it may be a customized vim alias.

It's too convenient in the initial state, but when you use it in other environments, you may feel something is wrong. </ font> With that in mind, I decided to write the minimum settings without using a plugin. First of all, I think that it is enough to include syntax highlighting and indentation settings, and if necessary, I will add it little by little.

I haven't written much .vimrc or installed plugins, but recently I've been using debian10 more often, and in the initial state, installing vim rather than not installing vim plugins. It wasn't done by itself.

I used the original vi for a while. You can write a vi configuration file, but I also introduced vim. I used to do "set tabstop = 4" for a while, but even if I didn't need it anymore, it became much easier.


1. If vim is not installed, install it

-For debian, if you use apt etc. and vim-nox is inserted, vim itself will also be included. If you want to put various settings in vimrc, put vim-nox as well. -Package names are different for redhat systems.

Is it installed? Verification



$ which vim
/usr/bin/vim

# apt search vim-nox
i   vim-nox                         - Vi IMproved - enhanced vi editor - with sc
p   vim-nox:i386                    - Vi IMproved - enhanced vi editor - with sc

root@mint01:~# exit 

2. Description of vimrc

Edit .vimrc in the home directory of a general user, or create a new one if it does not exist. In this config, I put in 6 lines of settings. [Caution: .vimrc is a dot file] The double quote "" "at the beginning of the line is a comment.

.vimrc



$ vim  .vimrc
"Display line numbers
set number

"Show corresponding parentheses and braces
set showmatch matchtime=1

"Comment color(light blue)Specify
hi Comment ctermfg=3

"Tab key character width
set shiftwidth=4

"Indent width
set tabstop=2

" syntax
syntax on

** This is the description of .vimrc that can be done in 3 minutes. ** **