Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Vim Getting Started Tutorial     - MyCAT separate read and write to achieve MySQL Practice (Database)

- MySQL performance view and configure finishing Daquan (Database)

- shell script: MySQL startup script simple (Database)

- RHEL 6.5 KVM analytical use (Server)

- Getting Started with Linux system to learn: how to install the kernel headers on Linux (Linux)

- Easy to get hidden administrator account (Linux)

- VMware virtual machine to use bridged mode fast Internet access (Linux)

- Python Dir find a folder several files (Programming)

- Realize screen recording and playback via Linux command (Linux)

- Java recognize simple codes (Programming)

- Without Visual Studio .NET Windows application development (Programming)

- Linux directory structure (Linux)

- To establish a secure and reliable Linux operating system (Linux)

- Hadoop 2.6.0 stand-alone / pseudo-distributed installation (Server)

- Ubuntu installation module Python rq (Linux)

- Log device files under Linux - logger (Linux)

- Linux reserves the rest of the file to delete several (Linux)

- wget command usage Explanation (Linux)

- PXE installation of Linux servers (Server)

- Red Hat Linux security settings document (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:      
 
- Use libpq under Ubuntu 14.04 (Linux)
- Linux remote connectivity tools -OpenSSH (Linux)
- 2016, the new Node project Precautions (Programming)
- Oracle 11g can not export a variety of empty table solution (Database)
- php How to prevent being injected (Linux)
- To batch create users under Linux (Linux)
- Python maketrans () method (Programming)
- Learning the Linux powerful network management capabilities (Linux)
- Linux file system structure Introduction (Linux)
- Linux deploy Tutorial (Linux)
- CentOS7 installation performance monitoring system (Server)
- Nodejs nano library to handle couchdb: need a timeout (Database)
- How to modify the Ubuntu terminal user name changed to red color (Linux)
- Recovery from MySQL master data consistency summary (Database)
- CentOS5 installation Nodejs (Linux)
- Introduction Linux namespace (Linux)
- Three methods easy data encryption on Linux (Linux)
- How to create a binary distribution with Bash (Linux)
- Shell Scripting early experience (Programming)
- CentOS6 5 Configure SSH password Free (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.