. vimrc file

Source: Internet
Author: User
Tags define function set background

Map <F9>: Call Saveinputdata () <CR>

func! Saveinputdata ()

Exec "Tabnew"

exec ' normal ' +GP '

Exec "w! /tmp/input_data "

Endfunc


"ColorScheme Torte

"ColorScheme Murphy

"ColorScheme Desert

"ColorScheme Desert

"ColorScheme Elflord

ColorScheme Ron


The Set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936

The Set Termencoding=utf-8

The Set Encoding=utf-8

The Set fileencodings=ucs-bom,utf-8,cp936

The Set Fileencoding=utf-8


""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

The show related

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

"Set Shortmess=ati" does not display the reminder to help Ugandan children when it starts

"Winpos 5 5" Setting window position

"Set lines=40 columns=155" setting window size

Set go= "Do not graph button

"Color asmanian2" setting background theme

Set Guifont=courier_new:h10:cansi font

"Syntax on" syntax highlighting

Autocmd insertleave * se nocul "highlight when moving forward with light

Autocmd insertenter * se cul "highlight when moving forward with light

"Set ruler" display ruler

Set showcmd "Input command displayed, see clearly

The height of the "set cmdheight=1" command line (under the status line), set to 1

"Set Whichwrap+=<,>,h,l" allows backspace and cursor keys to span line boundaries (not recommended)

The "set scrolloff=3" cursor moves to the top and bottom of buffer to maintain 3 lines of distance

Set Novisualbell "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\")} " What the status line displays

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 "Remove nasty about VI consistency mode, avoid some bugs and limitations of previous versions

The show Chinese help

If version >= 603

Set HELPLANG=CN

Set Encoding=utf-8

endif

The Set color scheme

"ColorScheme Murphy

The font

"If (Has (" gui_running "))

"Set guifont=bitstream\ vera\ sans\ mono\ 10

"EndIf

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

"" "" "New file title

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

"Create a new. c,.h,.sh,.java file, insert the file header automatically

Autocmd bufnewfile *.cpp,*. [Ch],*.sh,*.java exec]: Call Settitle () "

"" Define function Settitle, insert file header automatically

Func Settitle ()

"If the file type is. sh file

if &filetype = = ' sh '

Call Setline (1, "\############################################################")

Call Append ("."), "\# File Name:". Expand ("%"))

Call Append (".") +1, "\# Author: Follow Caterpillar")

Call Append (".") +2, "\# Mail: [email protected]")

Call Append (".") +3, "\# System Time:". Strftime ("%c"))

Call Append (".") +4, "\############################################################")

Call Append (".") +5, "\#!/bin/bash")

Call Append (".") +6, "")

Else

Call Append (".") +4, "************************************************************************/")

Call Append (".") +5, "")

endif

if &filetype = = ' cpp '

Call Append (".") +6, "#include <iostream>")

Call Append (".") +7, "using namespace std;")

Call Append (".") +8, "")

endif

if &filetype = = ' C '

Call Append (".") +6, "#include <stdio.h>")

Call Append (".") +7, "")

endif

"if &filetype = = ' java '

"call Append (". ") +6, "public class". Expand ("%"))

"call Append (". ") +7, "")

"endif

"Automatically navigates to the end of a file after you create a new file

Autocmd Bufnewfile * Normal G

Endfunc

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

The keyboard command

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""


Nmap <leader>w:w!<cr>

Nmap <leader>f:find<cr>


"Map Select all + Copy Ctrl + A

Map <C-A> Ggvgy

map! <C-A> <esc>ggvgy

Map <F12> gg=g

"CTRL + C copy in selected state

Vmap <C-c> "+y

"Go empty line

Nnoremap <F2>:g/^\s*$/d<cr>

The Compare files

Nnoremap <C-F2>: Vert diffsplit

The new label

Map <M-F2>:tabnew<cr>

"Lists the current directory files

Map <F3>: Tabnew .<cr>

"Open the tree-like file directory

Map <C-F3> \be

"C,c++ Press F5 to compile and run

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

func! 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%<"

endif

Endfunc

"Commissioning of the C,c++

Map <F8>: Call Rungdb () <CR>

func! Rungdb ()

Exec "W"

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

Exec "!gdb ./%<"

Endfunc




""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

"" Utility settings

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

"Set to automatically load when files are changed

Set Autoread

