Basic Linux Tutorial: build your own Vim IDE
1. Preface
After installing the Ubuntu 15.04 system, I feel very good when I have been playing with Ubuntu. Faster than Windows, you can open the program you want on the machine, but in Windows, you can enable the program normally only after it starts required items. Linux and MacOs are similar. But in Linux, there will be fewer software.
I wrote a blog post about the simple use of Vim, and I started to contact and use Vim from scratch. After learning about the commands in the blog, you can use vim to efficiently complete your editing. Of course, if you need to control the format, it is still not enough to use vim, and you need to go to markdown, if Vim can add Markdown, it can be edited perfectly. Haha.
Vim is not only the "God of the Editor", but also a rich array of Vim plug-ins, which can be used to create a development environment IDE. Next, record my vim. The whole process is completed, it's like building an IDE on your own. It's good.
Vim, as an IDE, can achieve the following results:
II. The Vim configuration function introduced in this blog
1. Install it first.
In Linux, the installation is very simple. Open the terminal and enter several commands to complete the installation.
Sudo apt-get install vim
Sudo apt-get install gvim
Sudo apt-get install git (this is very important. Use git to download the plug-in later)
This is the first command. It is said that I have already installed it and do not have to install it. After installation, input vim, git, or gvim on the terminal to check whether the installation is complete.
You can also use aptitude for installation. Before using aptitude for installation, you must first install aptitude.
Sudo aptitude install vim
Sudo aptitude install gvim
Sudo aptitude install git
Then, create the. vim directory in the user's home directory and the bundle directory in the. vim directory. The plug-ins automatically downloaded by Vundle will be saved here.
Vundle can automatically download and install plug-ins. You only need to use the Bundle command to list the required plug-ins after the "My Bundles Here" comment, and then run the BundleInstall command. Vundle supports the github.com and Vim official website vim.org.
Mkdir. vim/bundle
Then, go to the Bundle directory and run the git clone command to download vundle.
Git clone https://github.com/gmarik/vundle.git ~ /. Vim/bundle/vundle
After the download is completed, you can view the vundle directory under the bundle.
2. Create and configure the. vimrc file.
Enter vim on the terminal and then input echo $ VIM to view the vim directory. Then, check whether there is a. vimrc file in the directory. If not, create the file by yourself.
My. the vimrc file is in the/usr/share/vim directory (not everyone knows. vimrc is also in this directory), if not, use the command to create: touch. vimrc
First, basic configuration, no plug-ins, map those more advanced things first. Can be completed: code color, tab indentation, automatic saving, display the current edit row, matching brackets, search, public clipboard with the system, code folding, etc. As follows:
Note: to change the. vimrc file, you must use sudo vim vimrc to modify it. You can also use sudo gedit vimrc.
My basic configurations:
"----------------------------------- Basic ------------------------------------
"Confirmation pops up when processing unsaved or read-only files
Set confirm
"Automatically save
Set autowrite
"Number of historical records
Set history = 1000
"Encoding settings
Set fenc = UTF-8
Set fencs = UTF-8, ucs-bom, shift-jis, gb18030, gbk, gb2313, cp936
"Syntax highlighting
If has ("syntax ")
Syntax on
Endif
"Set the color scheme
Colorscheme ron
"Set row number
Set nu
"Set indent
Set tabstop = 4
Set sts = 4
Set smartindent
Set expandtab
Set softtabstop = 4
Set shiftwidth = 4
"Set automatic formatting (delete this line if there is a problem with the format)
Set formatoptions = tcrqn
"Set matching conditions of parentheses
Set showmatch
Set matchtime = 2
"No automatic backup is set.
Set noswapfile
Set nobackup
"Set vertical dotted line alignment
"Status line at the bottom of the cursor
Set ruler
"Set search
"Case Insensitive in Search Mode
Set ignorecase
"Ignorecase is not applicable if the search mode is case sensitive.
Set smartcase
"Re-search is prohibited when both ends of the file are searched.
Set nowrapscan
"Highlight the searched text
Set hlsearch
"Highlight by character
Set incsearch
"Use the mouse
"Right-click and hold shift to process the operation
Set mouse =
"Share clipboard with System
Set clipboard + = unnamed
"Highlight the current row
Set cursorline
"Enable fold and set spaces to switch fold
Set foldenable
Set foldmethod = syntax
Set foldcolumn = 0
Setlocal foldlevel = 1
Set foldclose = all
Nnoremap <space >@= (foldclosed (line ('.') <0 )? 'Zc': 'Z') <CR>
"The configured folding is not expanded during search and undo operations.
Set foldopen-= search
Set foldopen-= undo
Now, you can knock on the code, but it is not enough. As IDE is not enough. Why is there no tree directory? No one-click compilation and running? No syntax completion?
For more Vim tutorials, see the following:
Build VIM into a simple and practical IDE
Vim Learning Guide
Quick learn Vi Editor
Powerful Vim Editor
Build a Vim Development Environment on CentOS 6.2
Install the highlighted Vim editing tool in CentOS 5.4
Vim tips: C language settings
Set the Vim row number in Ubuntu
Vim editor basic tutorial
For more details, please continue to read the highlights on the next page: