linux Learning experience vim/Cvim piece

stay linux  Next ,vim  It's one of the most common editors , quite a lot linux It comes with the release of . My is CentOS 6.3.

Basically Vim Will be divided into 3 Patterns , They are the general pattern , Edit mode and command line mode , The functions of these three models are briefly described as follows :

  1. General pattern : The default mode . open vim It's the general mode that goes straight into , In this mode , The possible operations are : Move the cursor , Copy , Paste , Delete .
  2. Edit mode : Edit file contents , At the bottom left of the interface will appear INSERT The words... .
  3. Command line mode : lookup 、 Read 、 preservation 、 Replace character 、 According to the line Numbers 、 Leave vim Operation, etc. .

One :Vim Common commands under :

j Down   k Up   l towards the right   h towards the left

:w                               ( A lowercase letter ) Save the file

​:wq                             ( A lowercase letter ) Save and exit vim

:w file name name            Save the file as a file name name

:ZZ                             ( Capitalization ) Save file and exit , amount to :wq

:wq!                           ( A lowercase letter ) The file owner forces a read-only file to be saved , If not the owner of the file , Can't succeed

:q!                               Exit without saving the file

Copy (yank)
yy or Y                     Copy the whole line where the cursor is
y^                         Copy to the beginning of the line where the cursor is , Does not include cursor position characters
y$                         Copy to the end of the line where the cursor is , Include cursor position characters
yw                         Copy a word , The cursor must be at the beginning of the word
yG                         Copy to the end of the file
y1G                        Copy to the beginning of the file
nyy                        Copy the line where the cursor starts n That's ok

Paste
p                   ( A lowercase letter ) Paste after cursor
P                ( Capitalization ) Paste in front of the cursor
Delete
x                       ( A lowercase letter ) Delete the character before the cursor
X                        ( Capitalization ) Delete the character after the cursor
dd                      ( A lowercase letter ) Delete the entire line of the cursor
dw                       ( A lowercase letter ) Delete a word where the cursor is
dG                       Delete the whole line of the cursor to the end of the file
dgg                        Delete the whole line of the cursor to the beginning of the file
D                   ( Capitalization ) Delete to end of line , Contains the character at the cursor
d0                     Delete to the beginning of the line , Does not contain the character at the cursor

:n1,n2d                In edit mode , Delete n1-n2 That's ok

revoke

u               ( A lowercase letter ) Undo before saving unlimited times ( Probably 500 many times )

ctrl+r             redo redo

lookup

/string           amount to find,  Start at the cursor and look down for the string string
/ In search mode, press n( A lowercase letter ) Find the next one , Press N( Capitalization ) Find the last one
?string        Start at the cursor and look up the character from string
? In search mode, press n( A lowercase letter ) Find the last one , Press N( Capitalization ) Find the next one

:set nu(mber)                According to the line Numbers

:n                        Specify to move to n That's ok

Multi window function :

:r file        Read in file  file  Content , And insert after the current line

:new      Create a new column of blank windows

:split     Display the current file in two columns

<C-]>   stay :help in , You can press Ctrl+] Jump

<C-T>   stay :help in , Press Ctrl+T Go back and jump

Block selection : ctrl+v

Two :Vim Environment settings

In the catalog /etc/ below , A name is vimrc The file of , This is common in the system vim The configuration file , It works for all users . And in each user's home directory , You can create your own private configuration file , name by :“.vimrc”

open .vimrc, Add the following statement to make the syntax highlight :  syntax on

Set up Automatic indentation  : That is, the indent value of each line is equal to the previous line ; Use noautoindent Cancel settings :

set autoindent

Set to use C/C++ The automatic indentation of language :   set cindent

filetype plugin on It's using plug-in statements

3、 ... and :c-support.vim plug-in unit

recommend c-support.vim This plug-in , Can be used to compile c/c++, Very good !~

c-support.vim Download address

http://www.vim.org/scripts/script.php?script_id=213

Easy to install

Copy the zip archive  cvim.zip to $HOME/.vim/ (Linux/Unix) or $HOME/vimfiles (Windows) and run   unzip cvim.zip

The installation to $HOME/.vim/

You can use the command to see $HOME:

cd ~/.vim
unzip cvim.zip

stay /etc/vim/vimrc Add filetype plugin on You can use the plug-in .

Its hotkey says :

http://lug.fh-swf.de/vim/vim-c/c-hotkeys.pdf

\if    Insert the general function

\im    Insert the main function

\cfu    Insert function header , That is function description

\cfr    Insert a frame comment, Can be used to write variable descriptions

\rc    Save and compile

\rr   function

\nr    Can be in ~/.vim/c-support/codesnippets Write some precompiled code or code blocks in , Use this command to

 
 
 
label :  c-supportvim

