Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Vim Getting Started Tutorial     - Ubuntu 12.04 LTS installation configuration JDK1.6.0_45 (Linux)

- How to track performance issues when using the Unity Game Development Android (Programming)

- Java Access Control (Programming)

- SteamOS installation under Ubuntu 14.04 (Linux)

- Deploy Apache Spark cluster environment in Ubuntu (Server)

- Linux System Getting Started Tutorial: How to automatically set the JAVA_HOME environment variable on Linux (Linux)

- Linux ACL permissions (Linux)

- Linux directory configuration (Linux)

- Simple security measures to reinforce the Linux kernel (Linux)

- Kubuntu 14.04 desktop to the user how to upgrade KDE 4.13.2 (Linux)

- Apache Mina framework Practice (Programming)

- Oracle 11g partition maintenance (Nice) - Truncating And Partitions (Database)

- Linux operating process information (Linux)

- Linux installed Cisco Packet Tracer (Linux)

- Linux file and directory permissions settings (Linux)

- How to build Mono 3.4.0 / 3.4.1 on Windows (Linux)

- CentOS install video converter FFmpeg and cutting tools segmenter (Linux)

- Ubuntu 14.04 Enable root and disable the guest (Linux)

- Linux --- file descriptors and redirection (Linux)

- Linux network security strategy (Linux)

 
         
  Vim Getting Started Tutorial
     
  Add Date : 2018-11-21      
         
         
         
  Just work for some time been engaged in the VIM and EMACS, but as a JAVA program ape, with VIM to write JAVA code or not realistic (now with IDEA), there is nothing behind. Recently VIM is good feeling when writing front-end code and write a blog, and decided to pick it up and then VIM.

Bare VIM is not handy, you need to install plug-ins required, before the play is download the corresponding archive and modify the configuration, the process extremely test of patience and character!

Use vundle management plug

vundle let you do not need to tangle where to find plug-ins and configuration, all the plug-ins are managed in a similar manner, to a large extent reduces the cost!

Plugin store is ~ / .vim / bundle /, built after the download directory vundle:

git clone https://github.com/VundleVim/Vundle.vim.git ~ / .vim / bundle / Vundle.vim

After the configuration can be in ~ / .vimrc inside finish:

set nocompatible "Close compatibility mode
filetype off "to turn off automatic file type detection set rtp + = ~ / .vim / bundle / Vundle.vim" joining runpath
call vundle # begin () "initialize" plugin list begins
Plugin 'VundleVim / Vundle.vim'
"Plug-in end of the list
call vundle # end () "complete
filetype plugin indent on "open file type detection
Common source plug configuration are:

Source Description
Plugin (Plugin 'tpope / vim-fugitive') hosted on github.com github
vim-scripts.org/vim/scripts.html the maintenance station plugin (Plugin 'L9')
After configuration, you can start using open VIM, and use the following command:

: PluginList: Open the plug-in list
: PluginInstall: Plug
: PluginSearch foo: After the search plug-in, you can choose to install find
: PluginClean: clean up unused plug (this is not too much to understand)
Finally, for example, when you want to install the plug-winmanager:

Add your .vimrc Plugin 'winmanager'
Open vim
Executive: PluginList can see winmanager widget
Executive: PluginInstall installation
It is not a lot simpler than it used to? No plug-in management cumbersome, let's formal entry into the VIM trip!

Basic Usage

When switching to VIM EditPlus just not suited to, I just simply wanted to edit the file, but still have to consider switching to a different mode:

Command Mode
Edit mode
Visual mode
A little longer time to feel this way distinguish still very reasonable, in command mode can be simple text commands for quick view, edit, than using the mouse will be more efficient in EditPlus inside. The model used in the command is very large, the following classification point of view!

First, move the cursor

May be performed on each dimension freely Jump:

Command Function
h / j / k / l up / down / up / right movement
ctrl + f / b Up / Down
ctrl + d / u Up / Down turn half page
$ / 0 / ^ end of line / first line / first character
(/) On a / the next sentence
w / b word next / previous word
gg / G Document start / end of the document
% Bracket at the corresponding match
ngg / nG /: n to n-th row
Top H / M / L screen / middle / bottom
* / # Characters at once / last time the current location
Second, the Find and Replace

