Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Vim Getting Started Tutorial     - Zabbix monitoring platform to extract a single server graphical Python implementation of concurrent (Server)

- Ubuntu Gitolite management Git Server code base permissions (Server)

- NIC configuration parameters under Linux (Linux)

- C ++ Supplements - locates the new expression (Programming)

- How to install PlayOnLinux 4.2.5 under Ubuntu 14.04 / 12.04 (Linux)

- In-depth summary of the PHP core of object-oriented (Programming)

- How to Install Suricata IDS on a Linux system (Server)

- linux system optimization and security configuration (Linux)

- Increase Linux system security --chattr (Linux)

- Ubuntu 14.04 installed Nvidia CUDA 7.5 and build Python Theano deep learning development environment (Linux)

- Copy U disk files to the Linux system on a virtual machine (Linux)

- Try debugfs restore the deleted files ext3 file system (Linux)

- Expand an existing RAID arrays and remove the failed disk in a RAID (Linux)

- RVM installation instructions (Linux)

- ASM Disk Space Check (Database)

- TCP protocol flaw incomplete records (Linux)

- How to manage start-up applications in Ubuntu (Linux)

- iOS constants, variables, properties and characteristics (Programming)

- RHEL6 install Python and other packages from source (Linux)

- Linux modify the system time (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:      
 
- Getting Started Linux Shell Scripting (Programming)
- RedHat command line and graphical interface switching (Linux)
- To install Jetty server configuration in detail (Server)
- Linux LVM space expansion Demo (Linux)
- Creating and extracting archives 11 tar command examples in Linux (Linux)
- JavaScript, some conclusions about the implicit conversion (Programming)
- JIRA 3.6.2 Upgrade from older version to the new version 6.0.8 (Linux)
- Export error: ORA-04063: package body dmsys dbms dm model exp has error (Database)
- Disk Management LVM (Linux)
- Mongo-connector integrated MongoD to achieve incremental Solr index (Server)
- Oracle Database Delete Delete million or more common method of heap table data (Database)
- MongoDB 2.6 deployment replica set + partitions (Database)
- Linux common network tools: hping Advanced Host Scan (Linux)
- Nginx Keepalived Nginx monitoring scripts (Server)
- Two network security scanning tools under ubuntu (Linux)
- Oracle SQL statement to retrieve data paging table (Database)
- Create a project using Android Studio LinearLayout (Programming)
- HA-Federation-HDFS + Yarn cluster deployment (Server)
- Ubuntu 14.04 forget solution root password (Linux)
- Docker deployment practices in Ubuntu (Server)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.