"Quickfix mode

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

The Code completion

Set Completeopt=preview,menu

The Allow plugins

FileType plugin on

The Share clipboard

Set clipboard+=unnamed

"Never Back Up

Set Nobackup

The Make Run

: Set makeprg=g++\-wall\ \%

The Auto Save

Set Autowrite

Set ruler "Open the status bar ruler

Set Cursorline "highlight when moving forward

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%) \

"Sets the information displayed in the status line

Set foldcolumn=0

Set Foldmethod=indent

Set foldlevel=3

Set foldenable "Start folding

"Don't use VI's keyboard mode, but Vim's own

Set nocompatible

The syntax highlighting

Set Syntax=on

"Remove the sound of input errors

Set Noeb

"When working with unsaved or read-only files, pop-up confirmation

Set confirm

The Auto Indent

Set Autoindent

Set Cindent

The width of the TAB key

Set tabstop=4

"Unified Indentation is 4

Set softtabstop=4

Set shiftwidth=4

"Do not use spaces instead of tabs

Set Noexpandtab

Use tabs at the beginning of rows and segments

Set Smarttab

The Display line number

Set number

"Number of historical records

Set history=1000

"Prohibit generation of temporary files

Set Nobackup

Set Noswapfile

"Search ignores case

Set ignorecase

"Search for verbatim Fugauliang

Set Hlsearch

Set Incsearch

"In-line substitution

Set Gdefault

The Encoding settings

Set Enc=utf-8

Set fencs=utf-8,ucs-bom,shift-jis,gb18030,gbk,gb2312,cp936

The Language settings

Set LANGMENU=ZH_CN. UTF-8

Set HELPLANG=CN

"My status line displays the contents (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 status lines

Set laststatus=2

The height of the command line (under the status line), which defaults to 1, here is 2

Set cmdheight=2

"Detect file Types

FileType on

"Load file type plug-in

FileType plugin on

"Loading related indentation files for a specific file type

FileType indent on

"Save Global variables

Set viminfo+=!

"Words with the following symbols are not separated by line breaks

Set iskeyword+=_,$,@,%,#,-

The number of pixel lines inserted by the word putting

Set linespace=0

"Command-line auto-complete operation in enhanced mode

Set Wildmenu

"Make the Back bar (BACKSPACE) normal handling indent, EOL, start, etc.

Set backspace=2

"Allow backspace and cursor keys to span line boundaries

Set Whichwrap+=<,>,h,l

"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

"By using: Commands command, tell us which line of the file has been changed

Set report=0

"Display whitespace between split windows for easy reading

Set Fillchars=vert:\, Stl:\, Stlnc:\

"Highlight matching parentheses

Set Showmatch

"Matches the time of the parentheses highlighting (in a very second)

Set matchtime=1

"Keep 3 lines away when the cursor moves to the top and bottom of the buffer

Set scrolloff=3

"Provides automatic indentation for C programs

Set Smartindent

"Highlight normal TXT file (requires Txt.vim script)

Au bufread,bufnewfile * Setfiletype txt

"Auto-complete

: Inoremap (() <esc>i

: Inoremap) <c-r>=closepair (') ') <CR>

": inoremap {{<cr>}<esc>o

": Inoremap} <c-r>=closepair ('} ') <CR>

: Inoremap [[]<esc>i

: Inoremap] <c-r>=closepair ('] ') <CR>

: Inoremap "" "<esc>i

: Inoremap ' <esc>i

function! Closepair (char)

If Getline ('. ') [Col ('. ')-1] = = A:char

Return "\<right>"

Else

Return A:char

endif

Endfunction

FileType plugin indent on

"Open File type detection, add this sentence can be used to complete the smart

Set Completeopt=longest,menu

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""


"Nerdtee Settings

Let nerdchristmastree=1

Let Nerdtreeautocenter=1

Let nerdtreebookmarksfile= $VIM. ' \data\nerdbookmarks.txt '

Let nerdtreemousemode=2

Let Nerdtreeshowbookmarks=1

Let Nerdtreeshowfiles=1

Let Nerdtreeshowhidden=1

Let Nerdtreeshowlinenumbers=1

Let's nerdtreewinpos= ' left '

Let nerdtreewinsize=31

Nnoremap F:nerdtreetoggle

Map <F7>:nerdtree<cr>


. vimrc file

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.