This repository has been archived by the owner on Dec 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
149 lines (136 loc) · 4.48 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
let mapleader=","
filetype off
call pathogen#infect()
let g:ctrlp_by_filename=1
let g:ctrlp_regexp=0
let g:ctrlp_switch_buffer="E"
let g:ctrlp_clear_cache_on_exit=0
let g:ctrlp_open_new_file="t"
let g:ctrlp_open_multiple_files="tj"
let g:ctrlp_match_window_reversed=0
let g:ctrlp_prompt_mappings={ 'AcceptSelection("t")': ['<cr>'], 'AcceptSelection("e")': ['<c-t>'] }
let g:ctrlp_custom_ignore='\v(dist|build|buck-cache|buck-out)$'
let g:ctrlp_root_markers=['.buckconfig','BUCK','.git','.hg','pom.xml','TARGETS']
let g:ctrlp_max_files=0
let g:nerdtree_tabs_open_on_gui_startup=0
let g:nerdtree_tabs_focus_on_files=1
let g:nerdtree_tabs_autofind=1
let g:NERDTreeSortOrder=['*','\.swp$','\.bak$','\~$']
let g:opamshare = substitute(system('opam config var share'),'\n$','','''')
execute "set rtp+=" . g:opamshare . "/merlin/vim"
syntax on
filetype indent plugin off
set nocompatible
set tabstop=4
set softtabstop=2
set shiftwidth=2
set expandtab
set nocindent
set nosmartindent
set autoindent
set bs=indent,eol,start
set hls is ic scs
set gdefault
set ruler
set textwidth=80
set visualbell
set formatoptions=rcoq1
set equalalways
set autoread
set number
set foldmethod=indent
set foldlevelstart=99
set autochdir
set listchars=tab:→ ,nbsp:.
set path=./../**,/usr/include/**,/usr/local/include/**
set wildignore+=.*,buck-cache/*,buck-out/*
set list
set nrformats=alpha,hex
set backupcopy=auto
set comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM
autocmd FileType c,c++,cpp,objc setlocal comments-=:// comments+=:/// comments+=:// suffixesadd+=.m,.h,.c,.pch,.mm,.cc,.cpp,.hh,.hpp
autocmd FileType swift setlocal comments-=:// comments+=:/// comments+=://
autocmd FileType make setlocal noexpandtab softtabstop=4 shiftwidth=4
autocmd BufEnter *.mm let b:fswitchdst = 'hh,h,hpp' | let b:fswitchlocs='./'
autocmd BufEnter *.h let b:fswitchdst = 'c,m,mm,cc,cpp'
autocmd BufEnter *.hpp,*.hh let b:fswitchdst = 'mm,cc,cpp' | let b:fswitchlocs='./'
autocmd BufEnter BUCK setlocal filetype=python
autocmd BufEnter *.rx setlocal filetype=rust
noremap <silent> <C-o> :FSSplitRight<CR>
noremap <silent> <C-Down> <ESC><C-w>j
noremap <silent> <C-Up> <ESC><C-w>k
noremap <silent> <C-Left> <ESC><C-w>h
noremap <silent> <C-Right> <ESC><C-w>l
noremap <leader>p "*p
noremap <leader>P "*P
noremap <leader>t :NERDTreeTabsToggle<CR>
noremap y "*y
nnoremap <silent> <C-n> :noh<CR>
nnoremap ; :
nnoremap <Down> <C-w>j
nnoremap <Up> <C-w>k
nnoremap <Left> <C-w>h
nnoremap <Right> <C-w>l
nnoremap <Space> @q
nnoremap / /\v
nnoremap <tab> %
nnoremap <leader>h <C-w>s<C-w>k
nnoremap <leader>v <C-w>v<C-w>l
nnoremap <leader>= <C-W>=
nnoremap <leader>e :e
nnoremap <leader>s :%s/\v
nnoremap <leader>` :e ~/.vimrc<CR>
nnoremap <leader>_ <C-w>_
nnoremap <leader>n :noh<CR>
nnoremap <leader>H :syntax sync fromstart<CR>
nnoremap <leader>c /<<<<<<<\\|=======\\|>>>>>>><CR>
nnoremap <leader>d /deprecated<CR>
nnoremap <leader>T /fixme\\|todo<CR>
nnoremap <leader>j Jldw$
vnoremap / /\v
vnoremap <tab> %
vnoremap < <gv
vnoremap > >gv
vnoremap * y/<C-R>"<CR>
vnoremap # y?<C-R>"<CR>
vnoremap <leader>s :sort<CR>
inoremap jj <ESC>
set bg=dark
colorscheme terminal_custom
" From https://gist.github.com/yjsoon/3485271
function! SearchDash()
" Some setup
let s:browser = "/usr/bin/open"
let s:wordUnderCursor = expand("<cword>")
" Get the filetype (everything after the first ., for special cases
" such as index.html.haml or abc.css.scss.erb)
let s:fileType = substitute(expand("%"),"^[^.]*\.","",1)
" Match it and set the searchType -- make sure these are the right shortcuts
" in Dash! Sort by priority in the match list below if necessary, because
" Tilt-enabled projects may have endings like .scss.erb.
if match(s:fileType, "js") != -1
let s:searchType = "js:" " can assign this to jQuery, too
elseif match(s:fileType, "css") != -1
let s:searchType = "css:"
elseif match(s:fileType, "html") != -1
let s:searchType = "html:"
elseif match(s:fileType, "rb") != -1
let s:searchType = "rb:" " can assign this to Rails, too
elseif match(s:fileType, "php") != -1
let s:searchType = "php:"
elseif match(s:fileType, "py") != -1
let s:searchType = "python:"
elseif match(s:fileType, "hs") != -1 || match(s:fileType, "lhs") != -1
let s:searchType = "haskell:"
elseif match(s:fileType, "m") != -1 || match(s:fileType, "h") != -1
let s:searchType = "macosx:"
else
let s:searchType = ""
endif
" Run it
let s:url = "dash://".s:searchType.s:wordUnderCursor
let s:cmd ="silent ! " . s:browser . " " . s:url
execute s:cmd
redraw!
endfunction
noremap <leader>d :call SearchDash()<CR>