Analysis of VIM configuration file

Source: Internet
Author: User

 

 

 

" /etc/vimrc (configuration file for vim only)" author: Klaus Franken     <[email protected]>" author: Werner Fink       <[email protected]> " author: Florian La Roche  <[email protected]> " version: 00/01/20" commented lines start with `"‘" enable syntax highlightingsyntax on" automatically indent lines (default)" set noautoindent" select case-insenitiv search (not default)set ignorecase" show cursor line and column in the status lineset rulerset number" show matching bracketsset showmatch" display mode INSERT/REPLACE/...set showmode" changes special characters in search patterns (default)" set magic" Required to be able to use keypad keys and map missed escape sequencesset esckeys" get easier to use and more user friendly vim defaults" CAUTION: This option breaks some vi compatibility. "          Switch it off if you prefer real vi compatibilityset nocompatible" Complete longest common string, then each full match" enable this for bash compatible behaviour" set wildmode=longest,full" Try to get the correct main terminal typeif &term =~ "xterm"let myterm = "xterm"elselet myterm =  &termendiflet myterm = substitute(myterm, "cons[0-9][0-9].*$",  "linux", "")let myterm = substitute(myterm, "vt1[0-9][0-9].*$",   "vt100", "")let myterm = substitute(myterm, "vt2[0-9][0-9].*$",   "vt220", "")let myterm = substitute(myterm, "\\([^-]*\\)[_-].*$", "\\1",   "")

"Here we define the keys of the numlock in keyboard transmit mode of xterm
"Which misses or hasn' t activated alt/numlock modifiers. Often Not Defined
"Within termcap/terminfo and we shoshould map the character printed on the keys.
If myterm = "xterm" | myterm = "kvt" | myterm = "gnome"
"Keys in insert/command mode.
Map! <ESC> OO:
Map! <ESC> OJ *
Map! <ESC> OM-
Map! <ESC> OK +
Map! <ESC> ol,
Map! <ESC> OM
Map! <ESC> ow 7
Map! <ESC> ox 8
Map! <ESC> Oy 9
Map! <ESC> ot 4
Map! <ESC> ou 5
Map! <ESC> ov 6
Map! <ESC> OQ 1
Map! <ESC> or 2
Map! <ESC> OS 3
Map! <ESC> op 0
Map! <ESC> On.
"Keys in Normal Mode
Map <ESC> OO:
Map <ESC> OJ *
Map <ESC> OM-
Map <ESC> OK +
Map <ESC> ol,
Map <ESC> OM
Map <ESC> ow 7
Map <ESC> ox 8
Map <ESC> Oy 9
Map <ESC> ot 4
Map <ESC> ou 5
Map <ESC> ov 6
Map <ESC> OQ 1
Map <ESC> or 2
Map <ESC> OS 3
Map <ESC> op 0
Map <ESC> On.
Endif

"Xterm but without activated keyboard transmit mode
"And therefore not defined in termcap/terminfo.
If myterm = "xterm" | myterm = "kvt" | myterm = "gnome"
"Keys in insert/command mode.
Map! <ESC> [H <Home>
Map! <ESC> [F <End>
"Home/end: Older xterms do not fit termcap/terminfo.
Map! <ESC> [1 ~ <Home>
Map! <ESC> [4 ~ <End>
"Up/down/right/left
Map! <ESC> [A <up>
Map! <ESC> [B <down>
Map! <ESC> [C <right>
Map! <ESC> [d <left>
"Kp_5 (numlock off)
Map! <ESC> [E <Insert>
"Pageup/Pagedown
Map <ESC> [5 ~ <Pageup>
Map <ESC> [6 ~ <Pagedown>
Map <ESC> [5; 2 ~ <Pageup>
Map <ESC> [6; 2 ~ <Pagedown>
Map <ESC> [5; 5 ~ <Pageup>
Map <ESC> [6; 5 ~ <Pagedown>
"Keys in Normal Mode
Map <ESC> [H 0
Map <ESC> [F $
"Home/end: Older xterms do not fit termcap/terminfo.
Map <ESC> [1 ~ 0
Map <ESC> [4 ~ $
"Up/down/right/left
Map <ESC> [A K
Map <ESC> [B J
Map <ESC> [C L
Map <ESC> [d H
"Kp_5 (numlock off)
Map <ESC> [e I
"Pageup/Pagedown
Map <ESC> [5 ~
Map <ESC> [6 ~
Map <ESC> [5; 2 ~
Map <ESC> [6; 2 ~
Map <ESC> [5; 5 ~
Map <ESC> [6; 5 ~
Endif

"Xterm/kvt but with activated keyboard transmit mode.
"Sometimes not or wrong defined within termcap/terminfo.
If myterm = "xterm" | myterm = "kvt" | myterm = "gnome"
"Keys in insert/command mode.
Map! <ESC> oh <Home>
Map! <ESC> of <End>
Map! <ESC> o2h <Home>
Map! <ESC> o2f <End>
Map! <ESC> o5h <Home>
Map! <ESC> o5f <End>
"Cursor keys which works mostly
"Map! <ESC> OA <up>
"Map! <ESC> ob <down>
"Map! <ESC> OC <right>
"Map! <ESC> OD <left>
Map! <ESC> [2; 2 ~ <Insert>
Map! <ESC> [3; 2 ~ <Delete>
Map! <ESC> [2; 5 ~ <Insert>
Map! <ESC> [3; 5 ~ <Delete>
Map! <ESC> o2a <Pageup>
Map! <ESC> o2b <Pagedown>
Map! <ESC> o2c <s-Right>
Map! <ESC> o2d <s-left>
Map! <ESC> o5a <Pageup>
Map! <ESC> o5b <Pagedown>
Map! <ESC> o5c <s-Right>
Map! <ESC> o5d <s-left>
"Kp_5 (numlock off)
Map! <ESC> OE <Insert>
"Keys in Normal Mode
Map <ESC> oh 0
Map <ESC> of $
Map <ESC> o2h 0
Map <ESC> o2f $
Map <ESC> o5h 0
Map <ESC> o5f $
"Cursor keys which works mostly
"Map <ESC> Oa k
"Map <ESC> ob J
"Map <ESC> OD H
"Map <ESC> OC L
Map <ESC> [2; 2 ~ I
Map <ESC> [3; 2 ~ X
Map <ESC> [2; 5 ~ I
Map <ESC> [3; 5 ~ X
Map <ESC> o2a ^ B
Map <ESC> o2b ^ F
Map <ESC> o2d B
Map <ESC> o2c W
Map <ESC> o5a ^ B
Map <ESC> o5b ^ F
Map <ESC> o5d B
Map <ESC> o5c W
"Kp_5 (numlock off)
Map <ESC> oe I
Endif

If myterm = "Linux"
"Keys in insert/command mode.
Map! <ESC> [G <Insert>
"Kp_5 (numlock off)
"Keys in Normal Mode
"Kp_5 (numlock off)
Map <ESC> [g I
Endif

"This escape sequence is the well known ANSI sequence
"Remove character under the cursor (rcutc [Tm])
Map! <ESC> [3 ~ <Delete>
Map <ESC> [3 ~ X

"Only do this part when compiled with support for autocommands.
If has ("autocmd ")
"When editing a file, always jump to the last known cursor position.
"Don't do it when the position is invalid or when inside an event handler
"(Happens when dropping a file on gvim ).
Autocmd bufreadpost *
\ If line ("'\" ")> 0 & line ("' \ "") <= line ("$") |
\ Exe "normal G' \" "|
\ Endif

Endif "has (" autocmd ")

"Changed default required by SuSE Security Team -- be aware if enabling this
"That it potentially can open for malicious users to do harmful things.
Set modelines = 0

"Get easier to use and more user friendly Vim defaults
"/Etc/vimrc ends here

 

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.