-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
173 lines (133 loc) · 4.03 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
set nocompatible
set modelines=0
let mapleader=","
filetype off
execute pathogen#infect()
Helptags
" syntastic sucks at haml and sass
let g:syntastic_mode_map = { 'mode': 'active',
\ 'active_filetypes': ['ruby'],
\ 'passive_filetypes': ['haml', 'sass'] }
syntax enable
filetype plugin on " figure out filetype automatically
filetype indent on " indent based on filetype
set title " sets shell title to correct thing
set hidden " does good stuff with buffers
set backupdir=/tmp
set directory=/tmp
set autoread " Autoload file change
set nobackup
set nowritebackup
set noswapfile
set term=xterm-256color " force 256 color for colorschemes
if has('gui_running')
set background=light
set fuoptions=maxvert,maxhorz " default screen size
set guioptions-=rL " turn off scrollbar
else
set go-=T " hide the toolbar by default
set background=dark
endif
colorscheme solarized
let g:airline_theme="solarized"
" keep a bit of context around current cursor position
set scrolloff=5
set scrolljump=3
set nu " show line numbers
" invisible characters
set list
if has("multi_byte_encoding")
set listchars=tab:»\ ,trail:·,extends:>,precedes:<,eol:¬
else
set listchars=tab:\|\ ,trail:.,extends:>,precedes:,eol:$<
endif
nmap ,i :set list!<CR> " Toggle invisible chars
" set default font
set gfn=Inconsolata\ 14
" ignore case in searches, except if you type a capital letter
set ignorecase
set smartcase
set nohlsearch
set incsearch
" easy to source / edit this file
map ,s :source ~/.vimrc<CR>
map ,v :tabnew ~/.vimrc<CR>
set ai
set si
set cindent
set autoindent
set smartindent
set tabstop=2 " remove tabs for 2 spaces
set softtabstop=2
set shiftwidth=2
set expandtab
set cindent
set wildmenu
set wildmode=list:longest,full " make completion better
set shortmess=atI " turn off annoying messages
set backspace=indent,eol,start "backspace over everything in insert mode
" Folding
set nofoldenable "dont fold by default
set foldmethod=indent "fold based on indent
set foldnestmax=3 "deepest fold is 3 levels
" Mouse
set mouse=a
set noea " Turn off window resizing on buffer close
set cpoptions-=J "only 1 space after sentences
" Switch between windows with <C-J> and <C-K>
map <C-J> <C-W>j<C-W>_
map <C-K> <C-W>k<C-W>_
set winminheight=0
set winheight=6
set ruler
set showmatch
set matchtime=1
set relativenumber
map <F7> mzgg=G`z<CR>
" map comments to apple/
nmap <D-/> ,c<Space>
vmap <D-/> ,c<Space>
imap <D-/> <C-O>,c<Space>
" bind command-] to shift right
nmap <D-]> >>
vmap <D-]> >>
imap <D-]> <C-O>>>
" bind command-[ to shift left
nmap <D-[> <<
vmap <D-[> <<
imap <D-[> <C-O><<
" fuzzy finder mappings
map <leader>m :FuzzyFinderFile**/<CR>
map <leader>t :FufTag!<CR>
map <leader>n :FufFile**/<CR>
map <leader>e :FufBuffer<CR>
map <LocalLeader>r :FufRenewCache<CR> " renew finder cache shortcut
" NERDTree
let NERDChristmasTree = 1 " Enable nice colors
let NERDTreeHighlightCursorline = 1 " Make it easy to see where we are
let NERDTreeShowBookmarks = 1 " Make bookmarks visible
let NERDTreeShowHidden = 1 " Show hidden files
let NERDTreeIgnore=['\.$', '\~$']
map <silent> <leader>l :NERDTreeFind<CR> " Jump to current file
nmap <F2> :NERDTreeToggle<CR> " Make F2 open NERDTree
" split editing settings
map <C-J> <C-W>j<C-W>_
map <C-K> <C-W>k<C-W>_
set wmh=0
" ack integration
set grepprg=ack\ -a
set swb=newtab " switch buffer mode opens a new tab
nnoremap <silent> <leader>T :TlistToggle<CR> " taglist shortcuts
inoremap <C-space> <C-n> " Remap autocomplete to CTRL+SPACE
" Remap alt-j alt-k to insert blank lines without going to insert mode
nnoremap <silent><D-j> :set paste<CR>m`o<Esc>``:set nopaste<CR>
nnoremap <silent><D-k> :set paste<CR>m`O<Esc>``:set nopaste<CR>
" paste toggle
set pastetoggle=<F5>
" ruby tests from drew pope
map <silent> <LocalLeader>rb :RunAllRubyTests<CR>
map <silent> <LocalLeader>rc :RunRubyFocusedContext<CR>
map <silent> <LocalLeader>rf :RunRubyFocusedUnitTest<CR>
command! -nargs=1 Gg !git grep <args> " git grep
" clear trailing whitespaces
command! Gctw :%s/\s\+$//