My Vim configurations

Source: Internet
Author: User

It is for your reference only. If you have any mistakes, please correct them.

"All system-wide defaults are set in $ vimruntime/Debian. Vim (usually just

"/Usr/share/Vim/vimcurrent/Debian. Vim) and sourced by the call to: Runtime
"You can find below. If you wish to change any of those settings, you showould
"Do it in this file (/etc/Vim/vimrc), since Debian. Vim will be overwritten
"Everytime an upgrade of the vim packages is saved med. It is recommended
"Make changes after sourcing Debian. Vim since it alters the value of
"'Compute' option.

"This line shoshould not be removed as it ensures that varous options are
"Properly set to work with the vim-related packages available In Debian.
Runtime! Debian. Vim

"Uncomment the next line to make Vim more vi-compatible
"NOTE: Debian. Vim sets 'nocomputed'. Setting 'computed' changes numerous
"Options, so any other options shoshould be set after setting 'compute '.
"Set compatible

"Vim5 and later versions support syntax highlighting. uncommenting the next
"Line enables syntax highlighting by default.
If has ("Syntax ")
Syntax on
Endif

"If using a dark background within the editing area and syntax highlighting
"Turn on this option as well
"Set background = dark

"Uncomment the following to have Vim jump to the last position when
"Reopening a file
"If has (" autocmd ")
"Au bufreadpost * If line (" '\ "")> 1 & line ("' \" ") <= line (" $ ") | EXE" normal! G' \ "" | endif
"Endif

"Uncomment the following to have Vim load indentation rules and plugins
"According to the detected filetype.
"If has (" autocmd ")
"Filetype plugin indent on
"Endif

"The following are commented out as they cause Vim to behave a lot
"Differently from regular VI. They are highly recommended though.
"Set showcmd" show (partial) command in status line.
"Set showmatch" show matching brackets.
"Set ignorecase" Do case insensitive matching
"Set smartcase" do smart case matching
"Set incsearch" incremental search
"Set autowrite" automatically save before commands like: Next and: Make
"Set hidden" Hide buffers when they are abandoned
"Format settings
Set autoindent "auto indent

Set smartindent "smart indent

Set cindent "C indent

Set tabstop = 4 "Hard Tab

Set softtabstop = 4 "soft Tab

Set shiftwidth = 4 FO + = mm "Number of indented Spaces

Set expandtab "Space replacement Tab

"Set smarttab" smart Tab

"

Set showmatch "show matching
"==================================

Set mouse = A "enable mouse usage (all modes)
Map TL: tlist
Set tags = tags;
Set textwidth = 78 "set the length of each line to a maximum of 78 characters
Set autochdir
Set nu
Set Ai!
Let tlist_show_one_file = 1 "displays the tags of multiple files at the same time, only the tags of the current file
Let tlist_exit_onlywindow = 1
Set cscopetag

"""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""
"Cs1_settings For Vim
"""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""
"
"This file contains some boilerplate settings For Vim's cs1_interface,
"Plus some keyboard mappings that I 've found useful.
"
"Usage:
"-- Vim 6: Stick this file in your ~ /. Vim/plugin directory (or in
"'Plugin' directory in some other directory that is in your
"'Runtimepath '.
"
"-- Vim 5: Stick this file somewhere and 'source cscope. Vim 'it from
"Your ~ /. Vimrc file (or cut and paste it into your. vimrc ).
"
"NOTE:
"These key maps use multiple keystrokes (2 or 3 keys). If you find that Vim
"Keeps timing you out before you can complete them, try changing your timeout
"Settings, as explained below.
"
"Happy cscoping,
"
"Jason duell jduell@alumni.princeton.edu 2002/3/7
"""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""""""""""""""""""""""

"This tests to see if Vim was configured with the '-- enable-cs;' Option
"When it was compiled. If it wasn' t, time to recompile Vim...
If has ("CSAs ")

"Standard cs.pdf/Vim boilerplate

"Use both cscope and CTAG for 'ctrl-] ',': Ta', and 'vim-t'
Set cscopetag

"Check cstion for definition of a symbol before checking ctags: set to 1
"If you want the reverse search order.
Set CSTO = 0

"Add any cs1_database in current directory
If filereadable ("cscope. Out ")
CS add cscope. Out
"Else Add the database pointed to by Environment Variable
Elseif $ cscope_db! = ""
CS add $ cscope_db
Endif

"Show MSG when any other cs1_db added
Set cscopeverbose