linux Learning experience vim/Cvim More related articles in this article

  1. Linux Learning experience Linux Next command line Android Build the development environment

    author : Fengxueting Source :http://www.cnblogs.com/FengXueTing-px/ Welcome to reprint Linux Learning experience Linux Next command line Android Build the development environment 1. Preface 2. Jav ...

  2. Linux Learning experience Linux Next ant Installation and use

    author : Fengxueting Source :http://www.cnblogs.com/FengXueTing-px/ Welcome to reprint Linux Learning experience Linux Next ant Installation and use 1. Preface 2. ant install 3. ordinary a ...

  3. Linux Learning experience Sli 、 Chinese input method and svn Preliminary use

    author : Fengxueting Source :http://www.cnblogs.com/FengXueTing-px/ Welcome to reprint Linux Learning experience Sli . Chinese input method and svn Preliminary use 1. Preface 2.Linux Dual graphics card solution ...

  4. linux The beginning of the tree of learning experience and /etc( Image & Text )

    linux The beginning of the tree of learning experience and /etc( Image & Text ) linux in “ Everything is a document ”, Study linux One year. , In the process of learning a little experience of the directory tree , Share with you , If there is something wrong, please correct it . Not much said , First map : root directory : / ...

  5. linux Study :【 The first 3 piece 】 Remote connection and software installation

    Rabies declares : All articles are my own learning notes , Reprint must indicate the source ; Editing is not easy , Guard against gentlemen, not villains ~ Mutual encouragement ! linux Study :[ The first 3 piece ] Remote connection and software installation Remote connection xshell , xftp Software official website : ...

  6. linux Study :【 The first 2 piece 】 Common commands

    Rabies declares : All articles are my own learning notes , Reprint must indicate the source ; Editing is not easy , Guard against gentlemen, not villains ~ Mutual encouragement ! linux Study :[ The first 2 piece ] Common commands Basic commands // Open the terminal : CentOS: anywhere , Right click -- ...

  7. linux Study :【 The first 1 piece 】 First time to know Linux And installation

    Rabies declares : All articles are my own learning notes , Reprint must indicate the source ; Editing is not easy , Guard against gentlemen, not villains ~ Mutual encouragement ! linux Study :[ The first 1 piece ] First time to know Linux And installation Write it at the front At the beginning of my study, I read an article , Has a lot of feeling , So also ...

  8. Linux Learning experience LVM Management and Linux System installation

    author : Fengxueting Source :http://www.cnblogs.com/FengXueTing-px/ Welcome to reprint LVM Management and Linux System installation 1. Preface 2.LVM Introduction and terminology 3.LVM Use 4.Li ...

  9. Linux Learning experience linux command

    author : Fengxueting Source :http://www.cnblogs.com/FengXueTing-px/ Welcome to reprint Preface This blog is about   One day linux command (http://www.cnblogs.com/pe ...

Random recommendation

  1. 【LeetCode】389 Find the Difference(java)

    The original title is Given two strings s and t which consist of only lowercase letters. String t is generated by rando ...

  2. web The third part of the automation framework is to compare the database value with the interface value ~~

    The database uses mysql, The framework involves databases , It mainly includes two aspects , One is after each case is executed , Insert case related information and data : One is web When checking the interface data , Need from sql Get the value of a row and a column in the interface and compare it with a value in the interface . describe :w ...

  3. Use canvas Draw the clock (http://heeroluo.net/Article/Detail/95)

    preparation stay HTML The clock is placed in an area specified in : <div id="clock" style="position: relative;"></di ...

  4. Universal tab ,tab tab

    // Universal tab function PaPtabs(thisObj, num) { if (thisObj.className == "active") return; var ta ...

  5. [Oracle] How to view 10046 trace Medium tim= ... The specific moment

    Can be in   Linux Next , In the following way : Such as 10046 trace If there are the following contents in the document :... tim = 1503032923 It can be used date Order plus option The moment to see it : date - ...

  6. springMVC Front and back interaction

    Backstage return json object : package com.sawshaw.controller; import org.springframework.stereotype.Controller; import ...

  7. Centos eliminate IP

    We need to configure the ip Remove , You can use the following command : ip addr flush dev eth0 If there is no ip This command , You can use the simpler : ifconfig eth0 0.0.0.0 It can be used for PPTP allocate ...

  8. Study MongoDB 7、 ... and : MongoDB Indexes ( Index basic operations )( One )

    One . brief introduction stay MongoDB Indexing can improve query efficiency , Just scan the index to store only a small part of this collection , And just load that little bit into memory , Efficiency is greatly improved , If there is no index , In the query ,MongoDB A full table scan must be performed , In number ...

  9. socketserver Multithreading

    One . brief introduction SocketServer Simplify the writing of network server . It's going on socket Creation time , Use SocketServer It greatly reduces the creation steps , also SocketServer Used select It has 5 Classes :Base ...

  10. geoserver-manager Release style Failure

    When there is no error when the parameter is given , The most likely reason is : sld The file format should be UTF-8 nothing BOM Format encoding ( Self generated sld Most of the documents are based on UTF-8 Format encoding ).