-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
289 lines (242 loc) · 7.68 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
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
" ---------------------------------------------
" Dein Plugin Installer Configuration
" --------------------------------------------
if &compatible
set nocompatible
endif
set runtimepath+=/home/jalcerro/.config/nvim/repos/github.com/Shougo/dein.vim
if dein#load_state('/home/jalcerro/.config/nvim')
call dein#begin('/home/jalcerro/.config/nvim')
call dein#add('/home/jalcerro/.config/nvim/repos/github.com/Shougo/dein.vim')
call dein#add('Shougo/neocomplete.vim')
call dein#add('Shougo/deoplete.nvim')
call dein#end()
call dein#save_state()
endif
" ---------------------------------------------
" Bundle Plugin Installer Configuration
" --------------------------------------------
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" " alternatively, pass a path where Vundle should install plugins
" "call vundle#begin('~/some/path/here')
"
" " let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" ---------------------------------------------
" Python configuration
" --------------------------------------------
let g:python_host_prog = '/usr/bin/python2.7'
let g:python3_host_prog = '/usr/bin/python3'
" ---------------------------------------
" Bundle Installed Plugins
" --------------------------------------
Plugin 'jiangmiao/auto-pairs'
Plugin 'myusuf3/numbers.vim'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'tomtom/tcomment_vim'
Plugin 'tomtom/tlib_vim'
Plugin 'tpope/vim-bundler'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-rails'
Plugin 'marcweber/vim-addon-mw-utils'
" Plugin 'elixir-lang/vim-elixir'
Plugin 'elixir-editors/vim-elixir'
Plugin 'slashmili/alchemist.vim'
" Plugin 'Valloric/YouCompleteMe'
Plugin 'sirver/ultisnips'
Plugin 'honza/vim-snippets'
Plugin 'scrooloose/nerdtree'
Plugin 'jlanzarotta/bufexplorer'
Plugin 'majutsushi/tagbar'
Plugin 'elmcast/elm-vim'
Plugin 'sheerun/vim-polyglot'
" Plugin 'lambdatoast/elm.vim'
Plugin 'tomasr/molokai'
Plugin 'c-brenn/phoenix.vim'
Plugin 'tpope/vim-projectionist'
Plugin 'vim-erlang/vim-erlang-omnicomplete'
Plugin 'dracula/vim'
Plugin 'mileszs/ack.vim'
Plugin 'ryanoasis/vim-devicons'
call vundle#end() " required
" ---------------------------------------
" Deoplete Plugin
" --------------------------------------
let g:deoplete#enable_at_startup = 1
" ---------------------------------------
" UltiSnips and YouCompleteMe
" ---------------------------------------
" Trigger configuration. Do not use <tab> if you use
" https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger = "<Tab>"
let g:UltiSnipsJumpForwardTrigger = "<Tab>"
let g:UltiSnipsJumpBackwardTrigger="<S-Tab>"
" let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
" let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
" let g:SuperTabDefaultCompletionType = '<C-n>'
" let g:ycm_server_python_interpreter = '/usr/local/bin/python'
"
" ---------------------------------------
" Nerdtree configuration
" ---------------------------------------
" Start Nerdtree automatically when no file is supplied when calling vim
" autocmd StdinReadPre * let s:std_in=1
" autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" Change arrow types
let g:NERDTreeDirArrowExpandable = '▸'
let g:NERDTreeDirArrowCollapsible = '▾'
" Open vim with ctl+n map key
" map <C-n> :NERDTreeToggle<CR>
map <F2> :NERDTreeToggle<CR>
" ---------------------------------------
" Tagbar configuration
" ---------------------------------------
nmap <F8> :TagbarToggle<CR>
let g:tagbar_type_elixir = {
\ 'ctagstype' : 'elixir',
\ 'kinds' : [
\ 'f:functions',
\ 'functions:functions',
\ 'c:callbacks',
\ 'd:delegates',
\ 'e:exceptions',
\ 'i:implementations',
\ 'a:macros',
\ 'o:operators',
\ 'm:modules',
\ 'p:protocols',
\ 'r:records'
\ ]
\ }
" ---------------------------------------
" Tabs configuration
" ---------------------------------------
nmap <F3> :tabnew<CR>
nmap <F7> :tabprevious<CR>
nmap <F9> :tabnext<CR>
" ---------------------------------------
" Basic Configuration
" ---------------------------------------
set termguicolors
" set background=dark
colors dracula "molokai elflord
" let g:molokai_original = 1
" let g:rehash256 = 1
"
" Set leader key
let mapleader=","
set expandtab
set shiftwidth=2
set softtabstop=2
set tabstop=2
set encoding=utf-8
set guifont=DroidSansMono\ Nerd\ Font\ Mono\ Book\ 14
" set guifont=Fira\ Code\ Regular\ 13
set laststatus=2
" set cursorline
set number " Show current line number
set relativenumber " Show relative line numbers
set modifiable
" set foldmethod=indent
"Enable syntax and plugins (for netrw)
syntax enable
filetype plugin indent on
" ---------------------------------------
" Search options
" ---------------------------------------
set hlsearch
set incsearch
set ignorecase
set smartcase
map <CR> :nohl<cr>
" Let iTerm display file name
set title
" Set vim airline theme
let g:netrw_liststyle=3
let g:airline_powerline_fonts = 1
let g:airline_theme='dark'
let g:airline#extensions#branch#enabled=1
let g:airline#extensions#hunks#enabled=1
let g:airline#extensions#tabline#enabled = 1
" Configuration for netrw file explorer
let g:netrw_banner=0
" Split window
nmap <leader>swh :topleft vnew<C-R>=expand("%:p:h") . '/'<CR>
nmap <leader>swl :botright vnew<C-R>=expand("%:p:h") . '/'<CR>
nmap <leader>swk :topleft new<C-R>=expand("%:p:h") . '/'<CR>
nmap <leader>swj :botright new<C-R>=expand("%:p:h") . '/'<CR>
" Split Buffer
nmap <leader>sh :leftabove vnew<C-R>=expand("%:p:h") . '/'<CR>
nmap <leader>sl :rightbelow vnew<C-R>=expand("%:p:h") . '/'<CR>
nmap <leader>sk :leftabove new<C-R>=expand("%:p:h") . '/'<CR>
nmap <leader>sj :rightbelow new<C-R>=expand("%:p:h") . '/'<CR>
" Buffer handeling
nmap <leader>bh :bnext<CR>
nmap <leader>bl :bp<CR>
" Find files
nmap <leader>f :find <C-R>
nmap <leader>s :Ack! <C-R>
"Search down into subfolders
"Provides tab-completionfo all file-related tasks
set path+=**
"Display matching
set wildmenu wildmode=longest:full,full
" set wildmenu
" ----------------
" Workspace Setup
" ----------------
function! DefaultWorkspace()
" Rough num columns to decide between laptop and big monitor screens
let numcol = 2
if winwidth(0) >= 220
let numcol = 3
endif
if numcol == 3
e term://zsh
file Shell\ Two
vnew
endif
" sp term://zsh
" file Shell\ One
" wincmd k
" resize 35
" wincmd h
tabnew term://zsh
tabp
endfunction
command! -register DefaultWorkspace call DefaultWorkspace()
" Window split settings
highlight TermCursor ctermfg=red guifg=red
set splitbelow
set splitright
" Terminal settings
tnoremap <Leader><ESC> <C-\><C-n>
" Window navigation in VIM function
" Make ctrl-h/j/k/l move between windows and auto-insert in terminals
func! s:mapMoveToWindowInDirection(direction)
func! s:maybeInsertMode(direction)
stopinsert
execute "wincmd" a:direction
if &buftype == 'terminal'
startinsert!
endif
endfunc
execute "tnoremap" "<silent>" "<C-" . a:direction . ">"
\ "<C-\\><C-n>"
\ ":call <SID>maybeInsertMode(\"" . a:direction . "\")<CR>"
execute "nnoremap" "<silent>" "<C-" . a:direction . ">"
\ ":call <SID>maybeInsertMode(\"" . a:direction . "\")<CR>"
endfunc
for dir in ["h", "j", "l", "k"]
call s:mapMoveToWindowInDirection(dir)
endfor
" -------------------------
" Commands
" ------------------------
autocmd FileType eelixir inoremap ee <%%><Esc>F%i