-
Notifications
You must be signed in to change notification settings - Fork 5
/
.vimrc
105 lines (86 loc) · 2.92 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
runtime! autoload/pathogen.vim
if exists('g:loaded_pathogen')
call pathogen#runtime_prepend_subdirectories(expand('~/.vimbundles'))
endif
" Load common file
" source ~/.common.vim
" Swap files ******************************************************************
set nobackup " Do not save backup after close
set writebackup " Do keep a backup while working
set backupcopy=yes " Keep original file attribs
" Directories *****************************************************************
set backupdir=~/.vim/backup " Point backups somewhere else
set directory=~/.vim/swp,. " Point swap files outside of tree
" Borrowed from http://github.com/armmer/vim_files/blob/master/.vimrc
" Tabs ************************************************************************
"set sta " a <Tab> in an indent inserts 'shiftwidth' spaces
function! Tabstyle_tabs()
" Using 4 column tabs
set softtabstop=4
set shiftwidth=4
set tabstop=4
set noexpandtab
autocmd User Rails set softtabstop=4
autocmd User Rails set shiftwidth=4
autocmd User Rails set tabstop=4
autocmd User Rails set noexpandtab
endfunction
function! Tabstyle_spaces()
" Use 2 spaces
set softtabstop=2
set shiftwidth=2
set tabstop=2
set expandtab
endfunction
call Tabstyle_spaces()
" Indenting *******************************************************************
set ai " Automatically set the indent of a new line (local to buffer)
set si " smartindent (local to buffer)
:syntax on
"Bubble single lines (kicks butt)
"http://vimcasts.org/episodes/bubbling-text/
nmap <C-S-Up> ddkP
nmap <C-S-Down> ddp
"Bubble multiple lines
vmap <C-S-Up> xkP`[V`]
vmap <C-S-Down> xp`[V`]
imap jj <Esc>
imap uu _
imap hh =>
imap aa @
map <S-Enter> O<Esc>
map <Enter> o<Esc>
" Cursor Movement *************************************************************
" Make cursor move by visual lines instead of file lines (when wrapping)
map <up> gk
map k gk
imap <up> <C-o>gk
map <down> gj
map j gj
imap <down> <C-o>gj
map E ge
" Ruby stuff ******************************************************************
compiler ruby " Enable compiler support for ruby
map <F5> :!ruby %<CR>
" validates ruby syntax while in the file
map ,val :!ruby -c %<CR>
filetype plugin indent on
" Omni Completion *************************************************************
autocmd FileType html :set omnifunc=htmlcomplete#CompleteTags
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType php set omnifunc=phpcomplete#CompletePHP
autocmd FileType c set omnifunc=ccomplete#Complete
" May require ruby compiled in
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
"Add fuzzy search to :e lookups
set wildmenu
colorscheme herald
if has('gui_running')
set guioptions-=T
set columns=120
set lines=60
set number
endif