Linux/unix Vim Editor configuration file

Source: Internet
Author: User


I am very sorry, this is my 12 years of configuration, has been in the open source China community to share, the following are constantly updated and modified. More suitable for front-end engineers to use.
Vim is configured as follows:


Set nocompatible
Syntax enable "open syntax highlighting
Syntax on "Open File type detection
FileType indent on "uses different indentation formats for different file types; Indent on is automatically indented the script by indent directory
FileType plugin off "loads the corresponding plug-in for different file types; plugin on is a script that allows file type-specific scripts to be executed in the Ftplugin directory.
Set rtp+=~/.vim/bundle/vundle/
Call VUNDLE#RC ()
Bundle ' Maksimr/vim-jsbeautify '
"FileType plugin indent on" combined notation
Set tabstop=4 "Sets the width of the TAB key
Set shiftwidth=4 4 spaces interleaved between rows
Set autoindent Auto Align
Set backspace=2 the BACKSPACE key is available
Set Cindent shiftwidth=4 "automatically indents 4 spaces
Set smartindent "Intelligent Auto Indent
Set ai! The Set auto indent
Set nu! "Show line numbers
Set Showmatch "Show bracket pairing
Set matchtime=5 "matches the time of the brace highlighting (in a very second)
Set Mouse=a "Enable mouse
Set ruler the bottom right corner shows the status line of the cursor position
Set Incsearch "Find book, when input/b is automatically found
Set Hlsearch "Open highlighting results
Set Incsearch "Open real-time search function
Set Nowrapscan "Search for files at both ends without re-searching
Map nh:noh<cr>
Set nocompatible "Turn off compatibility Mode"
Set VB t_vb= "Turn off the beep
Set Cursorline "Highlight when forward
Set hidden "allows switching of buffers when there are unsaved modifications
Set list
Set lcs=tab:\|\
Hi Specialkey guifg= #0087AF

Set history=1000 "Number of historical records
Set ignorecase "Search ignores case

"Insert matching parentheses automatically
"Inoremap (() <LEFT>
"Inoremap [[]<left>
"Inoremap {{}<left>
"Inoremap < <><LEFT>
"Inoremap" "" <LEFT>
"Inoremap '" <LEFT>

"Set nowrap" setting does not wrap automatically
Set wrap "Setting Wrap line
Map Nw:set nowrap<cr>

Set Writebackup no backup files
Set Nobackup
Set directory=., $TEMP "resolve" cannot open an unnamed interchange file, recovery will not be possible "error
"Set Autochdir" set file browser directory is current directory

"Set Foldenable" begins folding
"Set Foldmethod=indent" sets syntax folding; Za/zo/zo folding and expanding
"Set Foldcolumn=0" sets the width of the collapsed area
"Setlocal foldlevel=1" sets the number of fold layers to
"Set foldlevelstart=99" Open file is the default do not collapse code
"Set Foldclose=all" is set to automatically turn off folding
"Nnoremap <space> @= (foldclosed (Line ('. ')) < 0)? ' Zc ': ' zo ') <CR> "Use the space bar to switch folding

Set laststatus=2 "Open status bar information
Set Cmdheight=1 the height of the command line, defaults to 1, where you can reset
Set statusline=%f%m%r%h%w\ [format=%{&ff}]\ [type=%y]\ [pos=%l,%v][%p%%]\%y%r%m%*%=\%{strftime (\ "%y/%m/%d\]-\%H :%m\ ")}" the contents of the status line [including system platform, file type, coordinates, percentage, time, etc.

Set shm+=i "Remove splash screen
Map JJ <Esc>
IMAP JJ <Esc>

Autocmd bufenter * CD%:p: H "Automatically migrate the Vim working directory to the directory of the Open text file
Map tt:tabnew<cr> "TT new label;
Map tn:tabn<cr>
Map tp:tabp<cr>
"Map <A-Left>:tabp<cr>" toggle tab; switch with alt+←
"Map <A-Right>:tabn<cr>" toggle tab; switch with alt+→
"Map <Tab>:tabn<cr>" tab Switch tab

