forked from spicycode/bringing-vim-to-the-people
/
.vimrc
executable file
·149 lines (110 loc) · 4.01 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
scriptencoding utf-8
" Enable filetype-specific indenting and plugins
filetype plugin indent on
" Explicitly set 256 color support
set t_Co=256
" Change <Leader>
let mapleader = ","
" Set temporary directory (don't litter local dir with swp/tmp files)
set directory=/tmp/
" Syntax Highlighting on
set nocompatible
syntax on
" Highlight matching parens
set showmatch
"set completeopt=menu,preview
" Use the tab complete menu
set wildmenu
set wildmode=list:longest,full
" have the mouse enabled all the time:
set mouse=a
" * Text Formatting -- General
" don't make it look like there are line breaks where there aren't:
set nowrap
" use indents of 2 spaces, and have them copied down lines:
set expandtab
set tabstop=2
set softtabstop=2
set shiftwidth=2
set autoindent
" Set to auto read when a file is changed from the outside
set autoread
" enable line numbers
set number
set numberwidth=3
"folding settings
set nofoldenable
set foldmethod=syntax
set foldlevel=1
set foldnestmax=10
" * File Browsing
" Settings for explorer.vim
let g:explHideFiles='^\.'
" Enable the tab bar
set showtabline=1 " 1=only if there are at least two tabs, 2=always
" Make backspace work in insert mode
set backspace=indent,eol,start
" Remember last position in file
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal g'\"" | endif
" Tab navigation
nmap <leader>tn :tabnext<CR>
nmap <leader>tp :tabprevious<CR>
nmap <leader>te :tabedit
" Remap F1 from Help to ESC. No more accidents
nmap <F1> <Esc>
map! <F1> <Esc>
set splitbelow " Open new horizontal split windows below current
set splitright " Open new vertical split windows to the right
" Add RebuildTagsFile function/command
function! s:RebuildTagsFile()
!ctags -R --exclude=coverage --exclude=files --exclude=public --exclude=log --exclude=tmp --exclude=vendor *
endfunction
command! -nargs=0 RebuildTagsFile call s:RebuildTagsFile()
" Run file with...
nmap <leader>st :Shell ruby %<CR>
" Quick, jump out of insert mode while no one is looking
imap ii <Esc>
" Title: no title for me
set notitle
" IRB
autocmd FileType irb inoremap <buffer> <silent> <CR> <Esc>:<C-u>ruby v=VIM::Buffer.current;v.append(v.line_number, eval(v[v.line_number]).inspect)<CR>
nnoremap <leader>irb :<C-u>below new<CR>:setfiletype irb<CR>:set syntax=ruby<CR>:set buftype=nofile<CR>:set bufhidden=delete<CR>i
" Turn on language specific omnifuncs
autocmd FileType ruby set omnifunc=rubycomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType c set omnifunc=ccomplete#Complete
autocmd FileType vim set omnifunc=syntaxcomplete#Complete
" have some fun with bufexplorer
let g:bufExplorerDefaultHelp=0 " Do not show default help.
let g:bufExplorerShowRelativePath=1 " Show relative paths.
" Set keyword prog for ruby
set keywordprg=ri
" search next/previous -- center in page
nmap n nzz
nmap N Nzz
nmap * *Nzz
nmap # #nzz
" Yank from the cursor to the end of the line, to be consistent with C and D.
nnoremap Y y$
" Hide search highlighting
map <silent> <leader>nh :nohls <CR>
" toggle Quickfix window with <leader>q
map <silent> <leader>q :QFix<CR>
" Mappings for align
vmap <silent> <Leader>i= <ESC>:AlignPush<CR>:AlignCtrl lp1P1<CR>:'<,'>Align =<CR>:AlignPop<CR>
vmap <silent> <Leader>i, <ESC>:AlignPush<CR>:AlignCtrl lp0P1<CR>:'<,'>Align ,<CR>:AlignPop<CR>
vmap <silent> <Leader>i( <ESC>:AlignPush<CR>:AlignCtrl lp0P0<CR>:'<,'>Align (<CR>:AlignPop<CR>
" Remap common rubytest keybindings
map <Leader>rt <Plug>RubyTestRun
map <Leader>rf <Plug>RubyFileRun
set term=xterm
colorscheme spicycode
runtime! statusbar.vim
runtime! clojure_config.vim
runtime! nerdtree_config.vim
runtime! nerdcommenter_config.vim
runtime! fuzzy_finder_config.vim
runtime! search_config.vim
runtime! shell.vim