-
Notifications
You must be signed in to change notification settings - Fork 1
/
dot_gvimrc
executable file
·254 lines (215 loc) · 7.09 KB
/
dot_gvimrc
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
" ==== Vundle ====
set nocompatible " be iMproved, required
filetype off " required
set ttymouse=sgr
call plug#begin('~/.vim/plugged')
Plug 'ctrlpvim/ctrlp.vim'
Plug 'vim-erlang/vim-erlang-tags'
Plug 'vim-erlang/vim-erlang-runtime'
Plug 'vim-erlang/vim-erlang-compiler'
Plug 'vim-erlang/vim-erlang-omnicomplete'
Plug 'vim-erlang/vim-erlang-skeletons'
Plug 'elixir-lang/vim-elixir'
Plug 'racer-rust/vim-racer'
" Plug 'ElmCast/elm-vim'
call plug#end()
" ==== Colours ====
:set t_Co=256
:let g:solarized_termcolors=256
":colorscheme torte
:colorscheme solarized
":colorscheme desert
:set bg=light
"Disable Background Color Erase
:set t_ut=
"---- End Colours ----
:set shiftwidth=2
:set softtabstop=2
:set expandtab smarttab
:set incsearch
:set hls
"Always show the status bar
:set laststatus=2
"Do not change the end of file that shows up in git diff
set nofixendofline
" use comma as <Leader> key instead of backslash
let mapleader=","
"Copy filename to clipboard
nmap <F6> :let @*=expand("%:p")<CR>
"Change to local directory
:map <Leader>l :lcd %:p:h<CR>
" syntax enable and filetype indent on is not needed as Plug handles it
":syntax enable
"filetype plugin indent on
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
au BufRead,BufNewFile *.es set filetype=erlang
let NERDTreeIgnore=['__init__.py','.pyc$', '\~$', '\.o$']
let g:netrw_list_hide= '.*\.swp$,\.git/$,.*\.pyc'
:let html_start_line = line("'<")
:let html_end_line = line("'>")
"Ignore whitespace in vimdiff
":set diffopt+=iwhite
"To insert the elipsis, press ctrl-vu followed by the numeric code for elipsis: 2026
":set showbreak=…
:set showbreak=...
:set ruler
:set wildmenu
:set visualbell t_vb=
:set dir=~/.vimswap//,/tmp//,.
:set nrformats=hex
"Add include dir for Erlang header files, used by gf
:set path+=../include
let g:erlang_quickfix_support = 1
"let g:erlang_make_options = '--outdir /Users/andras/tmp --xref'
let g:erlang_flymake_options = '--outdir /Users/andras/tmp --xref'
"Man pages
:runtime! ftplugin/man.vim
:set mouse=a
" ==== Plugins ====
"command-t http://mislav.uniqpath.com/2011/12/vim-revisited/
" double percentage sign in command mode is expanded
" to directory of current file - http://vimcasts.org/e/14
cnoremap %% <C-R>=expand('%:h').'/'<cr>
map <leader>f :CommandTFlush<cr>\|:CommandT<cr>
map <leader>F :CommandTFlush<cr>\|:CommandT %%<cr>
nnoremap <leader><leader> <c-^>
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
let $FZF_DEFAULT_COMMAND = 'ag -g ""'
nnoremap <Leader>a :Ack!<Space>
nmap ; :Files<CR>
:imap <Tab> <C-P>
:imap <S-Tab> <Plug>snipMateNextOrTrigger
"\ 'dir': '\v(_build|node_modules)$',
let g:ctrlp_custom_ignore = {
\ 'dir': '\v(node_modules)$',
\ 'file': '\v\.beam$'
\ }
"let g:ctrlp_root_markers = ['.CTRLP_ROOT']
" surround: b surrounds text with {% %} for djangohtml
autocmd FileType htmldjango let b:surround_{char2nr("b")} = "{% \r %}"
" vim-commentary
autocmd FileType erlang setlocal commentstring=\%\ %s
autocmd FileType elixir setlocal commentstring=\#\ %s
" ==== CTAGS ====
" for elixir tags run: ctags -R .
au FileType elixir set tags+=~/src/elixir/rumbl/tags,~/github/phoenix/tags,~/github/elixir/tags
"Do not find rebar3 in ~/w
set tags+=~/github/rebar3/tags
set tags+=../tags
set tags+=../../../tags
set tags+=~/w/tags
set tags+=~/github/otp/tags
set tags+=~/otpinst/tags
set tags+=~/github/elixir/tags
set tags+=~/github/tags
" Change current path to the open buffer
"autocmd BufEnter * silent! lcd %:p:h
" Open pane in new tab
:map <Leader>t :tab split<CR>
" jump to tag when enter pressed
"nmap <CR> <C-]>
let g:alchemist_tag_map = '<CR>'
nmap <CR> :set isk+=:<cr><c-]><c-o>:se isk-=:<cr><c-i>
" switch between horizontal splits
:map <C-Down> <C-W><Down><C-W>_
:map <C-Up> <C-W><Up><C-W>_
map h1 yypVr=o
"
noremap <Space> :
"noremap w :w<CR>
nmap <C-e> :b#<CR>
" Don't move on *
nnoremap * *<c-o>
" Window resizing
nnoremap <c-a-left> 5<c-w><
nnoremap <c-a-right> 5<c-w>>
" Source
vnoremap <leader>s y:execute @@<cr>:echo 'Sourced selection.'<cr>
nnoremap <leader>s ^vg_y:execute @@<cr>:echo 'Sourced line.'<cr>
" Use sane regexes.
nnoremap / /\v
vnoremap / /\v
" Easier to type
"noremap H ^
"noremap L $
"vnoremap L g_
" "Uppercase word" mapping.
"
" This mapping allows you to press <c-u> in insert mode to convert the current
" word to uppercase. It's handy when you're writing names of constants and
" don't want to use Capslock.
"
" To use it you type the name of the constant in lowercase. While your
" cursor is at the end of the word, press <c-u> to uppercase it, and then
" continue happily on your way:
"
" cursor
" v
" max_connections_allowed|
" <c-u>
" MAX_CONNECTIONS_ALLOWED|
" ^
" cursor
"
" It works by exiting out of insert mode, recording the current cursor location
" in the z mark, using gUiw to uppercase inside the current word, moving back to
" the z mark, and entering insert mode again.
"
" Note that this will overwrite the contents of the z mark. I never use it, but
" if you do you'll probably want to use another mark.
inoremap <C-u> <esc>mzgUiw`za
set spelllang=en,de,hu
"Turn off toolbar
set guioptions-=T
"OS X needs this
set backspace=2
" Copy github link to clipboard
"command! GithubLinkToClipboard let @+="blaba". expand('%:p:h') | let @*=@+
":echom substitute(expand('%:p:h'), "/Users/andras/ga/", "https://github.com/GameAnalytics/", "g") . "blob/master/" . expand('%:t') ."#L" . line('.')
" Rust
augroup Racer
autocmd!
autocmd FileType rust nmap <buffer> gd <Plug>(rust-def)
autocmd FileType rust nmap <buffer> gs <Plug>(rust-def-split)
autocmd FileType rust nmap <buffer> gx <Plug>(rust-def-vertical)
autocmd FileType rust nmap <buffer> gt <Plug>(rust-def-tab)
autocmd FileType rust nmap <buffer> <leader>gd <Plug>(rust-doc)
augroup END
" ==== From Csaba ====
noremap Q <nop>
" --------- "
" Underline "
" --------- "
" Underline:
" Underlines the current line with the given character.
" Example:
" Type this line:
" something
" Type the following command while the cursor is on that line:
" :call Underline('-')
" Now the line has been underlined with '-':
" something
" ---------
function! Underline(ch)
let len = strlen(substitute(getline("."), ".", "x", "g"))
normal o
call setline(".",repeat(a:ch, len))
endfunction
" ,<char><char> underlines the current line with <char>.
" <char> may be any of the followings: - = ^ " ' :
noremap ,-- :call Underline('-')<cr>
noremap ,== :call Underline('=')<cr>
noremap ,^^ :call Underline('^')<cr>
noremap ,"" :call Underline('"')<cr>
noremap ,'' :call Underline("'")<cr>
noremap ,:: :call Underline(":")<cr>
" ----------------------------- "
" Copying stuff to the keyboard "
" ----------------------------- "
command! FileNameToClipboard let @+=expand('%:p') | let @*=@+
command! PathToClipboard let @+=expand('%:p:h') | let @*=@+
command! PureFileNameToClipboard let @+=expand('%:t') | let @*=@+
command! ModuleNameToClipboard let @+=expand('%:t:r') | let @*=@+
" end Csaba