Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Vim Getting Started Tutorial     - Linux system security Comments (Linux)

- C # / iOS / Android Universal Encryption and decryption (Programming)

- How to install Linux Kernel 4.0 On CentOS 7 system (Linux)

- Ubuntu 14.04 build Android 5.1 development environment and compiler (Linux)

- Install apr support for Tomcat on Linux (Server)

- Linux can modify the maximum number of open files (Linux)

- Linux common network tools: batch scanning of hosting services netcat (Linux)

- CentOS 6.7 install Nagios Tutorials (Server)

- Cacti Linux-based system monitoring and alarm (Linux)

- Java data structures - the linear form of the single-chain applications (Programming)

- Process monitoring tools Supervisor start MongoDB (Database)

- Mac OS X command line to submit the local project to Git (Server)

- Linux System Getting Started Learning: After starting in Ubuntu or Debian, enter the command line (Linux)

- Install minimize RHEL / CentOS 7 some things need to do (Linux)

- Advanced permissions Linux file system settings (Linux)

- Oracle 10046 Event (Database)

- Based shell: using read, the command-line script to achieve mass participation and input two integer calculation (Programming)

- MySQL Server Time Synchronization Problem (Database)

- Locale files under Ubuntu (Linux)

- Via Twitter how open source library to be used anywhere Emoji emoticons (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:      
 
- Thinking in Java study notes - initialization and cleanup (Programming)
- Java reflection by calling the class method (Programming)
- RHEL 5.7 Yum configure local source [Errno 2] No such file or directory (Linux)
- XtraBackup achieve non-stop use of master-slave synchronization service (Database)
- Swift acquaintance of values and references, the circular reference, Agent Precautions (Programming)
- Ubuntu 14.04 kernel after the restart boot black screen to solve (Linux)
- Elasticsearch 2.20 Highlight (Server)
- User and user group management Linux Command (Linux)
- How to create a secure and easy to remember password (Linux)
- Virt Related Command Summary (Linux)
- Linux System Getting Started Learning: The Linux command line burn ISO or NRG image to DVD (Linux)
- View processes and threads under Linux (Linux)
- Git bulk delete remote tag (Linux)
- Nginx server security configuration (Server)
- To build a private Docker registry (Server)
- A new method for Linux hidden files (Linux)
- Wi-Fi hackers use to attack your seven methods (Linux)
- Java NIO1: I / O model overview (Programming)
- Oracle VirtualBox Problem Solving Case (Linux)
- Linux NFS FTP use (Server)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.