"My csings/Vim key Mappings
"
"The following maps all invoke one of the following cscope search types:
"
"'S 'symbol: Find all references to the token under cursor
"'G' Global: Find global definition (s) of the token under cursor
"'C' CILS: Find all CILS to the function name under cursor
"'T'text: Find all instances of the text under cursor
"'E' egrep: egrep search for the word under cursor
"'F' file: Open the filename under cursor
"'I'm Using DES: Find Files that include the filename under cursor
"'D 'called: Find functions that function under cursor CILS
"
"Below are three sets of the maps: One set that just jumps to your
"Search result, one that splits the existing Vim window horizontally and
"Diplays your search result in the new window, and one that does the same
"Thing, but does a Vertical Split instead (Vim 6 only ).
"
"I 've used Ctrl-\ and Ctrl-@ as the starting keys for these maps, as it's
"Unlikely that you need their default mappings (CTRL-\'s default use is
"As part of Ctrl-\ CTRL-N typemap, which basically just does the same
"Thing as hitting 'escape ': Ctrl-@ doesn' t seem to have any default use ).
"If you don't like using 'ctrl-@ 'or Ctrl-\, you can change some or all
"Of these maps to use other keys. One likely candidate is 'ctrl -_'
"(Which also maps to Ctrl-/, which is easier to type). By default it is
"Used to switch between Hebrew and English keyboard mode.
"
"All of the maps involving the <cfile> macro use '^ <cfile> $': This is so
"That searches over '# include <time. h>" return only references
"'Time. H', and not 'sys/time. H', etc. (By default cs1_will return all
"Files that contain 'time. H' as part of their name ).

"To do the first type of search, hit 'ctrl-\ ', followed by one of
"Csshortsearch types above (S, G, C, T, E, F, I, D). The result of your cs.pdf
"Search will be displayed in the current window. You can use CTRL-T
"Go back to where you were before the search.
"

NMAP <c-\> S: CS find S <C-R> = expand ("<cword>") <CR>
NMAP <c-\> G: CS find G <C-R> = expand ("<cword>") <CR>
NMAP <c-\> C: CS find C <C-R> = expand ("<cword>") <CR>
NMAP <c-\> T: CS find t <C-R> = expand ("<cword>") <CR>
NMAP <c-\> E: CS find e <C-R> = expand ("<cword>") <CR>
NMAP <c-\> F: CS find F <C-R> = expand ("<cfile>") <CR>
NMAP <c-\> I: CS find I ^ <C-R >=expand ("<cfile>") <CR >$ <CR>
NMAP <c-\> D: CS find d <C-R> = expand ("<cword>") <CR>

"Using 'ctrl-spacebar '(intepreted As ctrl-@ by VIM) then a search type
"Makes the vim window split horizontally, with search result displayed in
"The new window.
"
"(Note: earlier versions of VIM may not have the: SCS command, but it
"Can be simulated roughly:
"NMAP <c-@> S <C-W> <C-S>: CS find S <C-R> = expand (" <cword> ") <CR>

NMAP <c-@> S: SCS find S <C-R> = expand ("<cword>") <CR>
NMAP <c-@> G: SCS find G <C-R> = expand ("<cword>") <CR>
NMAP <c-@> C: SCS find C <C-R> = expand ("<cword>") <CR>
NMAP <c-@> T: SCS find t <C-R> = expand ("<cword>") <CR>
NMAP <c-@> E: SCS find e <C-R> = expand ("<cword>") <CR>
NMAP <c-@> F: SCS find F <C-R> = expand ("<cfile>") <CR>
NMAP <c-@> I: SCS find I ^ <C-R >=expand ("<cfile>") <CR >$ <CR>
NMAP <c-@> D: SCS find d <C-R> = expand ("<cword>") <CR>

"Hitting Ctrl-space * twice * Before the search type does a vertical
"Split instead of a horizontal one (Vim 6 and up only)
"
"(Note: You may wish to put a 'set splitright' in your. vimrc
"If you prefer the new window on the right instead of the left

NMAP <c-@> S: vert SCS find S <C-R> = expand ("<cword>") <CR>
NMAP <c-@> G: vert SCS find G <C-R> = expand ("<cword>") <CR>
NMAP <c-@> C: vert SCS find C <C-R> = expand ("<cword>") <CR>
NMAP <c-@> T: vert SCS find t <C-R> = expand ("<cword>") <CR>
NMAP <c-@> E: vert SCS find e <C-R> = expand ("<cword>") <CR>
NMAP <c-@> F: vert SCS find F <C-R> = expand ("<cfile>") <CR>
NMAP <c-@> I: vert SCS find I ^ <C-R >=expand ("<cfile>") <CR >$ <CR>
NMAP <c-@> D: vert SCS find d <C-R> = expand ("<cword>") <CR>

"Key Map timeouts
"
"By default Vim will only wait 1 second for each keystroke in a mapping.
"You may find that too short with the above typemaps. If so, You shoshould
"Either turn off mapping timeouts via 'notimeout '.
"
"Set notimeout
"
"Or, you can keep timeouts, by uncommenting the timeoutlen line below,
"With your own personal favorite value (in milliseconds ):
"
"Set timeoutlen = 4000
"
"Either way, since mapping timeout settings by default also set
"Timeouts for multicharacter 'keys Code' (like <F1>), You shoshould also
"Set ttimeout and ttimeoutlen: otherwise, you will experience strange
"Delays as Vim waits for a keystroke after you hit ESC (it will be
"Waiting to see if the ESC is actually part of a key code like <F1> ).
"
"Set ttimeout
"
"Personally, I find a tenth of a second to work well for key code
"Timeouts. If you experience problems and have a slow terminal or network
"Connection, set it higher. If you don't set ttimeoutlen, the value
"Timeoutlent (default: 1000 = 1 second, which is sluggish) is used.
"
"Set ttimeoutlen = 100

Endif

"Source a global configuration file if available
If filereadable ("/etc/Vim/vimrc. Local ")
Source/etc/Vim/vimrc. Local
Endif

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.