{"id":2229,"date":"2017-12-08T05:19:05","date_gmt":"2017-12-08T05:19:05","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=2229"},"modified":"2020-01-09T09:30:03","modified_gmt":"2020-01-09T09:30:03","slug":"vim-custom-settings","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/vim-custom-settings\/","title":{"rendered":"VIM custom settings."},"content":{"rendered":"<p><strong>rajeshkumar created the topic: VIM custom settings.<\/strong><br \/>\nHi,<\/p>\n<p>I was required to set my tab to 4 space. I got some inputs and based on google search i found good reference which can used to customize your VIM editor. Please create one .vimrc file and save in your home directory. .vimrc file will contain following info which can be modify depends on your requirement&#8230;.<\/p>\n<p><code>\" Michael's standard settings<br \/>\n\" Author: Michael Geddes<br \/>\n\" Version: 0.1<\/p>\n<p>\" Smart tabbing \/ autoindenting<br \/>\nset undolevels=100<br \/>\nset nocompatible<br \/>\nset autoindent<br \/>\nset smarttab<br \/>\n\" Allow backspace to back over lines<br \/>\nset backspace=2<br \/>\nset exrc<br \/>\nset shiftwidth=4<br \/>\nset tabstop=4<br \/>\nset cino=t0<br \/>\n\" I like it writing automatically on swapping<br \/>\nset autowrite<br \/>\nset noshowcmd<br \/>\nif exists('&selection')<br \/>\n  set selection=exclusive<br \/>\nendif<\/p>\n<p>if has(\"gui_running\")<br \/>\n    \" set the font to use<br \/>\n    set guifont=Courier_New:h10<br \/>\n    \" Hide the mouse pointer while typing<br \/>\n    set mousehide<br \/>\nendif<\/p>\n<p>\"Special error formats that handles borland make, greps<br \/>\n\"Error formats :<br \/>\n\"   line = line number<br \/>\n\"   file = file name<br \/>\n\"   etype = error type ( a single character )<br \/>\n\"   enumber = error number<br \/>\n\"   column = column number<br \/>\n\"   message = error message<br \/>\n\"   _ = space<\/p>\n<p>\"   file(line)_:_etype [^0-9] enumber:_message<br \/>\n\"   [^\"] \"file\" [^0-9] line:_message<br \/>\n\"   file(line)_:_message<br \/>\n\"   [^ ]_file_line:_message<br \/>\n\"   file:line:message<br \/>\n\"   etype [^ ]_file_line:_message<br \/>\n\"   etype [^:]:__file(line,column):message    = Borland ??<br \/>\n\"   file:line:message<br \/>\n\"   etype[^_]file_line_column:_message<br \/>\nset efm=%*[^\\ ]\\ %t%n\\ %f\\ %l:\\ %m,%\\\\s%#%f(%l)\\ :\\ %t%*[^0-9]%n:\\ %m,%*[^\\\"]\\\"%f\\\"%*[^0-9]%l:\\ %m,%\\\\s%#%f(%l)\\ :\\ %m,%*[^\\ ]\\ %f\\ %l:\\ %m,%f:%l:%m,%t%*[^\\ ]\\ %f\\ %l:\\ %m,%t%*[^:]:\\ \\ %f(%l\\\\,%c):%m,%f:%l:%m,%t%*[^\\ ]\\ %f\\ %l\\ %c:\\ %m<br \/>\n\" This changes the status bar highlight slightly from the default<br \/>\n\" \" set highlight=8b,db,es,mb,Mn,nu,rs,ss,tb,vr,ws<\/p>\n<p>\"I like things quiet<br \/>\nset visualbell<br \/>\n\" Give some room for errors<br \/>\nset cmdheight=2<br \/>\n\" always show a status line<br \/>\nau VimEnter * set laststatus=2<br \/>\nset ruler<br \/>\n\" Use a viminfo file<br \/>\nset viminfo='20,\\\"50<br \/>\n\"set path=.,d:\\wave,d:\\wave\\include,d:\\wave\\fdt<br \/>\nset textwidth=80        \" always limit the width of text to 80<br \/>\nset backup              \" keep a backup file<br \/>\nset backupext=.bak<br \/>\n\" Like having history<br \/>\nset history=100<\/p>\n<p>\" Map Y do be analog of D<br \/>\nmap Y y$<br \/>\n\" Toggle paste<br \/>\nmap zp :set paste! paste?<CR><\/p>\n<p>\" From the vimrc of 'Peppe'<\/p>\n<p>  \" So I can get to ,<br \/>\n  noremap g, ,<br \/>\n  \" Go to old line + column<br \/>\n  noremap gf gf`\"<br \/>\n  noremap <C-^> <C-^>`\"<\/p>\n<p>\" Switch off search pattern highlighting.<br \/>\nset nohlsearch<br \/>\n\"Toggle search pattern hilighting and display the value<br \/>\nif v:version >=600<br \/>\n  map <f7> :nohlsearch<CR><br \/>\nelse<br \/>\n  map <f7> :set hlsearch! hlsearch?<CR><br \/>\nendif<br \/>\nimap <f7> <C-O><f7> <\/p>\n<p>\"Ctags mapping for <alt n> and <alt p><br \/>\nmap <M-n> :cn<cr>z.:cc<CR><br \/>\nmap <M-p> :cp<cr>z.:cc<CR><br \/>\nset shellpipe=2>&1\\|tee<br \/>\n\"set shellpipe=\\|grep\\ -v\\ NOTE:\\|tee<\/p>\n<p>\" Set nice colors<br \/>\n\" background for normal text is light grey<br \/>\n\" Text below the last line is darker grey<br \/>\n\" Cursor is green<br \/>\n\" Constants are not underlined but have a slightly lighter background<br \/>\n\"  highlight Normal guibg=grey95<br \/>\nhighlight Cursor guibg=Red guifg=NONE<br \/>\nhighlight Visual guifg=Sys_HighlightText guibg=Sys_Highlight gui=NONE<br \/>\n\"  highlight NonText guibg=grey90<br \/>\n\"  highlight Constant gui=NONE guibg=grey95<br \/>\n\"  highlight Special gui=NONE guibg=grey95<\/p>\n<p>if has(\"gui_running\")<br \/>\n\"if &columns < 90 &#038;&#038; &#038;lines < 32\n\"   win 90 32 \n    au GUIEnter * win 90 32 \n\"  endif\n  \" Make external commands work through a pipe instead of a pseudo-tty\n  set noguipty\nendif\n \n\" Map control-cr to goto new line without comment leader\nimap <C-CR> <ESC>o<\/p>\n<p>\" Look at syntax attribute<br \/>\nnmap <F4> :echo synIDattr(synID(line(\".\"), col(\".\"), 1), \"name\")<CR><br \/>\nnmap <S-F4> :echo synIDattr(synID(line(\".\"), col(\".\"), 0), \"name\")<CR><br \/>\n\" delete the swap file<br \/>\nnmap \\\\. :echo strpart(\"Error  Deleted\",7*(0==delete(expand(\"%:p:h\").\"\/.\".expand(\"%:t\").\".swp\")),7)<cr><\/p>\n<p>\" delete prev word<br \/>\nimap <C-BS> <c-w><\/p>\n<p>  set joinspaces <\/p>\n<p>\" Today<br \/>\nif !exists('usersign')<br \/>\nlet usersign=$username<br \/>\nendif<br \/>\nimap <F2> <C-R>=strftime(\"%d%b%Y\").\" \".usersign.\":\"<CR><br \/>\nif has(\"menu\")<br \/>\n  imenu 35.60 &Insert.&Date<tab>F2      <c-r>=strftime(\"%d%b%Y\").\" \".usersign.\":\"<CR><br \/>\n  menu  35.60 &Insert.&Date<tab>F2      \"=strftime(\"%d%b%Y\").\" \".usersign.\":\"<CR>p<br \/>\n  imenu  35.60 &Insert.Date\\ and\\ &Username     <c-r>=strftime(\"%d%b%Y\")<CR><br \/>\n  menu  35.60 &Insert.Date\\ and\\ &Username      \"=strftime(\"%d%b%Y\")<CR>p<br \/>\nendif<\/p>\n<p>set listchars=eol:\u00b6,tab:\u203a\u2026,trail:_<br \/>\n\" Enable 'wild menus'<br \/>\nset wildmenu<br \/>\nset showfulltag<br \/>\nset display+=lastline<br \/>\nset printoptions=syntax:y,wrap:y<\/p>\n<p>\" Switch on syntax highlighting.<br \/>\nsyntax on<\/code><\/p>\n<p>Regards,<br \/>\nRajesh Kumar<br \/>\nTwitt me @ <a href=\"http:\/\/twitter.com\/RajeshKumarIn\" target=\"_blank\" rel=\"noopener\">twitter.com\/RajeshKumarIn<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>rajeshkumar created the topic: VIM custom settings. Hi, I was required to set my tab to 4 space. I got some inputs and based on google search i found good&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[454],"tags":[459],"class_list":["post-2229","post","type-post","status-publish","format-standard","hentry","category-shell-script","tag-vim"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2229","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=2229"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2229\/revisions"}],"predecessor-version":[{"id":2230,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2229\/revisions\/2230"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=2229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=2229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=2229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}