Command Function
: S / s1 / s2 next s1 s2 replaced
:% S / s1 / s2 s1 s2 replace all
: S1 replace s / s1 / s2 / g current row as s2
: N1, n2 s / s1 / s2 / g from n1 to n2 line s1 s2 replaced
/ Xxxx Find xxxx, later found by n continue to look down, N will continue to look up
mx insert a bookmark (x lowercase), can be used after `x jump to the bookmark at
`The position of the last edit
Third, copy, cut, paste, delete

There are some registers used to store copy, delete the contents of the VIM:

": Recently deleted or copied content
0: recently copied content
1, 2, 9: recent deletions into 1, 2 into 1 original content, and so on
%:file name
::command
/: Find string
When editing can be used: reg to see the contents of the registers! In order to facilitate the introduction of the selected text VIM visual mode, use the cursor to move to the starting position, then use the following command to enter visual mode:

ctrl + v: block
v: Normal
V: Line
Then move the cursor to select the text and can be manipulated! When editing commonly used commands are:

Command Function
y copy the selected text, use the "ny to copy to the n-th register
x Cut selected text or delete the current character
d Delete selected text
p Paste with "np No. n to paste the contents of the register
dd Delete the current line
dw delete a word after the cursor
dl delete a character
D / C delete to end of line
yy / Y Copy line
It can be used during and ctrl + r u to undo and redo.

Fourth, the macro

In data when making often encounter some simple mechanical operation, this generally can be used to get a macro:

px: Start recording macro action, x is lowercase
operating
q: The operating records to register
@x: the implementation of the operation register x
@@: Executed once recorded recently
It can also be used: reg to see the status register.

Fifth, edit

By the following command to enter the insert mode when you need to enter:

Command Description
Before i / a cursor / insertion after
I / A is at the beginning / end of the insertion
After o / O / insert a line before editing
s / S delete a character / line editing
R Replace mode, when you paint a very easy to use
Multi-screen operation

Write the code by engaging several files is common, in several screens do very comfortable, open split-screen mode are:

vim -On file1 file2 ...: vertical split screen to open multiple files
vim -on file1 file2 ...: horizontal split screen to open multiple files
ctrl + w s: Split up and down the current file
ctrl + w v: horizontal split the current file
: Sp filename: upper and lower split open the new file
: Vsp filename: horizontal split open the new file
You can use the command ctrl + w h / j / k / l / w to work when you need to switch the screen, where h / j / k / l is moving in the direction, w is to move to the next screen! When you think you can use ctrl + w H / J / K / L to move the split-screen sequence of screen time a bit uncomfortable. Alternatively, you can adjust the screen size:

ctrl + w =: All the screens are the same height
ctrl + w -: reduced height
ctrl + w +: increase height
You can browse the catalog in the sub-screen when editing:

: He: the upper and lower split-screen, in the following (:! He is above) Browse the catalog
: Ve: about split screen, the left (:! Ve is on the right) to browse the directory
You can also use: E Open Directory browsing in the current screen can be operated by commands:

-: To parent directory
s: Sort files
x: executable file
R: modify the file name
D: Delete file
Enter: Enter the subdirectory
Prepared to look when you need to scroll in sync on multiple screens, use: set scb and: set scb reconciliation to bind tie (this feature is very useful)! Finally, you can edit complete with ctrl + w c ​​or ctrl + w q (if it is the last screen to exit VIM) to turn off the split screen!

to sum up

Mastered these simple text editor should not be a problem, and will continue to post for more details of what to write alone.
     
         
         
         
  More:      
 
- C / C ++ various data types Conversion Summary (Programming)
- Web database security tips (Linux)
- How the program is executed (Programming)
- Linux System Getting Started Tutorial: Linux file permissions brief description (Linux)
- Oracle Execute to Parse perform analytical Ratio Analysis (Database)
- LVM basic concepts, management (Linux)
- CentOS7 install and configure Nagios (Server)
- Linux firewall to prevent external network attacks (Linux)
- Linux terminal program running in the background (Linux)
- Towards Docker (Server)
- Virtualbox virtual machine can not copy CentOS Network (Linux)
- SSH does not require a password to log on to a Linux server (Server)
- ORA-4031 error Solution (Database)
- Ubuntu 12.04 installation DHCP Server (Server)
- Source Analysis: Java object memory allocation (Programming)
- About Linux operating system security (Linux)
- C ++ pointer of the (error-prone model) (Programming)
- Character Encoding notes: ASCII, Unicode and UTF-8 (Linux)
- JDK comes with tools JPS (Linux)
- MySQL to NoSQL avatar (Database)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.