Linux Basics: A concise VIM training strategy

Source: Internet
Author: User
Tags define function set background

There are only three types of editors in the world, EMACS, vim, and other

650) this.width=650; "src=" Http://feihu.me/img/posts/vim-solarized-yinyang.png "width=" 433 "height=" 434 "alt=" Vim-solarized-yinyang.png "/>

Personally feel very good blog:

Concise VIM training strategy: http://coolshell.cn/articles/5426.html

no plug-in VIM programming tips: Http://coolshell.cn/tag/vim

learn vim with me: http://feihu.me/blog/2014/intro-to-vim/


. vimrc file:

Map <f9> :call saveinputdata () <cr>func! saveinputdata () exec  "tabnew" exec   ' normal  ' +gp ' exec  "W! /tmp/input_data" Endfunc "  Theme" Colorscheme torte "ColorScheme  murphy "colorscheme desert " colorscheme desert  "Colorscheme elflordcolorscheme  ron "  Code" set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936 "Set termencoding=utf-8 "Set encoding=utf-8" set fileencodings=ucs-bom,utf-8,cp936 "Set fileencoding=utf-8" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "Set shortmess=ati" When it starts, it doesn't show that aid. Tips for Ugandan children    "winpos 5 5"   setting window position    "set lines=40 columns= 155 "  Set window size   set go="   Do not graphics button    "color asmanian2"   Set background theme     "Set guifont=courier_new:h10:cansi      Set fonts    syntax on   syntax highlighting    autocmd insertleave * se nocul   "  Highlight current line with light   autocmd  insertenter * se cul     "  Highlight current line    Set ruler with light"   Show ruler   set showcmd "  input command displayed, see clearly   " set cmdheight=1 "  command line (under the status line) of the height, Set to 1   "Set whichwrap+=<,>,h,l"   allow backspace and cursor keys to span line boundaries (not recommended)    set  Scrolloff=3 "  Keep 3 lines distance   set novisualbell when moving the cursor to the top and bottom of the buffer"   do not blink (do not understand)   set  statusline=%f%m%r%h%w\ [format=%{&ff}]\ [type=%y]\ [pos=%l,%v][%p%%]\ %{strftime (\ "%d/%m/%y\ -\ %h:%m\")}     status line display   set laststatus=1   Start display status line (1), always show status line (2)   set  Foldenable "  Allow folding   set foldmethod=manual"   Manual folding    "Set background=dark" Background using black set nocompatible "Get rid of nasty about VI consistency mode, avoid some bugs and limitations of previous versions   "   Show Chinese help if version >=  603set helplang=cnset encoding=utf-8endif "  Set color scheme" colorscheme murphy "font  " if   (Has ("gui_running"))   "   set guifont=bitstream\ vera\ sans\ mono \ 10  "endif " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "Create a new. c,.h,.sh,.java file, insert the file header  autocmd bufnewfile *.cpp,* automatically. [ch],*.sh,*.java exec  ": Call settitle ()"   "" "Define function Settitle, automatically insert header  func settitle ()   "If the file type is. sh file  if &filetype ==  ' sh '  call setline (1," \################## ####################################################### ")  call append (Line (". "), " \# File  Name:  ". Expand ("% "))  call  Append (Line (".") +1,  "\# author: skypegnu")  call append (Line (".") +2,  "\# mail: [email protected]")  call append (Line (".") +3,  "\# created time: ". Strftime ("%c"))  call append (Line (".") +4,  "\#########################################################################")  call append ( Line (".") +5,  "\#!/bin/bash")  call append (Line (".") +6,  "")  else call setline (1,  "/****************************************************** ")  call append (Line (". "), " > File Name:  ". Expand ("% "))  call append (Line (".") +1,  "> author: skypegnu")  call append (Line (".") +2,  "> mail: [email protected]")  call append (Line (".") +3,  "> Created Time: ". Strftime ("%c"))  call append (Line (".") +4,  " *****************************************/")  call append (Line (". ") +5,  "") endifif &filetype ==  ' CPP ' Call append (Line (".") +6,  "#include <iostream>") Call append (Line (".") +7,  "using namespace std;") Call append (Line (".") +8,  "") endifif &filetype ==  ' C ' call append (Line (".") +6,  "#include <stdio.h>") Call append (Line (".") +7,  "") endif "if &filetype ==  ' java '" Call append (Line (".") +6, "public class ". Expand ("%")) "Call append (Line (". ") +7, "") "endif" After creating a new file, automatically navigates to the end of the file autocmd bufnewfile * normal gendfunc  "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "NMAP&NBSP;&LT;LEADER&GT;W&NBSP;: w!<cr>nmap <leader>f :find<cr> "  Map Select all + Copy  ctrl+amap &Lt C-a> ggvgymap! <c-a> <esc>ggvgymap <f12> gg=g "  Selected status   ctrl+c  copy vmap <c-c>  "+y" to Empty line   nnoremap <F2> :g/^\s*$/d<CR>   Compare files   nnoremap <C-F2> :vert diffsplit  new label   map  <M-F2> :tabnew<CR>   "lists the current directory file   map <f3> :tabnew . <CR>   "Open tree file directory   map <C-F3> \be  " c,c++  run map by F5 compilation &NBSP;&LT;F5&GT;&NBSP;:CALL&NBSP;COMPILERUNGCC () &LT;CR&GT;FUNC!&NBSP;COMPILERUNGCC () exec  "W" if & filetype ==  ' C ' exec  "!g++ % -o %<" exec  "! ./%<" elseif & filetype ==  ' cpp ' exec  "!g++ % -o %<" exec  "! ./%<" elseif  &filetype ==  ' java '  exec  '!javac % '  exec  '!java %< ' elseif  &filetype ==  ' sh ':!. /%elseif &filetype ==  ' py ' exec  "!python %" exec  "!python %<" Endifendfunc "c,c++ Debug Map <f8> :call rungdb () <cr>func! rungdb () exec " W " exec  "!g++ % -g -o %<" exec  "!gdb ./%<" Endfunc "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" Autoread " quickfix mode autocmd filetype c,cpp map <buffer> <leader>< Space> :w<cr>:make<cr> "code completion  set completeopt=preview,menu " Allow plugins    Filetype plugin on "Share clipboard   set clipboard+=unnamed " never Back up   set  Nobackup "make  run: set makeprg=g++\ -wall\ \ %" Auto Save Set autowriteset ruler                     "  Open status bar ruler" set  cursorline              "  Highlight Current Line set magic                     "  Set Magic set guioptions-=t               Hide the toolbar set guioptions-=m             "  Hide menu bar" set statusline=\ %<%f[%1*%m%*%n%r%h]%=\ %y\ %0 (%{& fileformat}\ %{&encoding}\ %c:%l/%l%) "  Set the information displayed in the status line set foldcolumn=0set foldmethod= indent set foldlevel=3 set foldenable                  Start folding   Do not use VI's keyboard mode, but Vim's own set nocompatible "  syntax highlighting set  syntax=on "  get rid of incorrect input sound set nOeb "  When working with unsaved or read-only files, pop the confirm set confirm"   Auto indent set autoindentset cindent " tab key width Set  tabstop=4 "  Unified indent for 4set softtabstop=4set shiftwidth=4"   do not use spaces instead of tabs Set noexpandtab "   Use tab Set smarttab at the beginning of lines and segments   show line numbers set number   history set history=1000 Disable generating temporary file set  nobackupset noswapfile "Search ignores case set ignorecase" search verbatim Fugauliang Set hlsearchset incsearch " Inline replace Set gdefault "encoding settings set enc=utf-8set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936" Language Settings set langmenu=zh_cn. UTF-8SET&NBSP;HELPLANG=CN "  My status line display content (including file type and decoding)" Set statusline=%f%m%r%h%w\ [format=%{&ff} " \ [type=%y]\ [pos=%l,%v][%p%%]\ %{strftime (\ "%d/%m/%y\ -\ %h:%m\")} "set  statusline=[%f]%y%r%m%*%=[line:%l/%l,column:%c][%p%%]   Always show the height of the status line set laststatus=2   command line (under the status line), The default is 1, here is 2set cmdheight=2 "  detect file type Filetype on"   load file type plug-in Filetype plugin on "  For a specific file typeinto related indent file Filetype indent on "  Save global variable set viminfo+=!"   Words with the following symbols do not wrap set iskeyword+=_,$,@,%,#,-"  Putting number of pixel rows inserted set linespace=0"   Command-line autocomplete in enhanced mode Set wildmenu "  make backspace normal Indent, eol, start set backspace=2"   Allow backspace and cursor keys to cross the line boundary set whichwrap+=<,>,h,l "  You can use the mouse anywhere in buffer (similar to the workspace in office, double-click the mouse to navigate) set  mouse=aset selection=exclusiveset selectmode=mouse,key "  by using:  commands command, Tell us which line of the file has been changed. set report=0 "  display whitespace between divided windows for easy reading SET&NBSP;FILLCHARS=VERT:\&NBSP;,STL:\&NBSP;,STLNC:"   Highlight matching brackets set showmatch "  match parentheses highlight time (in seconds) set matchtime=1"   Keep 3 lines away when the cursor moves to the top and bottom of buffer set scrolloff=3 "  provides auto indent set smartindent for C programs"   Highlight the normal TXT file (requires Txt.vim script) au bufread,bufnewfile *  setfiletype txt "auto-complete:inoremap  (   () <ESC>i:inoremap )  <c-r>=closepair (') ') <CR> ": INOREMAP&NBSP;{&NBSP;{&LT;CR >}<esc>o ": InOremap } <c-r>=closepair ('} ') <cr>:inoremap [ []<esc>i:inoremap ]  <c-r>=closepair ('] ') <CR>:inoremap  " " <ESC>i:inoremap  '   ' <esc >ifunction! closepair (char) if getline ('. ') [Col ('. ')  - 1] == a:charreturn  "\<right>" Elsereturn a:charendifendfunctionfiletype  plugin indent on  "Open File type detection,  added this to use the smart complement Set completeopt=longest,menu" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" nerdchristmastree=1let nerdtreeautocenter=1let nerdtreebookmarksfile= $VIM. ' \data\nerdbookmarks.txt ' Let nerdtreemousemode=2let nerdtreeshowbookmarks=1let nerdtreeshowfiles =1let nerdtreeshowhidden=1let nerdtreeshowlinenumbers=1let nerdtreewinpos= ' left ' let  Nerdtreewinsize=31nnoremap f :nerdtreetogglemap <f7> :nerdtree<cr> 


This article is from the "Share Your Knowledge" blog, so be sure to keep this source http://skypegnu1.blog.51cto.com/8991766/1621634

Linux Basics: A concise VIM training strategy

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.