Vim's DIY configuration under Mac (Linux vim Universal)

Source: Internet
Author: User

Vim's DIY preference configuration under Mac


"First execute:

"CP/USR/SHARE/VIM/VIMRC ~/.VIMRC

"Copy the default configuration file, and then execute:

"Vim ~/.VIMRC

"Edit the file at the end of the file to add

"Syntax on

"Save to exit

"========================== below is the configuration content ==================



"Configuration file for Vim

Set Modelines=0 "cve-2007-2438


"Normally we use vim-extensions. If you want True vi-compatibility

"Remove Change the following statements

Set nocompatible "Use Vim defaults instead of 100% VI compatibility

Set backspace=2 "more powerful backspacing


"Don ' t write backup file if Vim is being called by" CRONTAB-E "

Au bufwrite/private/tmp/crontab.* set nowritebackup nobackup

"Don ' t write backup file if Vim is being called by" Chpass "

Au bufwrite/private/etc/pw.* set nowritebackup nobackup



"=====================diy_configuration_setting============:


Set Showmatch "highlight the corresponding parentheses

Set number "Displays line numbers

Set Cindent "C-style alignment

Set autoindent "Auto Align

Set confirm "When processing unsaved or read-only files, pop-up confirmation

Set tabstop=4 the width of the TAB key

Syntax on "Automatic syntax highlighting


Set softtabstop=4

Set shiftwidth=4 "Unified Indentation is 4


Set Hlsearch

Set Incsearch "Search for verbatim Fugauliang


Set Gdefault "Inline substitution"


Set Encoding=utf-8

Set fileencodings=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936,utf-16,big5,euc-jp,latin1 "Encoding settings


"ColorScheme torte" Set color theme



Set Guifont=menlo:h16:cansi font


"Set LANGMENU=ZN_CN. UTF-8

"Set HELPLANG=CN" Language settings


Set Matchtime=5 "corresponds to the time of the parentheses highlighting (in a very second)


Set Autowrite "Automatically saves the current file when switching buffer


Command-line autocomplete in set Wildmenu enhanced mode


Set whichwrap=b,s,<,>,[,]

"Turn on normal or visual mode backspace key, SPACEBAR, LEFT ARROW key, RIGHT ARROW key, insert or Replace mode left ARROW key, RIGHT ARROW key skip function."


Command-line autocomplete in set Wildmenu enhanced mode


Set whichwrap=b,s,<,>,[,]

"Turn on normal or visual mode backspace key, SPACEBAR, LEFT ARROW key, RIGHT ARROW key, insert or Replace mode left ARROW key, RIGHT ARROW key skip function."



"Set to automatically load when files are changed

Set Autoread


"" Quickfix mode

Autocmd FileType c,cpp map <buffer> <leader><space>:w<cr>:make<cr>


"" Code completion

Set Completeopt=preview,menu


The shared clipboard

Set clipboard+=unnamed



"You can use the mouse anywhere in the buffer (similar to the workspace in office, double-click the mouse to navigate)

Set Mouse=a

Set selection=exclusive

Set Selectmode=mouse,key



FileType plugin indent on

"is divided into three parts: file on, file plugin on, and file indent on.

"Indicates the automatic identification of file types, with file type scripting, using indentation definition files.


"================== Custom Key mapping ======================


Vnoremap <esc> ' >a) <esc> ' <i (<esc>

Vnoremap <esc> ' >a]<esc> ' <i[<esc>

Vnoremap <esc> ' >a}<esc> ' <i{<esc>

Vnoremap $$ <esc> ' >a ' <esc> ' <i ' <esc>

Vnoremap $q <esc> ' >a ' <esc> ' <i ' <esc>

Vnoremap $e <esc> ' >a ' <esc> ' <i ' <esc>

The parentheses are automatically generated


Map <F7>: If exists ("syntax_on") <BAR>

\ syntax off <BAR><CR>

\ Else <BAR>

\syntax Enable <BAR>

\ endif

"Single button <F7> control syntax on/off. The reason is that sometimes too much color can hinder reading.


Map <F5>: Call COMPILERUNGCC () <CR>

func! COMPILERUNGCC ()

Exec "W"

Exec "!GCC%-O%<"

EXEC "! ./%<"

Endfunc

"<F5> compiling and running C programs


Map <F6>: Call compilerungpp<cr>

func! COMPILERUNGPP ()

Exec "W"

Exec "!g++%-O%<"

EXEC "! ./<"

Endfunc

"<F6> compiling and running C + + programs



Vim's DIY configuration under Mac (Linux vim Universal)

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.