forked from ehrenmurdick/config
-
Notifications
You must be signed in to change notification settings - Fork 2
/
vimrc
executable file
·174 lines (129 loc) · 4.25 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
scriptencoding utf-8
" MAKE ARROW KEYS WORK IN CONSOLE VI
set term=xterm
" Set temporary directory (don't litter local dir with swp/tmp files)
set directory=/tmp/
" Color themes
colors twilight2
" These two enable syntax highlighting
set nocompatible
syntax on
" have one hundred lines of command-line (etc) history:
set history=100
" Show us the command we're typing
set showcmd
" Highlight matching parens
set showmatch
set completeopt=menu,preview
" Use the cool 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 smartindent
""Set to auto read when a file is changed from the outside
set autoread
" * Search & Replace
" show the `best match so far' as search strings are typed:
set incsearch
" searching is case insensitive when all lowercase
set ignorecase
set smartcase
" assume the /g flag on :s substitutions to replace all matches in a line:
set gdefault
" enable line numbers
set number
" If possible, try to use a narrow line number column.
if v:version >= 700
try
setlocal numberwidth=3
catch
endtry
endif
" FILE BROWSING
" Settings for explorer.vim
let g:explHideFiles='^\.'
" Settings fo rnetrw
let g:netrw_list_hide='^\.,\~$'
" TAB COMPLETION FOR AUTO COMPLETE
if has("eval")
function! CleverTab()
if strpart(getline('.'), 0, col('.') - 1) =~ '^\s*$'
return "\<Tab>"
else
return "\<C-N>"
endif
endfun
inoremap <Tab> <C-R>=CleverTab()<CR>
inoremap <S-Tab> <C-P>
endif
" ENABLE THE TAB BAR
set tabline=%!MyTabLine()
set showtabline=2 " 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
" MAKE IT EASY TO UPDATE/RELOAD_vimrc
:nmap ,s :source ~/.vimrc<cr>
:nmap ,v :tabe ~/.vimrc<cr>
" RSPEC
:nmap ,sh :! script/spec spec/helpers<cr>
:nmap ,sm :! script/spec spec/models<cr>
:nmap ,sv :! script/spec spec/views<cr>
:nmap ,sc :! script/spec spec/controllers<cr>
:nmap ,sf :! script/spec %<cr>
:nmap ,c :! rake cruise<cr>
" exiting insert mode with command-i
:imap <D-i> <esc>
" easy wrap toggling
:map <D-r> :set wrap<cr>
:map <D-R> :set nowrap<cr>
" typing pound pound will print out the string interpolation characters and move the cusor in the middle
imap ## #{}<Left>
" typing percent percent will print out the erb output characters and move the cusor after the equals sign
imap %% <%=%><Left><Left>
" make current word a symbol by prepending it with :
map :: bi:<Esc>
" enclose curent word within double quotes
map "" bi"<Esc>ea"<Esc>
" enclose curent word within single quotes
map '' bi'<Esc>ea'<Esc>
" convert curent singly or double quoted word into to a symbol
map ": bhr:elx
map ': bhr:elx
" convert curent word as symbol into a double quoted string
map :" F:r"ea"<Esc>
" convert curent word as symbol into a single quoted string
map :' F:r'ea'<Esc>
" delete all buffers
map :bda :1,9999bd
""Nice statusbar
set laststatus=2
set statusline=\ "
set statusline+=%f\ " file name
set statusline+=[
set statusline+=%{strlen(&ft)?&ft:'none'}, " filetype
set statusline+=%{&fileformat}] " file format
set statusline+=%h%1*%m%r%w%0* " flag
set statusline+=%= " right align
set statusline+=%-14.(%l,%c%V%)\ %<%P " offset
" title: update the title of the window?
set title
" titlestring: what will actually be displayed
set titlestring=VIM:\ %-25.55F\ %a%r%m titlelen=70
" Turn off rails bits of statusbar
let g:rails_statusline=0
" fuzzyfindertextmate: cmd-e to trigger, cmd-enter to open selected file in new tab
let g:FuzzyFinderOptions = { 'Base':{}, 'Buffer':{}, 'File':{}, 'Dir':{}, 'MruFile':{}, 'MruCmd':{}, 'FavFile':{}, 'Tag':{}, 'TaggedFile':{}}
let g:FuzzyFinderOptions.Base.key_open_tab = '<D-CR>'
map <D-e> :FuzzyFinderTextMate<CR>