-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
120 lines (101 loc) · 4.66 KB
/
vimrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
"
" This vim config file was originally found on that Stack Overflow thread from
" 2009 that everyone know about. Customizations are ever-changing.
" Will Chatham. @willc
" www.willchatham.com
"
" 06.19.20 - Needs to be tested for coolness, as it has been a while.
"
" reset to vim-defaults
if &compatible " only if not set before:
set nocompatible " use vim-defaults instead of vi-defaults (easier, more user friendly)
endif
" display settings
set background=dark " enable for dark terminals
set nowrap " dont wrap lines
set scrolloff=2 " 2 lines above/below cursor when scrolling
set number " show line numbers
set showmatch " show matching bracket (briefly jump)
set showmode " show mode in status bar (insert/replace/...)
set showcmd " show typed command in status bar
set ruler " show cursor position in status bar
set title " show file in titlebar
set wildmenu " completion with menu
set wildignore=*.o,*.obj,*.bak,*.exe,*.py[co],*.swp,*~,*.pyc,.svn
set laststatus=2 " use 2 lines for the status bar
set matchtime=2 " show matching bracket for 0.2 seconds
set matchpairs+=<:> " specially for html
" editor settings
set esckeys " map missed escape sequences (enables keypad keys)
set ignorecase " case insensitive searching
set smartcase " but become case sensitive if you type uppercase characters
set smartindent " smart auto indenting
set smarttab " smart tab handling for indenting
set magic " change the way backslashes are used in search patterns
set bs=indent,eol,start " Allow backspacing over everything in insert mode
set tabstop=4 " number of spaces a tab counts for
set shiftwidth=4 " spaces for autoindents
"set expandtab " turn a tabs into spaces
set fileformat=unix " file mode is unix
"set fileformats=unix,dos " only detect unix file format, displays that ^M with dos files
" system settings
set lazyredraw " no redraws in macros
set confirm " get a dialog when :q, :w, or :wq fails
set nobackup " no backup~ files.
set viminfo='20,\"500 " remember copy registers after quitting in the .viminfo file -- 20 jump links, regs up to 500 lines'
set hidden " remember undo after quitting
set history=50 " keep 50 lines of command history
set mouse=v " use mouse in visual mode (not normal,insert,command,help mode
" color settings (if terminal/gui supports it)
if &t_Co > 2 || has("gui_running")
syntax on " enable colors
set hlsearch " highlight search (very useful!)
set incsearch " search incremently (search while typing)
endif
" paste mode toggle (needed when using autoindent/smartindent)
map <F10> :set paste<CR>
map <F11> :set nopaste<CR>
imap <F10> <C-O>:set paste<CR>
imap <F11> <nop>
set pastetoggle=<F11>
" Use of the filetype plugins, auto completion and indentation support
filetype plugin indent on
" file type specific settings
if has("autocmd")
" For debugging
"set verbose=9
" if bash is sh.
let bash_is_sh=1
" change to directory of current file automatically
autocmd BufEnter * lcd %:p:h
" Put these in an autocmd group, so that we can delete them easily.
augroup mysettings
au FileType xslt,xml,css,html,xhtml,javascript,sh,config,c,cpp,docbook set smartindent shiftwidth=2 softtabstop=2 expandtab
au FileType tex set wrap shiftwidth=2 softtabstop=2 expandtab
" Confirm to PEP8
au FileType python set tabstop=4 softtabstop=4 expandtab shiftwidth=4 cinwords=if,elif,else,for,while,try,except,finally,def,class
augroup END
augroup perl
" reset (disable previous 'augroup perl' settings)
au!
au BufReadPre,BufNewFile
\ *.pl,*.pm
\ set formatoptions=croq smartindent shiftwidth=2 softtabstop=2 cindent cinkeys='0{,0},!^F,o,O,e' " tags=./tags,tags,~/devel/tags,~/devel/C
" formatoption:
" t - wrap text using textwidth
" c - wrap comments using textwidth (and auto insert comment leader)
" r - auto insert comment leader when pressing <return> in insert mode
" o - auto insert comment leader when pressing 'o' or 'O'.
" q - allow formatting of comments with "gq"
" a - auto formatting for paragraphs
" n - auto wrap numbered lists
"
augroup END
" 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")