-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
89 lines (78 loc) · 3.64 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
"-------------------------------------------------------
" My ViM Run Commands (vimrc)
" Sankalp Khare
" Wed 20 Apr 2011 04:28:05 PM IST
" IIIT, Hyderabad
"-------------------------------------------------------
set nocompatible " don't use vi compatibility; I want all the new features in Vim
set nu " enable numbering
set autoindent " when opening a new line and no filetype-specific indenting is enabled, keep the same indent as the line you're currently on.
set cindent " automatic indentation for C code
set smartindent " some more indenting smartness
set incsearch " search next match as you type; incremental (emacs-style) search
set laststatus=2 " status line always displayed
set ignorecase " case insensitive searching
set smartcase " with 'ignorecase'on, if pattern contains an uppercase letter, search case sensitive, otherwise not.
set scrolloff=2 " have at least two lines of context visible around the cursor
set confirm " instead of failing commands because of changes in file, ask whether to save
set wildmode=longest,list " changed filename completion behaviour (complete till lc-substring, then list)
set showcmd " Show current vim command in status bar
set hlsearch " Highlight all matched regions
"-------------------------------------------------------
" tab space value and indent shiftwidth for some filetypes
autocmd FileType python set tabstop=4 | set shiftwidth=4
autocmd FileType ruby set tabstop=4 | set shiftwidth=4
autocmd FileType php set tabstop=2 | set shiftwidth=2
autocmd FileType html set tabstop=2 | set shiftwidth=2
autocmd FileType xhtml set tabstop=2 | set shiftwidth=2
autocmd FileType c set tabstop=4 | set shiftwidth=4
autocmd FileType cpp set tabstop=4 | set shiftwidth=4
"-------------------------------------------------------
"-------------------------------------------------------
" Some things to do, only if vim version is 600 or greater
if version >= 600
syntax enable " enable syntax highlighting, but keep current colour settings
filetype on
filetype plugin on
filetype indent on
else
syntax on " enable syntax highlighting, overriding current colour settings with defaults
endif
"-------------------------------------------------------
"-------------------------------------------------------
" allows typing :tabv myfile.txt to open the specified
" file in a new read-only tab
cabbrev tabv tab sview +setlocal\ nomodifiable
"-------------------------------------------------------
"-------------------------------------------------------
" press F5 to insert the current timestamp
:nnoremap <F5> "=strftime("%c")<CR>P
:inoremap <F5> <C-R>=strftime("%c")<CR>
"-------------------------------------------------------
"-------------------------------------------------------
" press Ctrl-Left or Ctrl-Right to go to the previous or next tabs
" press Alt-Left or Alt-Right to move the current tab to the left or right
nnoremap <C-Left> :tabprevious<CR>
nnoremap <C-Right> :tabnext<CR>
nnoremap <silent> <A-Left> :execute 'silent! tabmove ' . (tabpagenr()-2)<CR>
nnoremap <silent> <A-Right> :execute 'silent! tabmove ' . tabpagenr()<CR>
"-------------------------------------------------------
" Recognize .rkt files as scheme source
if version >= 600
au BufNewFile,BufRead *.rkt set filetype=scheme
endif
" Color theming
":colo wombat
"-------------------------------------------------------
" Yash's pro-coder additions
set makeprg=g++\ %\ -Wall
map <F3> :w <CR> :make<CR> <CR>
map <F2> :cn<CR>
"-------------------------------------------------------
if has("unix")
let s:uname = system("uname -s")
if s:uname == "Darwin"
" Do Mac stuff here
set backspace=indent,eol,start
endif
endif