Map cc:tabc<cr> "Press CC to close current tab"
Map <S-C>:tabc<cr> "Press Shift+c to close current tab
Map to:tabo<cr> "Close other labels

Set showtabline=1 "Settings tab bar display, 0 never show 12 more display 2 always show
Map Ft:set ft=html<cr>

Nmap <S-L> DD "Improve performance of deleting rows with the DD command
Nmap kil:g/^\s*$/d<cr>

The tab bar removes the path information for the currently edited file, leaving only the file name
function Shorttablabel ()
Let bufnrlist = Tabpagebuflist (v:lnum)
Let label = Bufname (Bufnrlist[tabpagewinnr (V:lnum)-1])
let filename = fnamemodify (label, ': T ')
return filename
Endfunction
Set Guitablabel=%{shorttablabel ()}

""""""""""""""""""""
"" "" "Plug-in Class" "" "" "" ""
""""""""""""""""""""

"# # #MRU ###
Nmap mr:mru<cr> "Open recently opened file

"# # #NERDTree ###

Let Nerdtreewinpos = ' left ' sets the window of the nerdtree to the left-hand side of the Gvim window
Let Nerdtreeshowbookmarks=1 automatically displays the bookmarks when the Nerdtree window is open
"Let Nerdtreeminimalui=1" does not show help panel
Let nerdtreechdirmode=2 "Select root to set as current directory
Let nerdtreecasesensitivesort=0 sort without case
Let nerdtreequitonopen=0 closes the Nerdtrre window after opening the file
Let nerdtreehighlightcursorline=1 "highlight Nerdtrre window when the forward
Let nerdtreeignore=[' \.zip$ ', ' \~$ ', ' \.png$ ', ' \.gif$ ', ' \.jpg$ ', ' \.bak$ ', ' \.html$ ', ' \.rar$ ', ' \.swp$ '] ' do not display the specified Type of File
"Let nerdtreeignore + = [' (\.txt\) \@<!$[[file]]" shows TXT file only
Map ':nerdtreetoggle<cr>
Map ne:nerdtreetoggle<cr>
"" Open a nerdtree automatically when Vim starts up
"Autocmd Vimenter * nerdtree
"" Open a nerdtree automatically when Vim starts up if no files were specified
"Autocmd Vimenter * if!ARGC () | Nerdtree | endif
"Close vim if the only window left open is a nerdtree
Autocmd Bufenter * if (WINNR ("$") = = 1 && exists ("B:nerdtreetype") && B:nerdtreetype = "PRIMARY") | Q | endif

"# # #session ###
Let G:session_autosave = ' yes '
Let g:session_autoload = ' yes '

"# # #WinResizer ###
"Let g:winresizer_enable = 0
Map <S-E>:winresizerstartresize<cr>
Map rs:winresizerstartresize<cr>

"Custom zencoding, replacing ctrl+y+ expansion expressions with Ctrl+e
Let G:user_emmet_install_global = 0
Autocmd FileType html,css Emmetinstall
Let G:user_emmet_expandabbr_key = ' <c-e> '
Let g:user_zen_settings = {
\ ' php ': {
\ ' extends ': ' HTML ',
\ ' Filters ': ' C ',
\ },
\ ' xml ': {
\ ' extends ': ' HTML ',
\ },
\ ' html ': {
\ ' extends ': ' HTML ',
\ },
\}
Let G:use_zen_complete_tag = 1

Map <C-S-R>:fuffilerecursive<cr>

"# # #auto_save
Let G:auto_save = 0 "Enable AutoSave on Vim startup
"Let G:auto_save_no_updatetime = 1" Don't change the ' updatetime ' option

"Jsbeautify
Map:call jsbeautify ()
"Or
Autocmd FileType JavaScript noremap:call jsbeautify ()
"For HTML
Autocmd FileType HTML noremap:call htmlbeautify ()
"For CSS or SCSS
Autocmd FileType CSS Noremap:call cssbeautify ()

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.